Validate matching uniform precisions.
TRAC #22635
Signed-off-by: Shannon Woods
Signed-off-by: Geoff Lang
Author: Nicolas Capens
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1941 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/version.h b/src/common/version.h
index bb6d830..bd6efd1 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
#define MAJOR_VERSION 1
#define MINOR_VERSION 1
#define BUILD_VERSION 0
-#define BUILD_REVISION 1818
+#define BUILD_REVISION 1831
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/src/libGLESv2/ProgramBinary.cpp b/src/libGLESv2/ProgramBinary.cpp
index 5bfd01a..450c01b 100644
--- a/src/libGLESv2/ProgramBinary.cpp
+++ b/src/libGLESv2/ProgramBinary.cpp
@@ -1627,14 +1627,16 @@
for (unsigned int i = 0; i < size; ++i)
{
GLenum type;
+ GLenum precision;
std::string name;
unsigned int arraySize;
stream.read(&type);
+ stream.read(&precision);
stream.read(&name);
stream.read(&arraySize);
- mUniforms[i] = new Uniform(type, name, arraySize);
+ mUniforms[i] = new Uniform(type, precision, name, arraySize);
stream.read(&mUniforms[i]->psRegisterIndex);
stream.read(&mUniforms[i]->vsRegisterIndex);
@@ -1762,6 +1764,7 @@
for (unsigned int i = 0; i < mUniforms.size(); ++i)
{
stream.write(mUniforms[i]->type);
+ stream.write(mUniforms[i]->precision);
stream.write(mUniforms[i]->name);
stream.write(mUniforms[i]->arraySize);
@@ -2054,18 +2057,18 @@
Uniform *uniform = NULL;
GLint location = getUniformLocation(constant.name);
- if (location >= 0) // Previously defined, types must match
+ if (location >= 0) // Previously defined, type and precision must match
{
uniform = mUniforms[mUniformIndex[location].index];
- if (uniform->type != constant.type)
+ if (uniform->type != constant.type || uniform->precision != constant.precision)
{
return false;
}
}
else
{
- uniform = new Uniform(constant.type, constant.name, constant.arraySize);
+ uniform = new Uniform(constant.type, constant.precision, constant.name, constant.arraySize);
}
if (!uniform)
diff --git a/src/libGLESv2/Uniform.cpp b/src/libGLESv2/Uniform.cpp
index 42606e1..0fe3b8c 100644
--- a/src/libGLESv2/Uniform.cpp
+++ b/src/libGLESv2/Uniform.cpp
@@ -12,8 +12,8 @@
namespace gl
{
-Uniform::Uniform(GLenum type, const std::string &name, unsigned int arraySize)
- : type(type), name(name), arraySize(arraySize)
+Uniform::Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize)
+ : type(type), precision(precision), name(name), arraySize(arraySize)
{
int bytes = gl::UniformInternalSize(type) * elementCount();
data = new unsigned char[bytes];
diff --git a/src/libGLESv2/Uniform.h b/src/libGLESv2/Uniform.h
index 65c3f2a..64414ac 100644
--- a/src/libGLESv2/Uniform.h
+++ b/src/libGLESv2/Uniform.h
@@ -21,7 +21,7 @@
// Helper struct representing a single shader uniform
struct Uniform
{
- Uniform(GLenum type, const std::string &name, unsigned int arraySize);
+ Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize);
~Uniform();
@@ -29,6 +29,7 @@
unsigned int elementCount() const;
const GLenum type;
+ const GLenum precision;
const std::string name;
const unsigned int arraySize;