Store the precision of uniforms.

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@1940 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent be211b37
...@@ -3036,7 +3036,7 @@ void OutputHLSL::declareUniform(const TType &type, const TString &name, int inde ...@@ -3036,7 +3036,7 @@ void OutputHLSL::declareUniform(const TType &type, const TString &name, int inde
if (!structure) if (!structure)
{ {
mActiveUniforms.push_back(Uniform(glVariableType(type), name.c_str(), type.getArraySize(), index)); mActiveUniforms.push_back(Uniform(glVariableType(type), glVariablePrecision(type), name.c_str(), type.getArraySize(), index));
} }
else else
{ {
...@@ -3153,4 +3153,39 @@ GLenum OutputHLSL::glVariableType(const TType &type) ...@@ -3153,4 +3153,39 @@ GLenum OutputHLSL::glVariableType(const TType &type)
return GL_NONE; return GL_NONE;
} }
GLenum OutputHLSL::glVariablePrecision(const TType &type)
{
if (type.getBasicType() == EbtFloat)
{
switch (type.getPrecision())
{
case EbpHigh: return GL_HIGH_FLOAT;
case EbpMedium: return GL_MEDIUM_FLOAT;
case EbpLow: return GL_LOW_FLOAT;
case EbpUndefined:
// Should be defined as the default precision by the parser
default: UNREACHABLE();
}
}
else if (type.getBasicType() == EbtInt)
{
switch (type.getPrecision())
{
case EbpHigh: return GL_HIGH_INT;
case EbpMedium: return GL_MEDIUM_INT;
case EbpLow: return GL_LOW_INT;
case EbpUndefined:
// Should be defined as the default precision by the parser
default: UNREACHABLE();
}
}
else if (type.getBasicType() == EbtBool)
{
return GL_BOOL; // Booleans don't have a precision
}
else UNREACHABLE();
return GL_NONE;
}
} }
...@@ -164,6 +164,7 @@ class OutputHLSL : public TIntermTraverser ...@@ -164,6 +164,7 @@ class OutputHLSL : public TIntermTraverser
int uniformRegister(TIntermSymbol *uniform); int uniformRegister(TIntermSymbol *uniform);
void declareUniform(const TType &type, const TString &name, int index); void declareUniform(const TType &type, const TString &name, int index);
static GLenum glVariableType(const TType &type); static GLenum glVariableType(const TType &type);
static GLenum glVariablePrecision(const TType &type);
ActiveUniforms mActiveUniforms; ActiveUniforms mActiveUniforms;
}; };
......
// //
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
namespace sh namespace sh
{ {
Uniform::Uniform(GLenum type, const char *name, int arraySize, int registerIndex) Uniform::Uniform(GLenum type, GLenum precision, const char *name, int arraySize, int registerIndex)
{ {
this->type = type; this->type = type;
this->precision = precision;
this->name = name; this->name = name;
this->arraySize = arraySize; this->arraySize = arraySize;
this->registerIndex = registerIndex; this->registerIndex = registerIndex;
......
// //
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -18,9 +18,10 @@ namespace sh ...@@ -18,9 +18,10 @@ namespace sh
struct Uniform struct Uniform
{ {
Uniform(GLenum type, const char *name, int arraySize, int registerIndex); Uniform(GLenum type, GLenum precision, const char *name, int arraySize, int registerIndex);
GLenum type; GLenum type;
GLenum precision;
std::string name; std::string name;
unsigned int arraySize; unsigned int arraySize;
......
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