Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data'
BUG=angleproject:1120
Change-Id: I01ef10bea7f487c2b394d030c76628f38d2ea645
Reviewed-on: https://chromium-review.googlesource.com/292780
Tested-by: Cooper Partin <coopp@microsoft.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/ProgramImpl.cpp b/src/libANGLE/renderer/ProgramImpl.cpp
index 9da0c42..c861dfd 100644
--- a/src/libANGLE/renderer/ProgramImpl.cpp
+++ b/src/libANGLE/renderer/ProgramImpl.cpp
@@ -86,7 +86,7 @@
return GL_INVALID_INDEX;
}
- unsigned int numUniforms = mUniforms.size();
+ unsigned int numUniforms = static_cast<unsigned int>(mUniforms.size());
for (unsigned int index = 0; index < numUniforms; index++)
{
if (mUniforms[index]->name == baseName)
@@ -106,7 +106,7 @@
size_t subscript = GL_INVALID_INDEX;
std::string baseName = gl::ParseUniformName(name, &subscript);
- unsigned int numUniformBlocks = mUniformBlocks.size();
+ unsigned int numUniformBlocks = static_cast<unsigned int>(mUniformBlocks.size());
for (unsigned int blockIndex = 0; blockIndex < numUniformBlocks; blockIndex++)
{
const gl::UniformBlock &uniformBlock = *mUniformBlocks[blockIndex];
diff --git a/src/libANGLE/renderer/d3d/BufferD3D.cpp b/src/libANGLE/renderer/d3d/BufferD3D.cpp
index 93ccd1d..20fc82a 100644
--- a/src/libANGLE/renderer/d3d/BufferD3D.cpp
+++ b/src/libANGLE/renderer/d3d/BufferD3D.cpp
@@ -116,7 +116,7 @@
return error;
}
- *outRange = gl::ComputeIndexRange(type, data + offset, count);
+ *outRange = gl::ComputeIndexRange(type, data + offset, static_cast<GLsizei>(count));
return gl::Error(GL_NO_ERROR);
}
diff --git a/src/libANGLE/renderer/d3d/DynamicHLSL.cpp b/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
index 3717f35..7a12d36 100644
--- a/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
+++ b/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
@@ -517,8 +517,9 @@
// corresponding to unwritten variables are similarly undefined.
if (outputVariable)
{
- declarationHLSL += " " + HLSLTypeString(outputVariable->type) + " " + outputVariable->name +
- " : " + targetSemantic + Str(layoutIndex) + ";\n";
+ declarationHLSL += " " + HLSLTypeString(outputVariable->type) + " " +
+ outputVariable->name + " : " + targetSemantic +
+ Str(static_cast<int>(layoutIndex)) + ";\n";
copyHLSL += " output." + outputVariable->name + " = " + outputVariable->source + ";\n";
}
diff --git a/src/libANGLE/renderer/d3d/IndexDataManager.cpp b/src/libANGLE/renderer/d3d/IndexDataManager.cpp
index c7c865b..1605590 100644
--- a/src/libANGLE/renderer/d3d/IndexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/IndexDataManager.cpp
@@ -222,7 +222,8 @@
}
ASSERT(bufferData != nullptr);
- unsigned int convertCount = buffer->getSize() >> srcTypeInfo.bytesShift;
+ unsigned int convertCount =
+ static_cast<unsigned int>(buffer->getSize()) >> srcTypeInfo.bytesShift;
error = StreamInIndexBuffer(staticBuffer, bufferData, convertCount,
srcType, dstType, nullptr);
if (error.isError())
diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
index 3532634..9290914 100644
--- a/src/libANGLE/renderer/d3d/ProgramD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
@@ -90,7 +90,8 @@
if (!shaderOutputVars.empty())
{
- defaultPixelOutput.push_back(GL_COLOR_ATTACHMENT0 + shaderOutputVars[0].outputIndex);
+ defaultPixelOutput.push_back(GL_COLOR_ATTACHMENT0 +
+ static_cast<unsigned int>(shaderOutputVars[0].outputIndex));
}
return defaultPixelOutput;
@@ -948,7 +949,7 @@
else if (!infoLog)
{
std::vector<char> tempCharBuffer(tempInfoLog.getLength() + 3);
- tempInfoLog.getLog(tempInfoLog.getLength(), NULL, &tempCharBuffer[0]);
+ tempInfoLog.getLog(static_cast<GLsizei>(tempInfoLog.getLength()), NULL, &tempCharBuffer[0]);
ERR("Error compiling dynamic pixel executable:\n%s\n", &tempCharBuffer[0]);
}
@@ -996,7 +997,7 @@
else if (!infoLog)
{
std::vector<char> tempCharBuffer(tempInfoLog.getLength() + 3);
- tempInfoLog.getLog(tempInfoLog.getLength(), NULL, &tempCharBuffer[0]);
+ tempInfoLog.getLog(static_cast<GLsizei>(tempInfoLog.getLength()), NULL, &tempCharBuffer[0]);
ERR("Error compiling dynamic vertex executable:\n%s\n", &tempCharBuffer[0]);
}
@@ -1253,7 +1254,7 @@
void ProgramD3D::dirtyAllUniforms()
{
- unsigned int numUniforms = mUniforms.size();
+ unsigned int numUniforms = static_cast<unsigned int>(mUniforms.size());
for (unsigned int index = 0; index < numUniforms; index++)
{
mUniforms[index]->dirty = true;
@@ -1509,7 +1510,8 @@
ASSERT(linkedUniform);
if (encoder)
- linkedUniform->registerElement = sh::HLSLBlockEncoder::getBlockRegisterElement(blockInfo);
+ linkedUniform->registerElement = static_cast<unsigned int>(
+ sh::HLSLBlockEncoder::getBlockRegisterElement(blockInfo));
mUniforms.push_back(linkedUniform);
}
@@ -1517,11 +1519,13 @@
{
if (shader->getShaderType() == GL_FRAGMENT_SHADER)
{
- linkedUniform->psRegisterIndex = sh::HLSLBlockEncoder::getBlockRegister(blockInfo);
+ linkedUniform->psRegisterIndex =
+ static_cast<unsigned int>(sh::HLSLBlockEncoder::getBlockRegister(blockInfo));
}
else if (shader->getShaderType() == GL_VERTEX_SHADER)
{
- linkedUniform->vsRegisterIndex = sh::HLSLBlockEncoder::getBlockRegister(blockInfo);
+ linkedUniform->vsRegisterIndex =
+ static_cast<unsigned int>(sh::HLSLBlockEncoder::getBlockRegister(blockInfo));
}
else UNREACHABLE();
}
@@ -1821,7 +1825,7 @@
blockIndex, memberInfo);
// add to uniform list, but not index, since uniform block uniforms have no location
- blockUniformIndexes->push_back(mUniforms.size());
+ blockUniformIndexes->push_back(static_cast<GLenum>(mUniforms.size()));
mUniforms.push_back(newUniform);
}
}
@@ -1838,7 +1842,7 @@
if (getUniformBlockIndex(interfaceBlock.name) == GL_INVALID_INDEX)
{
std::vector<unsigned int> blockUniformIndexes;
- const unsigned int blockIndex = mUniformBlocks.size();
+ const unsigned int blockIndex = static_cast<unsigned int>(mUniformBlocks.size());
// define member uniforms
sh::BlockLayoutEncoder *encoder = NULL;
@@ -1855,7 +1859,7 @@
defineUniformBlockMembers(interfaceBlock.fields, "", blockIndex, encoder, &blockUniformIndexes, interfaceBlock.isRowMajorLayout);
- size_t dataSize = encoder->getBlockSize();
+ unsigned int dataSize = static_cast<unsigned int>(encoder->getBlockSize());
// create all the uniform blocks
if (interfaceBlock.arraySize > 0)
@@ -1995,7 +1999,8 @@
if (!uniform.isBuiltIn())
{
// Assign in-order uniform locations
- mUniformIndex[mUniformIndex.size()] = gl::VariableLocation(uniform.name, arrayIndex, uniformIndex);
+ mUniformIndex[static_cast<GLuint>(mUniformIndex.size())] = gl::VariableLocation(
+ uniform.name, arrayIndex, static_cast<unsigned int>(uniformIndex));
}
}
}
diff --git a/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp b/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp
index 7c3c611..d8ec8ac 100644
--- a/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp
+++ b/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp
@@ -53,7 +53,9 @@
}
RenderTargetD3D *newRT = NULL;
- gl::Error error = mRenderer->createRenderTarget(width, height, creationFormat, samples, &newRT);
+ gl::Error error =
+ mRenderer->createRenderTarget(static_cast<int>(width), static_cast<int>(height),
+ creationFormat, static_cast<GLsizei>(samples), &newRT);
if (error.isError())
{
return error;
diff --git a/src/libANGLE/renderer/d3d/RendererD3D.cpp b/src/libANGLE/renderer/d3d/RendererD3D.cpp
index 4c7ebb4..c64b1f8 100644
--- a/src/libANGLE/renderer/d3d/RendererD3D.cpp
+++ b/src/libANGLE/renderer/d3d/RendererD3D.cpp
@@ -239,9 +239,9 @@
{
gl::Program *program = data.state->getProgram();
- size_t samplerRange = program->getUsedSamplerRange(type);
+ unsigned int samplerRange = static_cast<unsigned int>(program->getUsedSamplerRange(type));
- for (size_t i = 0; i < samplerRange; i++)
+ for (unsigned int i = 0; i < samplerRange; i++)
{
GLenum textureType = program->getSamplerTextureType(type, i);
GLint textureUnit = program->getSamplerMapping(type, i, *data.caps);
@@ -390,8 +390,8 @@
{
gl::Program *program = data.state->getProgram();
- size_t samplerRange = program->getUsedSamplerRange(shaderType);
- for (size_t samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
+ unsigned int samplerRange = program->getUsedSamplerRange(shaderType);
+ for (unsigned int samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
{
GLenum textureType = program->getSamplerTextureType(shaderType, samplerIndex);
GLint textureUnit = program->getSamplerMapping(shaderType, samplerIndex, *data.caps);
diff --git a/src/libANGLE/renderer/d3d/TextureD3D.cpp b/src/libANGLE/renderer/d3d/TextureD3D.cpp
index 1992af5..3a10db6 100644
--- a/src/libANGLE/renderer/d3d/TextureD3D.cpp
+++ b/src/libANGLE/renderer/d3d/TextureD3D.cpp
@@ -691,14 +691,21 @@
return gl::GetInternalFormatInfo(getInternalFormat(level)).depthBits > 0;
}
-gl::Error TextureD3D_2D::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, GLenum format, GLenum type,
- const gl::PixelUnpackState &unpack, const uint8_t *pixels)
+gl::Error TextureD3D_2D::setImage(GLenum target,
+ size_t imageLevel,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D && size.depth == 1);
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
bool fastUnpacked = false;
+ GLint level = static_cast<GLint>(imageLevel);
redefineImage(level, sizedInternalFormat, size);
@@ -741,8 +748,13 @@
return gl::Error(GL_NO_ERROR);
}
-gl::Error TextureD3D_2D::setSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, GLenum type,
- const gl::PixelUnpackState &unpack, const uint8_t *pixels)
+gl::Error TextureD3D_2D::setSubImage(GLenum target,
+ size_t imageLevel,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D && area.depth == 1 && area.z == 0);
@@ -752,6 +764,7 @@
return gl::Error(GL_INVALID_OPERATION, "unimplemented pixel store state");
}
+ GLint level = static_cast<GLint>(imageLevel);
gl::ImageIndex index = gl::ImageIndex::Make2D(level);
if (isFastUnpackable(unpack, getInternalFormat(level)) && isLevelComplete(level))
{
@@ -772,11 +785,16 @@
}
}
-
-gl::Error TextureD3D_2D::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
- const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
+gl::Error TextureD3D_2D::setCompressedImage(GLenum target,
+ size_t imageLevel,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D && size.depth == 1);
+ GLint level = static_cast<GLint>(imageLevel);
// compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
redefineImage(level, internalFormat, size);
@@ -789,7 +807,7 @@
{
ASSERT(target == GL_TEXTURE_2D && area.depth == 1 && area.z == 0);
- gl::ImageIndex index = gl::ImageIndex::Make2D(level);
+ gl::ImageIndex index = gl::ImageIndex::Make2D(static_cast<GLint>(level));
gl::Error error = TextureD3D::subImageCompressed(index, area, format, unpack, pixels, 0);
if (error.isError())
{
@@ -799,11 +817,15 @@
return commitRegion(index, area);
}
-gl::Error TextureD3D_2D::copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat,
+gl::Error TextureD3D_2D::copyImage(GLenum target,
+ size_t imageLevel,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
const gl::Framebuffer *source)
{
ASSERT(target == GL_TEXTURE_2D);
+ GLint level = static_cast<GLint>(imageLevel);
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, GL_UNSIGNED_BYTE);
redefineImage(level, sizedInternalFormat, gl::Extents(sourceArea.width, sourceArea.height, 1));
@@ -845,7 +867,10 @@
return gl::Error(GL_NO_ERROR);
}
-gl::Error TextureD3D_2D::copySubImage(GLenum target, size_t level, const gl::Offset &destOffset, const gl::Rectangle &sourceArea,
+gl::Error TextureD3D_2D::copySubImage(GLenum target,
+ size_t imageLevel,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
const gl::Framebuffer *source)
{
ASSERT(target == GL_TEXTURE_2D && destOffset.z == 0);
@@ -853,6 +878,7 @@
// can only make our texture storage to a render target if level 0 is defined (with a width & height) and
// the current level we're copying to is defined (with appropriate format, width & height)
+ GLint level = static_cast<GLint>(imageLevel);
gl::ImageIndex index = gl::ImageIndex::Make2D(level);
// If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
@@ -908,14 +934,15 @@
mImageArray[level]->redefine(GL_TEXTURE_2D, internalFormat, levelSize, true);
}
- for (int level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ for (size_t level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
{
mImageArray[level]->redefine(GL_TEXTURE_2D, GL_NONE, gl::Extents(0, 0, 0), true);
}
// TODO(geofflang): Verify storage creation had no errors
bool renderTarget = IsRenderTargetUsage(mUsage);
- TextureStorage *storage = mRenderer->createTextureStorage2D(internalFormat, renderTarget, size.width, size.height, levels, false);
+ TextureStorage *storage = mRenderer->createTextureStorage2D(
+ internalFormat, renderTarget, size.width, size.height, static_cast<int>(levels), false);
gl::Error error = setCompleteTexStorage(storage);
if (error.isError())
@@ -1316,9 +1343,9 @@
ASSERT(size.depth == 1);
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
- gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+ gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast<GLint>(level));
- redefineImage(index.layerIndex, level, sizedInternalFormat, size);
+ redefineImage(index.layerIndex, static_cast<GLint>(level), sizedInternalFormat, size);
return TextureD3D::setImage(index, type, unpack, pixels, 0);
}
@@ -1328,7 +1355,7 @@
{
ASSERT(area.depth == 1 && area.z == 0);
- gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+ gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast<GLint>(level));
return TextureD3D::subImage(index, area, format, type, unpack, pixels, 0);
}
@@ -1340,9 +1367,9 @@
// compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
size_t faceIndex = gl::CubeMapTextureTargetToLayerIndex(target);
- redefineImage(faceIndex, level, internalFormat, size);
+ redefineImage(static_cast<int>(faceIndex), static_cast<GLint>(level), internalFormat, size);
- gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+ gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast<GLint>(level));
return TextureD3D::setCompressedImage(index, unpack, pixels, 0);
}
@@ -1351,7 +1378,7 @@
{
ASSERT(area.depth == 1 && area.z == 0);
- gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+ gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast<GLint>(level));
gl::Error error = TextureD3D::subImageCompressed(index, area, format, unpack, pixels, 0);
if (error.isError())
@@ -1362,14 +1389,19 @@
return commitRegion(index, area);
}
-gl::Error TextureD3D_Cube::copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat,
+gl::Error TextureD3D_Cube::copyImage(GLenum target,
+ size_t imageLevel,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
const gl::Framebuffer *source)
{
- size_t faceIndex = gl::CubeMapTextureTargetToLayerIndex(target);
+ int faceIndex = static_cast<int>(gl::CubeMapTextureTargetToLayerIndex(target));
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, GL_UNSIGNED_BYTE);
+ GLint level = static_cast<GLint>(imageLevel);
+
gl::Extents size(sourceArea.width, sourceArea.height, 1);
- redefineImage(faceIndex, level, sizedInternalFormat, size);
+ redefineImage(static_cast<int>(faceIndex), level, sizedInternalFormat, size);
gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
gl::Offset destOffset(0, 0, 0);
@@ -1411,11 +1443,15 @@
return gl::Error(GL_NO_ERROR);
}
-gl::Error TextureD3D_Cube::copySubImage(GLenum target, size_t level, const gl::Offset &destOffset, const gl::Rectangle &sourceArea,
+gl::Error TextureD3D_Cube::copySubImage(GLenum target,
+ size_t imageLevel,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
const gl::Framebuffer *source)
{
- size_t faceIndex = gl::CubeMapTextureTargetToLayerIndex(target);
+ int faceIndex = static_cast<int>(gl::CubeMapTextureTargetToLayerIndex(target));
+ GLint level = static_cast<GLint>(imageLevel);
gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
// If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
@@ -1472,7 +1508,7 @@
}
}
- for (int level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ for (size_t level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
{
for (int faceIndex = 0; faceIndex < 6; faceIndex++)
{
@@ -1483,7 +1519,8 @@
// TODO(geofflang): Verify storage creation had no errors
bool renderTarget = IsRenderTargetUsage(mUsage);
- TextureStorage *storage = mRenderer->createTextureStorageCube(internalFormat, renderTarget, size.width, levels, false);
+ TextureStorage *storage = mRenderer->createTextureStorageCube(
+ internalFormat, renderTarget, size.width, static_cast<int>(levels), false);
gl::Error error = setCompleteTexStorage(storage);
if (error.isError())
@@ -1901,12 +1938,19 @@
return gl::Error(GL_INVALID_OPERATION);
}
-gl::Error TextureD3D_3D::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, GLenum format, GLenum type,
- const gl::PixelUnpackState &unpack, const uint8_t *pixels)
+gl::Error TextureD3D_3D::setImage(GLenum target,
+ size_t imageLevel,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_3D);
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
+ GLint level = static_cast<GLint>(imageLevel);
redefineImage(level, sizedInternalFormat, size);
bool fastUnpacked = false;
@@ -1950,11 +1994,17 @@
return gl::Error(GL_NO_ERROR);
}
-gl::Error TextureD3D_3D::setSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, GLenum type,
- const gl::PixelUnpackState &unpack, const uint8_t *pixels)
+gl::Error TextureD3D_3D::setSubImage(GLenum target,
+ size_t imageLevel,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_3D);
+ GLint level = static_cast<GLint>(imageLevel);
gl::ImageIndex index = gl::ImageIndex::Make3D(level);
// Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
@@ -1977,11 +2027,17 @@
}
}
-gl::Error TextureD3D_3D::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
- const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
+gl::Error TextureD3D_3D::setCompressedImage(GLenum target,
+ size_t imageLevel,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_3D);
+ GLint level = static_cast<GLint>(imageLevel);
// compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
redefineImage(level, internalFormat, size);
@@ -1994,7 +2050,7 @@
{
ASSERT(target == GL_TEXTURE_3D);
- gl::ImageIndex index = gl::ImageIndex::Make3D(level);
+ gl::ImageIndex index = gl::ImageIndex::Make3D(static_cast<GLint>(level));
gl::Error error = TextureD3D::subImageCompressed(index, area, format, unpack, pixels, 0);
if (error.isError())
{
@@ -2011,11 +2067,15 @@
return gl::Error(GL_INVALID_OPERATION, "Copying 3D textures is unimplemented.");
}
-gl::Error TextureD3D_3D::copySubImage(GLenum target, size_t level, const gl::Offset &destOffset, const gl::Rectangle &sourceArea,
+gl::Error TextureD3D_3D::copySubImage(GLenum target,
+ size_t imageLevel,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
const gl::Framebuffer *source)
{
ASSERT(target == GL_TEXTURE_3D);
+ GLint level = static_cast<GLint>(imageLevel);
gl::ImageIndex index = gl::ImageIndex::Make3D(level);
if (canCreateRenderTargetForImage(index))
@@ -2069,14 +2129,16 @@
mImageArray[level]->redefine(GL_TEXTURE_3D, internalFormat, levelSize, true);
}
- for (int level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ for (size_t level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
{
mImageArray[level]->redefine(GL_TEXTURE_3D, GL_NONE, gl::Extents(0, 0, 0), true);
}
// TODO(geofflang): Verify storage creation had no errors
bool renderTarget = IsRenderTargetUsage(mUsage);
- TextureStorage *storage = mRenderer->createTextureStorage3D(internalFormat, renderTarget, size.width, size.height, size.depth, levels);
+ TextureStorage *storage =
+ mRenderer->createTextureStorage3D(internalFormat, renderTarget, size.width, size.height,
+ size.depth, static_cast<int>(levels));
gl::Error error = setCompleteTexStorage(storage);
if (error.isError())
@@ -2435,13 +2497,20 @@
return gl::Error(GL_INVALID_OPERATION);
}
-gl::Error TextureD3D_2DArray::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, GLenum format, GLenum type,
- const gl::PixelUnpackState &unpack, const uint8_t *pixels)
+gl::Error TextureD3D_2DArray::setImage(GLenum target,
+ size_t imageLevel,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D_ARRAY);
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
+ GLint level = static_cast<GLint>(imageLevel);
redefineImage(level, sizedInternalFormat, size);
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(sizedInternalFormat);
@@ -2461,11 +2530,16 @@
return gl::Error(GL_NO_ERROR);
}
-gl::Error TextureD3D_2DArray::setSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, GLenum type,
- const gl::PixelUnpackState &unpack, const uint8_t *pixels)
+gl::Error TextureD3D_2DArray::setSubImage(GLenum target,
+ size_t imageLevel,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D_ARRAY);
-
+ GLint level = static_cast<GLint>(imageLevel);
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(getInternalFormat(level));
GLsizei inputDepthPitch = formatInfo.computeDepthPitch(type, area.width, area.height, unpack.alignment, unpack.rowLength);
@@ -2487,11 +2561,17 @@
return gl::Error(GL_NO_ERROR);
}
-gl::Error TextureD3D_2DArray::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
- const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
+gl::Error TextureD3D_2DArray::setCompressedImage(GLenum target,
+ size_t imageLevel,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D_ARRAY);
+ GLint level = static_cast<GLint>(imageLevel);
// compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
redefineImage(level, internalFormat, size);
@@ -2528,7 +2608,7 @@
gl::Box layerArea(area.x, area.y, 0, area.width, area.height, 1);
- gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, layer);
+ gl::ImageIndex index = gl::ImageIndex::Make2DArray(static_cast<GLint>(level), layer);
gl::Error error = TextureD3D::subImageCompressed(index, layerArea, format, unpack, pixels, layerOffset);
if (error.isError())
{
@@ -2552,11 +2632,15 @@
return gl::Error(GL_INVALID_OPERATION, "Copying 2D array textures is unimplemented.");
}
-gl::Error TextureD3D_2DArray::copySubImage(GLenum target, size_t level, const gl::Offset &destOffset, const gl::Rectangle &sourceArea,
+gl::Error TextureD3D_2DArray::copySubImage(GLenum target,
+ size_t imageLevel,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
const gl::Framebuffer *source)
{
ASSERT(target == GL_TEXTURE_2D_ARRAY);
+ GLint level = static_cast<GLint>(imageLevel);
gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, destOffset.z);
if (canCreateRenderTargetForImage(index))
@@ -2626,7 +2710,9 @@
// TODO(geofflang): Verify storage creation had no errors
bool renderTarget = IsRenderTargetUsage(mUsage);
- TextureStorage *storage = mRenderer->createTextureStorage2DArray(internalFormat, renderTarget, size.width, size.height, size.depth, levels);
+ TextureStorage *storage =
+ mRenderer->createTextureStorage2DArray(internalFormat, renderTarget, size.width,
+ size.height, size.depth, static_cast<int>(levels));
gl::Error error = setCompleteTexStorage(storage);
if (error.isError())
diff --git a/src/libANGLE/renderer/d3d/VertexBuffer.cpp b/src/libANGLE/renderer/d3d/VertexBuffer.cpp
index 3502f30..51ea6ef 100644
--- a/src/libANGLE/renderer/d3d/VertexBuffer.cpp
+++ b/src/libANGLE/renderer/d3d/VertexBuffer.cpp
@@ -210,7 +210,7 @@
StreamingVertexBufferInterface::StreamingVertexBufferInterface(BufferFactoryD3D *factory, std::size_t initialSize)
: VertexBufferInterface(factory, true)
{
- setBufferSize(initialSize);
+ setBufferSize(static_cast<unsigned int>(initialSize));
}
StreamingVertexBufferInterface::~StreamingVertexBufferInterface()
diff --git a/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
index 00adfc1..4fd4351 100644
--- a/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -35,8 +35,10 @@
size = static_cast<unsigned int>(std::numeric_limits<int>::max());
}
- GLsizei stride = ComputeVertexAttributeStride(attrib);
- return (size - attrib.offset % stride + (stride - ComputeVertexAttributeTypeSize(attrib))) / stride;
+ GLsizei stride = static_cast<GLsizei>(ComputeVertexAttributeStride(attrib));
+ return (size - attrib.offset % stride +
+ (stride - static_cast<GLsizei>(ComputeVertexAttributeTypeSize(attrib)))) /
+ stride;
}
static int StreamingBufferElementCount(const gl::VertexAttribute &attrib, int vertexDrawCount, int instanceDrawCount)
@@ -152,7 +154,8 @@
// Record the attribute now
translated->active = true;
translated->attribute = &vertexAttributes[attribIndex];
- translated->currentValueType = state.getVertexAttribCurrentValue(attribIndex).Type;
+ translated->currentValueType =
+ state.getVertexAttribCurrentValue(static_cast<unsigned int>(attribIndex)).Type;
translated->divisor = vertexAttributes[attribIndex].divisor;
if (vertexAttributes[attribIndex].enabled)
@@ -160,8 +163,9 @@
mActiveEnabledAttributes.push_back(translated);
// Also invalidate static buffers that don't contain matching attributes
- invalidateMatchingStaticData(vertexAttributes[attribIndex],
- state.getVertexAttribCurrentValue(attribIndex));
+ invalidateMatchingStaticData(
+ vertexAttributes[attribIndex],
+ state.getVertexAttribCurrentValue(static_cast<unsigned int>(attribIndex)));
}
else
{
@@ -199,9 +203,9 @@
mCurrentValueCache[attribIndex].buffer = new StreamingVertexBufferInterface(mFactory, CONSTANT_VERTEX_BUFFER_SIZE);
}
- gl::Error error = storeCurrentValue(state.getVertexAttribCurrentValue(attribIndex),
- &(*translatedAttribs)[attribIndex],
- &mCurrentValueCache[attribIndex]);
+ gl::Error error = storeCurrentValue(
+ state.getVertexAttribCurrentValue(static_cast<unsigned int>(attribIndex)),
+ &(*translatedAttribs)[attribIndex], &mCurrentValueCache[attribIndex]);
if (error.isError())
{
hintUnmapAllResources(vertexAttributes);
@@ -220,7 +224,7 @@
{
BufferD3D *bufferD3D = GetImplAs<BufferD3D>(buffer);
size_t typeSize = ComputeVertexAttributeTypeSize(*activeAttrib->attribute);
- bufferD3D->promoteStaticUsage(count * typeSize);
+ bufferD3D->promoteStaticUsage(count * static_cast<int>(typeSize));
}
}
@@ -263,7 +267,8 @@
{
if (staticBuffer->getBufferSize() == 0)
{
- int totalCount = ElementsInBuffer(attrib, bufferImpl->getSize());
+ int totalCount =
+ ElementsInBuffer(attrib, static_cast<unsigned int>(bufferImpl->getSize()));
gl::Error error = staticBuffer->reserveVertexSpace(attrib, totalCount, 0);
if (error.isError())
{
@@ -274,7 +279,9 @@
else
{
int totalCount = StreamingBufferElementCount(attrib, count, instances);
- ASSERT(!bufferImpl || ElementsInBuffer(attrib, bufferImpl->getSize()) >= totalCount);
+ ASSERT(!bufferImpl ||
+ ElementsInBuffer(attrib, static_cast<unsigned int>(bufferImpl->getSize())) >=
+ totalCount);
gl::Error error = mStreamingBuffer->reserveVertexSpace(attrib, totalCount, instances);
if (error.isError())
@@ -312,7 +319,7 @@
{
translated->storage = storage;
translated->serial = storage->getSerial();
- translated->stride = ComputeVertexAttributeStride(attrib);
+ translated->stride = static_cast<unsigned int>(ComputeVertexAttributeStride(attrib));
translated->offset = static_cast<unsigned int>(attrib.offset + translated->stride * firstVertexIndex);
return gl::Error(GL_NO_ERROR);
@@ -349,8 +356,10 @@
if (!staticBuffer->lookupAttribute(attrib, &streamOffset))
{
// Convert the entire buffer
- int totalCount = ElementsInBuffer(attrib, storage->getSize());
- int startIndex = attrib.offset / ComputeVertexAttributeStride(attrib);
+ int totalCount =
+ ElementsInBuffer(attrib, static_cast<unsigned int>(storage->getSize()));
+ int startIndex = static_cast<int>(attrib.offset) /
+ static_cast<int>(ComputeVertexAttributeStride(attrib));
error = staticBuffer->storeVertexAttributes(attrib,
translated->currentValueType,
@@ -365,7 +374,10 @@
}
}
- unsigned int firstElementOffset = (attrib.offset / ComputeVertexAttributeStride(attrib)) * outputElementSize;
+ unsigned int firstElementOffset =
+ (static_cast<unsigned int>(attrib.offset) /
+ static_cast<unsigned int>(ComputeVertexAttributeStride(attrib))) *
+ outputElementSize;
unsigned int startOffset = (instances == 0 || attrib.divisor == 0) ? firstVertexIndex * outputElementSize : 0;
if (streamOffset + firstElementOffset + startOffset < streamOffset)
{
@@ -436,7 +448,7 @@
translated->divisor = 0;
translated->stride = 0;
- translated->offset = cachedState->offset;
+ translated->offset = static_cast<unsigned int>(cachedState->offset);
return gl::Error(GL_NO_ERROR);
}
diff --git a/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp b/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp
index 402495f..3b42c98 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp
@@ -233,8 +233,10 @@
ID3D11Device *device = mRenderer->getDevice();
D3D11_BUFFER_DESC vbDesc;
- vbDesc.ByteWidth = std::max(sizeof(d3d11::PositionLayerTexCoord3DVertex), sizeof(d3d11::PositionTexCoordVertex)) *
- 6 * renderer->getRendererCaps().max3DTextureSize;
+ vbDesc.ByteWidth =
+ static_cast<unsigned int>(std::max(sizeof(d3d11::PositionLayerTexCoord3DVertex),
+ sizeof(d3d11::PositionTexCoordVertex)) *
+ 6 * renderer->getRendererCaps().max3DTextureSize);
vbDesc.Usage = D3D11_USAGE_DYNAMIC;
vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
diff --git a/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
index b354100..670561a 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
@@ -610,7 +610,8 @@
D3D11_SHADER_RESOURCE_VIEW_DESC bufferSRVDesc;
bufferSRVDesc.Buffer.ElementOffset = 0;
- bufferSRVDesc.Buffer.ElementWidth = mSize / dxgiFormatInfo.pixelBytes;
+ bufferSRVDesc.Buffer.ElementWidth =
+ static_cast<unsigned int>(mSize) / dxgiFormatInfo.pixelBytes;
bufferSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
bufferSRVDesc.Format = srvFormat;
@@ -929,8 +930,8 @@
else
{
D3D11_BOX srcBox;
- srcBox.left = sourceOffset;
- srcBox.right = sourceOffset + size;
+ srcBox.left = static_cast<unsigned int>(sourceOffset);
+ srcBox.right = static_cast<unsigned int>(sourceOffset + size);
srcBox.top = 0;
srcBox.bottom = 1;
srcBox.front = 0;
@@ -938,8 +939,8 @@
ID3D11Buffer *sourceBuffer = GetAs<NativeStorage>(source)->getNativeStorage();
- context->CopySubresourceRegion(mNativeStorage, 0, destOffset, 0, 0, sourceBuffer, 0,
- &srcBox);
+ context->CopySubresourceRegion(mNativeStorage, 0, static_cast<unsigned int>(destOffset), 0,
+ 0, sourceBuffer, 0, &srcBox);
}
return createBuffer;
@@ -951,7 +952,7 @@
ID3D11DeviceContext *context = mRenderer->getDeviceContext();
D3D11_BUFFER_DESC bufferDesc;
- fillBufferDesc(&bufferDesc, mRenderer, mUsage, size);
+ fillBufferDesc(&bufferDesc, mRenderer, mUsage, static_cast<unsigned int>(size));
ID3D11Buffer *newBuffer;
HRESULT result = device->CreateBuffer(&bufferDesc, nullptr, &newBuffer);
@@ -971,7 +972,7 @@
D3D11_BOX srcBox;
srcBox.left = 0;
- srcBox.right = mBufferSize;
+ srcBox.right = static_cast<unsigned int>(mBufferSize);
srcBox.top = 0;
srcBox.bottom = 1;
srcBox.front = 0;
@@ -1088,7 +1089,8 @@
if (!mNativeStorage)
{
// Expand the memory storage upon request and cache the results.
- unsigned int expandedDataSize = (mIndexInfo.srcCount * mAttributeStride) + mAttributeOffset;
+ unsigned int expandedDataSize =
+ static_cast<unsigned int>((mIndexInfo.srcCount * mAttributeStride) + mAttributeOffset);
MemoryBuffer expandedData;
if (!expandedData.resize(expandedDataSize))
{
diff --git a/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp b/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
index e7433a2..9adef8a 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
@@ -525,7 +525,8 @@
deviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
// Apply render targets
- deviceContext->OMSetRenderTargets(rtvs.size(), (rtvs.empty() ? nullptr : &rtvs[0]), dsv);
+ deviceContext->OMSetRenderTargets(static_cast<unsigned int>(rtvs.size()),
+ (rtvs.empty() ? nullptr : &rtvs[0]), dsv);
// Draw the clear quad
deviceContext->Draw(4, 0);
diff --git a/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
index a35a3a9..76bb15c 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
@@ -195,9 +195,10 @@
colorAttachmentID = attachments[i] - GL_COLOR_ATTACHMENT0;
}
- if (mData.getColorAttachment(colorAttachmentID))
+ if (mData.getColorAttachment(static_cast<unsigned int>(colorAttachmentID)))
{
- error = mData.getColorAttachment(colorAttachmentID)->getRenderTarget(&renderTarget);
+ error = mData.getColorAttachment(static_cast<unsigned int>(colorAttachmentID))
+ ->getRenderTarget(&renderTarget);
if (error.isError())
{
return error;
@@ -306,7 +307,8 @@
if (packBuffer != nullptr)
{
Buffer11 *packBufferStorage = GetImplAs<Buffer11>(packBuffer);
- PackPixelsParams packParams(area, format, type, outputPitch, pack, reinterpret_cast<ptrdiff_t>(pixels));
+ PackPixelsParams packParams(area, format, type, static_cast<GLuint>(outputPitch), pack,
+ reinterpret_cast<ptrdiff_t>(pixels));
error = packBufferStorage->packPixels(colorBufferTexture, subresourceIndex, packParams);
if (error.isError())
@@ -317,7 +319,8 @@
}
else
{
- error = mRenderer->readTextureData(colorBufferTexture, subresourceIndex, area, format, type, outputPitch, pack, pixels);
+ error = mRenderer->readTextureData(colorBufferTexture, subresourceIndex, area, format, type,
+ static_cast<GLuint>(outputPitch), pack, pixels);
if (error.isError())
{
SafeRelease(colorBufferTexture);
diff --git a/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp b/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
index fb3613c..3b2d05d 100644
--- a/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
@@ -377,8 +377,8 @@
}
bool dirtyBuffers = false;
- size_t minDiff = gl::MAX_VERTEX_ATTRIBS;
- size_t maxDiff = 0;
+ unsigned int minDiff = gl::MAX_VERTEX_ATTRIBS;
+ unsigned int maxDiff = 0;
unsigned int nextAvailableIndex = 0;
for (unsigned int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
@@ -432,8 +432,8 @@
vertexOffset != mCurrentVertexOffsets[i])
{
dirtyBuffers = true;
- minDiff = std::min(minDiff, static_cast<size_t>(i));
- maxDiff = std::max(maxDiff, static_cast<size_t>(i));
+ minDiff = std::min(minDiff, i);
+ maxDiff = std::max(maxDiff, i);
mCurrentBuffers[i] = buffer;
mCurrentVertexStrides[i] = vertexStride;
diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index e466689..ec569a3 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -384,16 +384,10 @@
#ifdef _DEBUG
{
TRACE_EVENT0("gpu.angle", "D3D11CreateDevice (Debug)");
- result = D3D11CreateDevice(NULL,
- mDriverType,
- NULL,
- D3D11_CREATE_DEVICE_DEBUG,
- mAvailableFeatureLevels.data(),
- mAvailableFeatureLevels.size(),
- D3D11_SDK_VERSION,
- &mDevice,
- &(mRenderer11DeviceCaps.featureLevel),
- &mDeviceContext);
+ result = D3D11CreateDevice(
+ NULL, mDriverType, NULL, D3D11_CREATE_DEVICE_DEBUG, mAvailableFeatureLevels.data(),
+ static_cast<unsigned int>(mAvailableFeatureLevels.size()), D3D11_SDK_VERSION, &mDevice,
+ &(mRenderer11DeviceCaps.featureLevel), &mDeviceContext);
}
if (!mDevice || FAILED(result))
@@ -407,16 +401,10 @@
SCOPED_ANGLE_HISTOGRAM_TIMER("GPU.ANGLE.D3D11CreateDeviceMS");
TRACE_EVENT0("gpu.angle", "D3D11CreateDevice");
- result = D3D11CreateDevice(NULL,
- mDriverType,
- NULL,
- 0,
- mAvailableFeatureLevels.data(),
- mAvailableFeatureLevels.size(),
- D3D11_SDK_VERSION,
- &mDevice,
- &(mRenderer11DeviceCaps.featureLevel),
- &mDeviceContext);
+ result = D3D11CreateDevice(NULL, mDriverType, NULL, 0, mAvailableFeatureLevels.data(),
+ static_cast<unsigned int>(mAvailableFeatureLevels.size()),
+ D3D11_SDK_VERSION, &mDevice,
+ &(mRenderer11DeviceCaps.featureLevel), &mDeviceContext);
// Cleanup done by destructor
if (!mDevice || FAILED(result))
@@ -556,7 +544,7 @@
};
D3D11_INFO_QUEUE_FILTER filter = {};
- filter.DenyList.NumIDs = ArraySize(hideMessages);
+ filter.DenyList.NumIDs = static_cast<unsigned int>(ArraySize(hideMessages));
filter.DenyList.pIDList = hideMessages;
infoQueue->AddStorageFilterEntries(&filter);
@@ -1020,13 +1008,17 @@
{
UINT firstConstant = 0, numConstants = 0;
CalculateConstantBufferParams(uniformBufferOffset, uniformBufferSize, &firstConstant, &numConstants);
- mDeviceContext1->VSSetConstantBuffers1(getReservedVertexUniformBuffers() + uniformBufferIndex,
- 1, &constantBuffer, &firstConstant, &numConstants);
+ mDeviceContext1->VSSetConstantBuffers1(
+ getReservedVertexUniformBuffers() +
+ static_cast<unsigned int>(uniformBufferIndex),
+ 1, &constantBuffer, &firstConstant, &numConstants);
}
else
{
- mDeviceContext->VSSetConstantBuffers(getReservedVertexUniformBuffers() + uniformBufferIndex,
- 1, &constantBuffer);
+ mDeviceContext->VSSetConstantBuffers(
+ getReservedVertexUniformBuffers() +
+ static_cast<unsigned int>(uniformBufferIndex),
+ 1, &constantBuffer);
}
mCurrentConstantBufferVS[uniformBufferIndex] = bufferStorage->getSerial();
@@ -1076,13 +1068,17 @@
{
UINT firstConstant = 0, numConstants = 0;
CalculateConstantBufferParams(uniformBufferOffset, uniformBufferSize, &firstConstant, &numConstants);
- mDeviceContext1->PSSetConstantBuffers1(getReservedFragmentUniformBuffers() + uniformBufferIndex,
- 1, &constantBuffer, &firstConstant, &numConstants);
+ mDeviceContext1->PSSetConstantBuffers1(
+ getReservedFragmentUniformBuffers() +
+ static_cast<unsigned int>(uniformBufferIndex),
+ 1, &constantBuffer, &firstConstant, &numConstants);
}
else
{
- mDeviceContext->PSSetConstantBuffers(getReservedFragmentUniformBuffers() + uniformBufferIndex,
- 1, &constantBuffer);
+ mDeviceContext->PSSetConstantBuffers(
+ getReservedFragmentUniformBuffers() +
+ static_cast<unsigned int>(uniformBufferIndex),
+ 1, &constantBuffer);
}
mCurrentConstantBufferPS[uniformBufferIndex] = bufferStorage->getSerial();
@@ -1238,8 +1234,8 @@
{
actualViewport.x = 0;
actualViewport.y = 0;
- actualViewport.width = mRenderTargetDesc.width;
- actualViewport.height = mRenderTargetDesc.height;
+ actualViewport.width = static_cast<int>(mRenderTargetDesc.width);
+ actualViewport.height = static_cast<int>(mRenderTargetDesc.height);
actualZNear = 0.0f;
actualZFar = 1.0f;
}
@@ -1259,8 +1255,8 @@
if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3)
{
// Feature Level 9 viewports shouldn't exceed the dimensions of the rendertarget.
- dxMaxViewportBoundsX = mRenderTargetDesc.width;
- dxMaxViewportBoundsY = mRenderTargetDesc.height;
+ dxMaxViewportBoundsX = static_cast<int>(mRenderTargetDesc.width);
+ dxMaxViewportBoundsY = static_cast<int>(mRenderTargetDesc.height);
dxMinViewportBoundsX = 0;
dxMinViewportBoundsY = 0;
}
@@ -1619,7 +1615,8 @@
mAppliedNumXFBBindings = numXFBBindings;
- mDeviceContext->SOSetTargets(numXFBBindings, mAppliedTFBuffers, mCurrentD3DOffsets);
+ mDeviceContext->SOSetTargets(static_cast<unsigned int>(numXFBBindings), mAppliedTFBuffers,
+ mCurrentD3DOffsets);
}
}
@@ -2376,20 +2373,15 @@
D3D_FEATURE_LEVEL dummyFeatureLevel;
ID3D11DeviceContext* dummyContext;
- HRESULT result = D3D11CreateDevice(NULL,
- mDriverType,
- NULL,
+ HRESULT result = D3D11CreateDevice(
+ NULL, mDriverType, NULL,
#if defined(_DEBUG)
- D3D11_CREATE_DEVICE_DEBUG,
+ D3D11_CREATE_DEVICE_DEBUG,
#else
- 0,
+ 0,
#endif
- mAvailableFeatureLevels.data(),
- mAvailableFeatureLevels.size(),
- D3D11_SDK_VERSION,
- &dummyDevice,
- &dummyFeatureLevel,
- &dummyContext);
+ mAvailableFeatureLevels.data(), static_cast<unsigned int>(mAvailableFeatureLevels.size()),
+ D3D11_SDK_VERSION, &dummyDevice, &dummyFeatureLevel, &dummyContext);
if (!mDevice || FAILED(result))
{
@@ -3011,7 +3003,7 @@
const gl::LinkedVarying &varying = transformFeedbackVaryings[i];
GLenum transposedType = gl::TransposeMatrixType(varying.type);
- for (size_t j = 0; j < varying.semanticIndexCount; j++)
+ for (unsigned int j = 0; j < varying.semanticIndexCount; j++)
{
D3D11_SO_DECLARATION_ENTRY entry = { 0 };
entry.Stream = 0;
@@ -3024,8 +3016,10 @@
}
}
- result = mDevice->CreateGeometryShaderWithStreamOutput(function, length, soDeclaration.data(), soDeclaration.size(),
- NULL, 0, 0, NULL, &streamOutShader);
+ result = mDevice->CreateGeometryShaderWithStreamOutput(
+ function, static_cast<unsigned int>(length), soDeclaration.data(),
+ static_cast<unsigned int>(soDeclaration.size()), NULL, 0, 0, NULL,
+ &streamOutShader);
ASSERT(SUCCEEDED(result));
if (FAILED(result))
{
@@ -3714,7 +3708,8 @@
sizeSum += buffer->getTotalCPUBufferMemoryBytes();
}
const int kOneMegaByte = 1024 * 1024;
- ANGLE_HISTOGRAM_MEMORY_MB("GPU.ANGLE.Buffer11CPUMemoryMB", sizeSum / kOneMegaByte);
+ ANGLE_HISTOGRAM_MEMORY_MB("GPU.ANGLE.Buffer11CPUMemoryMB",
+ static_cast<int>(sizeSum) / kOneMegaByte);
}
}
@@ -3858,11 +3853,15 @@
if (samplerType == gl::SAMPLER_VERTEX)
{
- mDeviceContext->VSSetShaderResources(rangeStart, rangeEnd - rangeStart, &mNullSRVs[0]);
+ mDeviceContext->VSSetShaderResources(static_cast<unsigned int>(rangeStart),
+ static_cast<unsigned int>(rangeEnd - rangeStart),
+ &mNullSRVs[0]);
}
else
{
- mDeviceContext->PSSetShaderResources(rangeStart, rangeEnd - rangeStart, &mNullSRVs[0]);
+ mDeviceContext->PSSetShaderResources(static_cast<unsigned int>(rangeStart),
+ static_cast<unsigned int>(rangeEnd - rangeStart),
+ &mNullSRVs[0]);
}
for (size_t samplerIndex = rangeStart; samplerIndex < rangeEnd; ++samplerIndex)
diff --git a/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp b/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp
index 9f1fcc6..4da51af 100644
--- a/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp
@@ -77,7 +77,7 @@
if (initialSize > 0)
{
D3D11_BUFFER_DESC constantBufferDescription = {0};
- constantBufferDescription.ByteWidth = initialSize;
+ constantBufferDescription.ByteWidth = static_cast<unsigned int>(initialSize);
constantBufferDescription.Usage = D3D11_USAGE_DYNAMIC;
constantBufferDescription.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
constantBufferDescription.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
diff --git a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
index 1ab03f5..347fed5 100644
--- a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
@@ -628,7 +628,7 @@
size_t outputPixelSize = dxgiFormatInfo.pixelBytes;
- UINT bufferRowPitch = outputPixelSize * width;
+ UINT bufferRowPitch = static_cast<unsigned int>(outputPixelSize) * width;
UINT bufferDepthPitch = bufferRowPitch * height;
size_t neededSize = bufferDepthPitch * depth;
diff --git a/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp b/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
index 57cf5af..098cefc 100644
--- a/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
@@ -117,7 +117,7 @@
return gl::Error(GL_OUT_OF_MEMORY, "Internal vertex buffer is not initialized.");
}
- int inputStride = ComputeVertexAttributeStride(attrib);
+ int inputStride = static_cast<int>(ComputeVertexAttributeStride(attrib));
// This will map the resource if it isn't already mapped.
gl::Error error = mapResource();
diff --git a/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp b/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp
index 6e91a9c..5b97c0a 100644
--- a/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp
@@ -389,11 +389,11 @@
if (colorInfoIter != colorInfoMap.end())
{
const DXGIColorFormatInfo &colorInfo = colorInfoIter->second;
- info.redBits = colorInfo.redBits;
- info.greenBits = colorInfo.greenBits;
- info.blueBits = colorInfo.blueBits;
- info.alphaBits = colorInfo.alphaBits;
- info.sharedBits = colorInfo.sharedBits;
+ info.redBits = static_cast<GLuint>(colorInfo.redBits);
+ info.greenBits = static_cast<GLuint>(colorInfo.greenBits);
+ info.blueBits = static_cast<GLuint>(colorInfo.blueBits);
+ info.alphaBits = static_cast<GLuint>(colorInfo.alphaBits);
+ info.sharedBits = static_cast<GLuint>(colorInfo.sharedBits);
}
static const DepthStencilInfoMap dsInfoMap = BuildDepthStencilInfoMap();
diff --git a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
index 79aae53..fd1d6e2 100644
--- a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
@@ -323,7 +323,8 @@
// Assume 1x
textureCaps.sampleCounts.insert(1);
- for (size_t sampleCount = 2; sampleCount <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; sampleCount *= 2)
+ for (unsigned int sampleCount = 2; sampleCount <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT;
+ sampleCount *= 2)
{
UINT qualityCount = 0;
if (SUCCEEDED(device->CheckMultisampleQualityLevels(formatInfo.renderFormat, sampleCount, &qualityCount)))
@@ -1025,10 +1026,10 @@
// GL core feature limits
caps->maxElementIndex = static_cast<GLint64>(std::numeric_limits<unsigned int>::max());
- caps->max3DTextureSize = GetMaximum3DTextureSize(featureLevel);
- caps->max2DTextureSize = GetMaximum2DTextureSize(featureLevel);
- caps->maxCubeMapTextureSize = GetMaximumCubeMapTextureSize(featureLevel);
- caps->maxArrayTextureLayers = GetMaximum2DTextureArraySize(featureLevel);
+ caps->max3DTextureSize = static_cast<GLuint>(GetMaximum3DTextureSize(featureLevel));
+ caps->max2DTextureSize = static_cast<GLuint>(GetMaximum2DTextureSize(featureLevel));
+ caps->maxCubeMapTextureSize = static_cast<GLuint>(GetMaximumCubeMapTextureSize(featureLevel));
+ caps->maxArrayTextureLayers = static_cast<GLuint>(GetMaximum2DTextureArraySize(featureLevel));
// Unimplemented, set to minimum required
caps->maxLODBias = 2.0f;
@@ -1038,11 +1039,12 @@
// Maximum draw buffers and color attachments are the same, max color attachments could eventually be
// increased to 16
- caps->maxDrawBuffers = GetMaximumSimultaneousRenderTargets(featureLevel);
- caps->maxColorAttachments = GetMaximumSimultaneousRenderTargets(featureLevel);
+ caps->maxDrawBuffers = static_cast<GLuint>(GetMaximumSimultaneousRenderTargets(featureLevel));
+ caps->maxColorAttachments =
+ static_cast<GLuint>(GetMaximumSimultaneousRenderTargets(featureLevel));
// D3D11 has the same limit for viewport width and height
- caps->maxViewportWidth = GetMaximumViewportSize(featureLevel);
+ caps->maxViewportWidth = static_cast<GLuint>(GetMaximumViewportSize(featureLevel));
caps->maxViewportHeight = caps->maxViewportWidth;
// Choose a reasonable maximum, enforced in the shader.
@@ -1054,8 +1056,8 @@
caps->maxAliasedLineWidth = 1.0f;
// Primitive count limits
- caps->maxElementsIndices = GetMaximumDrawIndexedIndexCount(featureLevel);
- caps->maxElementsVertices = GetMaximumDrawVertexCount(featureLevel);
+ caps->maxElementsIndices = static_cast<GLuint>(GetMaximumDrawIndexedIndexCount(featureLevel));
+ caps->maxElementsVertices = static_cast<GLuint>(GetMaximumDrawVertexCount(featureLevel));
// Program and shader binary formats (no supported shader binary formats)
caps->programBinaryFormats.push_back(GL_PROGRAM_BINARY_ANGLE);
@@ -1079,19 +1081,27 @@
caps->maxServerWaitTimeout = 0;
// Vertex shader limits
- caps->maxVertexAttributes = GetMaximumVertexInputSlots(featureLevel);
- caps->maxVertexUniformComponents = GetMaximumVertexUniformVectors(featureLevel) * 4;
- caps->maxVertexUniformVectors = GetMaximumVertexUniformVectors(featureLevel);
- caps->maxVertexUniformBlocks = GetMaximumVertexUniformBlocks(featureLevel);
- caps->maxVertexOutputComponents = GetMaximumVertexOutputVectors(featureLevel) * 4;
- caps->maxVertexTextureImageUnits = GetMaximumVertexTextureUnits(featureLevel);
+ caps->maxVertexAttributes = static_cast<GLuint>(GetMaximumVertexInputSlots(featureLevel));
+ caps->maxVertexUniformComponents =
+ static_cast<GLuint>(GetMaximumVertexUniformVectors(featureLevel)) * 4;
+ caps->maxVertexUniformVectors =
+ static_cast<GLuint>(GetMaximumVertexUniformVectors(featureLevel));
+ caps->maxVertexUniformBlocks = static_cast<GLuint>(GetMaximumVertexUniformBlocks(featureLevel));
+ caps->maxVertexOutputComponents =
+ static_cast<GLuint>(GetMaximumVertexOutputVectors(featureLevel)) * 4;
+ caps->maxVertexTextureImageUnits =
+ static_cast<GLuint>(GetMaximumVertexTextureUnits(featureLevel));
// Fragment shader limits
- caps->maxFragmentUniformComponents = GetMaximumPixelUniformVectors(featureLevel) * 4;
- caps->maxFragmentUniformVectors = GetMaximumPixelUniformVectors(featureLevel);
- caps->maxFragmentUniformBlocks = GetMaximumPixelUniformBlocks(featureLevel);
- caps->maxFragmentInputComponents = GetMaximumPixelInputVectors(featureLevel) * 4;
- caps->maxTextureImageUnits = GetMaximumPixelTextureUnits(featureLevel);
+ caps->maxFragmentUniformComponents =
+ static_cast<GLuint>(GetMaximumPixelUniformVectors(featureLevel)) * 4;
+ caps->maxFragmentUniformVectors =
+ static_cast<GLuint>(GetMaximumPixelUniformVectors(featureLevel));
+ caps->maxFragmentUniformBlocks =
+ static_cast<GLuint>(GetMaximumPixelUniformBlocks(featureLevel));
+ caps->maxFragmentInputComponents =
+ static_cast<GLuint>(GetMaximumPixelInputVectors(featureLevel)) * 4;
+ caps->maxTextureImageUnits = static_cast<GLuint>(GetMaximumPixelTextureUnits(featureLevel));
caps->minProgramTexelOffset = GetMinimumTexelOffset(featureLevel);
caps->maxProgramTexelOffset = GetMaximumTexelOffset(featureLevel);
@@ -1110,14 +1120,18 @@
static_cast<GLint64>(caps->maxVertexUniformComponents);
caps->maxCombinedFragmentUniformComponents = (static_cast<GLint64>(caps->maxFragmentUniformBlocks) * static_cast<GLint64>(caps->maxUniformBlockSize / 4)) +
static_cast<GLint64>(caps->maxFragmentUniformComponents);
- caps->maxVaryingComponents = GetMaximumVertexOutputVectors(featureLevel) * 4;
- caps->maxVaryingVectors = GetMaximumVertexOutputVectors(featureLevel);
+ caps->maxVaryingComponents =
+ static_cast<GLuint>(GetMaximumVertexOutputVectors(featureLevel)) * 4;
+ caps->maxVaryingVectors = static_cast<GLuint>(GetMaximumVertexOutputVectors(featureLevel));
caps->maxCombinedTextureImageUnits = caps->maxVertexTextureImageUnits + caps->maxTextureImageUnits;
// Transform feedback limits
- caps->maxTransformFeedbackInterleavedComponents = GetMaximumStreamOutputInterleavedComponents(featureLevel);
- caps->maxTransformFeedbackSeparateAttributes = GetMaximumStreamOutputBuffers(featureLevel);
- caps->maxTransformFeedbackSeparateComponents = GetMaximumStreamOutputSeparateComponents(featureLevel);
+ caps->maxTransformFeedbackInterleavedComponents =
+ static_cast<GLuint>(GetMaximumStreamOutputInterleavedComponents(featureLevel));
+ caps->maxTransformFeedbackSeparateAttributes =
+ static_cast<GLuint>(GetMaximumStreamOutputBuffers(featureLevel));
+ caps->maxTransformFeedbackSeparateComponents =
+ static_cast<GLuint>(GetMaximumStreamOutputSeparateComponents(featureLevel));
// Multisample limits
caps->maxSamples = maxSamples;
@@ -1245,7 +1259,8 @@
HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
{
#if defined(_DEBUG)
- return resource->SetPrivateData(WKPDID_D3DDebugObjectName, strlen(name), name);
+ return resource->SetPrivateData(WKPDID_D3DDebugObjectName,
+ static_cast<unsigned int>(strlen(name)), name);
#else
return S_OK;
#endif
diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
index 8d8f076..281622e 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
@@ -1139,8 +1139,8 @@
{
actualViewport.x = 0;
actualViewport.y = 0;
- actualViewport.width = mRenderTargetDesc.width;
- actualViewport.height = mRenderTargetDesc.height;
+ actualViewport.width = static_cast<int>(mRenderTargetDesc.width);
+ actualViewport.height = static_cast<int>(mRenderTargetDesc.height);
actualZNear = 0.0f;
actualZFar = 1.0f;
}
@@ -1761,7 +1761,7 @@
// Update the counting index buffer if it is not large enough or has not been created yet.
if (count <= 65536) // 16-bit indices
{
- const unsigned int spaceNeeded = count * sizeof(unsigned short);
+ const unsigned int spaceNeeded = static_cast<unsigned int>(count) * sizeof(unsigned short);
if (!mCountingIB || mCountingIB->getBufferSize() < spaceNeeded)
{
@@ -1791,7 +1791,7 @@
}
else if (getRendererExtensions().elementIndexUint)
{
- const unsigned int spaceNeeded = count * sizeof(unsigned int);
+ const unsigned int spaceNeeded = static_cast<unsigned int>(count) * sizeof(unsigned int);
if (!mCountingIB || mCountingIB->getBufferSize() < spaceNeeded)
{
@@ -1807,7 +1807,7 @@
}
unsigned int *data = reinterpret_cast<unsigned int*>(mappedMemory);
- for (size_t i = 0; i < count; i++)
+ for (unsigned int i = 0; i < count; i++)
{
data[i] = i;
}
@@ -2972,7 +2972,7 @@
// TODO(jmadill): faster way?
for (size_t samplerIndex = rangeStart; samplerIndex < rangeEnd; samplerIndex++)
{
- gl::Error error = setTexture(samplerType, samplerIndex, nullptr);
+ gl::Error error = setTexture(samplerType, static_cast<int>(samplerIndex), nullptr);
if (error.isError())
{
return error;
diff --git a/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp b/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
index ceddda1..89c8cce 100644
--- a/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
@@ -88,7 +88,7 @@
int TextureStorage9::getLevelCount() const
{
- return mMipLevels - mTopLevel;
+ return static_cast<int>(mMipLevels) - mTopLevel;
}
gl::Error TextureStorage9::setData(const gl::ImageIndex &index, ImageD3D *image, const gl::Box *destBox, GLenum type,
@@ -180,7 +180,9 @@
return error;
}
- mRenderTarget = new TextureRenderTarget9(surface, mInternalFormat, mTextureWidth, mTextureHeight, 1, 0);
+ mRenderTarget =
+ new TextureRenderTarget9(surface, mInternalFormat, static_cast<GLsizei>(mTextureWidth),
+ static_cast<GLsizei>(mTextureHeight), 1, 0);
}
ASSERT(outRT);
@@ -223,8 +225,10 @@
ASSERT(mMipLevels > 0);
IDirect3DDevice9 *device = mRenderer->getDevice();
- HRESULT result = device->CreateTexture(mTextureWidth, mTextureHeight, mMipLevels, getUsage(), mTextureFormat,
- getPool(), &mTexture, NULL);
+ HRESULT result = device->CreateTexture(static_cast<unsigned int>(mTextureWidth),
+ static_cast<unsigned int>(mTextureHeight),
+ static_cast<unsigned int>(mMipLevels), getUsage(),
+ mTextureFormat, getPool(), &mTexture, NULL);
if (FAILED(result))
{
@@ -352,7 +356,9 @@
return error;
}
- mRenderTarget[index.layerIndex] = new TextureRenderTarget9(surface, mInternalFormat, mTextureWidth, mTextureHeight, 1, 0);
+ mRenderTarget[index.layerIndex] =
+ new TextureRenderTarget9(surface, mInternalFormat, static_cast<GLsizei>(mTextureWidth),
+ static_cast<GLsizei>(mTextureHeight), 1, 0);
}
*outRT = mRenderTarget[index.layerIndex];
@@ -395,8 +401,9 @@
ASSERT(mTextureWidth == mTextureHeight);
IDirect3DDevice9 *device = mRenderer->getDevice();
- HRESULT result = device->CreateCubeTexture(mTextureWidth, mMipLevels, getUsage(), mTextureFormat, getPool(),
- &mTexture, NULL);
+ HRESULT result = device->CreateCubeTexture(
+ static_cast<unsigned int>(mTextureWidth), static_cast<unsigned int>(mMipLevels),
+ getUsage(), mTextureFormat, getPool(), &mTexture, NULL);
if (FAILED(result))
{
diff --git a/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp b/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
index 51cfbdd..bfdf137 100644
--- a/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
@@ -69,8 +69,8 @@
return gl::Error(GL_OUT_OF_MEMORY, "Internal vertex buffer is not initialized.");
}
- int inputStride = gl::ComputeVertexAttributeStride(attrib);
- int elementSize = gl::ComputeVertexAttributeTypeSize(attrib);
+ int inputStride = static_cast<int>(gl::ComputeVertexAttributeStride(attrib));
+ int elementSize = static_cast<int>(gl::ComputeVertexAttributeTypeSize(attrib));
DWORD lockFlags = mDynamicUsage ? D3DLOCK_NOOVERWRITE : 0;
@@ -179,7 +179,7 @@
unsigned int elementCount = 0;
if (instances == 0 || attrib.divisor == 0)
{
- elementCount = count;
+ elementCount = static_cast<unsigned int>(count);
}
else
{
@@ -191,7 +191,8 @@
{
if (outSpaceRequired)
{
- *outSpaceRequired = d3d9VertexInfo.outputElementSize * elementCount;
+ *outSpaceRequired =
+ static_cast<unsigned int>(d3d9VertexInfo.outputElementSize) * elementCount;
}
return gl::Error(GL_NO_ERROR);
}
diff --git a/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp b/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
index 6a1181a..e162dfd 100644
--- a/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
@@ -108,7 +108,7 @@
// Directly binding the storage buffer is not supported for d3d9
ASSERT(attributes[i].storage == NULL);
- int stream = i;
+ int stream = static_cast<int>(i);
if (instances > 0)
{
@@ -125,7 +125,7 @@
}
else if (i == 0)
{
- stream = indexedAttribute;
+ stream = static_cast<int>(indexedAttribute);
}
UINT frequency = 1;
@@ -164,7 +164,7 @@
element->Type = static_cast<BYTE>(d3d9VertexInfo.nativeFormat);
element->Method = D3DDECLMETHOD_DEFAULT;
element->Usage = D3DDECLUSAGE_TEXCOORD;
- element->UsageIndex = static_cast<BYTE>(program->getSemanticIndex(i));
+ element->UsageIndex = static_cast<BYTE>(program->getSemanticIndex(static_cast<int>(i)));
element++;
}
}
diff --git a/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp b/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
index 13df51f..3592cad 100644
--- a/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
@@ -319,7 +319,7 @@
}
textureCaps.sampleCounts.insert(1);
- for (size_t i = D3DMULTISAMPLE_2_SAMPLES; i <= D3DMULTISAMPLE_16_SAMPLES; i++)
+ for (unsigned int i = D3DMULTISAMPLE_2_SAMPLES; i <= D3DMULTISAMPLE_16_SAMPLES; i++)
{
D3DMULTISAMPLE_TYPE multisampleType = D3DMULTISAMPLE_TYPE(i);
diff --git a/src/libANGLE/renderer/gl/BufferGL.cpp b/src/libANGLE/renderer/gl/BufferGL.cpp
index 605cf021..cb57afd 100644
--- a/src/libANGLE/renderer/gl/BufferGL.cpp
+++ b/src/libANGLE/renderer/gl/BufferGL.cpp
@@ -107,7 +107,7 @@
mStateManager->bindBuffer(DestBufferOperationTarget, mBufferID);
const uint8_t *bufferData = reinterpret_cast<uint8_t*>(mFunctions->mapBuffer(DestBufferOperationTarget, GL_READ_ONLY));
- *outRange = gl::ComputeIndexRange(type, bufferData + offset, count);
+ *outRange = gl::ComputeIndexRange(type, bufferData + offset, static_cast<GLsizei>(count));
mFunctions->unmapBuffer(DestBufferOperationTarget);
return gl::Error(GL_NO_ERROR);
diff --git a/src/libANGLE/renderer/gl/FramebufferGL.cpp b/src/libANGLE/renderer/gl/FramebufferGL.cpp
index 6c2101a..300980b 100644
--- a/src/libANGLE/renderer/gl/FramebufferGL.cpp
+++ b/src/libANGLE/renderer/gl/FramebufferGL.cpp
@@ -96,8 +96,7 @@
if (!mIsDefault)
{
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
- BindFramebufferAttachment(mFunctions,
- GL_COLOR_ATTACHMENT0 + index,
+ BindFramebufferAttachment(mFunctions, GL_COLOR_ATTACHMENT0 + static_cast<GLenum>(index),
mData.getColorAttachment(static_cast<unsigned int>(index)));
}
}
@@ -140,7 +139,7 @@
if (!mIsDefault)
{
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
- mFunctions->drawBuffers(count, buffers);
+ mFunctions->drawBuffers(static_cast<GLsizei>(count), buffers);
}
}
@@ -165,7 +164,7 @@
if (mFunctions->invalidateFramebuffer)
{
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
- mFunctions->invalidateFramebuffer(GL_FRAMEBUFFER, count, attachments);
+ mFunctions->invalidateFramebuffer(GL_FRAMEBUFFER, static_cast<GLsizei>(count), attachments);
}
return gl::Error(GL_NO_ERROR);
@@ -177,7 +176,8 @@
if (mFunctions->invalidateSubFramebuffer)
{
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
- mFunctions->invalidateSubFramebuffer(GL_FRAMEBUFFER, count, attachments, area.x, area.y, area.width, area.height);
+ mFunctions->invalidateSubFramebuffer(GL_FRAMEBUFFER, static_cast<GLsizei>(count),
+ attachments, area.x, area.y, area.width, area.height);
}
return gl::Error(GL_NO_ERROR);
diff --git a/src/libANGLE/renderer/gl/ProgramGL.cpp b/src/libANGLE/renderer/gl/ProgramGL.cpp
index f92ad6e..bb3571d 100644
--- a/src/libANGLE/renderer/gl/ProgramGL.cpp
+++ b/src/libANGLE/renderer/gl/ProgramGL.cpp
@@ -132,7 +132,9 @@
GLsizei uniformNameLength = 0;
GLint uniformSize = 0;
GLenum uniformType = GL_NONE;
- mFunctions->getActiveUniform(mProgramID, i, uniformNameBuffer.size(), &uniformNameLength, &uniformSize, &uniformType, &uniformNameBuffer[0]);
+ mFunctions->getActiveUniform(mProgramID, i, static_cast<GLsizei>(uniformNameBuffer.size()),
+ &uniformNameLength, &uniformSize, &uniformType,
+ &uniformNameBuffer[0]);
size_t subscript = 0;
std::string uniformName = gl::ParseUniformName(std::string(&uniformNameBuffer[0], uniformNameLength), &subscript);
@@ -144,13 +146,15 @@
std::string locationName = uniformName;
if (isArray)
{
- locationName += "[" + Str(arrayIndex) + "]";
+ locationName += "[" + Str(static_cast<int>(arrayIndex)) + "]";
}
GLint location = mFunctions->getUniformLocation(mProgramID, locationName.c_str());
if (location >= 0)
{
- mUniformIndex[location] = gl::VariableLocation(uniformName, arrayIndex, static_cast<unsigned int>(mUniforms.size()));
+ mUniformIndex[location] =
+ gl::VariableLocation(uniformName, static_cast<unsigned int>(arrayIndex),
+ static_cast<unsigned int>(mUniforms.size()));
// If the uniform is a sampler, track it in the sampler bindings array
if (gl::IsSamplerType(uniformType))
@@ -192,7 +196,9 @@
GLsizei attributeNameLength = 0;
GLint attributeSize = 0;
GLenum attributeType = GL_NONE;
- mFunctions->getActiveAttrib(mProgramID, i, attributeNameBuffer.size(), &attributeNameLength, &attributeSize, &attributeType, &attributeNameBuffer[0]);
+ mFunctions->getActiveAttrib(mProgramID, i, static_cast<GLsizei>(attributeNameBuffer.size()),
+ &attributeNameLength, &attributeSize, &attributeType,
+ &attributeNameBuffer[0]);
std::string attributeName(&attributeNameBuffer[0], attributeNameLength);
diff --git a/src/libANGLE/renderer/gl/RenderbufferGL.cpp b/src/libANGLE/renderer/gl/RenderbufferGL.cpp
index 416fc29..bfc2bb2 100644
--- a/src/libANGLE/renderer/gl/RenderbufferGL.cpp
+++ b/src/libANGLE/renderer/gl/RenderbufferGL.cpp
@@ -45,8 +45,8 @@
nativegl::RenderbufferFormat renderbufferFormat =
nativegl::GetRenderbufferFormat(mFunctions, mWorkarounds, internalformat);
- mFunctions->renderbufferStorage(GL_RENDERBUFFER, renderbufferFormat.internalFormat, width,
- height);
+ mFunctions->renderbufferStorage(GL_RENDERBUFFER, renderbufferFormat.internalFormat,
+ static_cast<GLsizei>(width), static_cast<GLsizei>(height));
return gl::Error(GL_NO_ERROR);
}
@@ -57,8 +57,9 @@
nativegl::RenderbufferFormat renderbufferFormat =
nativegl::GetRenderbufferFormat(mFunctions, mWorkarounds, internalformat);
- mFunctions->renderbufferStorageMultisample(GL_RENDERBUFFER, samples,
- renderbufferFormat.internalFormat, width, height);
+ mFunctions->renderbufferStorageMultisample(
+ GL_RENDERBUFFER, static_cast<GLsizei>(samples), renderbufferFormat.internalFormat,
+ static_cast<GLsizei>(width), static_cast<GLsizei>(height));
const gl::TextureCaps &formatCaps = mTextureCaps.get(internalformat);
if (samples > formatCaps.getMaxSamples())
diff --git a/src/libANGLE/renderer/gl/StateManagerGL.cpp b/src/libANGLE/renderer/gl/StateManagerGL.cpp
index 99465ad..2f07074 100644
--- a/src/libANGLE/renderer/gl/StateManagerGL.cpp
+++ b/src/libANGLE/renderer/gl/StateManagerGL.cpp
@@ -238,7 +238,7 @@
if (mTextureUnitIndex != unit)
{
mTextureUnitIndex = unit;
- mFunctions->activeTexture(GL_TEXTURE0 + mTextureUnitIndex);
+ mFunctions->activeTexture(GL_TEXTURE0 + static_cast<GLenum>(mTextureUnitIndex));
}
}
@@ -470,9 +470,18 @@
mVertexAttribCurrentValues[index] = data;
switch (mVertexAttribCurrentValues[index].Type)
{
- case GL_FLOAT: mFunctions->vertexAttrib4fv(index, mVertexAttribCurrentValues[index].FloatValues); break;
- case GL_INT: mFunctions->vertexAttrib4iv(index, mVertexAttribCurrentValues[index].IntValues); break;
- case GL_UNSIGNED_INT: mFunctions->vertexAttrib4uiv(index, mVertexAttribCurrentValues[index].UnsignedIntValues); break;
+ case GL_FLOAT:
+ mFunctions->vertexAttrib4fv(static_cast<GLuint>(index),
+ mVertexAttribCurrentValues[index].FloatValues);
+ break;
+ case GL_INT:
+ mFunctions->vertexAttrib4iv(static_cast<GLuint>(index),
+ mVertexAttribCurrentValues[index].IntValues);
+ break;
+ case GL_UNSIGNED_INT:
+ mFunctions->vertexAttrib4uiv(static_cast<GLuint>(index),
+ mVertexAttribCurrentValues[index].UnsignedIntValues);
+ break;
default: UNREACHABLE();
}
}
diff --git a/src/libANGLE/renderer/gl/TextureGL.cpp b/src/libANGLE/renderer/gl/TextureGL.cpp
index 6dca94a..9a18953 100644
--- a/src/libANGLE/renderer/gl/TextureGL.cpp
+++ b/src/libANGLE/renderer/gl/TextureGL.cpp
@@ -89,13 +89,14 @@
if (UseTexImage2D(mTextureType))
{
ASSERT(size.depth == 1);
- mFunctions->texImage2D(target, level, texImageFormat.internalFormat, size.width,
- size.height, 0, texImageFormat.format, texImageFormat.type, pixels);
+ mFunctions->texImage2D(target, static_cast<GLint>(level), texImageFormat.internalFormat,
+ size.width, size.height, 0, texImageFormat.format,
+ texImageFormat.type, pixels);
}
else if (UseTexImage3D(mTextureType))
{
- mFunctions->texImage3D(target, level, texImageFormat.internalFormat, size.width,
- size.height, size.depth, 0, texImageFormat.format,
+ mFunctions->texImage3D(target, static_cast<GLint>(level), texImageFormat.internalFormat,
+ size.width, size.height, size.depth, 0, texImageFormat.format,
texImageFormat.type, pixels);
}
else
@@ -118,14 +119,15 @@
if (UseTexImage2D(mTextureType))
{
ASSERT(area.z == 0 && area.depth == 1);
- mFunctions->texSubImage2D(target, level, area.x, area.y, area.width, area.height,
- texSubImageFormat.format, texSubImageFormat.type, pixels);
+ mFunctions->texSubImage2D(target, static_cast<GLint>(level), area.x, area.y, area.width,
+ area.height, texSubImageFormat.format, texSubImageFormat.type,
+ pixels);
}
else if (UseTexImage3D(mTextureType))
{
- mFunctions->texSubImage3D(target, level, area.x, area.y, area.z, area.width, area.height,
- area.depth, texSubImageFormat.format, texSubImageFormat.type,
- pixels);
+ mFunctions->texSubImage3D(target, static_cast<GLint>(level), area.x, area.y, area.z,
+ area.width, area.height, area.depth, texSubImageFormat.format,
+ texSubImageFormat.type, pixels);
}
else
{
@@ -147,13 +149,15 @@
if (UseTexImage2D(mTextureType))
{
ASSERT(size.depth == 1);
- mFunctions->compressedTexImage2D(target, level, compressedTexImageFormat.internalFormat,
- size.width, size.height, 0, imageSize, pixels);
+ mFunctions->compressedTexImage2D(target, static_cast<GLint>(level),
+ compressedTexImageFormat.internalFormat, size.width,
+ size.height, 0, static_cast<GLsizei>(imageSize), pixels);
}
else if (UseTexImage3D(mTextureType))
{
- mFunctions->compressedTexImage3D(target, level, compressedTexImageFormat.internalFormat,
- size.width, size.height, size.depth, 0, imageSize, pixels);
+ mFunctions->compressedTexImage3D(
+ target, static_cast<GLint>(level), compressedTexImageFormat.internalFormat, size.width,
+ size.height, size.depth, 0, static_cast<GLsizei>(imageSize), pixels);
}
else
{
@@ -175,14 +179,16 @@
if (UseTexImage2D(mTextureType))
{
ASSERT(area.z == 0 && area.depth == 1);
- mFunctions->compressedTexSubImage2D(target, level, area.x, area.y, area.width, area.height,
- compressedTexSubImageFormat.format, imageSize, pixels);
+ mFunctions->compressedTexSubImage2D(
+ target, static_cast<GLint>(level), area.x, area.y, area.width, area.height,
+ compressedTexSubImageFormat.format, static_cast<GLsizei>(imageSize), pixels);
}
else if (UseTexImage3D(mTextureType))
{
- mFunctions->compressedTexSubImage3D(target, level, area.x, area.y, area.z, area.width,
- area.height, area.depth,
- compressedTexSubImageFormat.format, imageSize, pixels);
+ mFunctions->compressedTexSubImage3D(target, static_cast<GLint>(level), area.x, area.y,
+ area.z, area.width, area.height, area.depth,
+ compressedTexSubImageFormat.format,
+ static_cast<GLsizei>(imageSize), pixels);
}
else
{
@@ -205,8 +211,9 @@
if (UseTexImage2D(mTextureType))
{
- mFunctions->copyTexImage2D(target, level, copyTexImageFormat.internalFormat, sourceArea.x,
- sourceArea.y, sourceArea.width, sourceArea.height, 0);
+ mFunctions->copyTexImage2D(target, static_cast<GLint>(level),
+ copyTexImageFormat.internalFormat, sourceArea.x, sourceArea.y,
+ sourceArea.width, sourceArea.height, 0);
}
else
{
@@ -227,13 +234,15 @@
if (UseTexImage2D(mTextureType))
{
ASSERT(destOffset.z == 0);
- mFunctions->copyTexSubImage2D(target, level, destOffset.x, destOffset.y,
- sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height);
+ mFunctions->copyTexSubImage2D(target, static_cast<GLint>(level), destOffset.x, destOffset.y,
+ sourceArea.x, sourceArea.y, sourceArea.width,
+ sourceArea.height);
}
else if (UseTexImage3D(mTextureType))
{
- mFunctions->copyTexSubImage3D(target, level, destOffset.x, destOffset.y, destOffset.z,
- sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height);
+ mFunctions->copyTexSubImage3D(target, static_cast<GLint>(level), destOffset.x, destOffset.y,
+ destOffset.z, sourceArea.x, sourceArea.y, sourceArea.width,
+ sourceArea.height);
}
else
{
@@ -257,8 +266,8 @@
ASSERT(size.depth == 1);
if (mFunctions->texStorage2D)
{
- mFunctions->texStorage2D(target, levels, texStorageFormat.internalFormat, size.width,
- size.height);
+ mFunctions->texStorage2D(target, static_cast<GLsizei>(levels),
+ texStorageFormat.internalFormat, size.width, size.height);
}
else
{
@@ -281,16 +290,17 @@
if (internalFormatInfo.compressed)
{
size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, levelSize.width, levelSize.height);
- mFunctions->compressedTexImage2D(
- target, level, texStorageFormat.internalFormat, levelSize.width,
- levelSize.height, 0, dataSize, nullptr);
+ mFunctions->compressedTexImage2D(target, static_cast<GLint>(level),
+ texStorageFormat.internalFormat,
+ levelSize.width, levelSize.height, 0,
+ static_cast<GLsizei>(dataSize), nullptr);
}
else
{
- mFunctions->texImage2D(target, level, texStorageFormat.internalFormat,
- levelSize.width, levelSize.height, 0,
- internalFormatInfo.format, internalFormatInfo.type,
- nullptr);
+ mFunctions->texImage2D(target, static_cast<GLint>(level),
+ texStorageFormat.internalFormat, levelSize.width,
+ levelSize.height, 0, internalFormatInfo.format,
+ internalFormatInfo.type, nullptr);
}
}
else if (mTextureType == GL_TEXTURE_CUBE_MAP)
@@ -301,14 +311,15 @@
{
size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, levelSize.width, levelSize.height);
mFunctions->compressedTexImage2D(
- face, level, texStorageFormat.internalFormat, levelSize.width,
- levelSize.height, 0, dataSize, nullptr);
+ face, static_cast<GLint>(level), texStorageFormat.internalFormat,
+ levelSize.width, levelSize.height, 0,
+ static_cast<GLsizei>(dataSize), nullptr);
}
else
{
- mFunctions->texImage2D(face, level, texStorageFormat.internalFormat,
- levelSize.width, levelSize.height, 0,
- internalFormatInfo.format,
+ mFunctions->texImage2D(face, static_cast<GLint>(level),
+ texStorageFormat.internalFormat, levelSize.width,
+ levelSize.height, 0, internalFormatInfo.format,
internalFormatInfo.type, nullptr);
}
}
@@ -324,8 +335,9 @@
{
if (mFunctions->texStorage3D)
{
- mFunctions->texStorage3D(target, levels, texStorageFormat.internalFormat, size.width,
- size.height, size.depth);
+ mFunctions->texStorage3D(target, static_cast<GLsizei>(levels),
+ texStorageFormat.internalFormat, size.width, size.height,
+ size.depth);
}
else
{
@@ -337,7 +349,7 @@
// Internal format must be sized
ASSERT(internalFormatInfo.pixelBytes != 0);
- for (size_t i = 0; i < levels; i++)
+ for (GLsizei i = 0; i < static_cast<GLsizei>(levels); i++)
{
gl::Extents levelSize(std::max(size.width >> i, 1),
std::max(size.height >> i, 1),
@@ -345,7 +357,9 @@
if (internalFormatInfo.compressed)
{
- size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, levelSize.width, levelSize.height) * levelSize.depth;
+ GLsizei dataSize = static_cast<GLsizei>(internalFormatInfo.computeBlockSize(
+ GL_UNSIGNED_BYTE, levelSize.width, levelSize.height)) *
+ levelSize.depth;
mFunctions->compressedTexImage3D(target, i, texStorageFormat.internalFormat,
levelSize.width, levelSize.height,
levelSize.depth, 0, dataSize, nullptr);
diff --git a/src/libANGLE/renderer/gl/VertexArrayGL.cpp b/src/libANGLE/renderer/gl/VertexArrayGL.cpp
index a2ca881..13c9539 100644
--- a/src/libANGLE/renderer/gl/VertexArrayGL.cpp
+++ b/src/libANGLE/renderer/gl/VertexArrayGL.cpp
@@ -384,9 +384,10 @@
// Compute where the 0-index vertex would be.
const size_t vertexStartOffset = curBufferOffset - (indexRange.start * destStride);
- mFunctions->vertexAttribPointer(idx, attrib.size, attrib.type,
- attrib.normalized, destStride,
- reinterpret_cast<const GLvoid*>(vertexStartOffset));
+ mFunctions->vertexAttribPointer(
+ idx, attrib.size, attrib.type, attrib.normalized,
+ static_cast<GLsizei>(destStride),
+ reinterpret_cast<const GLvoid *>(vertexStartOffset));
curBufferOffset += destStride * streamedVertexCount;
diff --git a/src/libANGLE/renderer/gl/renderergl_utils.cpp b/src/libANGLE/renderer/gl/renderergl_utils.cpp
index 371d94a..527f25a 100644
--- a/src/libANGLE/renderer/gl/renderergl_utils.cpp
+++ b/src/libANGLE/renderer/gl/renderergl_utils.cpp
@@ -97,7 +97,8 @@
if (numSamples > 0)
{
std::vector<GLint> samples(numSamples);
- functions->getInternalformativ(GL_RENDERBUFFER, internalFormat, GL_SAMPLES, samples.size(), &samples[0]);
+ functions->getInternalformativ(GL_RENDERBUFFER, internalFormat, GL_SAMPLES,
+ static_cast<GLsizei>(samples.size()), &samples[0]);
for (size_t sampleIndex = 0; sampleIndex < samples.size(); sampleIndex++)
{
textureCaps.sampleCounts.insert(samples[sampleIndex]);