Updated the swizzle generation functions to use Error objects.
BUG=angle:520
Change-Id: I01b3cdb7d6719582fa8a57f21218705f6743a7b0
Reviewed-on: https://chromium-review.googlesource.com/217103
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index c467fa8..a54e68e 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -1390,7 +1390,7 @@
programBinary->applyUniforms();
}
-void Context::generateSwizzles(ProgramBinary *programBinary, SamplerType type)
+Error Context::generateSwizzles(ProgramBinary *programBinary, SamplerType type)
{
size_t samplerRange = programBinary->getUsedSamplerRange(type);
@@ -1403,16 +1403,33 @@
Texture* texture = getSamplerTexture(textureUnit, textureType);
if (texture->getSamplerState().swizzleRequired())
{
- mRenderer->generateSwizzle(texture);
+ Error error = mRenderer->generateSwizzle(texture);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
}
+
+ return Error(GL_NO_ERROR);
}
-void Context::generateSwizzles(ProgramBinary *programBinary)
+Error Context::generateSwizzles(ProgramBinary *programBinary)
{
- generateSwizzles(programBinary, SAMPLER_VERTEX);
- generateSwizzles(programBinary, SAMPLER_PIXEL);
+ Error error = generateSwizzles(programBinary, SAMPLER_VERTEX);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = generateSwizzles(programBinary, SAMPLER_PIXEL);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ return Error(GL_NO_ERROR);
}
// For each Direct3D sampler of either the pixel or vertex stage,
@@ -1673,7 +1690,11 @@
ProgramBinary *programBinary = mState.getCurrentProgramBinary();
programBinary->updateSamplerMapping();
- generateSwizzles(programBinary);
+ Error error = generateSwizzles(programBinary);
+ if (error.isError())
+ {
+ return gl::error(error.getCode());
+ }
if (!mRenderer->applyPrimitiveType(mode, count))
{
@@ -1683,7 +1704,7 @@
applyRenderTarget(mode, false);
applyState(mode);
- Error error = mRenderer->applyVertexBuffer(programBinary, mState.getVertexArray()->getVertexAttributes(), mState.getVertexAttribCurrentValues(), first, count, instances);
+ error = mRenderer->applyVertexBuffer(programBinary, mState.getVertexArray()->getVertexAttributes(), mState.getVertexAttribCurrentValues(), first, count, instances);
if (error.isError())
{
return gl::error(error.getCode());
@@ -1720,7 +1741,11 @@
ProgramBinary *programBinary = mState.getCurrentProgramBinary();
programBinary->updateSamplerMapping();
- generateSwizzles(programBinary);
+ Error error = generateSwizzles(programBinary);
+ if (error.isError())
+ {
+ return gl::error(error.getCode());
+ }
if (!mRenderer->applyPrimitiveType(mode, count))
{
@@ -1733,7 +1758,7 @@
VertexArray *vao = mState.getVertexArray();
rx::TranslatedIndexData indexInfo;
indexInfo.indexRange = indexRange;
- Error error = mRenderer->applyIndexBuffer(indices, vao->getElementArrayBuffer(), count, mode, type, &indexInfo);
+ error = mRenderer->applyIndexBuffer(indices, vao->getElementArrayBuffer(), count, mode, type, &indexInfo);
if (error.isError())
{
return gl::error(error.getCode());