Add error to catch mismatched allocations and samplers.
Change-Id: Id54d669fa9c3ce833fd094d5615e05ad4742e0ac
diff --git a/driver/rsdShader.cpp b/driver/rsdShader.cpp
index 0361844..816b17c 100644
--- a/driver/rsdShader.cpp
+++ b/driver/rsdShader.cpp
@@ -405,6 +405,11 @@
// This tells us the correct texture type
DrvAllocation *drvTex = (DrvAllocation *)tex->mHal.drv;
const GLenum target = drvTex->glTarget;
+ if (!target) {
+ // this can happen if the user set the wrong allocation flags.
+ rsc->setError(RS_ERROR_BAD_VALUE, "Allocation not compatible with sampler");
+ return;
+ }
if (!dc->gl.gl.OES_texture_npot && tex->getType()->getIsNp2()) {
if (tex->getHasGraphicsMipmaps() &&
@@ -502,7 +507,7 @@
GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
RSD_CALL_GL(glTexParameteri, mCurrentState->mTextureTargets[ct],
GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- rsdGLCheckError(rsc, "ProgramFragment::setup tex env");
+ rsdGLCheckError(rsc, "ProgramFragment::setup basic tex env");
}
rsdGLCheckError(rsc, "ProgramFragment::setup uniforms");
}