Commit 036aa49b by Geoff Lang

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
parent ba4f10a3
...@@ -369,7 +369,7 @@ static bool ReadShaderSource(const char* fileName, ShaderSource& source) { ...@@ -369,7 +369,7 @@ static bool ReadShaderSource(const char* fileName, ShaderSource& source) {
// Obtain file size. // Obtain file size.
fseek(in, 0, SEEK_END); fseek(in, 0, SEEK_END);
int count = ftell(in); size_t count = ftell(in);
rewind(in); rewind(in);
int len = (int)ceil((float)count / (float)NUM_SOURCE_STRINGS); int len = (int)ceil((float)count / (float)NUM_SOURCE_STRINGS);
...@@ -379,7 +379,7 @@ static bool ReadShaderSource(const char* fileName, ShaderSource& source) { ...@@ -379,7 +379,7 @@ static bool ReadShaderSource(const char* fileName, ShaderSource& source) {
// string is added to vector. // string is added to vector.
do { do {
char* data = new char[len + 1]; char* data = new char[len + 1];
int nread = fread(data, 1, len, in); size_t nread = fread(data, 1, len, in);
data[nread] = '\0'; data[nread] = '\0';
source.push_back(data); source.push_back(data);
......
...@@ -79,7 +79,7 @@ void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool is ...@@ -79,7 +79,7 @@ void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool is
void BlockLayoutEncoder::nextRegister() void BlockLayoutEncoder::nextRegister()
{ {
mCurrentOffset = rx::roundUp(mCurrentOffset, ComponentsPerRegister); mCurrentOffset = rx::roundUp<size_t>(mCurrentOffset, ComponentsPerRegister);
} }
Std140BlockEncoder::Std140BlockEncoder(std::vector<BlockMemberInfo> *blockInfoOut) Std140BlockEncoder::Std140BlockEncoder(std::vector<BlockMemberInfo> *blockInfoOut)
......
...@@ -147,7 +147,7 @@ unsigned int HLSLVariableRegisterCount(const Varying &variable) ...@@ -147,7 +147,7 @@ unsigned int HLSLVariableRegisterCount(const Varying &variable)
HLSLVariableRegisterCount(variable, &encoder); HLSLVariableRegisterCount(variable, &encoder);
const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister); 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) unsigned int HLSLVariableRegisterCount(const Uniform &variable)
...@@ -156,7 +156,7 @@ unsigned int HLSLVariableRegisterCount(const Uniform &variable) ...@@ -156,7 +156,7 @@ unsigned int HLSLVariableRegisterCount(const Uniform &variable)
HLSLVariableRegisterCount(variable, &encoder); HLSLVariableRegisterCount(variable, &encoder);
const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister); 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);
} }
} }
...@@ -23,10 +23,13 @@ ...@@ -23,10 +23,13 @@
namespace sh namespace sh
{ {
// Integer to TString conversion // Integer to TString conversion
TString str(int i) template <typename T>
TString str(T i)
{ {
char buffer[20]; ASSERT(std::numeric_limits<T>::is_integer);
snprintf(buffer, sizeof(buffer), "%d", i); 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; return buffer;
} }
......
...@@ -94,7 +94,7 @@ PixelTransfer11::PixelTransfer11(Renderer11 *renderer) ...@@ -94,7 +94,7 @@ PixelTransfer11::PixelTransfer11(Renderer11 *renderer)
ASSERT(SUCCEEDED(result)); ASSERT(SUCCEEDED(result));
D3D11_BUFFER_DESC constantBufferDesc = { 0 }; D3D11_BUFFER_DESC constantBufferDesc = { 0 };
constantBufferDesc.ByteWidth = rx::roundUp(sizeof(CopyShaderParams), 32u); constantBufferDesc.ByteWidth = rx::roundUp<UINT>(sizeof(CopyShaderParams), 32u);
constantBufferDesc.Usage = D3D11_USAGE_DYNAMIC; constantBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
constantBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; constantBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
......
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