glLinkProgram might try setting up program attributes even when an
invalid program name is passed to it. This patch fixes it.
BUG:
33069416
Change-Id: I93ed140095b67df47b158ba837c4aac8eb9e8e50
return pData ? pData->setSamplerUniform(appLoc, val, target) : false;
}
+bool GLSharedGroup::isShader(GLuint shader)
+{
+ android::AutoMutex _lock(m_lock);
+ ShaderData* pData = m_shaders.valueFor(shader);
+ return (pData!=NULL);
+}
+
bool GLSharedGroup::addShaderData(GLuint shader)
{
android::AutoMutex _lock(m_lock);
GLint getNextSamplerUniform(GLuint program, GLint index, GLint* val, GLenum* target) const;
bool setSamplerUniform(GLuint program, GLint appLoc, GLint val, GLenum* target);
+ bool isShader(GLuint shader);
bool addShaderData(GLuint shader);
// caller must hold a reference to the shader as long as it holds the pointer
ShaderData* getShaderData(GLuint shader);
void GL2Encoder::s_glLinkProgram(void * self, GLuint program)
{
GL2Encoder *ctx = (GL2Encoder *)self;
+ bool isProgram = ctx->m_shared->isProgram(program);
+ SET_ERROR_IF(!isProgram && !ctx->m_shared->isShader(program), GL_INVALID_VALUE);
+ SET_ERROR_IF(!isProgram, GL_INVALID_OPERATION);
+
ctx->m_glLinkProgram_enc(self, program);
GLint linkStatus = 0;