Commit 9cd1915c by Geoff Lang

Fix warnings about unreferenced local variables.

BUG=skia:2272 Change-Id: Ibf03efedc662fea2a389ad2dc5af5b7b014181a8 Reviewed-on: https://chromium-review.googlesource.com/201900Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 24d8d675
......@@ -13,7 +13,7 @@
[
'NOMINMAX',
],
'msvs_disabled_warnings': [ 4100, 4127, 4189, 4239, 4244, 4245, 4512, 4702, 4530, 4718, 4189, 4267 ],
'msvs_disabled_warnings': [ 4100, 4127, 4239, 4244, 4245, 4512, 4702, 4530, 4718, 4267 ],
'msvs_system_include_dirs':
[
'<(windows_sdk_path)/Include/shared',
......
......@@ -66,7 +66,6 @@ int main(int argc, char* argv[])
ShHandle fragmentCompiler = 0;
char* buffer = 0;
size_t bufferLen = 0;
int numAttribs = 0, numUniforms = 0;
ShShaderSpec spec = SH_GLES2_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT;
......
......@@ -77,8 +77,10 @@ namespace gl
ERR("\t! Assert failed in %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
assert(expression); \
} while(0)
#define UNUSED_ASSERTION_VARIABLE(variable)
#else
#define ASSERT(expression) (void(0))
#define UNUSED_ASSERTION_VARIABLE(variable) ((void)variable)
#endif
// A macro to indicate unimplemented functionality
......
......@@ -292,6 +292,7 @@ void Surface::unsubclassWindow()
if(parentWndFunc)
{
LONG_PTR prevWndFunc = SetWindowLongPtr(mWindow, GWLP_WNDPROC, parentWndFunc);
UNUSED_ASSERTION_VARIABLE(prevWndFunc);
ASSERT(prevWndFunc == reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
}
......
......@@ -104,6 +104,7 @@ FenceSync::FenceSync(rx::Renderer *renderer, GLuint id)
LARGE_INTEGER counterFreqency = { 0 };
BOOL success = QueryPerformanceFrequency(&counterFreqency);
UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success);
mCounterFrequency = counterFreqency.QuadPart;
......@@ -143,6 +144,7 @@ GLenum FenceSync::clientWait(GLbitfield flags, GLuint64 timeout)
LARGE_INTEGER currentCounter = { 0 };
BOOL success = QueryPerformanceCounter(&currentCounter);
UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success);
LONGLONG timeoutInSeconds = static_cast<LONGLONG>(timeout) * static_cast<LONGLONG>(1000000ll);
......@@ -152,6 +154,7 @@ GLenum FenceSync::clientWait(GLbitfield flags, GLuint64 timeout)
{
Sleep(0);
BOOL success = QueryPerformanceCounter(&currentCounter);
UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success);
}
......
......@@ -388,6 +388,7 @@ ID3D11ShaderResourceView *BufferStorage11::getSRV(DXGI_FORMAT srvFormat)
bufferSRVDesc.Format = srvFormat;
HRESULT result = device->CreateShaderResourceView(buffer, &bufferSRVDesc, &bufferSRV);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mBufferResourceViews[srvFormat] = BufferSRVPair(buffer, bufferSRV);
......@@ -597,6 +598,7 @@ bool BufferStorage11::NativeBuffer11::copyFromStorage(TypedBufferStorage11 *sour
D3D11_MAPPED_SUBRESOURCE mappedResource;
HRESULT hr = context->Map(mNativeBuffer, 0, D3D11_MAP_WRITE, 0, &mappedResource);
UNUSED_ASSERTION_VARIABLE(hr);
ASSERT(SUCCEEDED(hr));
unsigned char *destPointer = static_cast<unsigned char *>(mappedResource.pData) + destOffset;
......@@ -723,6 +725,7 @@ void *BufferStorage11::NativeBuffer11::map(GLbitfield access)
UINT d3dMapFlag = ((access & GL_MAP_UNSYNCHRONIZED_BIT) != 0 ? D3D11_MAP_FLAG_DO_NOT_WAIT : 0);
HRESULT result = context->Map(mNativeBuffer, 0, d3dMapType, d3dMapFlag, &mappedResource);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
return mappedResource.pData;
......@@ -831,7 +834,6 @@ void BufferStorage11::PackStorage11::packPixels(ID3D11Texture2D *srcTexure, UINT
ASSERT(SUCCEEDED(hr));
}
ID3D11Texture2D* srcTex = NULL;
if (textureDesc.SampleDesc.Count > 1)
{
UNIMPLEMENTED();
......
......@@ -1604,6 +1604,7 @@ void Renderer11::applyUniforms(const gl::ProgramBinary &programBinary)
{
D3D11_MAPPED_SUBRESOURCE map = {0};
HRESULT result = mDeviceContext->Map(vertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mapVS = (float(*)[4])map.pData;
}
......@@ -1612,6 +1613,7 @@ void Renderer11::applyUniforms(const gl::ProgramBinary &programBinary)
{
D3D11_MAPPED_SUBRESOURCE map = {0};
HRESULT result = mDeviceContext->Map(pixelConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mapPS = (float(*)[4])map.pData;
}
......@@ -1673,6 +1675,7 @@ void Renderer11::applyUniforms(const gl::ProgramBinary &programBinary)
constantBufferDescription.StructureByteStride = 0;
HRESULT result = mDevice->CreateBuffer(&constantBufferDescription, NULL, &mDriverConstantBufferVS);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mDeviceContext->VSSetConstantBuffers(1, 1, &mDriverConstantBufferVS);
......@@ -1689,6 +1692,7 @@ void Renderer11::applyUniforms(const gl::ProgramBinary &programBinary)
constantBufferDescription.StructureByteStride = 0;
HRESULT result = mDevice->CreateBuffer(&constantBufferDescription, NULL, &mDriverConstantBufferPS);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mDeviceContext->PSSetConstantBuffers(1, 1, &mDriverConstantBufferPS);
......@@ -3448,6 +3452,7 @@ void Renderer11::packPixels(ID3D11Texture2D *readTexture, const PackPixelsParams
D3D11_MAPPED_SUBRESOURCE mapping;
HRESULT hr = mDeviceContext->Map(readTexture, 0, D3D11_MAP_READ, 0, &mapping);
UNUSED_ASSERTION_VARIABLE(hr);
ASSERT(SUCCEEDED(hr));
unsigned char *source;
......
......@@ -93,6 +93,7 @@ UniformStorage11::UniformStorage11(Renderer11 *renderer, size_t initialSize)
constantBufferDescription.StructureByteStride = 0;
HRESULT result = d3d11Device->CreateBuffer(&constantBufferDescription, NULL, &mConstantBuffer);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
}
......
......@@ -593,6 +593,7 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
if (result == DXGI_ERROR_DEVICE_REMOVED)
{
HRESULT removedReason = device->GetDeviceRemovedReason();
UNUSED_ASSERTION_VARIABLE(removedReason);
ERR("Present failed: the D3D11 device was removed: 0x%08X", removedReason);
return EGL_CONTEXT_LOST;
}
......
......@@ -117,6 +117,7 @@ inline ID3D11VertexShader *CompileVS(ID3D11Device *device, const BYTE (&byteCode
{
ID3D11VertexShader *vs = NULL;
HRESULT result = device->CreateVertexShader(byteCode, N, NULL, &vs);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
SetDebugName(vs, name);
return vs;
......@@ -127,6 +128,7 @@ inline ID3D11GeometryShader *CompileGS(ID3D11Device *device, const BYTE (&byteCo
{
ID3D11GeometryShader *gs = NULL;
HRESULT result = device->CreateGeometryShader(byteCode, N, NULL, &gs);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
SetDebugName(gs, name);
return gs;
......@@ -137,6 +139,7 @@ inline ID3D11PixelShader *CompilePS(ID3D11Device *device, const BYTE (&byteCode)
{
ID3D11PixelShader *ps = NULL;
HRESULT result = device->CreatePixelShader(byteCode, N, NULL, &ps);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
SetDebugName(ps, name);
return ps;
......
......@@ -43,6 +43,7 @@ void Fence9::set()
}
HRESULT result = mQuery->Issue(D3DISSUE_END);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
......
......@@ -240,6 +240,7 @@ void Image9::unlock()
if (mSurface)
{
HRESULT result = mSurface->UnlockRect();
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
}
......@@ -367,6 +368,7 @@ bool Image9::copyToSurface(IDirect3DSurface9 *destSurface, GLint xoffset, GLint
{
// UpdateSurface: source must be SYSTEMMEM, dest must be DEFAULT pools
HRESULT result = device->UpdateSurface(sourceSurface, &rect, destSurface, &point);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
}
......@@ -417,11 +419,8 @@ void Image9::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLs
GLsizei inputRowPitch = gl::GetRowPitch(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion, width, 1);
GLsizei inputDepthPitch = gl::GetDepthPitch(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion, width, height, 1);
GLuint outputBlockWidth = d3d9::GetBlockWidth(mD3DFormat);
GLuint outputBlockHeight = d3d9::GetBlockHeight(mD3DFormat);
ASSERT(xoffset % outputBlockWidth == 0);
ASSERT(yoffset % outputBlockHeight == 0);
ASSERT(xoffset % d3d9::GetBlockWidth(mD3DFormat) == 0);
ASSERT(yoffset % d3d9::GetBlockHeight(mD3DFormat) == 0);
LoadImageFunction loadFunction = d3d9::GetImageLoadFunction(mInternalFormat, mRenderer);
ASSERT(loadFunction != NULL);
......
......@@ -38,6 +38,7 @@ void Query9::begin()
}
HRESULT result = mQuery->Issue(D3DISSUE_BEGIN);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
......@@ -46,6 +47,7 @@ void Query9::end()
ASSERT(mQuery);
HRESULT result = mQuery->Issue(D3DISSUE_END);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mStatus = GL_FALSE;
......
......@@ -676,6 +676,7 @@ IDirect3DQuery9* Renderer9::allocateEventQuery()
if (mEventQueryPool.empty())
{
HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &query);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
else
......
......@@ -145,6 +145,7 @@ IDirect3DSurface9 *TextureStorage9_2D::getSurfaceLevel(int level, bool dirty)
if (mTexture)
{
HRESULT result = mTexture->GetSurfaceLevel(level + mTopLevel, &surface);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
// With managed textures the driver needs to be informed of updates to the lower mipmap levels
......@@ -250,6 +251,7 @@ IDirect3DSurface9 *TextureStorage9_Cube::getCubeMapSurface(GLenum faceTarget, in
{
D3DCUBEMAP_FACES face = gl_d3d9::ConvertCubeFace(faceTarget);
HRESULT result = mTexture->GetCubeMapSurface(face, level + mTopLevel, &surface);
UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
// With managed textures the driver needs to be informed of updates to the lower mipmap levels
......
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