opengles emulator: Workaround Cordy (Unity) bug with intel driver.

Uniform locations are 32-bit values which the application queries
from the driver after a shader program is linked. It seems that Cordy
game (possibly all Unity based apps) store the returned location as
16-bit value. Intel driver returns location values in the upper 16-bit
range :(
This is a workaround for this issue, when a program is linked we check
the locations of all uniforms, if all locations are within the upper
16-bit range (as with Intel driver) we shift the location value before
returning to the application. Also override all functions which take
a location parameter and do the reverse shift before sending a location
value to the host.

Change-Id: I234aaafe3313774b5da79eb1dac713b89b10ad60
This commit is contained in:
Guy Zadickario
2011-08-05 16:04:33 +03:00
committed by David 'Digit' Turner
parent f7e07ec9ea
commit 52829d82ab
6 changed files with 287 additions and 7 deletions

View File

@@ -54,6 +54,7 @@ private:
GLuint m_numIndexes;
IndexInfo* m_Indexes;
bool m_initialized;
bool m_locShiftWAR;
public:
ProgramData();
void initProgramData(GLuint numIndexes);
@@ -62,6 +63,11 @@ public:
void setIndexInfo(GLuint index, GLint base, GLint size, GLenum type);
GLuint getIndexForLocation(GLint location);
GLenum getTypeForLocation(GLint location);
void setupLocationShiftWAR();
GLint locationWARHostToApp(GLint hostLoc);
GLint locationWARAppToHost(GLint appLoc);
};
class GLSharedGroup {
@@ -86,6 +92,9 @@ public:
void deleteProgramData(GLuint program);
void setProgramIndexInfo(GLuint program, GLuint index, GLint base, GLint size, GLenum type);
GLenum getProgramUniformType(GLuint program, GLint location);
void setupLocationShiftWAR(GLuint program);
GLint locationWARHostToApp(GLuint program, GLint hostLoc);
GLint locationWARAppToHost(GLuint program, GLint appLoc);
void addShaderData(GLuint shader);
bool isShader(GLuint shader);