Add the shader version of the compiled shaders to the program binary.

Also increment the binary version. TRAC #23182 Signed-off-by: Shannon Woods Signed-off-by: Nicolas Capens Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2368 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 6e4f2a6b
#define MAJOR_VERSION 1 #define MAJOR_VERSION 1
#define MINOR_VERSION 1 #define MINOR_VERSION 1
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 2212 #define BUILD_REVISION 1991
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -90,6 +90,7 @@ ProgramBinary::ProgramBinary(rx::Renderer *renderer) : mRenderer(renderer), RefC ...@@ -90,6 +90,7 @@ ProgramBinary::ProgramBinary(rx::Renderer *renderer) : mRenderer(renderer), RefC
mUsedVertexSamplerRange = 0; mUsedVertexSamplerRange = 0;
mUsedPixelSamplerRange = 0; mUsedPixelSamplerRange = 0;
mUsesPointSize = false; mUsesPointSize = false;
mShaderVersion = 100;
} }
ProgramBinary::~ProgramBinary() ProgramBinary::~ProgramBinary()
...@@ -121,6 +122,11 @@ unsigned int ProgramBinary::getSerial() const ...@@ -121,6 +122,11 @@ unsigned int ProgramBinary::getSerial() const
return mSerial; return mSerial;
} }
int ProgramBinary::getShaderVersion() const
{
return mShaderVersion;
}
unsigned int ProgramBinary::issueSerial() unsigned int ProgramBinary::issueSerial()
{ {
return mCurrentSerial++; return mCurrentSerial++;
...@@ -1545,6 +1551,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length) ...@@ -1545,6 +1551,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
stream.read(&mUsedVertexSamplerRange); stream.read(&mUsedVertexSamplerRange);
stream.read(&mUsedPixelSamplerRange); stream.read(&mUsedPixelSamplerRange);
stream.read(&mUsesPointSize); stream.read(&mUsesPointSize);
stream.read(&mShaderVersion);
size_t size; size_t size;
stream.read(&size); stream.read(&size);
...@@ -1738,6 +1745,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length) ...@@ -1738,6 +1745,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
stream.write(mUsedVertexSamplerRange); stream.write(mUsedVertexSamplerRange);
stream.write(mUsedPixelSamplerRange); stream.write(mUsedPixelSamplerRange);
stream.write(mUsesPointSize); stream.write(mUsesPointSize);
stream.write(mShaderVersion);
stream.write(mUniforms.size()); stream.write(mUniforms.size());
for (unsigned int uniformIndex = 0; uniformIndex < mUniforms.size(); ++uniformIndex) for (unsigned int uniformIndex = 0; uniformIndex < mUniforms.size(); ++uniformIndex)
...@@ -1870,6 +1878,8 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin ...@@ -1870,6 +1878,8 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin
return false; return false;
} }
mShaderVersion = vertexShader->getShaderVersion();
std::string pixelHLSL = fragmentShader->getHLSL(); std::string pixelHLSL = fragmentShader->getHLSL();
std::string vertexHLSL = vertexShader->getHLSL(); std::string vertexHLSL = vertexShader->getHLSL();
......
...@@ -137,6 +137,7 @@ class ProgramBinary : public RefCountObject ...@@ -137,6 +137,7 @@ class ProgramBinary : public RefCountObject
bool isValidated() const; bool isValidated() const;
unsigned int getSerial() const; unsigned int getSerial() const;
int getShaderVersion() const;
void sortAttributesByLayout(rx::TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS], int sortedSemanticIndices[MAX_VERTEX_ATTRIBS]) const; void sortAttributesByLayout(rx::TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS], int sortedSemanticIndices[MAX_VERTEX_ATTRIBS]) const;
...@@ -196,6 +197,7 @@ class ProgramBinary : public RefCountObject ...@@ -196,6 +197,7 @@ class ProgramBinary : public RefCountObject
GLuint mUsedVertexSamplerRange; GLuint mUsedVertexSamplerRange;
GLuint mUsedPixelSamplerRange; GLuint mUsedPixelSamplerRange;
bool mUsesPointSize; bool mUsesPointSize;
int mShaderVersion;
UniformArray mUniforms; UniformArray mUniforms;
UniformBlockArray mUniformBlocks; UniformBlockArray mUniformBlocks;
......
...@@ -34,6 +34,7 @@ Shader::Shader(ResourceManager *manager, const rx::Renderer *renderer, GLuint ha ...@@ -34,6 +34,7 @@ Shader::Shader(ResourceManager *manager, const rx::Renderer *renderer, GLuint ha
mRefCount = 0; mRefCount = 0;
mDeleteStatus = false; mDeleteStatus = false;
mShaderVersion = 100;
} }
Shader::~Shader() Shader::~Shader()
...@@ -361,6 +362,7 @@ void Shader::uncompile() ...@@ -361,6 +362,7 @@ void Shader::uncompile()
mUsesPointSize = false; mUsesPointSize = false;
mUsesPointCoord = false; mUsesPointCoord = false;
mUsesDepthRange = false; mUsesDepthRange = false;
mShaderVersion = 100;
mActiveUniforms.clear(); mActiveUniforms.clear();
mActiveInterfaceBlocks.clear(); mActiveInterfaceBlocks.clear();
...@@ -406,6 +408,8 @@ void Shader::compileToHLSL(void *compiler) ...@@ -406,6 +408,8 @@ void Shader::compileToHLSL(void *compiler)
size_t shaderVersion = 100; size_t shaderVersion = 100;
ShGetInfo(compiler, SH_SHADER_VERSION, &shaderVersion); ShGetInfo(compiler, SH_SHADER_VERSION, &shaderVersion);
mShaderVersion = static_cast<int>(shaderVersion);
if (shaderVersion == 300 && mRenderer->getCurrentClientVersion() < 3) if (shaderVersion == 300 && mRenderer->getCurrentClientVersion() < 3)
{ {
const char versionError[] = "GLSL ES 3.00 is not supported by OpenGL ES 2.0 contexts"; const char versionError[] = "GLSL ES 3.00 is not supported by OpenGL ES 2.0 contexts";
...@@ -577,6 +581,11 @@ bool Shader::compareVarying(const Varying &x, const Varying &y) ...@@ -577,6 +581,11 @@ bool Shader::compareVarying(const Varying &x, const Varying &y)
return false; return false;
} }
int Shader::getShaderVersion() const
{
return mShaderVersion;
}
VertexShader::VertexShader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle) VertexShader::VertexShader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle)
: Shader(manager, renderer, handle) : Shader(manager, renderer, handle)
{ {
......
...@@ -90,6 +90,7 @@ class Shader ...@@ -90,6 +90,7 @@ class Shader
unsigned int getRefCount() const; unsigned int getRefCount() const;
bool isFlaggedForDeletion() const; bool isFlaggedForDeletion() const;
void flagForDeletion(); void flagForDeletion();
int getShaderVersion() const;
static void releaseCompiler(); static void releaseCompiler();
...@@ -117,6 +118,7 @@ class Shader ...@@ -117,6 +118,7 @@ class Shader
bool mUsesPointSize; bool mUsesPointSize;
bool mUsesPointCoord; bool mUsesPointCoord;
bool mUsesDepthRange; bool mUsesDepthRange;
int mShaderVersion;
static void *mFragmentCompiler; static void *mFragmentCompiler;
static void *mVertexCompiler; static void *mVertexCompiler;
......
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