mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 933009 - Warn when drawing to a destination smaller than the viewport. r=bjacob
This commit is contained in:
parent
4836baa11c
commit
bef4e5a4a1
@ -156,6 +156,11 @@ WebGLContext::WebGLContext()
|
||||
mStencilWriteMaskFront = 0xffffffff;
|
||||
mStencilWriteMaskBack = 0xffffffff;
|
||||
|
||||
mViewportX = 0;
|
||||
mViewportY = 0;
|
||||
mViewportWidth = 0;
|
||||
mViewportHeight = 0;
|
||||
|
||||
mScissorTestEnabled = 0;
|
||||
mDitherEnabled = 1;
|
||||
mRasterizerDiscardEnabled = 0; // OpenGL ES 3.0 spec p244
|
||||
@ -193,6 +198,7 @@ WebGLContext::WebGLContext()
|
||||
|
||||
mAlreadyGeneratedWarnings = 0;
|
||||
mAlreadyWarnedAboutFakeVertexAttrib0 = false;
|
||||
mAlreadyWarnedAboutViewportLargerThanDest = false;
|
||||
mMaxWarnings = Preferences::GetInt("webgl.max-warnings-per-context", 32);
|
||||
if (mMaxWarnings < -1)
|
||||
{
|
||||
@ -573,6 +579,8 @@ WebGLContext::SetDimensions(int32_t width, int32_t height)
|
||||
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
mViewportWidth = width;
|
||||
mViewportHeight = height;
|
||||
mResetLayer = true;
|
||||
mOptionsFrozen = true;
|
||||
|
||||
|
@ -1136,6 +1136,12 @@ protected:
|
||||
GLint mStencilClearValue;
|
||||
GLfloat mDepthClearValue;
|
||||
|
||||
GLint mViewportX;
|
||||
GLint mViewportY;
|
||||
GLsizei mViewportWidth;
|
||||
GLsizei mViewportHeight;
|
||||
bool mAlreadyWarnedAboutViewportLargerThanDest;
|
||||
|
||||
nsCOMPtr<nsITimer> mContextRestorer;
|
||||
bool mAllowRestore;
|
||||
bool mContextLossTimerRunning;
|
||||
|
@ -53,7 +53,7 @@ using namespace mozilla::gfx;
|
||||
static bool BaseTypeAndSizeFromUniformType(GLenum uType, GLenum *baseType, GLint *unitSize);
|
||||
static GLenum InternalFormatForFormatAndType(GLenum format, GLenum type, bool isGLES2);
|
||||
|
||||
inline const WebGLRectangleObject *WebGLContext::FramebufferRectangleObject() const {
|
||||
const WebGLRectangleObject *WebGLContext::FramebufferRectangleObject() const {
|
||||
return mBoundFramebuffer ? mBoundFramebuffer->RectangleObject()
|
||||
: static_cast<const WebGLRectangleObject*>(this);
|
||||
}
|
||||
@ -3067,6 +3067,11 @@ WebGLContext::Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
|
||||
MakeContextCurrent();
|
||||
gl->fViewport(x, y, width, height);
|
||||
|
||||
mViewportX = x;
|
||||
mViewportY = y;
|
||||
mViewportWidth = width;
|
||||
mViewportHeight = height;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -733,6 +733,20 @@ void WebGLContext::Draw_cleanup()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Let's check the viewport
|
||||
const WebGLRectangleObject* rect = FramebufferRectangleObject();
|
||||
if (rect) {
|
||||
if (mViewportWidth > rect->Width() ||
|
||||
mViewportHeight > rect->Height())
|
||||
{
|
||||
if (!mAlreadyWarnedAboutViewportLargerThanDest) {
|
||||
GenerateWarning("Drawing to a destination rect smaller than the viewport rect. "
|
||||
"(This warning will only be given once)");
|
||||
mAlreadyWarnedAboutViewportLargerThanDest = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user