Commit b8af723d by Austin Kinross Committed by Geoff Lang

Fix and enable warning C4245 (signed/unsigned mismatch)

Change-Id: If48043835fcc98341a0626e3ece7d0e3f7958059 Reviewed-on: https://chromium-review.googlesource.com/260630Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCooper Partin <coopp@microsoft.com> Tested-by: 's avatarAustin Kinross <aukinros@microsoft.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 5899aadb
......@@ -17,7 +17,6 @@
# Conversion warnings. These fire all over the place in ANGLE.
4244, # Conversion from 'type1' to 'type2', possible loss of data
4245, # Conversion from 'type1' to 'type2', signed/unsigned mismatch
4267, # Conversion from 'size_t' to 'type', possible loss of data
4702, # Unreachable code. Useful, but fires on system header xtree.
......
......@@ -354,7 +354,7 @@ inline float float11ToFloat32(unsigned short fp11)
}
else // The value is zero
{
exponent = -112;
exponent = static_cast<unsigned short>(-112);
}
return bitCast<float>(((exponent + 112) << 23) | (mantissa << 17));
......@@ -393,7 +393,7 @@ inline float float10ToFloat32(unsigned short fp11)
}
else // The value is zero
{
exponent = -112;
exponent = static_cast<unsigned short>(-112);
}
return bitCast<float>(((exponent + 112) << 23) | (mantissa << 18));
......
......@@ -16,7 +16,7 @@
// TLS does not exist for Windows Store and needs to be emulated
# ifdef ANGLE_ENABLE_WINDOWS_STORE
# ifndef TLS_OUT_OF_INDEXES
# define TLS_OUT_OF_INDEXES -1
# define TLS_OUT_OF_INDEXES static_cast<DWORD>(0xFFFFFFFF)
# endif
# ifndef CREATE_SUSPENDED
# define CREATE_SUSPENDED 0x00000004
......
......@@ -611,7 +611,7 @@ GLuint Program::getAttributeLocation(const std::string &name)
}
}
return -1;
return static_cast<GLuint>(-1);
}
int Program::getSemanticIndex(int attributeIndex)
......
......@@ -75,11 +75,11 @@ void State::initialize(const Caps& caps, GLuint clientVersion)
mDepthStencil.depthMask = true;
mDepthStencil.stencilTest = false;
mDepthStencil.stencilFunc = GL_ALWAYS;
mDepthStencil.stencilMask = -1;
mDepthStencil.stencilWritemask = -1;
mDepthStencil.stencilMask = static_cast<GLuint>(-1);
mDepthStencil.stencilWritemask = static_cast<GLuint>(-1);
mDepthStencil.stencilBackFunc = GL_ALWAYS;
mDepthStencil.stencilBackMask = -1;
mDepthStencil.stencilBackWritemask = -1;
mDepthStencil.stencilBackMask = static_cast<GLuint>(-1);
mDepthStencil.stencilBackWritemask = static_cast<GLuint>(-1);
mDepthStencil.stencilFail = GL_KEEP;
mDepthStencil.stencilPassDepthFail = GL_KEEP;
mDepthStencil.stencilPassDepthPass = GL_KEEP;
......
......@@ -232,7 +232,7 @@ void ShaderD3D::compileToHLSL(ShHandle compiler, const std::string &source)
if (uniform.staticUse)
{
unsigned int index = -1;
unsigned int index = static_cast<unsigned int>(-1);
bool getUniformRegisterResult = ShGetUniformRegister(compiler, uniform.name, &index);
UNUSED_ASSERTION_VARIABLE(getUniformRegisterResult);
ASSERT(getUniformRegisterResult);
......@@ -249,7 +249,7 @@ void ShaderD3D::compileToHLSL(ShHandle compiler, const std::string &source)
if (interfaceBlock.staticUse)
{
unsigned int index = -1;
unsigned int index = static_cast<unsigned int>(-1);
bool blockRegisterResult = ShGetInterfaceBlockRegister(compiler, interfaceBlock.name, &index);
UNUSED_ASSERTION_VARIABLE(blockRegisterResult);
ASSERT(blockRegisterResult);
......
......@@ -48,8 +48,8 @@ InputLayoutCache::InputLayoutCache() : mInputLayoutMap(kMaxInputLayouts, hashInp
for (unsigned int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
{
mCurrentBuffers[i] = NULL;
mCurrentVertexStrides[i] = -1;
mCurrentVertexOffsets[i] = -1;
mCurrentVertexStrides[i] = static_cast<UINT>(-1);
mCurrentVertexOffsets[i] = static_cast<UINT>(-1);
}
mPointSpriteVertexBuffer = NULL;
mPointSpriteIndexBuffer = NULL;
......@@ -86,8 +86,8 @@ void InputLayoutCache::markDirty()
for (unsigned int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
{
mCurrentBuffers[i] = NULL;
mCurrentVertexStrides[i] = -1;
mCurrentVertexOffsets[i] = -1;
mCurrentVertexStrides[i] = static_cast<UINT>(-1);
mCurrentVertexOffsets[i] = static_cast<UINT>(-1);
}
}
......
......@@ -74,7 +74,7 @@ enum
};
// dirtyPointer is a special value that will make the comparison with any valid pointer fail and force the renderer to re-apply the state.
static const uintptr_t DirtyPointer = -1;
static const uintptr_t DirtyPointer = static_cast<uintptr_t>(-1);
static bool ImageIndexConflictsWithSRV(const gl::ImageIndex *index, D3D11_SHADER_RESOURCE_VIEW_DESC desc)
{
......@@ -181,7 +181,7 @@ Renderer11::Renderer11(egl::Display *display)
mAppliedGeometryShader = NULL;
mAppliedPixelShader = NULL;
mAppliedNumXFBBindings = -1;
mAppliedNumXFBBindings = static_cast<size_t>(-1);
const auto &attributes = mDisplay->getAttributeMap();
......@@ -1979,7 +1979,7 @@ void Renderer11::markAllStateDirty()
mAppliedGeometryShader = DirtyPointer;
mAppliedPixelShader = DirtyPointer;
mAppliedNumXFBBindings = -1;
mAppliedNumXFBBindings = static_cast<size_t>(-1);
for (size_t i = 0; i < gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
{
......@@ -1994,8 +1994,8 @@ void Renderer11::markAllStateDirty()
for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS; i++)
{
mCurrentConstantBufferVS[i] = -1;
mCurrentConstantBufferPS[i] = -1;
mCurrentConstantBufferVS[i] = static_cast<unsigned int>(-1);
mCurrentConstantBufferPS[i] = static_cast<unsigned int>(-1);
}
mCurrentVertexConstantBuffer = NULL;
......
......@@ -222,7 +222,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
offscreenSRVDesc.Format = backbufferFormatInfo.srvFormat;
offscreenSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
offscreenSRVDesc.Texture2D.MostDetailedMip = 0;
offscreenSRVDesc.Texture2D.MipLevels = -1;
offscreenSRVDesc.Texture2D.MipLevels = static_cast<UINT>(-1);
result = device->CreateShaderResourceView(mOffscreenTexture, &offscreenSRVDesc, &mOffscreenSRView);
ASSERT(SUCCEEDED(result));
......@@ -284,7 +284,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
depthStencilSRVDesc.Format = depthBufferFormatInfo.srvFormat;
depthStencilSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
depthStencilSRVDesc.Texture2D.MostDetailedMip = 0;
depthStencilSRVDesc.Texture2D.MipLevels = -1;
depthStencilSRVDesc.Texture2D.MipLevels = static_cast<UINT>(-1);
result = device->CreateShaderResourceView(mDepthStencilTexture, &depthStencilSRVDesc, &mDepthStencilSRView);
ASSERT(SUCCEEDED(result));
......
......@@ -2177,7 +2177,7 @@ gl::Error TextureStorage11_3D::getRenderTarget(const gl::ImageIndex &index, Rend
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
rtvDesc.Texture3D.FirstWSlice = 0;
rtvDesc.Texture3D.WSize = -1;
rtvDesc.Texture3D.WSize = static_cast<UINT>(-1);
ID3D11RenderTargetView *rtv;
HRESULT result = device->CreateRenderTargetView(texture, &rtvDesc, &rtv);
......@@ -2301,7 +2301,7 @@ gl::Error TextureStorage11_3D::getSwizzleRenderTarget(int mipLevel, ID3D11Render
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
rtvDesc.Texture3D.FirstWSlice = 0;
rtvDesc.Texture3D.WSize = -1;
rtvDesc.Texture3D.WSize = static_cast<UINT>(-1);
HRESULT result = device->CreateRenderTargetView(mSwizzleTexture, &rtvDesc, &mSwizzleRenderTargets[mipLevel]);
......
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