mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 21:33:43 +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;
|
||||
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,
|
||||
// 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);
|
||||
}
|
||||
|
||||
if (mRasterizerDiscardEnabled) {
|
||||
gl->fDisable(LOCAL_GL_RASTERIZER_DISCARD);
|
||||
}
|
||||
|
||||
// Do the clear!
|
||||
gl->fClear(mask);
|
||||
|
||||
@ -1334,6 +1339,10 @@ WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool
|
||||
if (mScissorTestEnabled)
|
||||
gl->fEnable(LOCAL_GL_SCISSOR_TEST);
|
||||
|
||||
if (mRasterizerDiscardEnabled) {
|
||||
gl->fEnable(LOCAL_GL_RASTERIZER_DISCARD);
|
||||
}
|
||||
|
||||
// Restore GL state after clearing.
|
||||
if (initializeColorBuffer) {
|
||||
if (drawBuffersIsEnabled) {
|
||||
|
@ -782,6 +782,7 @@ public:
|
||||
private:
|
||||
// State tracking slots
|
||||
realGLboolean mDitherEnabled;
|
||||
realGLboolean mRasterizerDiscardEnabled;
|
||||
realGLboolean mScissorTestEnabled;
|
||||
|
||||
bool ValidateCapabilityEnum(WebGLenum cap, const char* info);
|
||||
|
@ -24,6 +24,8 @@ WebGLContext::Clear(WebGLbitfield mask)
|
||||
|
||||
if (mask == 0) {
|
||||
GenerateWarning("Calling gl.clear(0) has no effect.");
|
||||
} else if (mRasterizerDiscardEnabled) {
|
||||
GenerateWarning("Calling gl.clear() with RASTERIZER_DISCARD enabled has no effects.");
|
||||
}
|
||||
|
||||
if (mBoundFramebuffer) {
|
||||
|
@ -552,6 +552,8 @@ WebGLContext::GetStateTrackingSlot(WebGLenum cap)
|
||||
return &mScissorTestEnabled;
|
||||
case LOCAL_GL_DITHER:
|
||||
return &mDitherEnabled;
|
||||
case LOCAL_GL_RASTERIZER_DISCARD:
|
||||
return &mRasterizerDiscardEnabled;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user