mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 1efb117b969c (bug 1004309) for build bustage on a CLOSED TREE
This commit is contained in:
parent
8be006092f
commit
e739b00982
@ -607,8 +607,6 @@ WebGLContext::SetDimensions(int32_t width, int32_t height)
|
||||
MOZ_ASSERT(gl->Caps().antialias == caps.antialias || !gl->Caps().antialias);
|
||||
MOZ_ASSERT(gl->Caps().preserve == caps.preserve);
|
||||
|
||||
AssertCachedState();
|
||||
|
||||
reporter.SetSuccessful();
|
||||
return NS_OK;
|
||||
}
|
||||
@ -974,6 +972,19 @@ WebGLContext::ClearScreen()
|
||||
ForceClearFramebufferWithDefaultValues(clearMask, colorAttachmentsMask);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// For NaNs, etc.
|
||||
static bool IsShadowCorrect(float shadow, float actual) {
|
||||
if (IsNaN(shadow)) {
|
||||
// GL is allowed to do anything it wants for NaNs, so if we're shadowing
|
||||
// a NaN, then whatever `actual` is might be correct.
|
||||
return true;
|
||||
}
|
||||
|
||||
return shadow == actual;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool colorAttachmentsMask[kMaxColorAttachments])
|
||||
{
|
||||
@ -988,7 +999,67 @@ WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool
|
||||
|
||||
// Fun GL fact: No need to worry about the viewport here, glViewport is just
|
||||
// setting up a coordinates transformation, it doesn't affect glClear at all.
|
||||
AssertCachedState();
|
||||
|
||||
#ifdef DEBUG
|
||||
// Scope to hide our variables.
|
||||
{
|
||||
// Sanity-check that all our state is set properly. Otherwise, when we
|
||||
// reset out state to what we *think* it is, we'll get it wrong.
|
||||
|
||||
// Dither shouldn't matter when we're clearing to {0,0,0,0}.
|
||||
MOZ_ASSERT(gl->fIsEnabled(LOCAL_GL_SCISSOR_TEST) == mScissorTestEnabled);
|
||||
|
||||
if (initializeColorBuffer) {
|
||||
realGLboolean colorWriteMask[4] = {2, 2, 2, 2};
|
||||
GLfloat colorClearValue[4] = {-1.0f, -1.0f, -1.0f, -1.0f};
|
||||
|
||||
gl->fGetBooleanv(LOCAL_GL_COLOR_WRITEMASK, colorWriteMask);
|
||||
gl->fGetFloatv(LOCAL_GL_COLOR_CLEAR_VALUE, colorClearValue);
|
||||
|
||||
MOZ_ASSERT(colorWriteMask[0] == mColorWriteMask[0] &&
|
||||
colorWriteMask[1] == mColorWriteMask[1] &&
|
||||
colorWriteMask[2] == mColorWriteMask[2] &&
|
||||
colorWriteMask[3] == mColorWriteMask[3]);
|
||||
MOZ_ASSERT(IsShadowCorrect(mColorClearValue[0], colorClearValue[0]) &&
|
||||
IsShadowCorrect(mColorClearValue[1], colorClearValue[1]) &&
|
||||
IsShadowCorrect(mColorClearValue[2], colorClearValue[2]) &&
|
||||
IsShadowCorrect(mColorClearValue[3], colorClearValue[3]));
|
||||
}
|
||||
|
||||
if (initializeDepthBuffer) {
|
||||
realGLboolean depthWriteMask = 2;
|
||||
GLfloat depthClearValue = -1.0f;
|
||||
|
||||
|
||||
gl->fGetBooleanv(LOCAL_GL_DEPTH_WRITEMASK, &depthWriteMask);
|
||||
gl->fGetFloatv(LOCAL_GL_DEPTH_CLEAR_VALUE, &depthClearValue);
|
||||
|
||||
MOZ_ASSERT(depthWriteMask == mDepthWriteMask);
|
||||
MOZ_ASSERT(IsShadowCorrect(mDepthClearValue, depthClearValue));
|
||||
}
|
||||
|
||||
if (initializeStencilBuffer) {
|
||||
GLuint stencilWriteMaskFront = 0xdeadbad1;
|
||||
GLuint stencilWriteMaskBack = 0xdeadbad1;
|
||||
GLuint stencilClearValue = 0xdeadbad1;
|
||||
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_WRITEMASK, &stencilWriteMaskFront);
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_BACK_WRITEMASK, &stencilWriteMaskBack);
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_CLEAR_VALUE, &stencilClearValue);
|
||||
|
||||
GLuint stencilBits = 0;
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_BITS, &stencilBits);
|
||||
GLuint stencilMask = (GLuint(1) << stencilBits) - 1;
|
||||
|
||||
MOZ_ASSERT( ( stencilWriteMaskFront & stencilMask) ==
|
||||
(mStencilWriteMaskFront & stencilMask) );
|
||||
MOZ_ASSERT( ( stencilWriteMaskBack & stencilMask) ==
|
||||
(mStencilWriteMaskBack & stencilMask) );
|
||||
MOZ_ASSERT( ( stencilClearValue & stencilMask) ==
|
||||
(mStencilClearValue & stencilMask) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Prepare GL state for clearing.
|
||||
gl->fDisable(LOCAL_GL_SCISSOR_TEST);
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "GLDefs.h"
|
||||
#include "WebGLActiveInfo.h"
|
||||
#include "WebGLObjectModel.h"
|
||||
#include "WebGLRenderbuffer.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "nsTArray.h"
|
||||
@ -115,17 +114,6 @@ struct WebGLContextOptions {
|
||||
bool preserveDrawingBuffer;
|
||||
};
|
||||
|
||||
static bool
|
||||
IsTextureBinding(GLenum binding)
|
||||
{
|
||||
switch (binding) {
|
||||
case LOCAL_GL_TEXTURE_BINDING_2D:
|
||||
case LOCAL_GL_TEXTURE_BINDING_CUBE_MAP:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
class WebGLContext :
|
||||
public nsIDOMWebGLRenderingContext,
|
||||
public nsICanvasRenderingContextInternal,
|
||||
@ -216,8 +204,7 @@ public:
|
||||
|
||||
void DummyFramebufferOperation(const char *info);
|
||||
|
||||
WebGLTexture* activeBoundTextureForTarget(GLenum target) const {
|
||||
MOZ_ASSERT(!IsTextureBinding(target));
|
||||
WebGLTexture *activeBoundTextureForTarget(GLenum target) const {
|
||||
return target == LOCAL_GL_TEXTURE_2D ? mBound2DTextures[mActiveTexture]
|
||||
: mBoundCubeMapTextures[mActiveTexture];
|
||||
}
|
||||
@ -262,8 +249,6 @@ public:
|
||||
void SetupContextLossTimer();
|
||||
void TerminateContextLossTimer();
|
||||
|
||||
void AssertCachedState();
|
||||
|
||||
// WebIDL WebGLRenderingContext API
|
||||
dom::HTMLCanvasElement* GetCanvas() const { return mCanvasElement; }
|
||||
GLsizei DrawingBufferWidth() const { return IsContextLost() ? 0 : mWidth; }
|
||||
|
@ -3,26 +3,25 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "WebGLContext.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "GLContext.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIDOMDataContainerEvent.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "prprf.h"
|
||||
#include "WebGLBuffer.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "WebGLFramebuffer.h"
|
||||
#include "WebGLProgram.h"
|
||||
#include "WebGLTexture.h"
|
||||
#include "WebGLVertexArray.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMDataContainerEvent.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -41,6 +40,8 @@ IsGLDepthStencilFormat(GLenum internalFormat)
|
||||
internalFormat == LOCAL_GL_DEPTH24_STENCIL8);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void
|
||||
WebGLContext::GenerateWarning(const char *fmt, ...)
|
||||
{
|
||||
@ -244,131 +245,3 @@ WebGLContext::GetAndFlushUnderlyingGLErrors()
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// For NaNs, etc.
|
||||
static bool
|
||||
IsCacheCorrect(float cached, float actual)
|
||||
{
|
||||
if (IsNaN(cached)) {
|
||||
// GL is allowed to do anything it wants for NaNs, so if we're shadowing
|
||||
// a NaN, then whatever `actual` is might be correct.
|
||||
return true;
|
||||
}
|
||||
|
||||
return cached == actual;
|
||||
}
|
||||
|
||||
static void
|
||||
AssertUintParamCorrect(gl::GLContext* gl, GLenum pname, GLuint shadow)
|
||||
{
|
||||
GLuint val = 0;
|
||||
gl->GetUIntegerv(pname, &val);
|
||||
MOZ_ASSERT(val == shadow);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
WebGLContext::AssertCachedState()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
MakeContextCurrent();
|
||||
|
||||
GetAndFlushUnderlyingGLErrors();
|
||||
|
||||
// extensions
|
||||
if (IsExtensionEnabled(WebGLExtensionID::WEBGL_draw_buffers)) {
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_MAX_COLOR_ATTACHMENTS, mGLMaxColorAttachments);
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_MAX_DRAW_BUFFERS, mGLMaxDrawBuffers);
|
||||
}
|
||||
|
||||
if (IsExtensionEnabled(WebGLExtensionID::OES_vertex_array_object)) {
|
||||
GLuint bound = mBoundVertexArray ? mBoundVertexArray->GLName() : 0;
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_VERTEX_ARRAY_BINDING, bound);
|
||||
}
|
||||
|
||||
// Draw state
|
||||
MOZ_ASSERT(gl->fIsEnabled(LOCAL_GL_SCISSOR_TEST) == mScissorTestEnabled);
|
||||
MOZ_ASSERT(gl->fIsEnabled(LOCAL_GL_DITHER) == mDitherEnabled);
|
||||
MOZ_ASSERT_IF(IsWebGL2(),
|
||||
gl->fIsEnabled(LOCAL_GL_RASTERIZER_DISCARD) == mRasterizerDiscardEnabled);
|
||||
|
||||
|
||||
realGLboolean colorWriteMask[4] = {0, 0, 0, 0};
|
||||
gl->fGetBooleanv(LOCAL_GL_COLOR_WRITEMASK, colorWriteMask);
|
||||
MOZ_ASSERT(colorWriteMask[0] == mColorWriteMask[0] &&
|
||||
colorWriteMask[1] == mColorWriteMask[1] &&
|
||||
colorWriteMask[2] == mColorWriteMask[2] &&
|
||||
colorWriteMask[3] == mColorWriteMask[3]);
|
||||
|
||||
GLfloat colorClearValue[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
gl->fGetFloatv(LOCAL_GL_COLOR_CLEAR_VALUE, colorClearValue);
|
||||
MOZ_ASSERT(IsCacheCorrect(mColorClearValue[0], colorClearValue[0]) &&
|
||||
IsCacheCorrect(mColorClearValue[1], colorClearValue[1]) &&
|
||||
IsCacheCorrect(mColorClearValue[2], colorClearValue[2]) &&
|
||||
IsCacheCorrect(mColorClearValue[3], colorClearValue[3]));
|
||||
|
||||
realGLboolean depthWriteMask = 0;
|
||||
gl->fGetBooleanv(LOCAL_GL_DEPTH_WRITEMASK, &depthWriteMask);
|
||||
MOZ_ASSERT(depthWriteMask == mDepthWriteMask);
|
||||
|
||||
GLfloat depthClearValue = 0.0f;
|
||||
gl->fGetFloatv(LOCAL_GL_DEPTH_CLEAR_VALUE, &depthClearValue);
|
||||
MOZ_ASSERT(IsCacheCorrect(mDepthClearValue, depthClearValue));
|
||||
|
||||
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_CLEAR_VALUE, mStencilClearValue);
|
||||
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_REF, mStencilRefFront);
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_BACK_REF, mStencilRefBack);
|
||||
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_VALUE_MASK, mStencilValueMaskFront);
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_BACK_VALUE_MASK, mStencilValueMaskBack);
|
||||
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_WRITEMASK, mStencilWriteMaskFront);
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_BACK_WRITEMASK, mStencilWriteMaskBack);
|
||||
|
||||
// Bound object state
|
||||
GLuint bound = mBoundFramebuffer ? mBoundFramebuffer->GLName() : 0;
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_FRAMEBUFFER_BINDING, bound);
|
||||
|
||||
bound = mCurrentProgram ? mCurrentProgram->GLName() : 0;
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_CURRENT_PROGRAM, bound);
|
||||
|
||||
// Textures
|
||||
GLenum activeTexture = mActiveTexture + LOCAL_GL_TEXTURE0;
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_ACTIVE_TEXTURE, activeTexture);
|
||||
|
||||
WebGLTexture* curTex = activeBoundTextureForTarget(LOCAL_GL_TEXTURE_2D);
|
||||
bound = curTex ? curTex->GLName() : 0;
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_TEXTURE_BINDING_2D, bound);
|
||||
|
||||
curTex = activeBoundTextureForTarget(LOCAL_GL_TEXTURE_CUBE_MAP);
|
||||
bound = curTex ? curTex->GLName() : 0;
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_TEXTURE_BINDING_CUBE_MAP, bound);
|
||||
|
||||
// Buffers
|
||||
bound = mBoundArrayBuffer ? mBoundArrayBuffer->GLName() : 0;
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_ARRAY_BUFFER_BINDING, bound);
|
||||
|
||||
MOZ_ASSERT(mBoundVertexArray);
|
||||
WebGLBuffer* curBuff = mBoundVertexArray->mBoundElementArrayBuffer;
|
||||
bound = curBuff ? curBuff->GLName() : 0;
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_ELEMENT_ARRAY_BUFFER_BINDING, bound);
|
||||
|
||||
// Viewport
|
||||
GLint int4[4] = {0, 0, 0, 0};
|
||||
gl->fGetIntegerv(LOCAL_GL_VIEWPORT, int4);
|
||||
MOZ_ASSERT(int4[0] == mViewportX &&
|
||||
int4[1] == mViewportY &&
|
||||
int4[2] == mViewportWidth &&
|
||||
int4[3] == mViewportHeight);
|
||||
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_PACK_ALIGNMENT, mPixelStorePackAlignment);
|
||||
AssertUintParamCorrect(gl, LOCAL_GL_UNPACK_ALIGNMENT, mPixelStoreUnpackAlignment);
|
||||
|
||||
MOZ_ASSERT(!GetAndFlushUnderlyingGLErrors());
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -8,13 +8,11 @@
|
||||
|
||||
#include "WebGLObjectModel.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "WebGLShader.h"
|
||||
#include "WebGLUniformInfo.h"
|
||||
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include <map>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user