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)
mTemporaryIndex = i + 1;
}
return false;
default:
return true;
}
return true;
}
bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
......
......@@ -1517,7 +1517,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
break;
case GL_TEXTURE_BINDING_2D:
{
if (mState.activeSampler < 0 || mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1)
if (mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1)
{
error(GL_INVALID_OPERATION);
return false;
......@@ -1528,7 +1528,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
break;
case GL_TEXTURE_BINDING_CUBE_MAP:
{
if (mState.activeSampler < 0 || mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1)
if (mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1)
{
error(GL_INVALID_OPERATION);
return false;
......@@ -2366,7 +2366,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
applyShaders();
applyTextures();
if (!getCurrentProgramBinary()->validateSamplers(false))
if (!getCurrentProgramBinary()->validateSamplers(NULL))
{
return error(GL_INVALID_OPERATION);
}
......
......@@ -1046,7 +1046,7 @@ ID3D10Blob *ProgramBinary::compileToBinary(InfoLog &infoLog, const char *hlsl, c
return NULL;
}
DWORD result = NOERROR;
HRESULT result = S_OK;
UINT flags = 0;
std::string sourceText;
if (perfActive())
......
......@@ -315,7 +315,7 @@ void Shader::uncompile()
void Shader::compileToHLSL(void *compiler)
{
// ensure we don't pass a NULL source to the compiler
char *source = "\0";
const char *source = "\0";
if (mSource)
{
source = mSource;
......@@ -504,7 +504,7 @@ void VertexShader::uncompile()
// set by ParseAttributes
mAttributes.clear();
};
}
void VertexShader::compile()
{
......
......@@ -47,7 +47,7 @@ const size_t g_shaderSize[] =
namespace rx
{
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();
memset(mCompiledShaders, 0, sizeof(mCompiledShaders));
......
......@@ -317,7 +317,7 @@ void Image::createSurface()
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);
if (FAILED(result))
......
......@@ -178,14 +178,14 @@ void Renderer11::initializeDevice()
int Renderer11::generateConfigs(ConfigDesc **configDescList)
{
int numRenderFormats = sizeof(RenderTargetFormats) / sizeof(RenderTargetFormats[0]);
int numDepthFormats = sizeof(DepthStencilFormats) / sizeof(DepthStencilFormats[0]);
unsigned int numRenderFormats = sizeof(RenderTargetFormats) / sizeof(RenderTargetFormats[0]);
unsigned int numDepthFormats = sizeof(DepthStencilFormats) / sizeof(DepthStencilFormats[0]);
(*configDescList) = new ConfigDesc[numRenderFormats * numDepthFormats];
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];
......
......@@ -385,12 +385,12 @@ int Renderer9::generateConfigs(ConfigDesc **configDescList)
D3DDISPLAYMODE currentDisplayMode;
mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
int numRenderFormats = sizeof(RenderTargetFormats) / sizeof(RenderTargetFormats[0]);
int numDepthFormats = sizeof(DepthStencilFormats) / sizeof(DepthStencilFormats[0]);
unsigned int numRenderFormats = sizeof(RenderTargetFormats) / sizeof(RenderTargetFormats[0]);
unsigned int numDepthFormats = sizeof(DepthStencilFormats) / sizeof(DepthStencilFormats[0]);
(*configDescList) = new ConfigDesc[numRenderFormats * numDepthFormats];
int numConfigs = 0;
for (int formatIndex = 0; formatIndex < numRenderFormats; formatIndex++)
for (unsigned int formatIndex = 0; formatIndex < numRenderFormats; formatIndex++)
{
D3DFORMAT renderTargetFormat = RenderTargetFormats[formatIndex];
......@@ -398,7 +398,7 @@ int Renderer9::generateConfigs(ConfigDesc **configDescList)
if (SUCCEEDED(result))
{
for (int depthStencilIndex = 0; depthStencilIndex < numDepthFormats; depthStencilIndex++)
for (unsigned int depthStencilIndex = 0; depthStencilIndex < numDepthFormats; depthStencilIndex++)
{
D3DFORMAT depthStencilFormat = DepthStencilFormats[depthStencilIndex];
HRESULT result = D3D_OK;
......
......@@ -22,11 +22,11 @@ namespace rx
unsigned int TextureStorage::mCurrentTextureSerial = 1;
TextureStorage::TextureStorage(Renderer9 *renderer, DWORD usage)
: mD3DUsage(usage),
mD3DPool(renderer->getTexturePool(usage)),
: mLodOffset(0),
mRenderer(renderer),
mTextureSerial(issueTextureSerial()),
mLodOffset(0)
mD3DUsage(usage),
mD3DPool(renderer->getTexturePool(usage)),
mTextureSerial(issueTextureSerial())
{
}
......
......@@ -58,4 +58,4 @@ inline bool isDeviceLostError(HRESULT errorCode)
default:
return false;
}
};
}
......@@ -75,6 +75,6 @@ inline bool isDeviceLostError(HRESULT errorCode)
default:
return false;
}
};
}
#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