Bug 1136508 - Removed unused READ_BUFFER out-var from ValidateCurFBForRead. - r=mtseng
MozReview-Commit-ID: 4qOQNbMkfUX
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -1939,18 +1939,17 @@ WebGLContext::DidRefresh()
if (gl) {
gl->FlushIfHeavyGLCallsSinceLastFlush();
}
}
bool
WebGLContext::ValidateCurFBForRead(const char* funcName,
const webgl::FormatUsageInfo** const out_format,
- uint32_t* const out_width, uint32_t* const out_height,
- GLenum* const out_mode)
+ uint32_t* const out_width, uint32_t* const out_height)
{
if (!mBoundReadFramebuffer) {
const GLenum readBufferMode = gl->Screen()->GetReadBufferMode();
if (readBufferMode == LOCAL_GL_NONE) {
ErrorInvalidOperation("%s: Can't read from backbuffer when readBuffer mode is"
" NONE.",
funcName);
return false;
@@ -1964,22 +1963,21 @@ WebGLContext::ValidateCurFBForRead(const
auto effFormat = mOptions.alpha ? webgl::EffectiveFormat::RGBA8
: webgl::EffectiveFormat::RGB8;
*out_format = mFormatUsage->GetUsage(effFormat);
MOZ_ASSERT(*out_format);
*out_width = mWidth;
*out_height = mHeight;
- *out_mode = gl->Screen()->GetReadBufferMode();
return true;
}
return mBoundReadFramebuffer->ValidateForRead(funcName, out_format, out_width,
- out_height, out_mode);
+ out_height);
}
////////////////////////////////////////////////////////////////////////////////
WebGLContext::ScopedMaskWorkaround::ScopedMaskWorkaround(WebGLContext& webgl)
: mWebGL(webgl)
, mFakeNoAlpha(ShouldFakeNoAlpha(webgl))
, mFakeNoDepth(ShouldFakeNoDepth(webgl))
--- a/dom/canvas/WebGLContext.h
+++ b/dom/canvas/WebGLContext.h
@@ -1298,18 +1298,17 @@ protected:
WebGLTexDimensions dims);
bool ValidateUniformLocationForProgram(WebGLUniformLocation* location,
WebGLProgram* program,
const char* funcName);
bool ValidateCurFBForRead(const char* funcName,
const webgl::FormatUsageInfo** const out_format,
- uint32_t* const out_width, uint32_t* const out_height,
- GLenum* const out_mode);
+ uint32_t* const out_width, uint32_t* const out_height);
void Invalidate();
void DestroyResourcesAndContext();
void MakeContextCurrent() const;
// helpers
--- a/dom/canvas/WebGLContextGL.cpp
+++ b/dom/canvas/WebGLContextGL.cpp
@@ -1573,18 +1573,17 @@ WebGLContext::ReadPixels(GLint x, GLint
return;
}
MakeContextCurrent();
const webgl::FormatUsageInfo* srcFormat;
uint32_t srcWidth;
uint32_t srcHeight;
- GLenum srcMode;
- if (!ValidateCurFBForRead("readPixels", &srcFormat, &srcWidth, &srcHeight, &srcMode))
+ if (!ValidateCurFBForRead("readPixels", &srcFormat, &srcWidth, &srcHeight))
return;
// Check the format and type params to assure they are an acceptable pair (as per spec)
auto srcType = srcFormat->format->componentType;
GLenum mainReadFormat;
GLenum mainReadType;
switch (srcType) {
case webgl::ComponentType::Float:
--- a/dom/canvas/WebGLContextState.cpp
+++ b/dom/canvas/WebGLContextState.cpp
@@ -377,34 +377,32 @@ WebGLContext::GetParameter(JSContext* cx
case LOCAL_GL_GENERATE_MIPMAP_HINT: {
GLint i = 0;
gl->fGetIntegerv(pname, &i);
return JS::NumberValue(uint32_t(i));
}
case LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE: {
const webgl::FormatUsageInfo* usage;
uint32_t width, height;
- GLenum mode;
- if (!ValidateCurFBForRead(funcName, &usage, &width, &height, &mode))
+ if (!ValidateCurFBForRead(funcName, &usage, &width, &height))
return JS::NullValue();
GLint i = 0;
if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) {
gl->fGetIntegerv(pname, &i);
} else {
i = LOCAL_GL_UNSIGNED_BYTE;
}
return JS::NumberValue(uint32_t(i));
}
case LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT: {
const webgl::FormatUsageInfo* usage;
uint32_t width, height;
- GLenum mode;
- if (!ValidateCurFBForRead(funcName, &usage, &width, &height, &mode))
+ if (!ValidateCurFBForRead(funcName, &usage, &width, &height))
return JS::NullValue();
GLint i = 0;
if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) {
gl->fGetIntegerv(pname, &i);
} else {
i = LOCAL_GL_RGBA;
}
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -1140,36 +1140,34 @@ WebGLFramebuffer::FinalizeAttachments()
}
FinalizeDrawAndReadBuffers(gl, mColorAttachment0.IsDefined());
}
bool
WebGLFramebuffer::ValidateForRead(const char* funcName,
const webgl::FormatUsageInfo** const out_format,
- uint32_t* const out_width, uint32_t* const out_height,
- GLenum* const out_mode)
+ uint32_t* const out_width, uint32_t* const out_height)
{
if (!ValidateAndInitAttachments(funcName))
return false;
if (mReadBufferMode == LOCAL_GL_NONE) {
- mContext->ErrorInvalidOperation("%s: Read buffer mode must not be"
- " NONE.", funcName);
+ mContext->ErrorInvalidOperation("%s: Read buffer mode must not be NONE.",
+ funcName);
return false;
}
const auto attachPoint = GetAttachPoint(mReadBufferMode);
if (!attachPoint || !attachPoint->IsDefined()) {
mContext->ErrorInvalidOperation("%s: The attachment specified for reading is"
" null.", funcName);
return false;
}
- *out_mode = mReadBufferMode;
*out_format = attachPoint->Format();
attachPoint->Size(out_width, out_height);
return true;
}
static bool
AttachmentsDontMatch(const WebGLFBAttachPoint& a, const WebGLFBAttachPoint& b)
{
--- a/dom/canvas/WebGLFramebuffer.h
+++ b/dom/canvas/WebGLFramebuffer.h
@@ -281,18 +281,17 @@ public:
bool ValidateAndInitAttachments(const char* funcName);
void InvalidateFramebufferStatus() const {
mIsKnownFBComplete = false;
}
bool ValidateForRead(const char* info,
const webgl::FormatUsageInfo** const out_format,
- uint32_t* const out_width, uint32_t* const out_height,
- GLenum* const out_mode);
+ uint32_t* const out_width, uint32_t* const out_height);
JS::Value GetAttachmentParameter(const char* funcName, JSContext* cx, GLenum target,
GLenum attachment, GLenum pname,
ErrorResult* const out_error);
};
} // namespace mozilla
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -1742,19 +1742,17 @@ WebGLTexture::CopyTexImage2D(TexImageTar
MOZ_ASSERT(imageInfo);
////////////////////////////////////
// Get source info
const webgl::FormatUsageInfo* srcUsage;
uint32_t srcWidth;
uint32_t srcHeight;
- GLenum srcMode;
- if (!mContext->ValidateCurFBForRead(funcName, &srcUsage, &srcWidth, &srcHeight,
- &srcMode))
+ if (!mContext->ValidateCurFBForRead(funcName, &srcUsage, &srcWidth, &srcHeight))
return;
auto srcFormat = srcUsage->format;
if (!ValidateCopyTexImageForFeedback(funcName, level))
return;
////////////////////////////////////
// Check that source and dest info are compatible
@@ -1897,19 +1895,17 @@ WebGLTexture::CopyTexSubImage(const char
}
////////////////////////////////////
// Get source info
const webgl::FormatUsageInfo* srcUsage;
uint32_t srcWidth;
uint32_t srcHeight;
- GLenum srcMode;
- if (!mContext->ValidateCurFBForRead(funcName, &srcUsage, &srcWidth, &srcHeight,
- &srcMode))
+ if (!mContext->ValidateCurFBForRead(funcName, &srcUsage, &srcWidth, &srcHeight))
return;
auto srcFormat = srcUsage->format;
if (!ValidateCopyTexImageForFeedback(funcName, level))
return;
////////////////////////////////////
// Check that source and dest info are compatible