mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-25 06:10:35 +00:00
bug 908232 - step 2 - [WebGL 2.0] Add RASTERIZER_DISCARD tracking - r=jgilbert
This commit is contained in:
parent
e2f8566e17
commit
26127c2eb2
@ -155,6 +155,7 @@ WebGLContext::WebGLContext()
|
|||||||
|
|
||||||
mScissorTestEnabled = 0;
|
mScissorTestEnabled = 0;
|
||||||
mDitherEnabled = 1;
|
mDitherEnabled = 1;
|
||||||
|
mRasterizerDiscardEnabled = 0; // OpenGL ES 3.0 spec p244
|
||||||
|
|
||||||
// initialize some GL values: we're going to get them from the GL and use them as the sizes of arrays,
|
// initialize some GL values: we're going to get them from the GL and use them as the sizes of arrays,
|
||||||
// so in case glGetIntegerv leaves them uninitialized because of a GL bug, we would have very weird crashes.
|
// so in case glGetIntegerv leaves them uninitialized because of a GL bug, we would have very weird crashes.
|
||||||
@ -1327,6 +1328,10 @@ WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool
|
|||||||
gl->fClearStencil(0);
|
gl->fClearStencil(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mRasterizerDiscardEnabled) {
|
||||||
|
gl->fDisable(LOCAL_GL_RASTERIZER_DISCARD);
|
||||||
|
}
|
||||||
|
|
||||||
// Do the clear!
|
// Do the clear!
|
||||||
gl->fClear(mask);
|
gl->fClear(mask);
|
||||||
|
|
||||||
@ -1334,6 +1339,10 @@ WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool
|
|||||||
if (mScissorTestEnabled)
|
if (mScissorTestEnabled)
|
||||||
gl->fEnable(LOCAL_GL_SCISSOR_TEST);
|
gl->fEnable(LOCAL_GL_SCISSOR_TEST);
|
||||||
|
|
||||||
|
if (mRasterizerDiscardEnabled) {
|
||||||
|
gl->fEnable(LOCAL_GL_RASTERIZER_DISCARD);
|
||||||
|
}
|
||||||
|
|
||||||
// Restore GL state after clearing.
|
// Restore GL state after clearing.
|
||||||
if (initializeColorBuffer) {
|
if (initializeColorBuffer) {
|
||||||
if (drawBuffersIsEnabled) {
|
if (drawBuffersIsEnabled) {
|
||||||
|
@ -782,6 +782,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
// State tracking slots
|
// State tracking slots
|
||||||
realGLboolean mDitherEnabled;
|
realGLboolean mDitherEnabled;
|
||||||
|
realGLboolean mRasterizerDiscardEnabled;
|
||||||
realGLboolean mScissorTestEnabled;
|
realGLboolean mScissorTestEnabled;
|
||||||
|
|
||||||
bool ValidateCapabilityEnum(WebGLenum cap, const char* info);
|
bool ValidateCapabilityEnum(WebGLenum cap, const char* info);
|
||||||
|
@ -24,6 +24,8 @@ WebGLContext::Clear(WebGLbitfield mask)
|
|||||||
|
|
||||||
if (mask == 0) {
|
if (mask == 0) {
|
||||||
GenerateWarning("Calling gl.clear(0) has no effect.");
|
GenerateWarning("Calling gl.clear(0) has no effect.");
|
||||||
|
} else if (mRasterizerDiscardEnabled) {
|
||||||
|
GenerateWarning("Calling gl.clear() with RASTERIZER_DISCARD enabled has no effects.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBoundFramebuffer) {
|
if (mBoundFramebuffer) {
|
||||||
|
@ -552,6 +552,8 @@ WebGLContext::GetStateTrackingSlot(WebGLenum cap)
|
|||||||
return &mScissorTestEnabled;
|
return &mScissorTestEnabled;
|
||||||
case LOCAL_GL_DITHER:
|
case LOCAL_GL_DITHER:
|
||||||
return &mDitherEnabled;
|
return &mDitherEnabled;
|
||||||
|
case LOCAL_GL_RASTERIZER_DISCARD:
|
||||||
|
return &mRasterizerDiscardEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user