Fixed some warnings on GCC

Mozilla has recently made using NULL as integer an error (via -Werror=conversion-null GCC flag), which caused ANGLE to no longer compile on mingw in Mozilla tree. The ones that may not be obvious are removal of some <0 checks. They are not needed because they were done on unsigned types. Author: Jacek Caban http://codereview.appspot.com/6679049 (With changes to apply to dx11proto branch) git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1464 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent dc94956c
...@@ -95,9 +95,9 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node) ...@@ -95,9 +95,9 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node)
mTemporaryIndex = i + 1; mTemporaryIndex = i + 1;
} }
return false; return false;
default:
return true;
} }
return true;
} }
bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node) bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
......
...@@ -1517,7 +1517,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params) ...@@ -1517,7 +1517,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
break; break;
case GL_TEXTURE_BINDING_2D: case GL_TEXTURE_BINDING_2D:
{ {
if (mState.activeSampler < 0 || mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1) if (mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1)
{ {
error(GL_INVALID_OPERATION); error(GL_INVALID_OPERATION);
return false; return false;
...@@ -1528,7 +1528,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params) ...@@ -1528,7 +1528,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
break; break;
case GL_TEXTURE_BINDING_CUBE_MAP: case GL_TEXTURE_BINDING_CUBE_MAP:
{ {
if (mState.activeSampler < 0 || mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1) if (mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1)
{ {
error(GL_INVALID_OPERATION); error(GL_INVALID_OPERATION);
return false; return false;
...@@ -2366,7 +2366,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid ...@@ -2366,7 +2366,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
applyShaders(); applyShaders();
applyTextures(); applyTextures();
if (!getCurrentProgramBinary()->validateSamplers(false)) if (!getCurrentProgramBinary()->validateSamplers(NULL))
{ {
return error(GL_INVALID_OPERATION); return error(GL_INVALID_OPERATION);
} }
......
...@@ -1046,7 +1046,7 @@ ID3D10Blob *ProgramBinary::compileToBinary(InfoLog &infoLog, const char *hlsl, c ...@@ -1046,7 +1046,7 @@ ID3D10Blob *ProgramBinary::compileToBinary(InfoLog &infoLog, const char *hlsl, c
return NULL; return NULL;
} }
DWORD result = NOERROR; HRESULT result = S_OK;
UINT flags = 0; UINT flags = 0;
std::string sourceText; std::string sourceText;
if (perfActive()) if (perfActive())
......
...@@ -315,7 +315,7 @@ void Shader::uncompile() ...@@ -315,7 +315,7 @@ void Shader::uncompile()
void Shader::compileToHLSL(void *compiler) void Shader::compileToHLSL(void *compiler)
{ {
// ensure we don't pass a NULL source to the compiler // ensure we don't pass a NULL source to the compiler
char *source = "\0"; const char *source = "\0";
if (mSource) if (mSource)
{ {
source = mSource; source = mSource;
...@@ -504,7 +504,7 @@ void VertexShader::uncompile() ...@@ -504,7 +504,7 @@ void VertexShader::uncompile()
// set by ParseAttributes // set by ParseAttributes
mAttributes.clear(); mAttributes.clear();
}; }
void VertexShader::compile() void VertexShader::compile()
{ {
......
...@@ -47,7 +47,7 @@ const size_t g_shaderSize[] = ...@@ -47,7 +47,7 @@ const size_t g_shaderSize[] =
namespace rx namespace rx
{ {
Blit::Blit(rx::Renderer9 *renderer) Blit::Blit(rx::Renderer9 *renderer)
: mRenderer(renderer), mQuadVertexBuffer(NULL), mQuadVertexDeclaration(NULL), mSavedRenderTarget(NULL), mSavedDepthStencil(NULL), mSavedStateBlock(NULL) : mRenderer(renderer), mQuadVertexBuffer(NULL), mQuadVertexDeclaration(NULL), mSavedStateBlock(NULL), mSavedRenderTarget(NULL), mSavedDepthStencil(NULL)
{ {
initGeometry(); initGeometry();
memset(mCompiledShaders, 0, sizeof(mCompiledShaders)); memset(mCompiledShaders, 0, sizeof(mCompiledShaders));
......
...@@ -317,7 +317,7 @@ void Image::createSurface() ...@@ -317,7 +317,7 @@ void Image::createSurface()
IDirect3DDevice9 *device = mRenderer->getDevice(); // D3D9_REPLACE IDirect3DDevice9 *device = mRenderer->getDevice(); // D3D9_REPLACE
HRESULT result = device->CreateTexture(requestWidth, requestHeight, levelToFetch + 1, NULL, d3dFormat, HRESULT result = device->CreateTexture(requestWidth, requestHeight, levelToFetch + 1, 0, d3dFormat,
poolToUse, &newTexture, NULL); poolToUse, &newTexture, NULL);
if (FAILED(result)) if (FAILED(result))
......
...@@ -178,14 +178,14 @@ void Renderer11::initializeDevice() ...@@ -178,14 +178,14 @@ void Renderer11::initializeDevice()
int Renderer11::generateConfigs(ConfigDesc **configDescList) int Renderer11::generateConfigs(ConfigDesc **configDescList)
{ {
int numRenderFormats = sizeof(RenderTargetFormats) / sizeof(RenderTargetFormats[0]); unsigned int numRenderFormats = sizeof(RenderTargetFormats) / sizeof(RenderTargetFormats[0]);
int numDepthFormats = sizeof(DepthStencilFormats) / sizeof(DepthStencilFormats[0]); unsigned int numDepthFormats = sizeof(DepthStencilFormats) / sizeof(DepthStencilFormats[0]);
(*configDescList) = new ConfigDesc[numRenderFormats * numDepthFormats]; (*configDescList) = new ConfigDesc[numRenderFormats * numDepthFormats];
int numConfigs = 0; int numConfigs = 0;
for (int formatIndex = 0; formatIndex < numRenderFormats; formatIndex++) for (unsigned int formatIndex = 0; formatIndex < numRenderFormats; formatIndex++)
{ {
for (int depthStencilIndex = 0; depthStencilIndex < numDepthFormats; depthStencilIndex++) for (unsigned int depthStencilIndex = 0; depthStencilIndex < numDepthFormats; depthStencilIndex++)
{ {
DXGI_FORMAT renderTargetFormat = RenderTargetFormats[formatIndex]; DXGI_FORMAT renderTargetFormat = RenderTargetFormats[formatIndex];
......
...@@ -385,12 +385,12 @@ int Renderer9::generateConfigs(ConfigDesc **configDescList) ...@@ -385,12 +385,12 @@ int Renderer9::generateConfigs(ConfigDesc **configDescList)
D3DDISPLAYMODE currentDisplayMode; D3DDISPLAYMODE currentDisplayMode;
mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode); mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
int numRenderFormats = sizeof(RenderTargetFormats) / sizeof(RenderTargetFormats[0]); unsigned int numRenderFormats = sizeof(RenderTargetFormats) / sizeof(RenderTargetFormats[0]);
int numDepthFormats = sizeof(DepthStencilFormats) / sizeof(DepthStencilFormats[0]); unsigned int numDepthFormats = sizeof(DepthStencilFormats) / sizeof(DepthStencilFormats[0]);
(*configDescList) = new ConfigDesc[numRenderFormats * numDepthFormats]; (*configDescList) = new ConfigDesc[numRenderFormats * numDepthFormats];
int numConfigs = 0; int numConfigs = 0;
for (int formatIndex = 0; formatIndex < numRenderFormats; formatIndex++) for (unsigned int formatIndex = 0; formatIndex < numRenderFormats; formatIndex++)
{ {
D3DFORMAT renderTargetFormat = RenderTargetFormats[formatIndex]; D3DFORMAT renderTargetFormat = RenderTargetFormats[formatIndex];
...@@ -398,7 +398,7 @@ int Renderer9::generateConfigs(ConfigDesc **configDescList) ...@@ -398,7 +398,7 @@ int Renderer9::generateConfigs(ConfigDesc **configDescList)
if (SUCCEEDED(result)) if (SUCCEEDED(result))
{ {
for (int depthStencilIndex = 0; depthStencilIndex < numDepthFormats; depthStencilIndex++) for (unsigned int depthStencilIndex = 0; depthStencilIndex < numDepthFormats; depthStencilIndex++)
{ {
D3DFORMAT depthStencilFormat = DepthStencilFormats[depthStencilIndex]; D3DFORMAT depthStencilFormat = DepthStencilFormats[depthStencilIndex];
HRESULT result = D3D_OK; HRESULT result = D3D_OK;
......
...@@ -22,11 +22,11 @@ namespace rx ...@@ -22,11 +22,11 @@ namespace rx
unsigned int TextureStorage::mCurrentTextureSerial = 1; unsigned int TextureStorage::mCurrentTextureSerial = 1;
TextureStorage::TextureStorage(Renderer9 *renderer, DWORD usage) TextureStorage::TextureStorage(Renderer9 *renderer, DWORD usage)
: mD3DUsage(usage), : mLodOffset(0),
mD3DPool(renderer->getTexturePool(usage)),
mRenderer(renderer), mRenderer(renderer),
mTextureSerial(issueTextureSerial()), mD3DUsage(usage),
mLodOffset(0) mD3DPool(renderer->getTexturePool(usage)),
mTextureSerial(issueTextureSerial())
{ {
} }
......
...@@ -58,4 +58,4 @@ inline bool isDeviceLostError(HRESULT errorCode) ...@@ -58,4 +58,4 @@ inline bool isDeviceLostError(HRESULT errorCode)
default: default:
return false; return false;
} }
}; }
...@@ -75,6 +75,6 @@ inline bool isDeviceLostError(HRESULT errorCode) ...@@ -75,6 +75,6 @@ inline bool isDeviceLostError(HRESULT errorCode)
default: default:
return false; return false;
} }
}; }
#endif // LIBGLESV2_RENDERER_RENDERER9_UTILS_H #endif // LIBGLESV2_RENDERER_RENDERER9_UTILS_H
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