Commit a502c749 by Jamie Madill

Use the specified Program instead of current in GetUniform.

This bug slipped in with the GetUniform validation refactor. BUG=angle:571 Change-Id: I2b87e6fe98224ba99c5b21a71d66b197fd618741 Reviewed-on: https://chromium-review.googlesource.com/214872Reviewed-by: 's avatarNicolas Capens <capn@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent b1196687
...@@ -3141,7 +3141,9 @@ void __stdcall glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSiz ...@@ -3141,7 +3141,9 @@ void __stdcall glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSiz
return; return;
} }
gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); gl::Program *programObject = context->getProgram(program);
ASSERT(programObject);
gl::ProgramBinary *programBinary = programObject->getProgramBinary();
ASSERT(programBinary); ASSERT(programBinary);
programBinary->getUniformfv(location, params); programBinary->getUniformfv(location, params);
...@@ -3160,7 +3162,9 @@ void __stdcall glGetUniformfv(GLuint program, GLint location, GLfloat* params) ...@@ -3160,7 +3162,9 @@ void __stdcall glGetUniformfv(GLuint program, GLint location, GLfloat* params)
return; return;
} }
gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); gl::Program *programObject = context->getProgram(program);
ASSERT(programObject);
gl::ProgramBinary *programBinary = programObject->getProgramBinary();
ASSERT(programBinary); ASSERT(programBinary);
programBinary->getUniformfv(location, params); programBinary->getUniformfv(location, params);
...@@ -3180,7 +3184,9 @@ void __stdcall glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSiz ...@@ -3180,7 +3184,9 @@ void __stdcall glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSiz
return; return;
} }
gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); gl::Program *programObject = context->getProgram(program);
ASSERT(programObject);
gl::ProgramBinary *programBinary = programObject->getProgramBinary();
ASSERT(programBinary); ASSERT(programBinary);
programBinary->getUniformiv(location, params); programBinary->getUniformiv(location, params);
...@@ -3199,7 +3205,9 @@ void __stdcall glGetUniformiv(GLuint program, GLint location, GLint* params) ...@@ -3199,7 +3205,9 @@ void __stdcall glGetUniformiv(GLuint program, GLint location, GLint* params)
return; return;
} }
gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); gl::Program *programObject = context->getProgram(program);
ASSERT(programObject);
gl::ProgramBinary *programBinary = programObject->getProgramBinary();
ASSERT(programBinary); ASSERT(programBinary);
programBinary->getUniformiv(location, params); programBinary->getUniformiv(location, params);
...@@ -6399,7 +6407,9 @@ void __stdcall glGetUniformuiv(GLuint program, GLint location, GLuint* params) ...@@ -6399,7 +6407,9 @@ void __stdcall glGetUniformuiv(GLuint program, GLint location, GLuint* params)
return; return;
} }
gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); gl::Program *programObject = context->getProgram(program);
ASSERT(programObject);
gl::ProgramBinary *programBinary = programObject->getProgramBinary();
ASSERT(programBinary); ASSERT(programBinary);
programBinary->getUniformuiv(location, params); programBinary->getUniformuiv(location, params);
......
...@@ -1859,7 +1859,9 @@ static bool ValidateSizedGetUniform(Context *context, GLuint program, GLint loca ...@@ -1859,7 +1859,9 @@ static bool ValidateSizedGetUniform(Context *context, GLuint program, GLint loca
return false; return false;
} }
gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); gl::Program *programObject = context->getProgram(program);
ASSERT(programObject);
gl::ProgramBinary *programBinary = programObject->getProgramBinary();
// sized queries -- ensure the provided buffer is large enough // sized queries -- ensure the provided buffer is large enough
LinkedUniform *uniform = programBinary->getUniformByLocation(location); LinkedUniform *uniform = programBinary->getUniformByLocation(location);
......
#include "ANGLETest.h"
class UniformTest : public ANGLETest
{
protected:
UniformTest()
{
setWindowWidth(128);
setWindowHeight(128);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
}
virtual void SetUp()
{
ANGLETest::SetUp();
const std::string &vertexShader = "void main() { gl_Position = vec4(1); }";
const std::string &fragShader =
"precision mediump float;\n"
"uniform float uniF;\n"
"uniform int uniI;\n"
"void main() { gl_FragColor = vec4(uniF + float(uniI)); }";
mProgram = CompileProgram(vertexShader, fragShader);
ASSERT_NE(mProgram, 0u);
mUniformFLocation = glGetUniformLocation(mProgram, "uniF");
ASSERT_NE(mUniformFLocation, -1);
mUniformILocation = glGetUniformLocation(mProgram, "uniI");
ASSERT_NE(mUniformILocation, -1);
ASSERT_GL_NO_ERROR();
}
virtual void TearDown()
{
glDeleteProgram(mProgram);
ANGLETest::TearDown();
}
GLuint mProgram;
GLint mUniformFLocation;
GLint mUniformILocation;
};
TEST_F(UniformTest, GetUniformNoCurrentProgram)
{
glUseProgram(mProgram);
glUniform1f(mUniformFLocation, 1.0f);
glUniform1i(mUniformILocation, 1);
glUseProgram(0);
GLfloat f;
glGetnUniformfvEXT(mProgram, mUniformFLocation, 4, &f);
ASSERT_GL_NO_ERROR();
EXPECT_EQ(1.0f, f);
glGetUniformfv(mProgram, mUniformFLocation, &f);
ASSERT_GL_NO_ERROR();
EXPECT_EQ(1.0f, f);
GLint i;
glGetnUniformivEXT(mProgram, mUniformILocation, 4, &i);
ASSERT_GL_NO_ERROR();
EXPECT_EQ(1, i);
glGetUniformiv(mProgram, mUniformILocation, &i);
ASSERT_GL_NO_ERROR();
EXPECT_EQ(1, i);
}
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