Disable warnings about size_t conversion and fix ambiguous template parameters in 64 bit builds.
TRAC #23409
Signed-off-by: Jamie Madill
Signed-off-by: Shannon Woods
diff --git a/src/compiler/translator/BlockLayoutEncoder.cpp b/src/compiler/translator/BlockLayoutEncoder.cpp
index 26d7ba2..b8d14e2 100644
--- a/src/compiler/translator/BlockLayoutEncoder.cpp
+++ b/src/compiler/translator/BlockLayoutEncoder.cpp
@@ -79,7 +79,7 @@
void BlockLayoutEncoder::nextRegister()
{
- mCurrentOffset = rx::roundUp(mCurrentOffset, ComponentsPerRegister);
+ mCurrentOffset = rx::roundUp<size_t>(mCurrentOffset, ComponentsPerRegister);
}
Std140BlockEncoder::Std140BlockEncoder(std::vector<BlockMemberInfo> *blockInfoOut)
diff --git a/src/compiler/translator/HLSLLayoutEncoder.cpp b/src/compiler/translator/HLSLLayoutEncoder.cpp
index 31656f9..7868fb9 100644
--- a/src/compiler/translator/HLSLLayoutEncoder.cpp
+++ b/src/compiler/translator/HLSLLayoutEncoder.cpp
@@ -147,7 +147,7 @@
HLSLVariableRegisterCount(variable, &encoder);
const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
- return rx::roundUp(encoder.getBlockSize(), registerBytes) / registerBytes;
+ return static_cast<unsigned int>(rx::roundUp<size_t>(encoder.getBlockSize(), registerBytes) / registerBytes);
}
unsigned int HLSLVariableRegisterCount(const Uniform &variable)
@@ -156,7 +156,7 @@
HLSLVariableRegisterCount(variable, &encoder);
const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
- return rx::roundUp(encoder.getBlockSize(), registerBytes) / registerBytes;
+ return static_cast<unsigned int>(rx::roundUp<size_t>(encoder.getBlockSize(), registerBytes) / registerBytes);
}
}
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index e2311b0..404ed39 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -23,10 +23,13 @@
namespace sh
{
// Integer to TString conversion
-TString str(int i)
+template <typename T>
+TString str(T i)
{
- char buffer[20];
- snprintf(buffer, sizeof(buffer), "%d", i);
+ ASSERT(std::numeric_limits<T>::is_integer);
+ char buffer[(CHAR_BIT * sizeof(T) / 3) + 3];
+ const char *formatStr = std::numeric_limits<T>::is_signed ? "%d" : "%u";
+ snprintf(buffer, sizeof(buffer), formatStr, i);
return buffer;
}