Commit b459fb04 by Cooper Partin Committed by Jamie Madill

Fixed compiler warning C4456 'declaration of variable hides previous local declaration'.

BUG=angleproject:1119 Change-Id: I99572711ceeae94fb920d197c86e741945d3b60b Reviewed-on: https://chromium-review.googlesource.com/292279Tested-by: 's avatarCooper Partin <coopp@microsoft.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 8168b4bd
...@@ -271,13 +271,13 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl ...@@ -271,13 +271,13 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl
ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported(); ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported();
ID3D11Device *device = mRenderer->getDevice(); ID3D11Device *device = mRenderer->getDevice();
for (size_t colorAttachment = 0; colorAttachment < colorAttachments.size(); colorAttachment++) for (size_t colorAttachmentIndex = 0; colorAttachmentIndex < colorAttachments.size();
colorAttachmentIndex++)
{ {
const gl::FramebufferAttachment &attachment = colorAttachments[colorAttachment]; const gl::FramebufferAttachment &attachment = colorAttachments[colorAttachmentIndex];
if (clearParams.clearColor[colorAttachment] && if (clearParams.clearColor[colorAttachmentIndex] && attachment.isAttached() &&
attachment.isAttached() && drawBufferStates[colorAttachmentIndex] != GL_NONE)
drawBufferStates[colorAttachment] != GL_NONE)
{ {
RenderTarget11 *renderTarget = nullptr; RenderTarget11 *renderTarget = nullptr;
gl::Error error = attachment.getRenderTarget(&renderTarget); gl::Error error = attachment.getRenderTarget(&renderTarget);
...@@ -291,9 +291,12 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl ...@@ -291,9 +291,12 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl
if (clearParams.colorClearType == GL_FLOAT && if (clearParams.colorClearType == GL_FLOAT &&
!(formatInfo.componentType == GL_FLOAT || formatInfo.componentType == GL_UNSIGNED_NORMALIZED || formatInfo.componentType == GL_SIGNED_NORMALIZED)) !(formatInfo.componentType == GL_FLOAT || formatInfo.componentType == GL_UNSIGNED_NORMALIZED || formatInfo.componentType == GL_SIGNED_NORMALIZED))
{ {
ERR("It is undefined behaviour to clear a render buffer which is not normalized fixed point or floating-" ERR(
"point to floating point values (color attachment %u has internal format 0x%X).", colorAttachment, "It is undefined behaviour to clear a render buffer which is not normalized "
attachment.getInternalFormat()); "fixed point or floating-"
"point to floating point values (color attachment %u has internal format "
"0x%X).",
colorAttachmentIndex, attachment.getInternalFormat());
} }
if ((formatInfo.redBits == 0 || !clearParams.colorMaskRed) && if ((formatInfo.redBits == 0 || !clearParams.colorMaskRed) &&
...@@ -312,7 +315,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl ...@@ -312,7 +315,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl
{ {
// A masked clear is required, or a scissored clear is required and ID3D11DeviceContext1::ClearView is unavailable // A masked clear is required, or a scissored clear is required and ID3D11DeviceContext1::ClearView is unavailable
MaskedRenderTarget maskAndRt; MaskedRenderTarget maskAndRt;
bool clearColor = clearParams.clearColor[colorAttachment]; bool clearColor = clearParams.clearColor[colorAttachmentIndex];
maskAndRt.colorMask[0] = (clearColor && clearParams.colorMaskRed); maskAndRt.colorMask[0] = (clearColor && clearParams.colorMaskRed);
maskAndRt.colorMask[1] = (clearColor && clearParams.colorMaskGreen); maskAndRt.colorMask[1] = (clearColor && clearParams.colorMaskGreen);
maskAndRt.colorMask[2] = (clearColor && clearParams.colorMaskBlue); maskAndRt.colorMask[2] = (clearColor && clearParams.colorMaskBlue);
......
...@@ -1302,12 +1302,13 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorAtt ...@@ -1302,12 +1302,13 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorAtt
const gl::FramebufferAttachment *depthStencilAttachment) const gl::FramebufferAttachment *depthStencilAttachment)
{ {
const gl::FramebufferAttachment *renderAttachment = colorAttachment; const gl::FramebufferAttachment *renderAttachment = colorAttachment;
gl::Error error(GL_NO_ERROR);
// if there is no color attachment we must synthesize a NULL colorattachment // if there is no color attachment we must synthesize a NULL colorattachment
// to keep the D3D runtime happy. This should only be possible if depth texturing. // to keep the D3D runtime happy. This should only be possible if depth texturing.
if (renderAttachment == nullptr) if (renderAttachment == nullptr)
{ {
gl::Error error = getNullColorbuffer(depthStencilAttachment, &renderAttachment); error = getNullColorbuffer(depthStencilAttachment, &renderAttachment);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -1320,7 +1321,7 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorAtt ...@@ -1320,7 +1321,7 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorAtt
D3DFORMAT renderTargetFormat = D3DFMT_UNKNOWN; D3DFORMAT renderTargetFormat = D3DFMT_UNKNOWN;
RenderTarget9 *renderTarget = nullptr; RenderTarget9 *renderTarget = nullptr;
gl::Error error = renderAttachment->getRenderTarget(&renderTarget); error = renderAttachment->getRenderTarget(&renderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -1351,7 +1352,7 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorAtt ...@@ -1351,7 +1352,7 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorAtt
if (depthStencilAttachment != nullptr) if (depthStencilAttachment != nullptr)
{ {
gl::Error error = depthStencilAttachment->getRenderTarget(&depthStencilRenderTarget); error = depthStencilAttachment->getRenderTarget(&depthStencilRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
......
...@@ -132,8 +132,8 @@ gl::Error VertexArrayGL::syncDrawState(const std::vector<GLuint> &activeAttribLo ...@@ -132,8 +132,8 @@ gl::Error VertexArrayGL::syncDrawState(const std::vector<GLuint> &activeAttribLo
{ {
ASSERT(attributesNeedStreaming); ASSERT(attributesNeedStreaming);
gl::Error error = streamAttributes(activeAttribLocations, streamingDataSize, maxAttributeDataSize, error = streamAttributes(activeAttribLocations, streamingDataSize, maxAttributeDataSize,
indexRange); indexRange);
if (error.isError()) if (error.isError())
{ {
return error; return error;
......
...@@ -825,7 +825,7 @@ EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint b ...@@ -825,7 +825,7 @@ EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint b
return EGL_FALSE; return EGL_FALSE;
} }
egl::Error error = eglSurface->bindTexImage(textureObject, buffer); error = eglSurface->bindTexImage(textureObject, buffer);
if (error.isError()) if (error.isError())
{ {
SetGlobalError(error); SetGlobalError(error);
...@@ -894,7 +894,7 @@ EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLin ...@@ -894,7 +894,7 @@ EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLin
if (texture) if (texture)
{ {
egl::Error error = eglSurface->releaseTexImage(buffer); error = eglSurface->releaseTexImage(buffer);
if (error.isError()) if (error.isError())
{ {
SetGlobalError(error); SetGlobalError(error);
......
...@@ -214,8 +214,6 @@ TEST_P(SixteenBppTextureTest, RGBA5551ClearAlpha) ...@@ -214,8 +214,6 @@ TEST_P(SixteenBppTextureTest, RGBA5551ClearAlpha)
GLuint tex = 0; GLuint tex = 0;
GLuint fbo = 0; GLuint fbo = 0;
GLubyte pixel[4];
// Create a simple 5551 texture // Create a simple 5551 texture
glGenTextures(1, &tex); glGenTextures(1, &tex);
...@@ -233,12 +231,10 @@ TEST_P(SixteenBppTextureTest, RGBA5551ClearAlpha) ...@@ -233,12 +231,10 @@ TEST_P(SixteenBppTextureTest, RGBA5551ClearAlpha)
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
EXPECT_PIXEL_EQ(0, 0, 0, 0, 0, 0); EXPECT_PIXEL_EQ(0, 0, 0, 0, 0, 0);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
EXPECT_PIXEL_EQ(0, 0, 0, 0, 0, 255); EXPECT_PIXEL_EQ(0, 0, 0, 0, 0, 255);
glDeleteFramebuffers(1, &fbo); glDeleteFramebuffers(1, &fbo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment