Backed out changeset 24e0d3aa4ada (bug 1726265) for causing non-unified build bustage. CLOSED TREE

This commit is contained in:
Cosmin Sabou 2021-08-20 04:29:04 +03:00
Родитель 8d8ce124e4
Коммит 135d55cd7e
31 изменённых файлов: 179 добавлений и 542 удалений

Просмотреть файл

@ -1165,11 +1165,6 @@ DOMInterfaces = {
'headerFile': 'ClientWebGLExtensions.h'
},
'OES_draw_buffers_indexed': {
'nativeType': 'mozilla::ClientWebGLExtensionDrawBuffersIndexed',
'headerFile': 'ClientWebGLExtensions.h'
},
'OES_element_index_uint': {
'nativeType': 'mozilla::ClientWebGLExtensionElementIndexUint',
'headerFile': 'ClientWebGLExtensions.h'

Просмотреть файл

@ -1622,9 +1622,9 @@ bool ClientWebGLContext::IsVertexArray(
// ------------------------- GL State -------------------------
void ClientWebGLContext::SetEnabledI(GLenum cap, Maybe<GLuint> i, bool val) const {
Run<RPROC(SetEnabled)>(cap, i, val);
}
void ClientWebGLContext::Disable(GLenum cap) const { Run<RPROC(Disable)>(cap); }
void ClientWebGLContext::Enable(GLenum cap) const { Run<RPROC(Enable)>(cap); }
bool ClientWebGLContext::IsEnabled(GLenum cap) const {
const FuncScope funcScope(*this, "isEnabled");
@ -1896,6 +1896,17 @@ void ClientWebGLContext::GetParameter(JSContext* cx, GLenum pname,
retval.set(Create<dom::Int32Array>(cx, this, state.mViewport, rv));
return;
// 4 bools
case LOCAL_GL_COLOR_WRITEMASK: {
JS::Rooted<JS::Value> arr(cx);
const auto& src = state.mColorWriteMask;
if (!dom::ToJSValue(cx, src.data(), src.size(), &arr)) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
retval.set(arr);
return;
}
// any
case LOCAL_GL_COMPRESSED_TEXTURE_FORMATS:
retval.set(Create<dom::Uint32Array>(cx, this,
@ -2175,21 +2186,6 @@ void ClientWebGLContext::GetParameter(JSContext* cx, GLenum pname,
retval.set(JS::BooleanValue(*maybe));
break;
// 4 bools
case LOCAL_GL_COLOR_WRITEMASK: {
const auto mask = uint8_t(*maybe);
const auto bs = std::bitset<4>(mask);
const auto src = std::array<bool, 4>{
bs[0], bs[1], bs[2], bs[3],
};
JS::Rooted<JS::Value> arr(cx);
if (!dom::ToJSValue(cx, src.data(), src.size(), &arr)) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
retval.set(arr);
return;
}
default:
retval.set(JS::NumberValue(*maybe));
break;
@ -2357,7 +2353,6 @@ void ClientWebGLContext::GetIndexedParameter(
retval.set(JS::NullValue());
const FuncScope funcScope(*this, "getIndexedParameter");
if (IsContextLost()) return;
auto keepalive = mNotLost;
const auto& state = State();
@ -2400,24 +2395,7 @@ void ClientWebGLContext::GetIndexedParameter(
return ret;
}();
if (maybe) {
switch (target) {
case LOCAL_GL_COLOR_WRITEMASK: {
const auto bs = std::bitset<4>(*maybe);
const auto src = std::array<bool, 4>{
bs[0], bs[1], bs[2], bs[3],
};
JS::Rooted<JS::Value> arr(cx);
if (!dom::ToJSValue(cx, src.data(), src.size(), &arr)) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
retval.set(arr);
return;
}
default:
retval.set(JS::NumberValue(*maybe));
return;
}
retval.set(JS::NumberValue(*maybe));
}
}
@ -2592,14 +2570,14 @@ void ClientWebGLContext::BlendColor(GLclampf r, GLclampf g, GLclampf b,
Run<RPROC(BlendColor)>(r, g, b, a);
}
void ClientWebGLContext::BlendEquationSeparateI(Maybe<GLuint> i, GLenum modeRGB,
void ClientWebGLContext::BlendEquationSeparate(GLenum modeRGB,
GLenum modeAlpha) {
Run<RPROC(BlendEquationSeparate)>(i, modeRGB, modeAlpha);
Run<RPROC(BlendEquationSeparate)>(modeRGB, modeAlpha);
}
void ClientWebGLContext::BlendFuncSeparateI(Maybe<GLuint> i, GLenum srcRGB, GLenum dstRGB,
void ClientWebGLContext::BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
GLenum srcAlpha, GLenum dstAlpha) {
Run<RPROC(BlendFuncSeparate)>(i, srcRGB, dstRGB, srcAlpha, dstAlpha);
Run<RPROC(BlendFuncSeparate)>(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
GLenum ClientWebGLContext::CheckFramebufferStatus(GLenum target) {
@ -2700,13 +2678,15 @@ void ClientWebGLContext::ClearDepth(GLclampf v) { Run<RPROC(ClearDepth)>(v); }
void ClientWebGLContext::ClearStencil(GLint v) { Run<RPROC(ClearStencil)>(v); }
void ClientWebGLContext::ColorMaskI(Maybe<GLuint> i, bool r, bool g,
bool b, bool a) const {
void ClientWebGLContext::ColorMask(WebGLboolean r, WebGLboolean g,
WebGLboolean b, WebGLboolean a) {
const FuncScope funcScope(*this, "colorMask");
if (IsContextLost()) return;
auto& state = State();
const uint8_t mask = uint8_t(r << 0) | uint8_t(g << 1) | uint8_t(b << 2) | uint8_t(a << 3);
Run<RPROC(ColorMask)>(i, mask);
state.mColorWriteMask = {r, g, b, a};
Run<RPROC(ColorMask)>(r, g, b, a);
}
void ClientWebGLContext::CullFace(GLenum face) { Run<RPROC(CullFace)>(face); }

Просмотреть файл

@ -159,6 +159,7 @@ class ContextGenerationInfo final {
std::vector<TypedQuad> mGenericVertexAttribs;
std::array<bool, 4> mColorWriteMask = {{true, true, true, true}};
std::array<int32_t, 4> mScissor = {};
std::array<int32_t, 4> mViewport = {};
std::array<float, 4> mClearColor = {{0, 0, 0, 0}};
@ -1059,13 +1060,8 @@ class ClientWebGLContext final : public nsICanvasRenderingContextInternal,
public:
bool IsContextLost() const { return !mNotLost; }
void Disable(GLenum cap) const {
SetEnabledI(cap, {}, false);
}
void Enable(GLenum cap) const {
SetEnabledI(cap, {}, true);
}
void SetEnabledI(GLenum cap, Maybe<GLuint> i, bool val) const;
void Disable(GLenum cap) const;
void Enable(GLenum cap) const;
bool IsEnabled(GLenum cap) const;
private:
@ -1232,16 +1228,8 @@ class ClientWebGLContext final : public nsICanvasRenderingContextInternal,
BlendFuncSeparate(sfactor, dfactor, sfactor, dfactor);
}
void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) {
BlendEquationSeparateI({}, modeRGB, modeAlpha);
}
void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
GLenum dstAlpha){
BlendFuncSeparateI({}, srcRGB, dstRGB, srcAlpha, dstAlpha);
}
void BlendEquationSeparateI(Maybe<GLuint> buf, GLenum modeRGB, GLenum modeAlpha);
void BlendFuncSeparateI(Maybe<GLuint> buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
GLenum dstAlpha);
// -
@ -1284,12 +1272,8 @@ class ClientWebGLContext final : public nsICanvasRenderingContextInternal,
void ClearStencil(GLint v);
void ColorMask(bool r, bool g, bool b,
bool a) const {
ColorMaskI({}, r, g, b, a);
}
void ColorMaskI(Maybe<GLuint> buf, bool r, bool g, bool b,
bool a) const;
void ColorMask(WebGLboolean r, WebGLboolean g, WebGLboolean b,
WebGLboolean a);
void CullFace(GLenum face);

Просмотреть файл

@ -28,8 +28,6 @@ DEFINE_WEBGL_EXTENSION_GOOP(EXT_texture_filter_anisotropic,
WebGLExtensionTextureFilterAnisotropic)
DEFINE_WEBGL_EXTENSION_GOOP(EXT_texture_norm16, WebGLExtensionTextureNorm16)
DEFINE_WEBGL_EXTENSION_GOOP(MOZ_debug, WebGLExtensionMOZDebug)
DEFINE_WEBGL_EXTENSION_GOOP(OES_draw_buffers_indexed,
WebGLExtensionDrawBuffersIndexed)
DEFINE_WEBGL_EXTENSION_GOOP(OES_element_index_uint,
WebGLExtensionElementIndexUint)
DEFINE_WEBGL_EXTENSION_GOOP(OES_fbo_render_mipmap,

Просмотреть файл

@ -362,67 +362,6 @@ class ClientWebGLExtensionMultiview : public ClientWebGLExtensionBase {
}
};
class ClientWebGLExtensionDrawBuffersIndexed : public ClientWebGLExtensionBase {
public:
virtual JSObject* WrapObject(JSContext* cx,
JS::Handle<JSObject*> givenProto) override;
explicit ClientWebGLExtensionDrawBuffersIndexed(ClientWebGLContext&);
void EnableiOES(const GLenum target, const GLuint buf) const {
if (MOZ_UNLIKELY(!mContext)) {
AutoJsWarning(
"enableiOES: Extension is `invalidated`.");
return;
}
mContext->SetEnabledI(target, Some(buf), true);
}
void DisableiOES(const GLenum target, const GLuint buf) const {
if (MOZ_UNLIKELY(!mContext)) {
AutoJsWarning(
"disableiOES: Extension is `invalidated`.");
return;
}
mContext->SetEnabledI(target, Some(buf), false);
}
void BlendEquationiOES(const GLuint buf, const GLenum mode) const {
BlendEquationSeparateiOES(buf, mode, mode);
}
void BlendEquationSeparateiOES(const GLuint buf, const GLenum modeRgb, const GLenum modeAlpha) const {
if (MOZ_UNLIKELY(!mContext)) {
AutoJsWarning(
"blendEquationSeparateiOES: Extension is `invalidated`.");
return;
}
mContext->BlendEquationSeparateI(Some(buf), modeRgb, modeAlpha);
}
void BlendFunciOES(const GLuint buf, const GLenum src, const GLenum dst) const {
BlendFuncSeparateiOES(buf, src, dst, src, dst);
}
void BlendFuncSeparateiOES(const GLuint buf, const GLenum srcRgb,
const GLenum dstRgb, const GLenum srcAlpha, const GLenum dstAlpha) const {
if (MOZ_UNLIKELY(!mContext)) {
AutoJsWarning(
"blendFuncSeparateiOES: Extension is `invalidated`.");
return;
}
mContext->BlendFuncSeparateI(Some(buf), srcRgb, dstRgb, srcAlpha, dstAlpha);
}
void ColorMaskiOES(const GLuint buf, const bool r, const bool g, const bool b, const bool a) const {
if (MOZ_UNLIKELY(!mContext)) {
AutoJsWarning(
"colorMaskiOES: Extension is `invalidated`.");
return;
}
mContext->ColorMaskI(Some(buf), r, g, b, a);
}
};
} // namespace mozilla
#endif // CLIENTWEBGLEXTENSIONS_H_

Просмотреть файл

@ -241,9 +241,9 @@ class HostWebGLContext final : public SupportsWeakPtr {
// ------------------------- GL State -------------------------
bool IsContextLost() const { return mContext->IsContextLost(); }
void SetEnabled(GLenum cap, Maybe<GLuint> i, bool val) const {
mContext->SetEnabled(cap, i, val);
}
void Disable(GLenum cap) const { mContext->Disable(cap); }
void Enable(GLenum cap) const { mContext->Enable(cap); }
bool IsEnabled(GLenum cap) const { return mContext->IsEnabled(cap); }
@ -277,13 +277,13 @@ class HostWebGLContext final : public SupportsWeakPtr {
mContext->BlendColor(r, g, b, a);
}
void BlendEquationSeparate(Maybe<GLuint> i, GLenum modeRGB, GLenum modeAlpha) const {
mContext->BlendEquationSeparate(i, modeRGB, modeAlpha);
void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) const {
mContext->BlendEquationSeparate(modeRGB, modeAlpha);
}
void BlendFuncSeparate(Maybe<GLuint> i, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
GLenum dstAlpha) const {
mContext->BlendFuncSeparate(i, srcRGB, dstRGB, srcAlpha, dstAlpha);
mContext->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
GLenum CheckFramebufferStatus(GLenum target) const {
@ -300,8 +300,9 @@ class HostWebGLContext final : public SupportsWeakPtr {
void ClearStencil(GLint v) const { mContext->ClearStencil(v); }
void ColorMask(Maybe<GLuint> i, uint8_t mask) const {
mContext->ColorMask(i, mask);
void ColorMask(WebGLboolean r, WebGLboolean g, WebGLboolean b,
WebGLboolean a) const {
mContext->ColorMask(r, g, b, a);
}
void CompileShader(const ObjectId id) const {

Просмотреть файл

@ -25,36 +25,6 @@ Maybe<double> WebGL2Context::GetIndexedParameter(const GLenum pname,
const FuncScope funcScope(*this, "getIndexedParameter");
if (IsContextLost()) return {};
if (IsExtensionEnabled(WebGLExtensionID::OES_draw_buffers_indexed)) {
switch (pname) {
case LOCAL_GL_BLEND_EQUATION_RGB:
case LOCAL_GL_BLEND_EQUATION_ALPHA:
case LOCAL_GL_BLEND_SRC_RGB:
case LOCAL_GL_BLEND_SRC_ALPHA:
case LOCAL_GL_BLEND_DST_RGB:
case LOCAL_GL_BLEND_DST_ALPHA:
case LOCAL_GL_COLOR_WRITEMASK: {
const auto limit = MaxValidDrawBuffers();
if (index >= limit) {
ErrorInvalidValue("`index` (%u) must be < %s (%u)", index, "MAX_DRAW_BUFFERS", limit);
return {};
}
std::array<GLint, 4> data = {};
gl->fGetIntegeri_v(pname, index, data.data());
auto val = data[0];
if (pname == LOCAL_GL_COLOR_WRITEMASK) {
val = (bool(data[0]) << 0 |
bool(data[1]) << 1 |
bool(data[2]) << 2 |
bool(data[3]) << 3);
}
return Some(val);
}
}
}
const auto* bindings = &mIndexedUniformBufferBindings;
const char* limitStr = "MAX_UNIFORM_BUFFER_BINDINGS";
switch (pname) {
@ -69,7 +39,7 @@ Maybe<double> WebGL2Context::GetIndexedParameter(const GLenum pname,
break;
default:
ErrorInvalidEnumArg("pname", pname);
ErrorInvalidEnumInfo("pname", pname);
return {};
}

Просмотреть файл

@ -1246,14 +1246,11 @@ bool WebGLContext::BindDefaultFBForRead() {
}
void WebGLContext::DoColorMask(const uint8_t bitmask) const {
if (mDriverColorMask0 != bitmask) {
mDriverColorMask0 = bitmask;
const auto bs = std::bitset<4>(bitmask);
if (gl->IsSupported(gl::GLFeature::draw_buffers_indexed)) {
gl->fColorMaski(0, bs[0], bs[1], bs[2], bs[3]);
} else {
gl->fColorMask(bs[0], bs[1], bs[2], bs[3]);
}
if (mDriverColorMask != bitmask) {
mDriverColorMask = bitmask;
gl->fColorMask(
bool(mDriverColorMask & (1 << 0)), bool(mDriverColorMask & (1 << 1)),
bool(mDriverColorMask & (1 << 2)), bool(mDriverColorMask & (1 << 3)));
}
}
@ -1261,16 +1258,16 @@ void WebGLContext::DoColorMask(const uint8_t bitmask) const {
ScopedDrawCallWrapper::ScopedDrawCallWrapper(WebGLContext& webgl)
: mWebGL(webgl) {
uint8_t driverColorMask0 = mWebGL.mColorWriteMask0;
uint8_t driverColorMask = mWebGL.mColorWriteMask;
bool driverDepthTest = mWebGL.mDepthTestEnabled;
bool driverStencilTest = mWebGL.mStencilTestEnabled;
const auto& fb = mWebGL.mBoundDrawFramebuffer;
if (!fb) {
if (mWebGL.mDefaultFB_DrawBuffer0 == LOCAL_GL_NONE) {
driverColorMask0 = 0; // Is this well-optimized enough for depth-first
driverColorMask = 0; // Is this well-optimized enough for depth-first
// rendering?
} else {
driverColorMask0 &= ~(uint8_t(mWebGL.mNeedsFakeNoAlpha) << 3);
driverColorMask &= ~(uint8_t(mWebGL.mNeedsFakeNoAlpha) << 3);
}
driverDepthTest &= !mWebGL.mNeedsFakeNoDepth;
driverStencilTest &= !mWebGL.mNeedsFakeNoStencil;
@ -1283,7 +1280,7 @@ ScopedDrawCallWrapper::ScopedDrawCallWrapper(WebGLContext& webgl)
}
const auto& gl = mWebGL.gl;
mWebGL.DoColorMask(driverColorMask0);
mWebGL.DoColorMask(driverColorMask);
if (mWebGL.mDriverDepthTest != driverDepthTest) {
// "When disabled, the depth comparison and subsequent possible updates to
// the

Просмотреть файл

@ -6,7 +6,6 @@
#ifndef WEBGLCONTEXT_H_
#define WEBGLCONTEXT_H_
#include <bitset>
#include <memory>
#include <stdarg.h>
@ -539,15 +538,16 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
void BindRenderbuffer(GLenum target, WebGLRenderbuffer* fb);
void BindVertexArray(WebGLVertexArray* vao);
void BlendColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a);
void BlendEquationSeparate(Maybe<GLuint> i, GLenum modeRGB, GLenum modeAlpha);
void BlendFuncSeparate(Maybe<GLuint> i, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
GLenum dstAlpha);
GLenum CheckFramebufferStatus(GLenum target);
void Clear(GLbitfield mask);
void ClearColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a);
void ClearDepth(GLclampf v);
void ClearStencil(GLint v);
void ColorMask(Maybe<GLuint> i, uint8_t mask);
void ColorMask(WebGLboolean r, WebGLboolean g, WebGLboolean b,
WebGLboolean a);
void CompileShader(WebGLShader& shader);
private:
@ -703,7 +703,12 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
// -----------------------------------------------------------------------------
// State and State Requests (WebGLContextState.cpp)
void SetEnabled(GLenum cap, Maybe<GLuint> i, bool enabled);
private:
void SetEnabled(const char* funcName, GLenum cap, bool enabled);
public:
void Disable(GLenum cap) { SetEnabled("disabled", cap, false); }
void Enable(GLenum cap) { SetEnabled("enabled", cap, true); }
bool GetStencilBits(GLint* const out_stencilBits) const;
virtual Maybe<double> GetParameter(GLenum pname);
@ -713,12 +718,13 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
private:
// State tracking slots
bool mDitherEnabled = true;
bool mRasterizerDiscardEnabled = false;
bool mScissorTestEnabled = false;
bool mDepthTestEnabled = false;
bool mStencilTestEnabled = false;
GLenum mGenerateMipmapHint = LOCAL_GL_DONT_CARE;
realGLboolean mDitherEnabled = 1;
realGLboolean mRasterizerDiscardEnabled = 0;
realGLboolean mScissorTestEnabled = 0;
realGLboolean mDepthTestEnabled = 0;
realGLboolean mStencilTestEnabled = 0;
realGLboolean mBlendEnabled = 0;
GLenum mGenerateMipmapHint = 0;
struct ScissorRect final {
GLint x;
@ -731,7 +737,7 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
ScissorRect mScissorRect = {};
bool ValidateCapabilityEnum(GLenum cap);
bool* GetStateTrackingSlot(GLenum cap, GLuint i);
realGLboolean* GetStateTrackingSlot(GLenum cap);
// Allocation debugging variables
mutable uint64_t mDataAllocGLCallCount = 0;
@ -865,8 +871,8 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
void DeleteWebGLObjectsArray(nsTArray<WebGLObjectType>& array);
GLuint mActiveTexture = 0;
GLenum mDefaultFB_DrawBuffer0 = LOCAL_GL_BACK;
GLenum mDefaultFB_ReadBuffer = LOCAL_GL_BACK;
GLenum mDefaultFB_DrawBuffer0 = 0;
GLenum mDefaultFB_ReadBuffer = 0;
mutable GLenum mWebGLError = 0;
@ -1145,15 +1151,11 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
GLuint mStencilValueMaskBack = 0;
GLuint mStencilWriteMaskFront = 0;
GLuint mStencilWriteMaskBack = 0;
uint8_t mColorWriteMask0 = 0xf; // bitmask
mutable uint8_t mDriverColorMask0 = 0xf;
bool mDepthWriteMask = true;
GLfloat mColorClearValue[4] = {0,0,0,0};
uint8_t mColorWriteMask = 0xf; // bitmask
realGLboolean mDepthWriteMask = 0;
GLfloat mColorClearValue[4];
GLint mStencilClearValue = 0;
GLfloat mDepthClearValue = 1.0f;
std::bitset<webgl::kMaxDrawBuffers> mColorWriteMaskNonzero = -1;
std::bitset<webgl::kMaxDrawBuffers> mBlendEnabled = 0;
GLfloat mDepthClearValue = 0.0;
GLint mViewportX = 0;
GLint mViewportY = 0;
@ -1161,7 +1163,7 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
GLsizei mViewportHeight = 0;
bool mAlreadyWarnedAboutViewportLargerThanDest = false;
GLfloat mLineWidth = 1.0;
GLfloat mLineWidth = 0.0;
WebGLContextLossHandler mContextLossHandler;
@ -1184,6 +1186,7 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
bool mNeedsFakeNoStencil = false;
bool mNeedsFakeNoStencil_UserFBs = false;
mutable uint8_t mDriverColorMask = 0;
bool mDriverDepthTest = false;
bool mDriverStencilTest = false;

Просмотреть файл

@ -333,30 +333,18 @@ static bool DoSetsIntersect(const std::set<T>& a, const std::set<T>& b) {
return bool(intersection.size());
}
template<size_t N>
static size_t FindFirstOne(const std::bitset<N>& bs) {
MOZ_ASSERT(bs.any());
// We don't need this to be fast, so don't bother with CLZ intrinsics.
for (const auto i : IntegerRange(N)) {
if (bs[i]) return i;
}
return -1;
}
const webgl::CachedDrawFetchLimits* ValidateDraw(WebGLContext* const webgl,
const GLenum mode,
const uint32_t instanceCount) {
if (!webgl->BindCurFBForDraw()) return nullptr;
const auto& fb = webgl->mBoundDrawFramebuffer;
if (fb) {
if (fb && webgl->mBlendEnabled) {
const auto& info = *fb->GetCompletenessInfo();
const auto isF32WithBlending = info.isAttachmentF32 & webgl->mBlendEnabled;
if (isF32WithBlending.any()) {
if (info.hasFloat32) {
if (!webgl->IsExtensionEnabled(WebGLExtensionID::EXT_float_blend)) {
const auto first = FindFirstOne(isF32WithBlending);
webgl->ErrorInvalidOperation(
"Attachment %u is float32 with blending enabled, which requires EXT_float_blend.", uint32_t(first));
"Float32 blending requires EXT_float_blend.");
return nullptr;
}
webgl->WarnIfImplicit(WebGLExtensionID::EXT_float_blend);
@ -432,7 +420,14 @@ const webgl::CachedDrawFetchLimits* ValidateDraw(WebGLContext* const webgl,
const auto fnValidateFragOutputType =
[&](const uint8_t loc, const webgl::TextureBaseType dstBaseType) {
const auto itr = fragOutputs.find(loc);
MOZ_DIAGNOSTIC_ASSERT(itr != fragOutputs.end());
if (MOZ_UNLIKELY(itr == fragOutputs.end())) {
webgl->ErrorInvalidOperation(
"Program has no frag output at location %u, but"
" destination draw buffer has an attached"
" image.",
uint32_t(loc));
return false;
}
const auto& info = itr->second;
const auto& srcBaseType = info.baseType;
@ -450,15 +445,9 @@ const webgl::CachedDrawFetchLimits* ValidateDraw(WebGLContext* const webgl,
if (!webgl->mRasterizerDiscardEnabled) {
uint8_t fbZLayerCount = 1;
auto hasAttachment = std::bitset<webgl::kMaxDrawBuffers>(1);
auto drawBufferEnabled = std::bitset<webgl::kMaxDrawBuffers>();
if (fb) {
drawBufferEnabled = fb->DrawBufferEnabled();
const auto& info = *fb->GetCompletenessInfo();
fbZLayerCount = info.zLayerCount;
hasAttachment = info.hasAttachment;
} else {
drawBufferEnabled[0] = (webgl->mDefaultFB_DrawBuffer0 == LOCAL_GL_BACK);
}
if (fbZLayerCount != linkInfo->zLayerCount) {
@ -468,39 +457,19 @@ const webgl::CachedDrawFetchLimits* ValidateDraw(WebGLContext* const webgl,
return nullptr;
}
const auto writable = hasAttachment & drawBufferEnabled & webgl->mColorWriteMaskNonzero;
if (writable.any()) {
// Do we have any undefined outputs with real attachments that
// aren't masked-out by color write mask or drawBuffers?
const auto wouldWriteUndefined = ~linkInfo->hasOutput & writable;
if (wouldWriteUndefined.any()) {
const auto first = FindFirstOne(wouldWriteUndefined);
webgl->ErrorInvalidOperation(
"Program has no frag output at location %u, the"
" destination draw buffer has an attached"
" image, and its color write mask is not all false,"
" and DRAW_BUFFER%u is not NONE.",
uint32_t(first), uint32_t(first));
return nullptr;
}
const auto outputWrites = linkInfo->hasOutput & writable;
if (webgl->mColorWriteMask) {
if (fb) {
for (const auto& attach : fb->ColorDrawBuffers()) {
const auto i =
uint8_t(attach->mAttachmentPoint - LOCAL_GL_COLOR_ATTACHMENT0);
if (!outputWrites[i]) continue;
const auto& imageInfo = attach->GetImageInfo();
if (!imageInfo) continue;
const auto& dstBaseType = imageInfo->mFormat->format->baseType;
if (!fnValidateFragOutputType(i, dstBaseType)) return nullptr;
}
} else {
if (outputWrites[0]) {
if (!fnValidateFragOutputType(0, webgl::TextureBaseType::Float))
return nullptr;
}
if (!fnValidateFragOutputType(0, webgl::TextureBaseType::Float))
return nullptr;
}
}
}

Просмотреть файл

@ -9,7 +9,6 @@
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/EnumeratedRange.h"
#include "mozilla/StaticPrefs_webgl.h"
#include "nsString.h"
#include "WebGLContextUtils.h"
#include "WebGLExtensions.h"
@ -41,7 +40,6 @@ const char* GetExtensionName(const WebGLExtensionID ext) {
WEBGL_EXTENSION_IDENTIFIER(EXT_texture_filter_anisotropic)
WEBGL_EXTENSION_IDENTIFIER(EXT_texture_norm16)
WEBGL_EXTENSION_IDENTIFIER(MOZ_debug)
WEBGL_EXTENSION_IDENTIFIER(OES_draw_buffers_indexed)
WEBGL_EXTENSION_IDENTIFIER(OES_element_index_uint)
WEBGL_EXTENSION_IDENTIFIER(OES_fbo_render_mipmap)
WEBGL_EXTENSION_IDENTIFIER(OES_standard_derivatives)
@ -163,8 +161,6 @@ RefPtr<ClientWebGLExtensionBase> ClientWebGLContext::GetExtension(
return new ClientWebGLExtensionMOZDebug(*this);
// OES_
case WebGLExtensionID::OES_draw_buffers_indexed:
return new ClientWebGLExtensionDrawBuffersIndexed(*this);
case WebGLExtensionID::OES_element_index_uint:
return new ClientWebGLExtensionElementIndexUint(*this);
case WebGLExtensionID::OES_fbo_render_mipmap:
@ -287,12 +283,6 @@ bool WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const {
return WebGLExtensionTextureNorm16::IsSupported(this);
// OES_
case WebGLExtensionID::OES_draw_buffers_indexed:
if (!StaticPrefs::webgl_enable_draft_extensions()) return false;
if (!IsWebGL2()) return false;
return gl->IsSupported(gl::GLFeature::draw_buffers_indexed) &&
gl->IsSupported(gl::GLFeature::get_integer_indexed);
case WebGLExtensionID::OES_element_index_uint:
if (IsWebGL2()) return false;
return gl->IsSupported(gl::GLFeature::element_index_uint);
@ -436,9 +426,6 @@ void WebGLContext::RequestExtension(const WebGLExtensionID ext,
break;
// OES_
case WebGLExtensionID::OES_draw_buffers_indexed:
slot.reset(new WebGLExtensionDrawBuffersIndexed(this));
break;
case WebGLExtensionID::OES_element_index_uint:
slot.reset(new WebGLExtensionElementIndexUint(this));
break;

Просмотреть файл

@ -123,34 +123,13 @@ void WebGLContext::ClearStencil(GLint v) {
gl->fClearStencil(v);
}
void WebGLContext::ColorMask(const Maybe<GLuint> i, const uint8_t mask) {
void WebGLContext::ColorMask(WebGLboolean r, WebGLboolean g, WebGLboolean b,
WebGLboolean a) {
const FuncScope funcScope(*this, "colorMask");
if (IsContextLost()) return;
const auto bs = std::bitset<4>(mask);
if (i) {
MOZ_RELEASE_ASSERT(IsExtensionEnabled(WebGLExtensionID::OES_draw_buffers_indexed));
const auto limit = MaxValidDrawBuffers();
if (*i >= limit) {
ErrorInvalidValue("`index` (%u) must be < %s (%u)", *i, "MAX_DRAW_BUFFERS", limit);
return;
}
gl->fColorMaski(*i, bs[0], bs[1], bs[2], bs[3]);
if (*i == 0) {
mColorWriteMask0 = mask;
}
mColorWriteMaskNonzero[*i] = bool(mask);
} else {
gl->fColorMask(bs[0], bs[1], bs[2], bs[3]);
mColorWriteMask0 = mask;
if (mask) {
mColorWriteMaskNonzero.set();
} else {
mColorWriteMaskNonzero.reset();
}
}
mColorWriteMask = uint8_t(bool(r) << 0) | uint8_t(bool(g) << 1) |
uint8_t(bool(b) << 2) | uint8_t(bool(a) << 3);
}
void WebGLContext::DepthMask(WebGLboolean b) {

Просмотреть файл

@ -130,7 +130,7 @@ void WebGLContext::BindFramebuffer(GLenum target, WebGLFramebuffer* wfb) {
funcScope.mBindFailureGuard = false;
}
void WebGLContext::BlendEquationSeparate(Maybe<GLuint> i, GLenum modeRGB, GLenum modeAlpha) {
void WebGLContext::BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) {
const FuncScope funcScope(*this, "blendEquationSeparate");
if (IsContextLost()) return;
@ -139,18 +139,7 @@ void WebGLContext::BlendEquationSeparate(Maybe<GLuint> i, GLenum modeRGB, GLenum
return;
}
if (i) {
MOZ_RELEASE_ASSERT(IsExtensionEnabled(WebGLExtensionID::OES_draw_buffers_indexed));
const auto limit = MaxValidDrawBuffers();
if (*i >= limit) {
ErrorInvalidValue("`index` (%u) must be < %s (%u)", *i, "MAX_DRAW_BUFFERS", limit);
return;
}
gl->fBlendEquationSeparatei(*i, modeRGB, modeAlpha);
} else {
gl->fBlendEquationSeparate(modeRGB, modeAlpha);
}
gl->fBlendEquationSeparate(modeRGB, modeAlpha);
}
static bool ValidateBlendFuncEnum(WebGLContext* webgl, GLenum factor,
@ -204,7 +193,7 @@ static bool ValidateBlendFuncEnums(WebGLContext* webgl, GLenum srcRGB,
return true;
}
void WebGLContext::BlendFuncSeparate(Maybe<GLuint> i, GLenum srcRGB, GLenum dstRGB,
void WebGLContext::BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
GLenum srcAlpha, GLenum dstAlpha) {
const FuncScope funcScope(*this, "blendFuncSeparate");
if (IsContextLost()) return;
@ -217,18 +206,7 @@ void WebGLContext::BlendFuncSeparate(Maybe<GLuint> i, GLenum srcRGB, GLenum dstR
if (!ValidateBlendFuncEnumsCompatibility(srcRGB, dstRGB, "srcRGB and dstRGB"))
return;
if (i) {
MOZ_RELEASE_ASSERT(IsExtensionEnabled(WebGLExtensionID::OES_draw_buffers_indexed));
const auto limit = MaxValidDrawBuffers();
if (*i >= limit) {
ErrorInvalidValue("`index` (%u) must be < %s (%u)", *i, "MAX_DRAW_BUFFERS", limit);
return;
}
gl->fBlendFuncSeparatei(*i, srcRGB, dstRGB, srcAlpha, dstAlpha);
} else {
gl->fBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
gl->fBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
GLenum WebGLContext::CheckFramebufferStatus(GLenum target) {

Просмотреть файл

@ -22,39 +22,16 @@
namespace mozilla {
void WebGLContext::SetEnabled(const GLenum cap,
const Maybe<GLuint> i, const bool enabled) {
const FuncScope funcScope(*this, "enable(i)/disable(i)");
void WebGLContext::SetEnabled(const char* const funcName, const GLenum cap,
const bool enabled) {
const FuncScope funcScope(*this, funcName);
if (IsContextLost()) return;
if (!ValidateCapabilityEnum(cap)) return;
if (i) {
if (cap != LOCAL_GL_BLEND) {
ErrorInvalidEnumArg("cap", cap);
return;
}
const auto limit = MaxValidDrawBuffers();
if (*i >= limit) {
ErrorInvalidValue("`index` (%u) must be < %s (%u)", *i, "MAX_DRAW_BUFFERS", limit);
return;
}
}
const auto slot = GetStateTrackingSlot(cap, i ? *i : 0);
const auto& slot = GetStateTrackingSlot(cap);
if (slot) {
*slot = enabled;
} else if (cap == LOCAL_GL_BLEND) {
if (i) {
mBlendEnabled[*i] = enabled;
} else {
if (enabled) {
mBlendEnabled.set();
} else {
mBlendEnabled.reset();
}
}
}
switch (cap) {
@ -64,15 +41,7 @@ void WebGLContext::SetEnabled(const GLenum cap,
default:
// Non-lazy caps.
if (i) {
if (enabled) {
gl->fEnablei(cap, *i);
} else {
gl->fDisablei(cap, *i);
}
} else {
gl->SetEnabled(cap, enabled);
}
gl->SetEnabled(cap, enabled);
break;
}
}
@ -119,8 +88,7 @@ Maybe<double> WebGLContext::GetParameter(const GLenum pname) {
}
} else {
const auto& fb = *mBoundDrawFramebuffer;
const auto& bs = fb.DrawBufferEnabled();
if (bs[slotId]) {
if (fb.IsDrawBufferEnabled(slotId)) {
ret = LOCAL_GL_COLOR_ATTACHMENT0 + slotId;
}
}
@ -387,9 +355,6 @@ Maybe<double> WebGLContext::GetParameter(const GLenum pname) {
case LOCAL_GL_STENCIL_WRITEMASK:
return Some(mStencilWriteMaskFront);
case LOCAL_GL_COLOR_WRITEMASK:
return Some(mColorWriteMask0);
// float
case LOCAL_GL_LINE_WIDTH:
return Some((double)mLineWidth);
@ -437,7 +402,7 @@ bool WebGLContext::IsEnabled(GLenum cap) {
if (!ValidateCapabilityEnum(cap)) return false;
const auto& slot = GetStateTrackingSlot(cap, 0);
const auto& slot = GetStateTrackingSlot(cap);
if (slot) return *slot;
return gl->fIsEnabled(cap);
@ -463,7 +428,7 @@ bool WebGLContext::ValidateCapabilityEnum(GLenum cap) {
}
}
bool* WebGLContext::GetStateTrackingSlot(GLenum cap, GLuint i) {
realGLboolean* WebGLContext::GetStateTrackingSlot(GLenum cap) {
switch (cap) {
case LOCAL_GL_DEPTH_TEST:
return &mDepthTestEnabled;
@ -475,6 +440,8 @@ bool* WebGLContext::GetStateTrackingSlot(GLenum cap, GLuint i) {
return &mScissorTestEnabled;
case LOCAL_GL_STENCIL_TEST:
return &mStencilTestEnabled;
case LOCAL_GL_BLEND:
return &mBlendEnabled;
}
return nullptr;

Просмотреть файл

@ -63,9 +63,10 @@ TexTarget TexImageTargetToTexTarget(TexImageTarget texImageTarget) {
// This version is fallible and will return nullptr if unrecognized.
const char* GetEnumName(const GLenum val, const char* const defaultRet) {
switch (val) {
case 0: return "0";
#define XX(x) case LOCAL_GL_##x: return #x
//XX(NONE);
#define XX(x) \
case LOCAL_GL_##x: \
return #x
XX(NONE);
XX(ALPHA);
XX(COMPRESSED_RGBA_PVRTC_2BPPV1);
XX(COMPRESSED_RGBA_PVRTC_4BPPV1);
@ -409,22 +410,17 @@ std::string EnumString(const GLenum val) {
void WebGLContext::ErrorInvalidEnumArg(const char* const argName,
const GLenum val) const {
const auto info = nsPrintfCString("Bad `%s`", argName);
ErrorInvalidEnumInfo(info.BeginReading(), val);
nsCString enumName;
EnumName(val, &enumName);
ErrorInvalidEnum("Bad `%s`: %s", argName, enumName.BeginReading());
}
void WebGLContext::ErrorInvalidEnumInfo(const char* const info,
const GLenum enumValue) const {
nsCString name;
EnumName(enumValue, &name);
const char* hint = "";
if (!enumValue) {
hint = " (Did you typo `gl.SOMETHINGG` and pass `undefined`?)";
}
ErrorInvalidEnum("%s: Invalid enum value %s%s", info,
name.BeginReading(), hint);
return ErrorInvalidEnum("%s: Invalid enum value %s", info,
name.BeginReading());
}
#ifdef DEBUG

Просмотреть файл

@ -285,6 +285,21 @@ bool WebGLContext::InitAndValidateGL(FailureReason* const out_failReason) {
mCanLoseContextInForeground =
StaticPrefs::webgl_can_lose_context_in_foreground();
// These are the default values, see 6.2 State tables in the
// OpenGL ES 2.0.25 spec.
mDriverColorMask = mColorWriteMask;
mColorClearValue[0] = 0.f;
mColorClearValue[1] = 0.f;
mColorClearValue[2] = 0.f;
mColorClearValue[3] = 0.f;
mDepthWriteMask = true;
mDepthClearValue = 1.f;
mStencilClearValue = 0;
mStencilRefFront = 0;
mStencilRefBack = 0;
mLineWidth = 1.0;
/*
// Technically, we should be setting mStencil[...] values to
// `allOnes`, but either ANGLE breaks or the SGX540s on Try break.
@ -311,7 +326,23 @@ bool WebGLContext::InitAndValidateGL(FailureReason* const out_failReason) {
AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_BACK_WRITEMASK,
mStencilWriteMaskBack);
mDitherEnabled = true;
mRasterizerDiscardEnabled = false;
mScissorTestEnabled = false;
mDepthTestEnabled = 0;
mDriverDepthTest = false;
mStencilTestEnabled = 0;
mDriverStencilTest = false;
mGenerateMipmapHint = LOCAL_GL_DONT_CARE;
// Bindings, etc.
mActiveTexture = 0;
mDefaultFB_DrawBuffer0 = LOCAL_GL_BACK;
mDefaultFB_ReadBuffer = LOCAL_GL_BACK;
mWebGLError = LOCAL_GL_NO_ERROR;
mBound2DTextures.Clear();
mBoundCubeMapTextures.Clear();

Просмотреть файл

@ -124,12 +124,6 @@ class WebGLExtensionDepthTexture : public WebGLExtensionBase {
static bool IsSupported(const WebGLContext*);
};
class WebGLExtensionDrawBuffersIndexed : public WebGLExtensionBase {
public:
explicit WebGLExtensionDrawBuffersIndexed(WebGLContext* webgl)
: WebGLExtensionBase(webgl) {}
};
class WebGLExtensionElementIndexUint : public WebGLExtensionBase {
public:
explicit WebGLExtensionElementIndexUint(WebGLContext* webgl)

Просмотреть файл

@ -505,6 +505,7 @@ WebGLFramebuffer::WebGLFramebuffer(WebGLContext* webgl,
CompletenessInfo info;
info.width = mOpaque->mSize.width;
info.height = mOpaque->mSize.height;
info.hasFloat32 = false;
info.zLayerCount = 1;
info.isMultiview = false;
@ -540,7 +541,7 @@ Maybe<WebGLFBAttachPoint*> WebGLFramebuffer::GetColorAttachPoint(
const size_t colorId = attachPoint - LOCAL_GL_COLOR_ATTACHMENT0;
MOZ_ASSERT(mContext->Limits().maxColorDrawBuffers <= webgl::kMaxDrawBuffers);
MOZ_ASSERT(mContext->Limits().maxColorDrawBuffers <= kMaxColorAttachments);
if (colorId >= mContext->MaxValidDrawBuffers()) return Nothing();
return Some(&mColorAttachments[colorId]);
@ -1012,7 +1013,7 @@ FBStatus WebGLFramebuffer::CheckFramebufferStatus() const {
ResolveAttachmentData();
// Sweet, let's cache that.
auto info = CompletenessInfo{this};
auto info = CompletenessInfo{this, UINT32_MAX, UINT32_MAX};
mCompletenessInfo.ResetInvalidators({});
mCompletenessInfo.AddInvalidator(*this);
@ -1034,20 +1035,12 @@ FBStatus WebGLFramebuffer::CheckFramebufferStatus() const {
}
const auto& imageInfo = cur->GetImageInfo();
MOZ_ASSERT(imageInfo);
const auto maybeColorId = cur->ColorAttachmentId();
if (maybeColorId) {
const auto id = *maybeColorId;
info.hasAttachment[id] = true;
info.isAttachmentF32[id] = fnIsFloat32(*imageInfo->mFormat->format);
}
info.width = imageInfo->mWidth;
info.height = imageInfo->mHeight;
info.width = std::min(info.width, imageInfo->mWidth);
info.height = std::min(info.height, imageInfo->mHeight);
info.hasFloat32 |= fnIsFloat32(*imageInfo->mFormat->format);
info.zLayerCount = cur->ZLayerCount();
info.isMultiview = cur->IsMultiview();
}
MOZ_ASSERT(info.width && info.height);
mCompletenessInfo = Some(std::move(info));
info.fb = nullptr; // Don't trigger the invalidation warning.
return LOCAL_GL_FRAMEBUFFER_COMPLETE;
@ -1115,7 +1108,6 @@ void WebGLFramebuffer::DrawBuffers(const std::vector<GLenum>& buffers) {
std::vector<const WebGLFBAttachPoint*> newColorDrawBuffers;
newColorDrawBuffers.reserve(buffers.size());
mDrawBufferEnabled.reset();
for (const auto i : IntegerRange(buffers.size())) {
// "If the GL is bound to a draw framebuffer object, the `i`th buffer listed
// in bufs must be COLOR_ATTACHMENTi or NONE. Specifying a buffer out of
@ -1132,7 +1124,6 @@ void WebGLFramebuffer::DrawBuffers(const std::vector<GLenum>& buffers) {
if (cur == LOCAL_GL_COLOR_ATTACHMENT0 + i) {
const auto& attach = mColorAttachments[i];
newColorDrawBuffers.push_back(&attach);
mDrawBufferEnabled[i] = true;
} else if (cur != LOCAL_GL_NONE) {
const bool isColorEnum = (cur >= LOCAL_GL_COLOR_ATTACHMENT0 &&
cur < mContext->LastColorAttachmentEnum());
@ -1154,6 +1145,16 @@ void WebGLFramebuffer::DrawBuffers(const std::vector<GLenum>& buffers) {
RefreshDrawBuffers(); // Calls glDrawBuffers.
}
bool WebGLFramebuffer::IsDrawBufferEnabled(const uint32_t slotId) const {
const auto attachEnum = LOCAL_GL_COLOR_ATTACHMENT0 + slotId;
for (const auto& cur : mColorDrawBuffers) {
if (cur->mAttachmentPoint == attachEnum) {
return true;
}
}
return false;
}
void WebGLFramebuffer::ReadBuffer(GLenum attachPoint) {
const auto& maybeAttach = GetColorAttachPoint(attachPoint);
if (!maybeAttach) {

Просмотреть файл

@ -78,12 +78,6 @@ class WebGLFBAttachPoint final {
WebGLTexture* Texture() const { return mTexturePtr; }
WebGLRenderbuffer* Renderbuffer() const { return mRenderbufferPtr; }
Maybe<size_t> ColorAttachmentId() const {
const size_t id = mAttachmentPoint - LOCAL_GL_COLOR_ATTACHMENT0;
if (id >= webgl::kMaxDrawBuffers) return {};
return Some(id);
}
auto Layer() const { return mTexImageLayer; }
auto ZLayerCount() const { return mTexImageZLayerCount; }
auto MipLevel() const { return mTexImageLevel; }
@ -156,8 +150,14 @@ class WebGLFramebuffer final : public WebGLContextBoundObject,
WebGLFBAttachPoint mStencilAttachment;
WebGLFBAttachPoint mDepthStencilAttachment;
std::array<WebGLFBAttachPoint, webgl::kMaxDrawBuffers> mColorAttachments = {};
std::bitset<webgl::kMaxDrawBuffers> mDrawBufferEnabled = {1};
// In theory, this number can be unbounded based on the driver. However, no
// driver appears to expose more than 8. We might as well stop there too, for
// now.
// (http://opengl.gpuinfo.org/gl_stats_caps_single.php?listreportsbycap=GL_MAX_COLOR_ATTACHMENTS)
static const size_t kMaxColorAttachments =
8; // jgilbert's MacBook Pro exposes 8.
WebGLFBAttachPoint mColorAttachments[kMaxColorAttachments];
////
std::vector<WebGLFBAttachPoint*> mAttachments; // Non-null.
@ -172,8 +172,7 @@ class WebGLFramebuffer final : public WebGLContextBoundObject,
uint32_t width = 0;
uint32_t height = 0;
std::bitset<webgl::kMaxDrawBuffers> hasAttachment = 0;
std::bitset<webgl::kMaxDrawBuffers> isAttachmentF32 = 0;
bool hasFloat32 = false;
uint8_t zLayerCount = 1;
bool isMultiview = false;
@ -237,7 +236,7 @@ class WebGLFramebuffer final : public WebGLContextBoundObject,
#undef GETTER
const auto& ColorAttachment0() const { return mColorAttachments[0]; }
const auto& DrawBufferEnabled() const { return mDrawBufferEnabled; }
bool IsDrawBufferEnabled(uint32_t slotId) const;
////////////////
// Invalidation

Просмотреть файл

@ -60,7 +60,8 @@ DEFINE_ASYNC(HostWebGLContext::DeleteTexture)
DEFINE_ASYNC(HostWebGLContext::DeleteTransformFeedback)
DEFINE_ASYNC(HostWebGLContext::DeleteVertexArray)
DEFINE_ASYNC(HostWebGLContext::SetEnabled)
DEFINE_ASYNC(HostWebGLContext::Disable)
DEFINE_ASYNC(HostWebGLContext::Enable)
DEFINE_ASYNC(HostWebGLContext::GenerateError)
DEFINE_ASYNC(HostWebGLContext::Resize)
DEFINE_ASYNC(HostWebGLContext::RequestExtension)

Просмотреть файл

@ -348,7 +348,6 @@ RefPtr<const webgl::LinkedProgramInfo> QueryProgramInfo(WebGLProgram* prog,
const auto version = compileResults->mShaderVersion;
const auto fnAddInfo = [&](const webgl::FragOutputInfo& x) {
info->hasOutput[x.loc] = true;
info->fragOutputs.insert({x.loc, x});
};

Просмотреть файл

@ -100,7 +100,6 @@ struct LinkedProgramInfo final : public RefCounted<LinkedProgramInfo>,
WebGLProgram* const prog;
const GLenum transformFeedbackBufferMode;
std::bitset<kMaxDrawBuffers> hasOutput = 0;
std::unordered_map<uint8_t, const FragOutputInfo> fragOutputs;
uint8_t zLayerCount = 1;

Просмотреть файл

@ -228,7 +228,6 @@ enum class WebGLExtensionID : uint8_t {
EXT_texture_filter_anisotropic,
EXT_texture_norm16,
MOZ_debug,
OES_draw_buffers_indexed,
OES_element_index_uint,
OES_fbo_render_mipmap,
OES_standard_derivatives,
@ -1157,15 +1156,6 @@ inline void Memcpy(const RangedPtr<uint8_t>& destBytes,
// -
namespace webgl {
// In theory, this number can be unbounded based on the driver. However, no
// driver appears to expose more than 8. We might as well stop there too, for
// now.
// (http://opengl.gpuinfo.org/gl_stats_caps_single.php?listreportsbycap=GL_MAX_COLOR_ATTACHMENTS)
inline constexpr size_t kMaxDrawBuffers = 8;
} // namespace webgl
} // namespace mozilla
#endif

Просмотреть файл

@ -1,23 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'/>
<script src='/tests/SimpleTest/SimpleTest.js'></script>
<link rel='stylesheet' href='/tests/SimpleTest/test.css'>
<script src='ensure-ext.js'></script>
</head>
<body>
<script>
'use strict';
EnsureExtFor('webgl', 'OES_draw_buffers_indexed', false);
EnsureExtFor('webgl2', 'OES_draw_buffers_indexed', false);
Lastly_WithDraftExtsEnabled(() => {
EnsureExtFor('webgl', 'OES_draw_buffers_indexed', false);
EnsureExtFor('webgl2', 'OES_draw_buffers_indexed', true);
});
</script>
</body>
</html>

Просмотреть файл

@ -56,9 +56,8 @@ var defaultExts = [
];
var draftExts = [
['EXT_texture_norm16' , [FORBID , MACHINE_SPECIFIC]],
['OES_draw_buffers_indexed', [FORBID , MACHINE_SPECIFIC]],
['WEBGL_explicit_present' , [ENSURE , ENSURE ]],
['EXT_texture_norm16' , [FORBID , MACHINE_SPECIFIC]],
['WEBGL_explicit_present', [ENSURE , ENSURE ]],
];
////////////////////

Просмотреть файл

@ -29,7 +29,6 @@ fail-if = (os == 'android') || (os == 'linux' && os_version == '16.04') || (os =
fail-if = (os == 'android')
[ensure-exts/test_EXT_texture_filter_anisotropic.html]
fail-if = (os == 'linux')
[ensure-exts/test_OES_draw_buffers_indexed.html]
[ensure-exts/test_OES_fbo_render_mipmap.html]
[ensure-exts/test_OES_standard_derivatives.html]
[ensure-exts/test_OVR_multiview2.html]

Просмотреть файл

@ -1182,29 +1182,6 @@ interface WEBGL_explicit_present {
void present();
};
// https://www.khronos.org/registry/webgl/extensions/OES_draw_buffers_indexed/
[Exposed=(Window,Worker), LegacyNoInterfaceObject]
interface OES_draw_buffers_indexed {
void enableiOES(GLenum target, GLuint index);
void disableiOES(GLenum target, GLuint index);
void blendEquationiOES(GLuint buf, GLenum mode);
void blendEquationSeparateiOES(GLuint buf,
GLenum modeRGB, GLenum modeAlpha);
void blendFunciOES(GLuint buf,
GLenum src, GLenum dst);
void blendFuncSeparateiOES(GLuint buf,
GLenum srcRGB, GLenum dstRGB,
GLenum srcAlpha, GLenum dstAlpha);
void colorMaskiOES(GLuint buf,
GLboolean r, GLboolean g, GLboolean b, GLboolean a);
};
// https://immersive-web.github.io/webxr/#dom-webglcontextattributes-xrcompatible
partial dictionary WebGLContextAttributes {
[Pref="dom.vr.webxr.enabled"]

Просмотреть файл

@ -201,7 +201,6 @@ static const char* const sExtensionNames[] = {
"GL_OES_depth24",
"GL_OES_depth32",
"GL_OES_depth_texture",
"GL_OES_draw_buffers_indexed",
"GL_OES_element_index_uint",
"GL_OES_fbo_render_mipmap",
"GL_OES_framebuffer_object",
@ -1262,26 +1261,6 @@ void GLContext::LoadMoreSymbols(const SymbolLoader& loader) {
fnLoadFeatureByCore(coreSymbols, extSymbols, GLFeature::draw_buffers);
}
if (IsSupported(GLFeature::draw_buffers_indexed)) {
const SymLoadStruct coreSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fBlendEquationSeparatei, {{ "glBlendEquationSeparatei" }} },
{ (PRFuncPtr*) &mSymbols.fBlendFuncSeparatei, {{ "glBlendFuncSeparatei" }} },
{ (PRFuncPtr*) &mSymbols.fColorMaski, {{ "glColorMaski" }} },
{ (PRFuncPtr*) &mSymbols.fDisablei, {{ "glDisablei" }} },
{ (PRFuncPtr*) &mSymbols.fEnablei, {{ "glEnablei" }} },
END_SYMBOLS
};
const SymLoadStruct extSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fBlendEquationSeparatei, {{ "glBlendEquationSeparateiOES" }} },
{ (PRFuncPtr*) &mSymbols.fBlendFuncSeparatei, {{ "glBlendFuncSeparateiOES" }} },
{ (PRFuncPtr*) &mSymbols.fColorMaski, {{ "glColorMaskiOES" }} },
{ (PRFuncPtr*) &mSymbols.fDisablei, {{ "glDisableiOES" }} },
{ (PRFuncPtr*) &mSymbols.fEnablei, {{ "glEnableiOES" }} },
END_SYMBOLS
};
fnLoadFeatureByCore(coreSymbols, extSymbols, GLFeature::draw_buffers);
}
if (IsSupported(GLFeature::get_integer_indexed)) {
const SymLoadStruct coreSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fGetIntegeri_v, {{ "glGetIntegeri_v" }} },

Просмотреть файл

@ -79,7 +79,6 @@ enum class GLFeature {
copy_buffer,
depth_texture,
draw_buffers,
draw_buffers_indexed,
draw_instanced,
element_index_uint,
ES2_compatibility,
@ -474,7 +473,6 @@ class GLContext : public GenericAtomicRefCounted, public SupportsWeakPtr {
OES_depth24,
OES_depth32,
OES_depth_texture,
OES_draw_buffers_indexed,
OES_element_index_uint,
OES_fbo_render_mipmap,
OES_framebuffer_object,
@ -3313,42 +3311,6 @@ class GLContext : public GenericAtomicRefCounted, public SupportsWeakPtr {
AFTER_GL_CALL;
}
// -
// draw_buffers_indexed
void fBlendEquationSeparatei(GLuint i, GLenum modeRGB, GLenum modeAlpha) const {
BEFORE_GL_CALL;
mSymbols.fBlendEquationSeparatei(i, modeRGB, modeAlpha);
AFTER_GL_CALL;
}
void fBlendFuncSeparatei(GLuint i, GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorAlpha, GLenum dfactorAlpha) const {
BEFORE_GL_CALL;
mSymbols.fBlendFuncSeparatei(i, sfactorRGB, dfactorRGB, sfactorAlpha,
dfactorAlpha);
AFTER_GL_CALL;
}
void fColorMaski(GLuint i, realGLboolean red, realGLboolean green, realGLboolean blue,
realGLboolean alpha) const {
BEFORE_GL_CALL;
mSymbols.fColorMaski(i, red, green, blue, alpha);
AFTER_GL_CALL;
}
void fDisablei(GLenum capability, GLuint i) const {
BEFORE_GL_CALL;
mSymbols.fDisablei(capability, i);
AFTER_GL_CALL;
}
void fEnablei(GLenum capability, GLuint i) const {
BEFORE_GL_CALL;
mSymbols.fEnablei(capability, i);
AFTER_GL_CALL;
}
#undef BEFORE_GL_CALL
#undef AFTER_GL_CALL
#undef ASSERT_SYMBOL_PRESENT

Просмотреть файл

@ -104,12 +104,6 @@ static const FeatureInfo sFeatureInfoArr[] = {
GLContext::Extension_None,
{GLContext::ARB_draw_buffers, GLContext::EXT_draw_buffers,
GLContext::Extensions_End}},
{"draw_buffers_indexed",
GLVersion::GL3,
GLESVersion::ES3_2,
GLContext::Extension_None,
{GLContext::OES_draw_buffers_indexed,
GLContext::Extensions_End}},
{"draw_instanced",
GLVersion::GL3_1,
GLESVersion::ES3,

Просмотреть файл

@ -448,13 +448,6 @@ struct GLContextSymbols final {
GLuint texture, GLint level,
GLint baseViewIndex,
GLsizei numViews);
// draw_buffers_indexed
void(GLAPIENTRY* fBlendEquationSeparatei)(GLuint, GLenum, GLenum);
void(GLAPIENTRY* fBlendFuncSeparatei)(GLuint, GLenum, GLenum, GLenum, GLenum);
void(GLAPIENTRY* fColorMaski)(GLuint, realGLboolean, realGLboolean, realGLboolean, realGLboolean);
void(GLAPIENTRY* fDisablei)(GLenum, GLuint);
void(GLAPIENTRY* fEnablei)(GLenum, GLuint);
};
} // namespace gl