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 MINOR_VERSION 1
#define BUILD_VERSION 0
#define BUILD_REVISION 2212
#define BUILD_REVISION 1991
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
......@@ -90,6 +90,7 @@ ProgramBinary::ProgramBinary(rx::Renderer *renderer) : mRenderer(renderer), RefC
mUsedVertexSamplerRange = 0;
mUsedPixelSamplerRange = 0;
mUsesPointSize = false;
mShaderVersion = 100;
}
ProgramBinary::~ProgramBinary()
......@@ -121,6 +122,11 @@ unsigned int ProgramBinary::getSerial() const
return mSerial;
}
int ProgramBinary::getShaderVersion() const
{
return mShaderVersion;
}
unsigned int ProgramBinary::issueSerial()
{
return mCurrentSerial++;
......@@ -1545,6 +1551,7 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
stream.read(&mUsedVertexSamplerRange);
stream.read(&mUsedPixelSamplerRange);
stream.read(&mUsesPointSize);
stream.read(&mShaderVersion);
size_t size;
stream.read(&size);
......@@ -1738,6 +1745,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
stream.write(mUsedVertexSamplerRange);
stream.write(mUsedPixelSamplerRange);
stream.write(mUsesPointSize);
stream.write(mShaderVersion);
stream.write(mUniforms.size());
for (unsigned int uniformIndex = 0; uniformIndex < mUniforms.size(); ++uniformIndex)
......@@ -1870,6 +1878,8 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin
return false;
}
mShaderVersion = vertexShader->getShaderVersion();
std::string pixelHLSL = fragmentShader->getHLSL();
std::string vertexHLSL = vertexShader->getHLSL();
......
......@@ -137,6 +137,7 @@ class ProgramBinary : public RefCountObject
bool isValidated() const;
unsigned int getSerial() const;
int getShaderVersion() const;
void sortAttributesByLayout(rx::TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS], int sortedSemanticIndices[MAX_VERTEX_ATTRIBS]) const;
......@@ -196,6 +197,7 @@ class ProgramBinary : public RefCountObject
GLuint mUsedVertexSamplerRange;
GLuint mUsedPixelSamplerRange;
bool mUsesPointSize;
int mShaderVersion;
UniformArray mUniforms;
UniformBlockArray mUniformBlocks;
......
......@@ -34,6 +34,7 @@ Shader::Shader(ResourceManager *manager, const rx::Renderer *renderer, GLuint ha
mRefCount = 0;
mDeleteStatus = false;
mShaderVersion = 100;
}
Shader::~Shader()
......@@ -361,6 +362,7 @@ void Shader::uncompile()
mUsesPointSize = false;
mUsesPointCoord = false;
mUsesDepthRange = false;
mShaderVersion = 100;
mActiveUniforms.clear();
mActiveInterfaceBlocks.clear();
......@@ -406,6 +408,8 @@ void Shader::compileToHLSL(void *compiler)
size_t shaderVersion = 100;
ShGetInfo(compiler, SH_SHADER_VERSION, &shaderVersion);
mShaderVersion = static_cast<int>(shaderVersion);
if (shaderVersion == 300 && mRenderer->getCurrentClientVersion() < 3)
{
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)
return false;
}
int Shader::getShaderVersion() const
{
return mShaderVersion;
}
VertexShader::VertexShader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle)
: Shader(manager, renderer, handle)
{
......
......@@ -90,6 +90,7 @@ class Shader
unsigned int getRefCount() const;
bool isFlaggedForDeletion() const;
void flagForDeletion();
int getShaderVersion() const;
static void releaseCompiler();
......@@ -117,6 +118,7 @@ class Shader
bool mUsesPointSize;
bool mUsesPointCoord;
bool mUsesDepthRange;
int mShaderVersion;
static void *mFragmentCompiler;
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