From 6cd1f70bb6ee86487085b70415b25034fb1cf157 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 13 Mar 2015 10:16:19 +0000 Subject: [PATCH] Fix several warnings for compiling on VS2015 * Note at the time of committing there are still some warnings in MS headers that you might need to suppress in a couple of files. * 3rd party code just has the warnings suppressed for ease of merging. * The majority of warning fixes were for local variables shadowing other locals, function parameters, or members. In most cases they weren't a problem, but in some cases it was potentially dangerous! --- renderdoc/3rdparty/jpeg-compressor/jpgd.cpp | 4 +- renderdoc/3rdparty/stb/stb_impl.c | 4 +- renderdoc/common/common.cpp | 4 +- renderdoc/core/core.cpp | 2 +- renderdoc/core/remote_access.cpp | 2 +- renderdoc/core/remote_replay.cpp | 15 +- renderdoc/driver/d3d11/d3d11_analyse.cpp | 218 +++++++++--------- renderdoc/driver/d3d11/d3d11_common.cpp | 8 +- renderdoc/driver/d3d11/d3d11_context.cpp | 16 +- renderdoc/driver/d3d11/d3d11_context_wrap.cpp | 54 +++-- renderdoc/driver/d3d11/d3d11_debug.cpp | 34 ++- renderdoc/driver/d3d11/d3d11_device.cpp | 44 ++-- renderdoc/driver/d3d11/d3d11_device_wrap.cpp | 34 +-- renderdoc/driver/d3d11/shaders/dxbc_debug.cpp | 56 ++--- .../driver/d3d11/shaders/dxbc_disassemble.cpp | 8 +- .../driver/d3d11/shaders/dxbc_inspect.cpp | 87 ++++--- renderdoc/driver/gl/gl_debug.cpp | 24 +- renderdoc/driver/gl/gl_driver.cpp | 8 +- renderdoc/driver/gl/gl_replay_win32.cpp | 4 +- renderdoc/driver/gl/gl_shader_refl.cpp | 12 +- .../driver/gl/wrappers/gl_draw_funcs.cpp | 208 ++++++++--------- .../driver/gl/wrappers/gl_query_funcs.cpp | 2 +- renderdoc/hooks/gl_win32_hooks.cpp | 4 +- renderdoc/maths/matrix.cpp | 6 +- renderdoc/maths/vec.h | 2 +- renderdoc/os/win32/win32_hook.cpp | 8 +- renderdoc/os/win32/win32_network.cpp | 6 +- renderdoc/serialise/serialiser.cpp | 9 +- .../PipelineState/GLPipelineStateViewer.cs | 2 +- renderdocui/Windows/TextureViewer.cs | 12 +- 30 files changed, 443 insertions(+), 454 deletions(-) diff --git a/renderdoc/3rdparty/jpeg-compressor/jpgd.cpp b/renderdoc/3rdparty/jpeg-compressor/jpgd.cpp index 8c6b5ca56..44d3b2390 100644 --- a/renderdoc/3rdparty/jpeg-compressor/jpgd.cpp +++ b/renderdoc/3rdparty/jpeg-compressor/jpgd.cpp @@ -2,7 +2,8 @@ // Public domain, Rich Geldreich // Alex Evans: Linear memory allocator (taken from jpge.h). // v1.04, May. 19, 2012: Code tweaks to fix VS2008 static code analysis warnings (all looked harmless) -// changes from upstream, May. 5 2014: Fix harmless VC++ warning C4703 +// changes from upstream, May. 5 2014: Fix harmless VC++ warning C4703 +// Feb. 24 2015: Suppress VC++ warning C4458 without clear fix // // Supports progressive and baseline sequential JPEG image files, and the most common chroma subsampling factors: Y, H1V1, H2V1, H1V2, and H2V2. // @@ -18,6 +19,7 @@ #ifdef _MSC_VER #pragma warning (disable : 4611) // warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable +#pragma warning (disable : 4458) // warning C4458: declaration of 'm_block_y_mcu' hides class member in decode_scan() #endif // Set to 1 to enable freq. domain chroma upsampling on images using H2V2 subsampling (0=faster nearest neighbor sampling). diff --git a/renderdoc/3rdparty/stb/stb_impl.c b/renderdoc/3rdparty/stb/stb_impl.c index 529ef5922..210370bd7 100644 --- a/renderdoc/3rdparty/stb/stb_impl.c +++ b/renderdoc/3rdparty/stb/stb_impl.c @@ -7,7 +7,9 @@ #define STB_TRUETYPE_IMPLEMENTATION -#pragma warning(disable:4996) +#pragma warning(disable:4996) // function unsafe (fopen vs fopen_s) +#pragma warning(disable:4456) // declaration hides previous local declaration +#pragma warning(disable:4457) // declaration hides function parameter #include "stb_image.h" #include "stb_image_write.h" diff --git a/renderdoc/common/common.cpp b/renderdoc/common/common.cpp index 9b46a4087..786fd9ab1 100644 --- a/renderdoc/common/common.cpp +++ b/renderdoc/common/common.cpp @@ -132,8 +132,8 @@ bool Vec16NotEqual(void *a, void *b) bool FindDiffRange(void *a, void *b, size_t bufSize, size_t &diffStart, size_t &diffEnd) { - RDCASSERT(((unsigned long)a)%16 == 0); - RDCASSERT(((unsigned long)b)%16 == 0); + RDCASSERT(uintptr_t(a)%16 == 0); + RDCASSERT(uintptr_t(b)%16 == 0); diffStart = bufSize+1; diffEnd = 0; diff --git a/renderdoc/core/core.cpp b/renderdoc/core/core.cpp index b6c2ade5c..7cc7ed7f5 100644 --- a/renderdoc/core/core.cpp +++ b/renderdoc/core/core.cpp @@ -463,7 +463,7 @@ Serialiser *RenderDoc::OpenWriteSerialiser(uint32_t frameNum, RDCInitParams *par chunkSerialiser->SerialiseString("DriverName", m_CurrentDriverName); { - ScopedContext scope(chunkSerialiser, NULL, "Driver Specific", DRIVER_INIT_PARAMS, false); + ScopedContext driverparams(chunkSerialiser, NULL, "Driver Specific", DRIVER_INIT_PARAMS, false); params->m_pSerialiser = chunkSerialiser; params->m_State = WRITING; diff --git a/renderdoc/core/remote_access.cpp b/renderdoc/core/remote_access.cpp index 938202f6d..ac18a9c85 100644 --- a/renderdoc/core/remote_access.cpp +++ b/renderdoc/core/remote_access.cpp @@ -174,7 +174,7 @@ void RenderDoc::RemoteAccessClientThread(void *s) } else if(type == ePacket_CopyCapture) { - vector caps = RenderDoc::Inst().GetCaptures(); + caps = RenderDoc::Inst().GetCaptures(); uint32_t id = 0; recvser->Serialise("", id); diff --git a/renderdoc/core/remote_replay.cpp b/renderdoc/core/remote_replay.cpp index b948b5036..a0b42b1a5 100644 --- a/renderdoc/core/remote_replay.cpp +++ b/renderdoc/core/remote_replay.cpp @@ -144,22 +144,22 @@ void RenderDoc::BecomeReplayHost(volatile bool32 &killReplay) string dummy, dummy2; FileIO::GetDefaultFiles("remotecopy", cap_file, dummy, dummy2); - Serialiser *ser = NULL; + Serialiser *fileRecv = NULL; - if(!RecvChunkedFile(client, ePacket_CopyCapture, cap_file.c_str(), ser, NULL)) + if(!RecvChunkedFile(client, ePacket_CopyCapture, cap_file.c_str(), fileRecv, NULL)) { FileIO::Delete(cap_file.c_str()); RDCERR("Network error receiving file"); - SAFE_DELETE(ser); + SAFE_DELETE(fileRecv); SAFE_DELETE(client); continue; } RDCLOG("File received."); - SAFE_DELETE(ser); + SAFE_DELETE(fileRecv); RDCDriver driverType = RDC_Unknown; string driverName = ""; @@ -183,7 +183,6 @@ void RenderDoc::BecomeReplayHost(volatile bool32 &killReplay) if(status != eReplayCreate_Success || driver == NULL) { RDCERR("Failed to create remote driver for driver type %d name %s", driverType, driverName.c_str()); - SAFE_DELETE(ser); SAFE_DELETE(client); continue; } @@ -335,12 +334,12 @@ struct RemoteRenderer PacketType type = ePacket_Noop; while(m_Socket) { - Serialiser *ser; - GetPacket(type, &ser); + Serialiser *progressSer; + GetPacket(type, &progressSer); if(!m_Socket || type != ePacket_LogOpenProgress) break; - ser->Serialise("", *progress); + progressSer->Serialise("", *progress); RDCLOG("% 3.0f%%...", (*progress)*100.0f); } diff --git a/renderdoc/driver/d3d11/d3d11_analyse.cpp b/renderdoc/driver/d3d11/d3d11_analyse.cpp index 3e8ebb195..2e9bb4618 100644 --- a/renderdoc/driver/d3d11/d3d11_analyse.cpp +++ b/renderdoc/driver/d3d11/d3d11_analyse.cpp @@ -300,21 +300,21 @@ void D3D11DebugManager::FillCBufferVariables(const string &prefix, size_t &offse (*out)[outIdx+r].isStruct = false; (*out)[outIdx+r].columns = regLen; - size_t dataOffset = (vec+r*rowCopy)*16; + size_t rowDataOffset = (vec+r*rowCopy)*16; - if(dataOffset < data.size()) + if(rowDataOffset < data.size()) { - const byte *d = &data[dataOffset]; + const byte *d = &data[rowDataOffset]; - memcpy(&((*out)[outIdx+r].value.uv[0]), d, RDCMIN(data.size()-dataOffset, elemByteSize*rowCopy*regLen)); + memcpy(&((*out)[outIdx+r].value.uv[0]), d, RDCMIN(data.size()- rowDataOffset, elemByteSize*rowCopy*regLen)); if(!flatten && columnMajor) { ShaderVariable tmp = (*out)[outIdx]; // transpose - for(size_t r=0; r < rows; r++) - for(size_t c=0; c < cols; c++) - (*out)[outIdx].value.uv[r*cols+c] = tmp.value.uv[c*rows+r]; + for(size_t ri=0; ri < rows; ri++) + for(size_t ci=0; ci < cols; ci++) + (*out)[outIdx].value.uv[ri*cols+ci] = tmp.value.uv[ci*rows+ri]; } } } @@ -2543,17 +2543,17 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver SAFE_RELEASE(dsView); - D3D11_DEPTH_STENCIL_DESC desc; + D3D11_DEPTH_STENCIL_DESC dsDesc; - desc.BackFace.StencilFailOp = desc.BackFace.StencilPassOp = desc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP; - desc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS; - desc.FrontFace.StencilFailOp = desc.FrontFace.StencilPassOp = desc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP; - desc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS; - desc.DepthEnable = TRUE; - desc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; - desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; - desc.StencilEnable = FALSE; - desc.StencilReadMask = desc.StencilWriteMask = 0xff; + dsDesc.BackFace.StencilFailOp = dsDesc.BackFace.StencilPassOp = dsDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP; + dsDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS; + dsDesc.FrontFace.StencilFailOp = dsDesc.FrontFace.StencilPassOp = dsDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP; + dsDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS; + dsDesc.DepthEnable = TRUE; + dsDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; + dsDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; + dsDesc.StencilEnable = FALSE; + dsDesc.StencilReadMask = dsDesc.StencilWriteMask = 0xff; if(overlay == eTexOverlay_NaN || overlay == eTexOverlay_Clipping) @@ -2564,11 +2564,11 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver { m_pImmediateContext->PSSetShader(m_DebugRender.OverlayPS, NULL, 0); - desc.DepthEnable = FALSE; - desc.StencilEnable = FALSE; + dsDesc.DepthEnable = FALSE; + dsDesc.StencilEnable = FALSE; ID3D11DepthStencilState *os = NULL; - hr = m_pDevice->CreateDepthStencilState(&desc, &os); + hr = m_pDevice->CreateDepthStencilState(&dsDesc, &os); if(FAILED(hr)) { RDCERR("Failed to create drawcall depth stencil state %08x", hr); @@ -2581,20 +2581,20 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver ID3D11RasterizerState *rs = NULL; { - D3D11_RASTERIZER_DESC desc; + D3D11_RASTERIZER_DESC rdesc; - desc.FillMode = D3D11_FILL_SOLID; - desc.CullMode = D3D11_CULL_NONE; - desc.FrontCounterClockwise = FALSE; - desc.DepthBias = D3D11_DEFAULT_DEPTH_BIAS; - desc.DepthBiasClamp = D3D11_DEFAULT_DEPTH_BIAS_CLAMP; - desc.SlopeScaledDepthBias = D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; - desc.DepthClipEnable = FALSE; - desc.ScissorEnable = FALSE; - desc.MultisampleEnable = FALSE; - desc.AntialiasedLineEnable = FALSE; + rdesc.FillMode = D3D11_FILL_SOLID; + rdesc.CullMode = D3D11_CULL_NONE; + rdesc.FrontCounterClockwise = FALSE; + rdesc.DepthBias = D3D11_DEFAULT_DEPTH_BIAS; + rdesc.DepthBiasClamp = D3D11_DEFAULT_DEPTH_BIAS_CLAMP; + rdesc.SlopeScaledDepthBias = D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + rdesc.DepthClipEnable = FALSE; + rdesc.ScissorEnable = FALSE; + rdesc.MultisampleEnable = FALSE; + rdesc.AntialiasedLineEnable = FALSE; - hr = m_pDevice->CreateRasterizerState(&desc, &rs); + hr = m_pDevice->CreateRasterizerState(&rdesc, &rs); if(FAILED(hr)) { RDCERR("Failed to create drawcall rast state %08x", hr); @@ -2621,11 +2621,11 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver { m_pImmediateContext->PSSetShader(m_DebugRender.OverlayPS, NULL, 0); - desc.DepthEnable = FALSE; - desc.StencilEnable = FALSE; + dsDesc.DepthEnable = FALSE; + dsDesc.StencilEnable = FALSE; ID3D11DepthStencilState *os = NULL; - hr = m_pDevice->CreateDepthStencilState(&desc, &os); + hr = m_pDevice->CreateDepthStencilState(&dsDesc, &os); if(FAILED(hr)) { RDCERR("Failed to create drawcall depth stencil state %08x", hr); @@ -2652,29 +2652,29 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver } { - D3D11_RASTERIZER_DESC desc; + D3D11_RASTERIZER_DESC rdesc; - desc.FillMode = D3D11_FILL_SOLID; - desc.CullMode = D3D11_CULL_NONE; - desc.FrontCounterClockwise = FALSE; - desc.DepthBias = D3D11_DEFAULT_DEPTH_BIAS; - desc.DepthBiasClamp = D3D11_DEFAULT_DEPTH_BIAS_CLAMP; - desc.SlopeScaledDepthBias = D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; - desc.DepthClipEnable = FALSE; - desc.ScissorEnable = FALSE; - desc.MultisampleEnable = FALSE; - desc.AntialiasedLineEnable = FALSE; + rdesc.FillMode = D3D11_FILL_SOLID; + rdesc.CullMode = D3D11_CULL_NONE; + rdesc.FrontCounterClockwise = FALSE; + rdesc.DepthBias = D3D11_DEFAULT_DEPTH_BIAS; + rdesc.DepthBiasClamp = D3D11_DEFAULT_DEPTH_BIAS_CLAMP; + rdesc.SlopeScaledDepthBias = D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + rdesc.DepthClipEnable = FALSE; + rdesc.ScissorEnable = FALSE; + rdesc.MultisampleEnable = FALSE; + rdesc.AntialiasedLineEnable = FALSE; - hr = m_pDevice->CreateRasterizerState(&desc, &rs); + hr = m_pDevice->CreateRasterizerState(&rdesc, &rs); if(FAILED(hr)) { RDCERR("Failed to create drawcall rast state %08x", hr); return m_OverlayResourceId; } - desc.CullMode = origdesc.CullMode; + rdesc.CullMode = origdesc.CullMode; - hr = m_pDevice->CreateRasterizerState(&desc, &rsCull); + hr = m_pDevice->CreateRasterizerState(&rdesc, &rsCull); if(FAILED(hr)) { RDCERR("Failed to create drawcall rast state %08x", hr); @@ -2734,11 +2734,11 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver SAFE_RELEASE(rs); } - desc.DepthEnable = FALSE; - desc.StencilEnable = FALSE; + dsDesc.DepthEnable = FALSE; + dsDesc.StencilEnable = FALSE; ID3D11DepthStencilState *os = NULL; - hr = m_pDevice->CreateDepthStencilState(&desc, &os); + hr = m_pDevice->CreateDepthStencilState(&dsDesc, &os); if(FAILED(hr)) { RDCERR("Failed to create drawcall depth stencil state %08x", hr); @@ -2752,29 +2752,29 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver ID3D11RasterizerState *rs = NULL; ID3D11RasterizerState *rs2 = NULL; { - D3D11_RASTERIZER_DESC desc; + D3D11_RASTERIZER_DESC rdesc; - desc.FillMode = D3D11_FILL_SOLID; - desc.CullMode = D3D11_CULL_NONE; - desc.FrontCounterClockwise = FALSE; - desc.DepthBias = D3D11_DEFAULT_DEPTH_BIAS; - desc.DepthBiasClamp = D3D11_DEFAULT_DEPTH_BIAS_CLAMP; - desc.SlopeScaledDepthBias = D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; - desc.DepthClipEnable = FALSE; - desc.ScissorEnable = FALSE; - desc.MultisampleEnable = FALSE; - desc.AntialiasedLineEnable = FALSE; + rdesc.FillMode = D3D11_FILL_SOLID; + rdesc.CullMode = D3D11_CULL_NONE; + rdesc.FrontCounterClockwise = FALSE; + rdesc.DepthBias = D3D11_DEFAULT_DEPTH_BIAS; + rdesc.DepthBiasClamp = D3D11_DEFAULT_DEPTH_BIAS_CLAMP; + rdesc.SlopeScaledDepthBias = D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + rdesc.DepthClipEnable = FALSE; + rdesc.ScissorEnable = FALSE; + rdesc.MultisampleEnable = FALSE; + rdesc.AntialiasedLineEnable = FALSE; - hr = m_pDevice->CreateRasterizerState(&desc, &rs); + hr = m_pDevice->CreateRasterizerState(&rdesc, &rs); if(FAILED(hr)) { RDCERR("Failed to create drawcall rast state %08x", hr); return m_OverlayResourceId; } - desc.ScissorEnable = TRUE; + rdesc.ScissorEnable = TRUE; - hr = m_pDevice->CreateRasterizerState(&desc, &rs2); + hr = m_pDevice->CreateRasterizerState(&rdesc, &rs2); if(FAILED(hr)) { RDCERR("Failed to create drawcall rast state %08x", hr); @@ -2814,10 +2814,10 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver { m_pImmediateContext->PSSetShader(m_DebugRender.OverlayPS, NULL, 0); - desc.DepthEnable = FALSE; + dsDesc.DepthEnable = FALSE; ID3D11DepthStencilState *os = NULL; - hr = m_pDevice->CreateDepthStencilState(&desc, &os); + hr = m_pDevice->CreateDepthStencilState(&dsDesc, &os); if(FAILED(hr)) { RDCERR("Failed to create wireframe depth state %08x", hr); @@ -2830,34 +2830,34 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver ID3D11RasterizerState *rs = NULL; { - D3D11_RASTERIZER_DESC desc; + D3D11_RASTERIZER_DESC rdesc; m_pImmediateContext->RSGetState(&rs); if(rs) { - rs->GetDesc(&desc); + rs->GetDesc(&rdesc); } else { - desc.FillMode = D3D11_FILL_SOLID; - desc.CullMode = D3D11_CULL_BACK; - desc.FrontCounterClockwise = FALSE; - desc.DepthBias = D3D11_DEFAULT_DEPTH_BIAS; - desc.DepthBiasClamp = D3D11_DEFAULT_DEPTH_BIAS_CLAMP; - desc.SlopeScaledDepthBias = D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; - desc.DepthClipEnable = TRUE; - desc.ScissorEnable = FALSE; - desc.MultisampleEnable = FALSE; - desc.AntialiasedLineEnable = FALSE; + rdesc.FillMode = D3D11_FILL_SOLID; + rdesc.CullMode = D3D11_CULL_BACK; + rdesc.FrontCounterClockwise = FALSE; + rdesc.DepthBias = D3D11_DEFAULT_DEPTH_BIAS; + rdesc.DepthBiasClamp = D3D11_DEFAULT_DEPTH_BIAS_CLAMP; + rdesc.SlopeScaledDepthBias = D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + rdesc.DepthClipEnable = TRUE; + rdesc.ScissorEnable = FALSE; + rdesc.MultisampleEnable = FALSE; + rdesc.AntialiasedLineEnable = FALSE; } SAFE_RELEASE(rs); - desc.FillMode = D3D11_FILL_WIREFRAME; - desc.CullMode = D3D11_CULL_NONE; + rdesc.FillMode = D3D11_FILL_WIREFRAME; + rdesc.CullMode = D3D11_CULL_NONE; - hr = m_pDevice->CreateRasterizerState(&desc, &rs); + hr = m_pDevice->CreateRasterizerState(&rdesc, &rs); if(FAILED(hr)) { RDCERR("Failed to create wireframe rast state %08x", hr); @@ -2926,25 +2926,25 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver if(dim == D3D11_RESOURCE_DIMENSION_TEXTURE1D) { - D3D11_TEXTURE1D_DESC desc; - ((ID3D11Texture1D *)res)->GetDesc(&desc); + D3D11_TEXTURE1D_DESC texdesc; + ((ID3D11Texture1D *)res)->GetDesc(&texdesc); - width = desc.Width>>1; + width = texdesc.Width>>1; height = 1; } else if(dim == D3D11_RESOURCE_DIMENSION_TEXTURE2D) { - D3D11_TEXTURE2D_DESC desc; - ((ID3D11Texture2D *)res)->GetDesc(&desc); + D3D11_TEXTURE2D_DESC texdesc; + ((ID3D11Texture2D *)res)->GetDesc(&texdesc); - width = desc.Width>>1; - height = desc.Height>>1; + width = texdesc.Width>>1; + height = texdesc.Height>>1; - if(desc.SampleDesc.Count > 1) + if(texdesc.SampleDesc.Count > 1) { forceDepth = true; - depthWidth = desc.Width; - depthHeight = desc.Height; + depthWidth = texdesc.Width; + depthHeight = texdesc.Height; } } else @@ -3116,12 +3116,12 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver { ID3D11DepthStencilState *os = NULL; - D3D11_DEPTH_STENCIL_DESC d = desc; + D3D11_DEPTH_STENCIL_DESC d = dsDesc; if(overlay == eTexOverlay_DepthBoth) { - desc.DepthEnable = d.DepthEnable = TRUE; - desc.StencilEnable = d.StencilEnable = FALSE; + dsDesc.DepthEnable = d.DepthEnable = TRUE; + dsDesc.StencilEnable = d.StencilEnable = FALSE; switch(cur.DepthFunc) { @@ -3156,13 +3156,13 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver } else if(overlay == eTexOverlay_StencilBoth) { - desc.DepthEnable = d.DepthEnable = FALSE; - desc.StencilEnable = d.StencilEnable = TRUE; + dsDesc.DepthEnable = d.DepthEnable = FALSE; + dsDesc.StencilEnable = d.StencilEnable = TRUE; d.FrontFace = cur.FrontFace; d.BackFace = cur.BackFace; - desc.StencilReadMask = d.StencilReadMask = cur.StencilReadMask; - desc.StencilWriteMask = d.StencilWriteMask = cur.StencilWriteMask; + dsDesc.StencilReadMask = d.StencilReadMask = cur.StencilReadMask; + dsDesc.StencilWriteMask = d.StencilWriteMask = cur.StencilWriteMask; switch(cur.FrontFace.StencilFunc) { @@ -3253,7 +3253,7 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver m_pImmediateContext->CopyResource(renderDepth, preDrawDepth); - d = desc; + d = dsDesc; if(overlay == eTexOverlay_DepthBoth) { @@ -3360,7 +3360,7 @@ void D3D11DebugManager::PixelHistoryCopyPixel(CopyPixelParams &p, uint32_t x, ui m_pImmediateContext->CSGetShaderResources(0, ARRAY_COUNT(curCSSRVs), curCSSRVs); m_pImmediateContext->CSGetUnorderedAccessViews(0, ARRAY_COUNT(curCSUAV), curCSUAV); - uint32_t storexyData[4] = { x, y, p.depthcopy, p.srv[1] != NULL }; + uint32_t storexyData[4] = { x, y, uint32_t(p.depthcopy), uint32_t(p.srv[1] != NULL) }; D3D11_MAPPED_SUBRESOURCE mapped; m_pImmediateContext->Map(p.storexyCBuf, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped); @@ -3667,18 +3667,16 @@ vector D3D11DebugManager::PixelHistory(uint32_t frameID, vect uint32_t srcxyData[8] = { x, y, sampleIdx, - multisampled, + uint32_t(multisampled), - floatTex, - uintTex, - intTex, + uint32_t(floatTex), + uint32_t(uintTex), + uint32_t(intTex), 0, }; - D3D11_SUBRESOURCE_DATA data = { srcxyData, sizeof(srcxyData), sizeof(srcxyData) }; - - ID3D11Buffer *srcxyCBuf = MakeCBuffer(data.SysMemPitch); - ID3D11Buffer *storexyCBuf = MakeCBuffer(data.SysMemPitch); + ID3D11Buffer *srcxyCBuf = MakeCBuffer(sizeof(srcxyData)); + ID3D11Buffer *storexyCBuf = MakeCBuffer(sizeof(srcxyData)); FillCBuffer(srcxyCBuf, (float *)srcxyData, sizeof(srcxyData)); diff --git a/renderdoc/driver/d3d11/d3d11_common.cpp b/renderdoc/driver/d3d11/d3d11_common.cpp index 2b5b53d28..e516e6feb 100644 --- a/renderdoc/driver/d3d11/d3d11_common.cpp +++ b/renderdoc/driver/d3d11/d3d11_common.cpp @@ -1308,7 +1308,7 @@ void Serialiser::Serialise(const char *name, D3D11_BLEND_DESC &el) Serialise("IndependentBlendEnable", el.IndependentBlendEnable); for(int i=0; i < 8; i++) { - ScopedContext scope(this, this, name, "D3D11_RENDER_TARGET_BLEND_DESC", 0, true); + ScopedContext targetscope(this, this, name, "D3D11_RENDER_TARGET_BLEND_DESC", 0, true); bool enable = el.RenderTarget[i].BlendEnable == TRUE; Serialise("BlendEnable", enable); @@ -1340,14 +1340,14 @@ void Serialiser::Serialise(const char *name, D3D11_DEPTH_STENCIL_DESC &el) Serialise("StencilWriteMask", el.StencilWriteMask); { - ScopedContext scope(this, this, name, "D3D11_DEPTH_STENCILOP_DESC", 0, true); + ScopedContext opscope(this, this, name, "D3D11_DEPTH_STENCILOP_DESC", 0, true); Serialise("FrontFace.StencilFailOp", el.FrontFace.StencilFailOp); Serialise("FrontFace.StencilDepthFailOp", el.FrontFace.StencilDepthFailOp); Serialise("FrontFace.StencilPassOp", el.FrontFace.StencilPassOp); Serialise("FrontFace.StencilFunc", el.FrontFace.StencilFunc); } { - ScopedContext scope(this, this, name, "D3D11_DEPTH_STENCILOP_DESC", 0, true); + ScopedContext opscope(this, this, name, "D3D11_DEPTH_STENCILOP_DESC", 0, true); Serialise("BackFace.StencilFailOp", el.BackFace.StencilFailOp); Serialise("BackFace.StencilDepthFailOp", el.BackFace.StencilDepthFailOp); Serialise("BackFace.StencilPassOp", el.BackFace.StencilPassOp); @@ -1494,7 +1494,7 @@ void Serialiser::Serialise(const char *name, D3D11_BLEND_DESC1 &el) Serialise("IndependentBlendEnable", el.IndependentBlendEnable); for(int i=0; i < 8; i++) { - ScopedContext scope(this, this, name, "D3D11_RENDER_TARGET_BLEND_DESC1", 0, true); + ScopedContext targetscope(this, this, name, "D3D11_RENDER_TARGET_BLEND_DESC1", 0, true); bool enable = el.RenderTarget[i].BlendEnable == TRUE; Serialise("BlendEnable", enable); diff --git a/renderdoc/driver/d3d11/d3d11_context.cpp b/renderdoc/driver/d3d11/d3d11_context.cpp index 61422ba4c..386c1ad67 100644 --- a/renderdoc/driver/d3d11/d3d11_context.cpp +++ b/renderdoc/driver/d3d11/d3d11_context.cpp @@ -1206,8 +1206,8 @@ void WrappedID3D11DeviceContext::ReplayLog(LogState readType, uint32_t startEven ClearMaps(); for(size_t i=0; i < m_pDevice->GetNumDeferredContexts(); i++) { - WrappedID3D11DeviceContext *context = m_pDevice->GetDeferredContext(i); - context->ClearMaps(); + WrappedID3D11DeviceContext *defcontext = m_pDevice->GetDeferredContext(i); + defcontext->ClearMaps(); } } @@ -1223,15 +1223,15 @@ void WrappedID3D11DeviceContext::ReplayLog(LogState readType, uint32_t startEven uint64_t offset = m_pSerialiser->GetOffset(); - D3D11ChunkType context = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, 1, false); + D3D11ChunkType chunktype = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, 1, false); - ProcessChunk(offset, context, false); + ProcessChunk(offset, chunktype, false); RenderDoc::Inst().SetProgress(FileInitialRead, float(offset)/float(m_pSerialiser->GetSize())); // for now just abort after capture scope. Really we'd need to support multiple frames // but for now this will do. - if(context == CONTEXT_CAPTURE_FOOTER) + if(chunktype == CONTEXT_CAPTURE_FOOTER) break; m_CurEventID++; @@ -1256,12 +1256,12 @@ void WrappedID3D11DeviceContext::ReplayLog(LogState readType, uint32_t startEven for(auto it = m_ResourceUses.begin(); it != m_ResourceUses.end(); ++it) { - ResourceId id = m_pDevice->GetResourceManager()->GetOriginalID(it->first); + ResourceId resid = m_pDevice->GetResourceManager()->GetOriginalID(it->first); - if(m_pDevice->GetResourceManager()->GetInitialContents(id).resource == NULL) + if(m_pDevice->GetResourceManager()->GetInitialContents(resid).resource == NULL) continue; - RDCDEBUG("Resource %llu", id); + RDCDEBUG("Resource %llu", resid); if(it->second.empty()) { RDCDEBUG("Never used!"); diff --git a/renderdoc/driver/d3d11/d3d11_context_wrap.cpp b/renderdoc/driver/d3d11/d3d11_context_wrap.cpp index 8cd91b6f8..2b4b7d117 100644 --- a/renderdoc/driver/d3d11/d3d11_context_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_context_wrap.cpp @@ -801,11 +801,11 @@ bool WrappedID3D11DeviceContext::Serialise_VSSetShader(ID3D11VertexShader *pShad for(UINT i=0; i < NumClassInstances; i++) Instances[i] = UNWRAP(WrappedID3D11ClassInstance, Instances[i]); - ID3D11DeviceChild *pShader = NULL; + ID3D11DeviceChild *pSH = NULL; if(m_pDevice->GetResourceManager()->HasLiveResource(Shader)) - pShader = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); - m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->VS.Shader, pShader); - m_pRealContext->VSSetShader(UNWRAP(WrappedID3D11Shader, pShader), Instances, NumClassInstances); + pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); + m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->VS.Shader, pSH); + m_pRealContext->VSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, NumClassInstances); VerifyState(); } @@ -1162,11 +1162,11 @@ bool WrappedID3D11DeviceContext::Serialise_HSSetShader(ID3D11HullShader *pShader for(UINT i=0; i < NumClassInstances; i++) Instances[i] = UNWRAP(WrappedID3D11ClassInstance, Instances[i]); - ID3D11DeviceChild *pShader = NULL; + ID3D11DeviceChild *pSH = NULL; if(m_pDevice->GetResourceManager()->HasLiveResource(Shader)) - pShader = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); - m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->HS.Shader, pShader); - m_pRealContext->HSSetShader(UNWRAP(WrappedID3D11Shader, pShader), Instances, NumClassInstances); + pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); + m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->HS.Shader, pSH); + m_pRealContext->HSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, NumClassInstances); VerifyState(); } @@ -1522,11 +1522,11 @@ bool WrappedID3D11DeviceContext::Serialise_DSSetShader(ID3D11DomainShader *pShad for(UINT i=0; i < NumClassInstances; i++) Instances[i] = UNWRAP(WrappedID3D11ClassInstance, Instances[i]); - ID3D11DeviceChild *pShader = NULL; + ID3D11DeviceChild *pSH = NULL; if(m_pDevice->GetResourceManager()->HasLiveResource(Shader)) - pShader = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); - m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->DS.Shader, pShader); - m_pRealContext->DSSetShader(UNWRAP(WrappedID3D11Shader, pShader), Instances, NumClassInstances); + pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); + m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->DS.Shader, pSH); + m_pRealContext->DSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, NumClassInstances); VerifyState(); } @@ -1882,11 +1882,11 @@ bool WrappedID3D11DeviceContext::Serialise_GSSetShader(ID3D11GeometryShader *pSh for(UINT i=0; i < NumClassInstances; i++) Instances[i] = UNWRAP(WrappedID3D11ClassInstance, Instances[i]); - ID3D11DeviceChild *pShader = NULL; + ID3D11DeviceChild *pSH = NULL; if(m_pDevice->GetResourceManager()->HasLiveResource(Shader)) - pShader = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); - m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->GS.Shader, pShader); - m_pRealContext->GSSetShader(UNWRAP(WrappedID3D11Shader, pShader), Instances, NumClassInstances); + pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); + m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->GS.Shader, pSH); + m_pRealContext->GSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, NumClassInstances); VerifyState(); } @@ -2651,11 +2651,11 @@ bool WrappedID3D11DeviceContext::Serialise_PSSetShader(ID3D11PixelShader *pShade for(UINT i=0; i < NumClassInstances; i++) Instances[i] = UNWRAP(WrappedID3D11ClassInstance, Instances[i]); - ID3D11DeviceChild *pShader = NULL; + ID3D11DeviceChild *pSH = NULL; if(m_pDevice->GetResourceManager()->HasLiveResource(Shader)) - pShader = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); - m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->PS.Shader, pShader); - m_pRealContext->PSSetShader(UNWRAP(WrappedID3D11Shader, pShader), Instances, NumClassInstances); + pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); + m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->PS.Shader, pSH); + m_pRealContext->PSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, NumClassInstances); VerifyState(); } @@ -3389,7 +3389,7 @@ void WrappedID3D11DeviceContext::Serialise_DebugMessages() for(uint32_t i=0; i < NumMessages; i++) { - ScopedContext scope(m_pSerialiser, m_pDebugSerialiser, "DebugMessage", "DebugMessage", 0, false); + ScopedContext msgscope(m_pSerialiser, m_pDebugSerialiser, "DebugMessage", "DebugMessage", 0, false); string desc; if(m_State >= WRITING) @@ -3781,8 +3781,6 @@ bool WrappedID3D11DeviceContext::Serialise_DrawIndexedInstancedIndirect(ID3D11Bu { AddEvent(DRAW, desc); - ID3D11Buffer *argBuffer = NULL; - FetchDrawcall draw; string name = "DrawIndexedInstancedIndirect(-, -)"; @@ -4323,11 +4321,11 @@ bool WrappedID3D11DeviceContext::Serialise_CSSetShader(ID3D11ComputeShader *pSha for(UINT i=0; i < NumClassInstances; i++) Instances[i] = UNWRAP(WrappedID3D11ClassInstance, Instances[i]); - ID3D11DeviceChild *pShader = NULL; + ID3D11DeviceChild *pSH = NULL; if(m_pDevice->GetResourceManager()->HasLiveResource(Shader)) - pShader = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); - m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->CS.Shader, pShader); - m_pRealContext->CSSetShader(UNWRAP(WrappedID3D11Shader, pShader), Instances, NumClassInstances); + pSH = (ID3D11DeviceChild *)m_pDevice->GetResourceManager()->GetLiveResource(Shader); + m_CurrentPipelineState->ChangeRefRead(m_CurrentPipelineState->CS.Shader, pSH); + m_pRealContext->CSSetShader(UNWRAP(WrappedID3D11Shader, pSH), Instances, NumClassInstances); VerifyState(); } @@ -6602,7 +6600,7 @@ bool WrappedID3D11DeviceContext::Serialise_Map(ID3D11Resource *pResource, UINT S } else { - MapIntercept intercept; + intercept = MapIntercept(); intercept.SetD3D(mapped); intercept.Init((ID3D11Buffer *)pResource, record->GetDataPtr()); intercept.CopyFromD3D(); diff --git a/renderdoc/driver/d3d11/d3d11_debug.cpp b/renderdoc/driver/d3d11/d3d11_debug.cpp index 84aef5bfe..931a93a64 100644 --- a/renderdoc/driver/d3d11/d3d11_debug.cpp +++ b/renderdoc/driver/d3d11/d3d11_debug.cpp @@ -238,7 +238,7 @@ D3D11DebugManager::D3D11DebugManager(WrappedID3D11Device *wrapper) byte *data = ptr; ptr += len; bufsize -= len; ID3DBlob *blob = NULL; - HRESULT hr = blobCreate((SIZE_T)len, &blob); + hr = blobCreate((SIZE_T)len, &blob); if(FAILED(hr)) { @@ -1294,8 +1294,8 @@ bool D3D11DebugManager::InitStreamOut() hr = m_pDevice->CreateQuery(&qdesc, &m_SOStatsQuery); if(FAILED(hr)) RDCERR("Failed to create m_SOStatsQuery %08x", hr); - D3D11_RASTERIZER_DESC desc; { + D3D11_RASTERIZER_DESC desc; desc.AntialiasedLineEnable = TRUE; desc.DepthBias = 0; desc.DepthBiasClamp = 0.0f; @@ -1321,6 +1321,12 @@ bool D3D11DebugManager::InitStreamOut() hr = m_pDevice->CreateRasterizerState(&desc, &m_WireframeHelpersCullCWRS); if(FAILED(hr)) RDCERR("Failed to create m_WireframeHelpersCullCCWRS %08x", hr); + + desc.FillMode = D3D11_FILL_SOLID; + desc.CullMode = D3D11_CULL_NONE; + + hr = m_pDevice->CreateRasterizerState(&desc, &m_SolidHelpersRS); + if(FAILED(hr)) RDCERR("Failed to create m_SolidHelpersRS %08x", hr); } { @@ -1341,14 +1347,6 @@ bool D3D11DebugManager::InitStreamOut() hr = m_pDevice->CreateBlendState(&desc, &m_WireframeHelpersBS); if(FAILED(hr)) RDCERR("Failed to create m_WireframeHelpersRS %08x", hr); } - - { - desc.FillMode = D3D11_FILL_SOLID; - desc.CullMode = D3D11_CULL_NONE; - - hr = m_pDevice->CreateRasterizerState(&desc, &m_SolidHelpersRS); - if(FAILED(hr)) RDCERR("Failed to create m_SolidHelpersRS %08x", hr); - } { Vec3f axisVB[6] = @@ -2431,15 +2429,15 @@ void D3D11DebugManager::CopyArrayToTex2DMS(ID3D11Texture2D *destMS, ID3D11Textur m_pImmediateContext->OMSetRenderTargetsAndUnorderedAccessViews(0, NULL, dsvMS, 0, 0, NULL, NULL); // loop over every stencil value (zzzzzz, no shader stencil read/write) - for(UINT stencil=0; stencil < 256; stencil++) + for(UINT stencilval=0; stencilval < 256; stencilval++) { - uint32_t cdata[4] = { descMS.SampleDesc.Count, stencil, 0, slice}; + uint32_t cdata[4] = { descMS.SampleDesc.Count, stencilval, 0, slice}; ID3D11Buffer *cbuf = MakeCBuffer((float *)cdata, sizeof(cdata)); m_pImmediateContext->PSSetConstantBuffers(0, 1, &cbuf); - m_pImmediateContext->OMSetDepthStencilState(dsState, stencil); + m_pImmediateContext->OMSetDepthStencilState(dsState, stencilval); m_pImmediateContext->Draw(3, 0); } @@ -2724,15 +2722,15 @@ void D3D11DebugManager::CopyTex2DMSToArray(ID3D11Texture2D *destArray, ID3D11Tex m_pImmediateContext->OMSetRenderTargetsAndUnorderedAccessViews(0, NULL, dsvArray, 0, 0, NULL, NULL); // loop over every stencil value (zzzzzz, no shader stencil read/write) - for(UINT stencil=0; stencil < 256; stencil++) + for(UINT stencilval=0; stencilval < 256; stencilval++) { - uint32_t cdata[4] = { descMS.SampleDesc.Count, stencil, sample, slice}; + uint32_t cdata[4] = { descMS.SampleDesc.Count, stencilval, sample, slice}; ID3D11Buffer *cbuf = MakeCBuffer((float *)cdata, sizeof(cdata)); m_pImmediateContext->PSSetConstantBuffers(0, 1, &cbuf); - m_pImmediateContext->OMSetDepthStencilState(dsState, stencil); + m_pImmediateContext->OMSetDepthStencilState(dsState, stencilval); m_pImmediateContext->Draw(3, 0); } @@ -3366,8 +3364,6 @@ bool D3D11DebugManager::RenderTexture(TextureDisplay cfg, bool blendAlpha) RDCASSERT(dxbc); RDCASSERT(dxbc->m_Type == D3D11_SHVER_PIXEL_SHADER); - WrappedID3D11Shader *wrapped = NULL; - if(m_WrappedDevice->GetResourceManager()->HasLiveResource(cfg.CustomShader)) { WrappedID3D11Shader *wrapped = @@ -4390,7 +4386,7 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t frameID, uint32_t eventID) m_PostVSData[idx].gsout.hasPosOut = posidx >= 0; m_PostVSData[idx].gsout.idxBuf = NULL; - D3D11_PRIMITIVE_TOPOLOGY topo = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST; + topo = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST; if(lastShader == dxbcGS) { diff --git a/renderdoc/driver/d3d11/d3d11_device.cpp b/renderdoc/driver/d3d11/d3d11_device.cpp index 738ad1601..119e368ae 100644 --- a/renderdoc/driver/d3d11/d3d11_device.cpp +++ b/renderdoc/driver/d3d11/d3d11_device.cpp @@ -1195,7 +1195,9 @@ bool WrappedID3D11Device::Prepare_InitialState(ID3D11DeviceChild *res) stageDesc.ArraySize *= desc.SampleDesc.Count; } - HRESULT hr = m_pDevice->CreateTexture2D(&stageDesc, NULL, &stage); + HRESULT hr = S_OK; + + hr = m_pDevice->CreateTexture2D(&stageDesc, NULL, &stage); if(FAILED(hr)) { @@ -1207,7 +1209,7 @@ bool WrappedID3D11Device::Prepare_InitialState(ID3D11DeviceChild *res) if(desc.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) { - HRESULT hr = UNWRAP(WrappedID3D11Texture2D, tex2D)->QueryInterface(__uuidof(IDXGIKeyedMutex), (void **)&mutex); + hr = UNWRAP(WrappedID3D11Texture2D, tex2D)->QueryInterface(__uuidof(IDXGIKeyedMutex), (void **)&mutex); if(SUCCEEDED(hr) && mutex) { @@ -1686,8 +1688,10 @@ bool WrappedID3D11Device::Serialise_InitialState(ID3D11DeviceChild *res) initialDesc.Usage = D3D11_USAGE_IMMUTABLE; + HRESULT hr = S_OK; + ID3D11Texture2D *contents = NULL; - HRESULT hr = m_pDevice->CreateTexture2D(&initialDesc, subData, &contents); + hr = m_pDevice->CreateTexture2D(&initialDesc, subData, &contents); if(FAILED(hr) || contents == NULL) { @@ -1705,7 +1709,7 @@ bool WrappedID3D11Device::Serialise_InitialState(ID3D11DeviceChild *res) desc.Format = GetDepthTypedFormat(desc.Format); ID3D11Texture2D *contentsMS = NULL; - HRESULT hr = m_pDevice->CreateTexture2D(&desc, NULL, &contentsMS); + hr = m_pDevice->CreateTexture2D(&desc, NULL, &contentsMS); m_DebugManager->CopyArrayToTex2DMS(contentsMS, contents); @@ -1901,14 +1905,14 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild * { ID3D11Buffer *stage = NULL; - D3D11_BUFFER_DESC desc; - desc.BindFlags = 0; - desc.ByteWidth = 16; - desc.MiscFlags = 0; - desc.StructureByteStride = 0; - desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; - desc.Usage = D3D11_USAGE_STAGING; - HRESULT hr = m_pDevice->CreateBuffer(&desc, NULL, &stage); + D3D11_BUFFER_DESC bdesc; + bdesc.BindFlags = 0; + bdesc.ByteWidth = 16; + bdesc.MiscFlags = 0; + bdesc.StructureByteStride = 0; + bdesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; + bdesc.Usage = D3D11_USAGE_STAGING; + HRESULT hr = m_pDevice->CreateBuffer(&bdesc, NULL, &stage); if(FAILED(hr) || stage == NULL) { @@ -2240,7 +2244,7 @@ void WrappedID3D11Device::ReplayLog(uint32_t frameID, uint32_t startEventID, uin m_pSerialiser->SetOffset(offs); - D3D11ChunkType header = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, 1, false); + header = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, 1, false); m_pSerialiser->SkipCurrentChunk(); m_pSerialiser->PopContext(NULL, header); @@ -2386,10 +2390,10 @@ void WrappedID3D11Device::SetSwapChainTexture(IDXGISwapChain *swap, DXGI_SWAP_CH if(swap) { - DXGI_SWAP_CHAIN_DESC desc; - swap->GetDesc(&desc); + DXGI_SWAP_CHAIN_DESC sdesc; + swap->GetDesc(&sdesc); - Keyboard::AddInputWindow(desc.OutputWindow); + Keyboard::AddInputWindow(sdesc.OutputWindow); } if(m_SwapChain == NULL) @@ -2578,7 +2582,9 @@ bool WrappedID3D11Device::EndFrameCapture(void *wnd) ID3D11Texture2D *stagingTex = NULL; - HRESULT hr = m_pDevice->CreateTexture2D(&desc, NULL, &stagingTex); + HRESULT hr = S_OK; + + hr = m_pDevice->CreateTexture2D(&desc, NULL, &stagingTex); if(FAILED(hr)) { @@ -2594,7 +2600,7 @@ bool WrappedID3D11Device::EndFrameCapture(void *wnd) ID3D11Texture2D *resolveTex = NULL; - HRESULT hr = m_pDevice->CreateTexture2D(&desc, NULL, &resolveTex); + hr = m_pDevice->CreateTexture2D(&desc, NULL, &resolveTex); if(FAILED(hr)) { @@ -3266,7 +3272,7 @@ bool WrappedID3D11Device::Serialise_ReleaseResource(ID3D11DeviceChild *res) } if(m_State < WRITING && GetResourceManager()->HasLiveResource(resource)) { - ID3D11DeviceChild *res = GetResourceManager()->GetLiveResource(resource); + res = GetResourceManager()->GetLiveResource(resource); GetResourceManager()->EraseLiveResource(resource); SAFE_RELEASE(res); } diff --git a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp index 08f2ade67..02d467dd2 100644 --- a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp @@ -621,9 +621,9 @@ bool WrappedID3D11Device::Serialise_CreateShaderResourceView( { ID3D11ShaderResourceView *ret; - D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc = NULL; + D3D11_SHADER_RESOURCE_VIEW_DESC *pSRVDesc = NULL; if(HasDesc) - pDesc = &Descriptor; + pSRVDesc = &Descriptor; ID3D11Resource *live = (ID3D11Resource*)GetResourceManager()->GetLiveResource(Resource); @@ -644,7 +644,7 @@ bool WrappedID3D11Device::Serialise_CreateShaderResourceView( backbufferTypedDesc.Format = tex2d->m_RealDescriptor->Format; backbufferTypedDesc.Texture2D.MipLevels = 1; backbufferTypedDesc.Texture2D.MostDetailedMip = 0; - pDesc = &backbufferTypedDesc; + pSRVDesc = &backbufferTypedDesc; } // if we have a descriptor but it specifies DXGI_FORMAT_UNKNOWN format, that means use @@ -653,12 +653,12 @@ bool WrappedID3D11Device::Serialise_CreateShaderResourceView( // // This behaviour is documented only for render targets, but seems to be used & work for // SRVs, so apply it here too. - if(pDesc && pDesc->Format == DXGI_FORMAT_UNKNOWN && WrappedID3D11Texture2D::IsAlloc(live) && tex2d->m_RealDescriptor) + if(pSRVDesc && pSRVDesc->Format == DXGI_FORMAT_UNKNOWN && WrappedID3D11Texture2D::IsAlloc(live) && tex2d->m_RealDescriptor) { - pDesc->Format = tex2d->m_RealDescriptor->Format; + pSRVDesc->Format = tex2d->m_RealDescriptor->Format; } - HRESULT hr = m_pDevice->CreateShaderResourceView(GetResourceManager()->UnwrapResource(live), pDesc, &ret); + HRESULT hr = m_pDevice->CreateShaderResourceView(GetResourceManager()->UnwrapResource(live), pSRVDesc, &ret); if(FAILED(hr)) { @@ -750,13 +750,13 @@ bool WrappedID3D11Device::Serialise_CreateUnorderedAccessView( { ID3D11UnorderedAccessView *ret; - D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc = NULL; + D3D11_UNORDERED_ACCESS_VIEW_DESC *pUAVDesc = NULL; if(HasDesc) - pDesc = &Descriptor; + pUAVDesc = &Descriptor; ID3D11Resource *live = (ID3D11Resource*)GetResourceManager()->GetLiveResource(Resource); - HRESULT hr = m_pDevice->CreateUnorderedAccessView(GetResourceManager()->UnwrapResource(live), pDesc, &ret); + HRESULT hr = m_pDevice->CreateUnorderedAccessView(GetResourceManager()->UnwrapResource(live), pUAVDesc, &ret); if(FAILED(hr)) { @@ -848,9 +848,9 @@ bool WrappedID3D11Device::Serialise_CreateRenderTargetView( { ID3D11RenderTargetView *ret; - D3D11_RENDER_TARGET_VIEW_DESC *pDesc = NULL; + D3D11_RENDER_TARGET_VIEW_DESC *pRTVDesc = NULL; if(HasDesc) - pDesc = &Descriptor; + pRTVDesc = &Descriptor; ID3D11Resource *live = (ID3D11Resource *)GetResourceManager()->GetLiveResource(Resource); @@ -870,18 +870,18 @@ bool WrappedID3D11Device::Serialise_CreateRenderTargetView( backbufferTypedDesc.Format = tex2d->m_RealDescriptor->Format; backbufferTypedDesc.Texture2D.MipSlice = 0; - pDesc = &backbufferTypedDesc; + pRTVDesc = &backbufferTypedDesc; } // if we have a descriptor but it specifies DXGI_FORMAT_UNKNOWN format, that means use // the texture's format. But as above, we fudge around the typeless backbuffer so we // have to set the correct typed format - if(pDesc && pDesc->Format == DXGI_FORMAT_UNKNOWN && WrappedID3D11Texture2D::IsAlloc(live) && tex2d->m_RealDescriptor) + if(pRTVDesc && pRTVDesc->Format == DXGI_FORMAT_UNKNOWN && WrappedID3D11Texture2D::IsAlloc(live) && tex2d->m_RealDescriptor) { - pDesc->Format = tex2d->m_RealDescriptor->Format; + pRTVDesc->Format = tex2d->m_RealDescriptor->Format; } - HRESULT hr = m_pDevice->CreateRenderTargetView(GetResourceManager()->UnwrapResource(live), pDesc, &ret); + HRESULT hr = m_pDevice->CreateRenderTargetView(GetResourceManager()->UnwrapResource(live), pRTVDesc, &ret); if(FAILED(hr)) { @@ -976,7 +976,7 @@ bool WrappedID3D11Device::Serialise_CreateDepthStencilView( ID3D11Resource *live = (ID3D11Resource*)GetResourceManager()->GetLiveResource(Resource); - D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc = NULL; + pDesc = NULL; if(HasDesc) pDesc = &Descriptor; HRESULT hr = m_pDevice->CreateDepthStencilView(GetResourceManager()->UnwrapResource(live), pDesc, &ret); @@ -2544,7 +2544,7 @@ bool WrappedID3D11Device::Serialise_OpenSharedResource( { ID3D11Buffer *stage = NULL; - D3D11_BUFFER_DESC desc; + RDCEraseEl(desc); desc.ByteWidth = Descriptor.ByteWidth; desc.MiscFlags = 0; desc.StructureByteStride = 0; diff --git a/renderdoc/driver/d3d11/shaders/dxbc_debug.cpp b/renderdoc/driver/d3d11/shaders/dxbc_debug.cpp index ef4513910..44e356cb2 100644 --- a/renderdoc/driver/d3d11/shaders/dxbc_debug.cpp +++ b/renderdoc/driver/d3d11/shaders/dxbc_debug.cpp @@ -3226,8 +3226,8 @@ State State::GetNext(GlobalState &global, State quad[4]) const { uint32_t *u = (uint32_t *)d; - for(int i=0; i < fmt.numComps; i++) - result.value.uv[i] = u[i]; + for(int c=0; c < fmt.numComps; c++) + result.value.uv[c] = u[c]; } else if(fmt.byteWidth == 2) { @@ -3235,41 +3235,41 @@ State State::GetNext(GlobalState &global, State quad[4]) const { uint16_t *u = (uint16_t *)d; - for(int i=0; i < fmt.numComps; i++) - result.value.fv[i] = ConvertFromHalf(u[i]); + for(int c=0; c < fmt.numComps; c++) + result.value.fv[c] = ConvertFromHalf(u[c]); } else if(fmt.fmt == eCompType_UInt) { uint16_t *u = (uint16_t *)d; - for(int i=0; i < fmt.numComps; i++) - result.value.uv[i] = u[i]; + for(int c=0; c < fmt.numComps; c++) + result.value.uv[c] = u[c]; } else if(fmt.fmt == eCompType_SInt) { int16_t *in = (int16_t *)d; - for(int i=0; i < fmt.numComps; i++) - result.value.iv[i] = in[i]; + for(int c=0; c < fmt.numComps; c++) + result.value.iv[c] = in[c]; } else if(fmt.fmt == eCompType_UNorm) { uint16_t *u = (uint16_t *)d; - for(int i=0; i < fmt.numComps; i++) - result.value.fv[i] = float(u[i])/float(0xffff); + for(int c=0; c < fmt.numComps; c++) + result.value.fv[c] = float(u[c])/float(0xffff); } else if(fmt.fmt == eCompType_SNorm) { int16_t *in = (int16_t *)d; - for(int i=0; i < fmt.numComps; i++) + for(int c=0; c < fmt.numComps; c++) { // -32768 is mapped to -1, then -32767 to -32767 are mapped to -1 to 1 - if(in[i] == -32768) - result.value.fv[i] = -1.0f; + if(in[c] == -32768) + result.value.fv[c] = -1.0f; else - result.value.fv[i] = float(in[i])/32767.0f; + result.value.fv[c] = float(in[c])/32767.0f; } } else @@ -3283,34 +3283,34 @@ State State::GetNext(GlobalState &global, State quad[4]) const { uint8_t *u = (uint8_t *)d; - for(int i=0; i < fmt.numComps; i++) - result.value.uv[i] = u[i]; + for(int c = 0; c < fmt.numComps; c++) + result.value.uv[c] = u[c]; } else if(fmt.fmt == eCompType_SInt) { int8_t *in = (int8_t *)d; - for(int i=0; i < fmt.numComps; i++) - result.value.iv[i] = in[i]; + for(int c = 0; c < fmt.numComps; c++) + result.value.iv[c] = in[c]; } else if(fmt.fmt == eCompType_UNorm) { uint8_t *u = (uint8_t *)d; - for(int i=0; i < fmt.numComps; i++) - result.value.fv[i] = float(u[i])/float(0xff); + for(int c = 0; c < fmt.numComps; c++) + result.value.fv[c] = float(u[c])/float(0xff); } else if(fmt.fmt == eCompType_SNorm) { int8_t *in = (int8_t *)d; - for(int i=0; i < fmt.numComps; i++) + for(int c=0; c < fmt.numComps; c++) { // -128 is mapped to -1, then -127 to -127 are mapped to -1 to 1 - if(in[i] == -128) - result.value.fv[i] = -1.0f; + if(in[c] == -128) + result.value.fv[c] = -1.0f; else - result.value.fv[i] = float(in[i])/127.0f; + result.value.fv[c] = float(in[c])/127.0f; } } else @@ -3326,13 +3326,13 @@ State State::GetNext(GlobalState &global, State quad[4]) const ShaderVariable fetch("", 0U, 0U, 0U, 0U); - for(int i=0; i < 4; i++) + for(int c=0; c < 4; c++) { - uint8_t comp = op.operands[2].comps[i]; - if(op.operands[2].comps[i] == 0xff) + uint8_t comp = op.operands[2].comps[c]; + if(op.operands[2].comps[c] == 0xff) comp = 0; - fetch.value.uv[i] = result.value.uv[comp]; + fetch.value.uv[c] = result.value.uv[comp]; } s.SetDst(op.operands[0], op, fetch); diff --git a/renderdoc/driver/d3d11/shaders/dxbc_disassemble.cpp b/renderdoc/driver/d3d11/shaders/dxbc_disassemble.cpp index 2bf864e97..9d391abf2 100644 --- a/renderdoc/driver/d3d11/shaders/dxbc_disassemble.cpp +++ b/renderdoc/driver/d3d11/shaders/dxbc_disassemble.cpp @@ -361,13 +361,7 @@ void DXBCFile::MakeDisassembly() default: RDCERR("Unknown shader type: %u", m_Type); break; } - char buf[] = {0, 0}; - buf[0] = (char)('0'+m_Version.Major); - m_Disassembly += buf; - m_Disassembly += "_"; - buf[0] = (char)('0'+m_Version.Minor); - m_Disassembly += buf; - m_Disassembly += "\n"; + m_Disassembly += StringFormat::Fmt("%d_%d\n", m_Version.Major, m_Version.Minor); int indent = 0; diff --git a/renderdoc/driver/d3d11/shaders/dxbc_inspect.cpp b/renderdoc/driver/d3d11/shaders/dxbc_inspect.cpp index a35a82df5..db074a1ce 100644 --- a/renderdoc/driver/d3d11/shaders/dxbc_inspect.cpp +++ b/renderdoc/driver/d3d11/shaders/dxbc_inspect.cpp @@ -1144,7 +1144,7 @@ SDBGChunk::SDBGChunk(void *data) char *dbgPostHeader = dbgData+sizeof(SDBGHeader); - SDBGFileHeader *Files = (SDBGFileHeader *)(dbgPostHeader+m_Header.files.offset); + SDBGFileHeader *FileHeaders = (SDBGFileHeader *)(dbgPostHeader+m_Header.files.offset); SDBGAsmInstruction *Instructions = (SDBGAsmInstruction *)(dbgPostHeader+m_Header.instructions.offset); SDBGVariable *Variables = (SDBGVariable *)(dbgPostHeader+m_Header.variables.offset); SDBGInputRegister *Inputs = (SDBGInputRegister *)(dbgPostHeader+m_Header.inputRegisters.offset); @@ -1153,7 +1153,7 @@ SDBGChunk::SDBGChunk(void *data) SDBGType *Types = (SDBGType *)(dbgPostHeader+m_Header.types.offset); int32_t *Int32DB = (int32_t *)(dbgPostHeader+m_Header.int32DBOffset); - m_FileHeaders = vector(Files, Files + m_Header.files.count); + m_FileHeaders = vector(FileHeaders, FileHeaders + m_Header.files.count); m_Instructions = vector(Instructions, Instructions + m_Header.instructions.count); m_Variables = vector(Variables, Variables + m_Header.variables.count); m_Inputs = vector(Inputs, Inputs + m_Header.inputRegisters.count); @@ -1254,14 +1254,14 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) byte *data = NULL; - uint32_t len; + uint32_t spdblength; { uint32_t *raw = (uint32_t *)chunk; if(raw[0] != FOURCC_SPDB) return; - len = raw[1]; + spdblength = raw[1]; data = (byte *)&raw[2]; } @@ -1276,7 +1276,7 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) return; } - RDCASSERT(header->PageCount*header->PageSize == len); + RDCASSERT(header->PageCount*header->PageSize == spdblength); const byte **pages = new const byte*[header->PageCount]; for(uint32_t i=0; i < header->PageCount; i++) @@ -1470,12 +1470,12 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) PDBStream &s = streams[modules[m].stream]; PageMapping modMapping(pages, header->PageSize, &s.pageIndices[0], (uint32_t)s.pageIndices.size()); - uint32_t *data = (uint32_t *)modMapping.Data(); + uint32_t *moduledata = (uint32_t *)modMapping.Data(); - RDCASSERT(data[0] == 4); + RDCASSERT(moduledata[0] == 4); - byte *cur = (byte *)&data[1]; - byte *end = (byte *)data + modules[m].cbSyms; + byte *cur = (byte *)&moduledata[1]; + byte *end = (byte *)moduledata + modules[m].cbSyms; while(cur < end) { uint16_t *sym = (uint16_t *)cur; @@ -1489,10 +1489,10 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) if(type == 0x1110) { - ProcHeader *header = (ProcHeader *)contents; - char *name = (char *)(header + 1); + ProcHeader *proc = (ProcHeader *)contents; + char *name = (char *)(proc + 1); - //RDCDEBUG("Got global procedure start %s %x -> %x", name, header->Offset, header->Offset+header->Length); + //RDCDEBUG("Got global procedure start %s %x -> %x", name, proc->Offset, proc->Offset+proc->Length); } else if(type == 0x113c) { @@ -1567,7 +1567,7 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) func.baseLineNum = 0; byte *iterator = (byte *)contents; - byte *end = contents + len; + byte *callend = contents + len; uint32_t *adsf = (uint32_t *)iterator; @@ -1580,17 +1580,16 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) uint32_t currentColStart = 1; uint32_t currentColEnd = 100000; - while(iterator < end) + while(iterator < callend) { - uint32_t type = (uint32_t)*iterator; - FuncCallBytestreamOpcodes opcode = (FuncCallBytestreamOpcodes)type; + FuncCallBytestreamOpcodes opcode = (FuncCallBytestreamOpcodes)*iterator; iterator++; if(opcode == PrologueEnd || opcode == EpilogueBegin) { - uint32_t data = ReadVarLenUInt(iterator); - //RDCDEBUG("type %02x: unk=%02x", type, data); + uint32_t value = ReadVarLenUInt(iterator); + //RDCDEBUG("type %02x: unk=%02x", opcode, value); if(opcode == EpilogueBegin) { @@ -1600,9 +1599,9 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) } else if(opcode == FunctionEndNoAdvance) { - uint32_t data = ReadVarLenUInt(iterator); + uint32_t value = ReadVarLenUInt(iterator); - //RDCDEBUG(" type %02x: %02x: adjust line by 4(?!) & bytes by %x", type, data, data); + //RDCDEBUG(" type %02x: %02x: adjust line by 4(?!) & bytes by %x", opcode, value, value); if(working) { @@ -1613,31 +1612,31 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) loc.colEnd = currentColEnd; func.locations.push_back(loc); - loc.offset = currentBytes+data; + loc.offset = currentBytes+ value; loc.funcEnd = true; func.locations.push_back(loc); //RDCDEBUG(" (loc: %04x - %u [%u,%u] )", currentBytes, currentLine, currentColStart, currentColEnd); } - currentBytes += data; + currentBytes += value; } else if(opcode == AdvanceBytesAndLines) { - uint32_t data = (uint32_t)*iterator; iterator++; + uint32_t value = (uint32_t)*iterator; iterator++; - uint32_t byteMod = (data&0xf); - uint32_t lineMod = (data>>4); + uint32_t byteMod = (value &0xf); + uint32_t lineMod = (value >>4); currentBytes += byteMod; currentLine += lineMod/2; - //RDCDEBUG(" type %02x: %02x: adjust line by %u & bytes by %x", type, data, lineMod/2, byteMod); + //RDCDEBUG(" type %02x: %02x: adjust line by %u & bytes by %x", type, value, lineMod/2, byteMod); } else if(opcode == EndOfFunction) { - //RDCDEBUG("type %02x:", type); + //RDCDEBUG("type %02x:", opcode); byte lenbyte = *iterator; @@ -1667,7 +1666,7 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) else if(opcode == SetByteOffset) { currentBytes = ReadVarLenUInt(iterator); - //RDCDEBUG(" type %02x: start at byte offset %x", type, currentBytes); + //RDCDEBUG(" type %02x: start at byte offset %x", opcode, currentBytes); } else if(opcode == AdvanceBytes) { @@ -1675,7 +1674,7 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) currentBytes += offs; - //RDCDEBUG(" type %02x: advance %x bytes", type, offs); + //RDCDEBUG(" type %02x: advance %x bytes", opcode, offs); if(working) { @@ -1698,26 +1697,26 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) else currentLine += (linesAdv/2); - //RDCDEBUG(" type %02x: advance %u (%u) lines", type, linesAdv/2, linesAdv); + //RDCDEBUG(" type %02x: advance %u (%u) lines", opcode, linesAdv/2, linesAdv); } else if(opcode == ColumnStart) { currentColStart = ReadVarLenUInt(iterator); - //RDCDEBUG(" type %02x: col < %u", type, currentColStart); + //RDCDEBUG(" type %02x: col < %u", opcode, currentColStart); } else if(opcode == ColumnEnd) { currentColEnd = ReadVarLenUInt(iterator); - //RDCDEBUG(" type %02x: col > %u", type, currentColEnd); + //RDCDEBUG(" type %02x: col > %u", opcode, currentColEnd); } else if(opcode == EndStream) { - while(*iterator == 0 && iterator < end) iterator++; - RDCASSERT(iterator == end); + while(*iterator == 0 && iterator < callend) iterator++; + RDCASSERT(iterator == callend); } else { - RDCLOG("Unrecognised: %02x", type); + RDCLOG("Unrecognised: %02x", opcode); break; } } @@ -1737,7 +1736,7 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) funcCalls.push_back(func); - //RDCDEBUG("Lost %d bytes after we stopped processing", end - iterator); + //RDCDEBUG("Lost %d bytes after we stopped processing", callend - iterator); } else if(type == 0x113E) { @@ -1919,7 +1918,7 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) FileLineNumbers *file = (FileLineNumbers *)cur; cur = (byte *)(file + 1); - uint32_t *data = (uint32_t *)cur; + uint32_t *linedata = (uint32_t *)cur; cur += (sizeof(uint32_t) + sizeof(uint32_t)) * file->numLines; if(hasExtra) @@ -1938,18 +1937,18 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) for(uint32_t l=0; l < file->numLines; l++) { - uint32_t offs = data[0]; - uint32_t lineNum = data[1]&0x00fffff; - uint32_t unknown = data[1]>>24; + uint32_t offs = linedata[0]; + uint32_t lineNum = linedata[1]&0x00fffff; + uint32_t unknown = linedata[1]>>24; - data += 2; + linedata += 2; m_LineNumbers[offs] = make_pair(fileIdx, lineNum); //RDCDEBUG("Offset %x is line %d", offs, lineNum); } - uint16_t *extraData = (uint16_t *)data; + uint16_t *extraData = (uint16_t *)linedata; for(uint32_t l=0; l < file->numLines; l++) { @@ -1970,7 +1969,7 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) cur = (byte *)(len + 1); uint32_t *calls = (uint32_t *)cur; - uint32_t *end = (uint32_t *)(cur + *len); + uint32_t *callsend = (uint32_t *)(cur + *len); // 0 seems to indicate no files, 1 indicates files but we don't need // to care as we can just handle this below. @@ -1978,7 +1977,7 @@ SPDBChunk::SPDBChunk(void *chunk, uint32_t firstInstructionOffset) calls++; int idx = 0; - while(calls < end) + while(calls < callsend) { // some kind of control bytes? they have n file mappings following but I'm not sure what // they mean diff --git a/renderdoc/driver/gl/gl_debug.cpp b/renderdoc/driver/gl/gl_debug.cpp index d924da42a..7ce59a96a 100644 --- a/renderdoc/driver/gl/gl_debug.cpp +++ b/renderdoc/driver/gl/gl_debug.cpp @@ -2549,8 +2549,8 @@ void GLReplay::InitPostVSBuffers(uint32_t frameID, uint32_t eventID) // see above for the justification/explanation of this monstrosity. - GLint status = 0; - bool finished = false; + status = 0; + finished = false; while(true) { // specify current varyings & relink @@ -2663,7 +2663,7 @@ void GLReplay::InitPostVSBuffers(uint32_t frameID, uint32_t eventID) // we don't have to restore the buffer binding on the default feedback object. gl.glBindBufferBase(eGL_TRANSFORM_FEEDBACK_BUFFER, 0, DebugData.feedbackBuffer); - GLuint idxBuf = 0; + idxBuf = 0; GLenum shaderOutMode = eGL_TRIANGLES; GLenum lastOutTopo = eGL_TRIANGLES; @@ -2718,7 +2718,7 @@ void GLReplay::InitPostVSBuffers(uint32_t frameID, uint32_t eventID) gl.glEndQuery(eGL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); // this should be the same as the draw size - GLuint primsWritten = 0; + primsWritten = 0; gl.glGetQueryObjectuiv(DebugData.feedbackQuery, eGL_QUERY_RESULT, &primsWritten); error = false; @@ -2730,7 +2730,7 @@ void GLReplay::InitPostVSBuffers(uint32_t frameID, uint32_t eventID) } // get buffer data from buffer attached to feedback object - float *data = (float *)gl.glMapNamedBufferEXT(DebugData.feedbackBuffer, eGL_READ_ONLY); + data = (float *)gl.glMapNamedBufferEXT(DebugData.feedbackBuffer, eGL_READ_ONLY); if(data == NULL) { @@ -2788,12 +2788,12 @@ void GLReplay::InitPostVSBuffers(uint32_t frameID, uint32_t eventID) gl.glBindBuffer(eGL_ARRAY_BUFFER, lastoutBuffer); gl.glNamedBufferStorageEXT(lastoutBuffer, stride*m_PostVSData[idx].gsout.numVerts, data, 0); - byte *byteData = (byte *)data; + byteData = (byte *)data; - float nearp = 0.1f; - float farp = 100.0f; + nearp = 0.1f; + farp = 100.0f; - Vec4f *pos0 = (Vec4f *)byteData; + pos0 = (Vec4f *)byteData; for(uint32_t i=1; posidx != -1 && i < m_PostVSData[idx].gsout.numVerts; i++) { @@ -3102,7 +3102,7 @@ void GLReplay::RenderMesh(uint32_t frameID, uint32_t eventID, const vectorGetResourceManager()->GetCurrentResource(fmt.buf).name; gl.glBindVertexBuffer(0, vb, fmt.offset, fmt.stride); - GLenum topo = MakeGLPrimitiveTopology(fmt.topo); + GLenum secondarytopo = MakeGLPrimitiveTopology(fmt.topo); if(fmt.idxbuf != ResourceId()) { @@ -3115,11 +3115,11 @@ void GLReplay::RenderMesh(uint32_t frameID, uint32_t eventID, const vector= WRITING) @@ -3249,15 +3249,15 @@ void WrappedOpenGL::ContextReplayLog(LogState readType, uint32_t startEventID, u uint64_t offset = m_pSerialiser->GetOffset(); - GLChunkType context = (GLChunkType)m_pSerialiser->PushContext(NULL, 1, false); + GLChunkType chunktype = (GLChunkType)m_pSerialiser->PushContext(NULL, 1, false); - ContextProcessChunk(offset, context, false); + ContextProcessChunk(offset, chunktype, false); RenderDoc::Inst().SetProgress(FileInitialRead, float(offset)/float(m_pSerialiser->GetSize())); // for now just abort after capture scope. Really we'd need to support multiple frames // but for now this will do. - if(context == CONTEXT_CAPTURE_FOOTER) + if(chunktype == CONTEXT_CAPTURE_FOOTER) break; m_CurEventID++; diff --git a/renderdoc/driver/gl/gl_replay_win32.cpp b/renderdoc/driver/gl/gl_replay_win32.cpp index 60ee46ff6..be0ef4334 100644 --- a/renderdoc/driver/gl/gl_replay_win32.cpp +++ b/renderdoc/driver/gl/gl_replay_win32.cpp @@ -429,9 +429,9 @@ ReplayCreateStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **dr GLint numExts = 0; getInt(eGL_NUM_EXTENSIONS, &numExts); - for(GLint i=0; i < numExts; i++) + for(GLint e=0; e < numExts; e++) { - const char *ext = (const char *)getStr(eGL_EXTENSIONS, (GLuint)i); + const char *ext = (const char *)getStr(eGL_EXTENSIONS, (GLuint)e); if(!strcmp(ext, "GL_EXT_direct_state_access")) { diff --git a/renderdoc/driver/gl/gl_shader_refl.cpp b/renderdoc/driver/gl/gl_shader_refl.cpp index d95a46f43..cf3ad2ea5 100644 --- a/renderdoc/driver/gl/gl_shader_refl.cpp +++ b/renderdoc/driver/gl/gl_shader_refl.cpp @@ -1468,12 +1468,12 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, GLenum props[] = { eGL_NAME_LENGTH, eGL_TYPE, eGL_LOCATION, eGL_LOCATION_COMPONENT }; GLint values[] = { 0 , 0 , 0 , 0 }; - GLsizei numProps = (GLsizei)ARRAY_COUNT(props); + GLsizei numSigProps = (GLsizei)ARRAY_COUNT(props); // GL_LOCATION_COMPONENT not supported on core <4.4 (or without GL_ARB_enhanced_layouts) if(!ExtensionSupported[ExtensionSupported_ARB_enhanced_layouts] && GLCoreVersion < 44) - numProps--; - gl.glGetProgramResourceiv(sepProg, sigEnum, i, numProps, props, numProps, NULL, values); + numSigProps--; + gl.glGetProgramResourceiv(sepProg, sigEnum, i, numSigProps, props, numSigProps, NULL, values); char *nm = new char[values[0]+1]; gl.glGetProgramResourceName(sepProg, sigEnum, i, values[0]+1, NULL, nm); @@ -1715,11 +1715,11 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, } else { - for(int i=0; i < rows; i++) + for(int r=0; r < rows; r++) { SigParameter s = sig; - s.varName = StringFormat::Fmt("%s.row%d", nm, i); - s.regIndex += i; + s.varName = StringFormat::Fmt("%s.row%d", nm, r); + s.regIndex += r; sigs.push_back(s); } } diff --git a/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp index 5ec1ce4d8..c62e3f56a 100644 --- a/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp @@ -1404,20 +1404,20 @@ bool WrappedOpenGL::Serialise_glMultiDrawArrays(GLenum mode, const GLint *first, for(uint32_t i=0; i < Count; i++) { - FetchDrawcall draw; - draw.numIndices = countArray[i]; - draw.vertexOffset = firstArray[i]; + FetchDrawcall multidraw; + multidraw.numIndices = countArray[i]; + multidraw.vertexOffset = firstArray[i]; - draw.name = "glMultiDrawArrays[" + ToStr::Get(i) + "](" + - ToStr::Get(draw.numIndices) + ", " + - ToStr::Get(draw.vertexOffset) + ")"; + multidraw.name = "glMultiDrawArrays[" + ToStr::Get(i) + "](" + + ToStr::Get(multidraw.numIndices) + ", " + + ToStr::Get(multidraw.vertexOffset) + ")"; - draw.flags |= eDraw_Drawcall; + multidraw.flags |= eDraw_Drawcall; - draw.topology = MakePrimitiveTopology(m_Real, Mode); + multidraw.topology = MakePrimitiveTopology(m_Real, Mode); AddEvent(MULTI_DRAWARRAYS, desc); - AddDrawcall(draw, true); + AddDrawcall(multidraw, true); m_CurEventID++; } @@ -1550,20 +1550,20 @@ bool WrappedOpenGL::Serialise_glMultiDrawElements(GLenum mode, const GLsizei *co for(uint32_t i=0; i < Count; i++) { - FetchDrawcall draw; - draw.numIndices = countArray[i]; - draw.indexOffset = (uint32_t) uint64_t(idxOffsArray[i])&0xFFFFFFFF; + FetchDrawcall multidraw; + multidraw.numIndices = countArray[i]; + multidraw.indexOffset = (uint32_t) uint64_t(idxOffsArray[i])&0xFFFFFFFF; - draw.name = "glMultiDrawElements[" + ToStr::Get(i) + "](" + - ToStr::Get(draw.numIndices) + ", " + - ToStr::Get(draw.indexOffset) + ")"; + multidraw.name = "glMultiDrawElements[" + ToStr::Get(i) + "](" + + ToStr::Get(multidraw.numIndices) + ", " + + ToStr::Get(multidraw.indexOffset) + ")"; - draw.flags |= eDraw_Drawcall|eDraw_UseIBuffer; + multidraw.flags |= eDraw_Drawcall|eDraw_UseIBuffer; - draw.topology = MakePrimitiveTopology(m_Real, Mode); + multidraw.topology = MakePrimitiveTopology(m_Real, Mode); AddEvent(MULTI_DRAWELEMENTS, desc); - AddDrawcall(draw, true); + AddDrawcall(multidraw, true); m_CurEventID++; } @@ -1703,23 +1703,23 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsBaseVertex(GLenum mode, const G for(uint32_t i=0; i < Count; i++) { - FetchDrawcall draw; - draw.numIndices = countArray[i]; - draw.indexOffset = (uint32_t) uint64_t(idxOffsArray[i])&0xFFFFFFFF; - draw.vertexOffset = baseArray[i]; + FetchDrawcall multidraw; + multidraw.numIndices = countArray[i]; + multidraw.indexOffset = (uint32_t) uint64_t(idxOffsArray[i])&0xFFFFFFFF; + multidraw.vertexOffset = baseArray[i]; - draw.name = "glMultiDrawElementsBaseVertex[" + ToStr::Get(i) + "](" + - ToStr::Get(draw.numIndices) + ", " + - ToStr::Get(draw.indexOffset) + ", " + - ToStr::Get(draw.vertexOffset) + ")"; + multidraw.name = "glMultiDrawElementsBaseVertex[" + ToStr::Get(i) + "](" + + ToStr::Get(multidraw.numIndices) + ", " + + ToStr::Get(multidraw.indexOffset) + ", " + + ToStr::Get(multidraw.vertexOffset) + ")"; - draw.flags |= eDraw_Drawcall|eDraw_UseIBuffer; + multidraw.flags |= eDraw_Drawcall|eDraw_UseIBuffer; - draw.topology = MakePrimitiveTopology(m_Real, Mode); - draw.indexByteWidth = IdxSize; + multidraw.topology = MakePrimitiveTopology(m_Real, Mode); + multidraw.indexByteWidth = IdxSize; AddEvent(MULTI_DRAWELEMENTSBASEVERTEX, desc); - AddDrawcall(draw, true); + AddDrawcall(multidraw, true); m_CurEventID++; } @@ -1851,24 +1851,24 @@ bool WrappedOpenGL::Serialise_glMultiDrawArraysIndirect(GLenum mode, const void else offs += sizeof(params); - FetchDrawcall draw; - draw.numIndices = params.count; - draw.numInstances = params.instanceCount; - draw.vertexOffset = params.first; - draw.instanceOffset = params.baseInstance; + FetchDrawcall multidraw; + multidraw.numIndices = params.count; + multidraw.numInstances = params.instanceCount; + multidraw.vertexOffset = params.first; + multidraw.instanceOffset = params.baseInstance; - draw.name = "glMultiDrawArraysIndirect[" + ToStr::Get(i) + "](<" + - ToStr::Get(draw.numIndices) + ", " + - ToStr::Get(draw.numInstances) + ", " + - ToStr::Get(draw.vertexOffset) + ", " + - ToStr::Get(draw.instanceOffset) + ">)"; + multidraw.name = "glMultiDrawArraysIndirect[" + ToStr::Get(i) + "](<" + + ToStr::Get(multidraw.numIndices) + ", " + + ToStr::Get(multidraw.numInstances) + ", " + + ToStr::Get(multidraw.vertexOffset) + ", " + + ToStr::Get(multidraw.instanceOffset) + ">)"; - draw.flags |= eDraw_Drawcall|eDraw_Instanced|eDraw_Indirect; + multidraw.flags |= eDraw_Drawcall|eDraw_Instanced|eDraw_Indirect; - draw.topology = MakePrimitiveTopology(m_Real, Mode); + multidraw.topology = MakePrimitiveTopology(m_Real, Mode); AddEvent(MULTI_DRAWARRAYS_INDIRECT, desc); - AddDrawcall(draw, true); + AddDrawcall(multidraw, true); m_CurEventID++; } @@ -1977,11 +1977,6 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsIndirect(GLenum mode, GLenum ty ToStr::Get(Type) + "," + ToStr::Get(Count) + ")"; - uint32_t IdxSize = - Type == eGL_UNSIGNED_BYTE ? 1 - : Type == eGL_UNSIGNED_SHORT ? 2 - : /*Type == eGL_UNSIGNED_INT*/ 4; - FetchDrawcall draw; draw.name = name; @@ -2009,26 +2004,26 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsIndirect(GLenum mode, GLenum ty else offs += sizeof(params); - FetchDrawcall draw; - draw.numIndices = params.count; - draw.numInstances = params.instanceCount; - draw.indexOffset = params.firstIndex; - draw.vertexOffset = params.baseVertex; - draw.instanceOffset = params.baseInstance; + FetchDrawcall multidraw; + multidraw.numIndices = params.count; + multidraw.numInstances = params.instanceCount; + multidraw.indexOffset = params.firstIndex; + multidraw.vertexOffset = params.baseVertex; + multidraw.instanceOffset = params.baseInstance; - draw.name = "glMultiDrawElementsIndirect[" + ToStr::Get(i) + "](<" + - ToStr::Get(draw.numIndices) + ", " + - ToStr::Get(draw.numInstances) + ", " + - ToStr::Get(draw.indexOffset) + ", " + - ToStr::Get(draw.instanceOffset) + ">)"; + multidraw.name = "glMultiDrawElementsIndirect[" + ToStr::Get(i) + "](<" + + ToStr::Get(multidraw.numIndices) + ", " + + ToStr::Get(multidraw.numInstances) + ", " + + ToStr::Get(multidraw.indexOffset) + ", " + + ToStr::Get(multidraw.instanceOffset) + ">)"; - draw.flags |= eDraw_Drawcall|eDraw_UseIBuffer|eDraw_Instanced|eDraw_Indirect; + multidraw.flags |= eDraw_Drawcall|eDraw_UseIBuffer|eDraw_Instanced|eDraw_Indirect; - draw.topology = MakePrimitiveTopology(m_Real, Mode); - draw.indexByteWidth = IdxSize; + multidraw.topology = MakePrimitiveTopology(m_Real, Mode); + multidraw.indexByteWidth = IdxSize; AddEvent(MULTI_DRAWELEMENTS_INDIRECT, desc); - AddDrawcall(draw, true); + AddDrawcall(multidraw, true); m_CurEventID++; } @@ -2167,24 +2162,24 @@ bool WrappedOpenGL::Serialise_glMultiDrawArraysIndirectCountARB(GLenum mode, GLi else offs += sizeof(params); - FetchDrawcall draw; - draw.numIndices = params.count; - draw.numInstances = params.instanceCount; - draw.vertexOffset = params.first; - draw.instanceOffset = params.baseInstance; + FetchDrawcall multidraw; + multidraw.numIndices = params.count; + multidraw.numInstances = params.instanceCount; + multidraw.vertexOffset = params.first; + multidraw.instanceOffset = params.baseInstance; - draw.name = "glMultiDrawArraysIndirect[" + ToStr::Get(i) + "](<" + - ToStr::Get(draw.numIndices) + ", " + - ToStr::Get(draw.numInstances) + ", " + - ToStr::Get(draw.vertexOffset) + ", " + - ToStr::Get(draw.instanceOffset) + ">)"; + multidraw.name = "glMultiDrawArraysIndirect[" + ToStr::Get(i) + "](<" + + ToStr::Get(multidraw.numIndices) + ", " + + ToStr::Get(multidraw.numInstances) + ", " + + ToStr::Get(multidraw.vertexOffset) + ", " + + ToStr::Get(multidraw.instanceOffset) + ">)"; - draw.flags |= eDraw_Drawcall|eDraw_Instanced|eDraw_Indirect; + multidraw.flags |= eDraw_Drawcall|eDraw_Instanced|eDraw_Indirect; - draw.topology = MakePrimitiveTopology(m_Real, Mode); + multidraw.topology = MakePrimitiveTopology(m_Real, Mode); AddEvent(MULTI_DRAWARRAYS_INDIRECT, desc); - AddDrawcall(draw, true); + AddDrawcall(multidraw, true); m_CurEventID++; } @@ -2305,11 +2300,6 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsIndirectCountARB(GLenum mode, G ToStr::Get(realdrawcount) + ">, " + ToStr::Get(MaxCount) + ")"; - uint32_t IdxSize = - Type == eGL_UNSIGNED_BYTE ? 1 - : Type == eGL_UNSIGNED_SHORT ? 2 - : /*Type == eGL_UNSIGNED_INT*/ 4; - FetchDrawcall draw; draw.name = name; @@ -2337,26 +2327,26 @@ bool WrappedOpenGL::Serialise_glMultiDrawElementsIndirectCountARB(GLenum mode, G else offs += sizeof(params); - FetchDrawcall draw; - draw.numIndices = params.count; - draw.numInstances = params.instanceCount; - draw.indexOffset = params.firstIndex; - draw.vertexOffset = params.baseVertex; - draw.instanceOffset = params.baseInstance; + FetchDrawcall multidraw; + multidraw.numIndices = params.count; + multidraw.numInstances = params.instanceCount; + multidraw.indexOffset = params.firstIndex; + multidraw.vertexOffset = params.baseVertex; + multidraw.instanceOffset = params.baseInstance; - draw.name = "glMultiDrawElementsIndirect[" + ToStr::Get(i) + "](" + - ToStr::Get(draw.numIndices) + ", " + - ToStr::Get(draw.numInstances) + ", " + - ToStr::Get(draw.indexOffset) + ", " + - ToStr::Get(draw.instanceOffset) + ")"; + multidraw.name = "glMultiDrawElementsIndirect[" + ToStr::Get(i) + "](" + + ToStr::Get(multidraw.numIndices) + ", " + + ToStr::Get(multidraw.numInstances) + ", " + + ToStr::Get(multidraw.indexOffset) + ", " + + ToStr::Get(multidraw.instanceOffset) + ")"; - draw.flags |= eDraw_Drawcall|eDraw_UseIBuffer|eDraw_Instanced|eDraw_Indirect; + multidraw.flags |= eDraw_Drawcall|eDraw_UseIBuffer|eDraw_Instanced|eDraw_Indirect; - draw.topology = MakePrimitiveTopology(m_Real, Mode); - draw.indexByteWidth = IdxSize; + multidraw.topology = MakePrimitiveTopology(m_Real, Mode); + multidraw.indexByteWidth = IdxSize; AddEvent(MULTI_DRAWELEMENTS_INDIRECT, desc); - AddDrawcall(draw, true); + AddDrawcall(multidraw, true); m_CurEventID++; } @@ -2390,7 +2380,7 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferfv(GLuint framebuffer, GLen { SERIALISE_ELEMENT(ResourceId, Id, (framebuffer ? GetResourceManager()->GetID(FramebufferRes(GetCtx(), framebuffer)) : ResourceId())); SERIALISE_ELEMENT(GLenum, buf, buffer); - SERIALISE_ELEMENT(int32_t, draw, drawbuffer); + SERIALISE_ELEMENT(int32_t, drawbuf, drawbuffer); if(m_State <= EXECUTING) { @@ -2412,7 +2402,7 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferfv(GLuint framebuffer, GLen if(m_State == READING) name = "glClearBufferfv(" + ToStr::Get(buf) + ", " + - ToStr::Get(draw) + ", " + + ToStr::Get(drawbuf) + ", " + ToStr::Get(v.x) + ", " + ToStr::Get(v.y) + ", " + ToStr::Get(v.z) + ", " + @@ -2423,7 +2413,7 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferfv(GLuint framebuffer, GLen // necessary since these functions can be serialised even if ARB_dsa was not used originally, and // we need to support this case. if(m_State <= EXECUTING) - m_Real.glClearNamedFramebufferfv(framebuffer, buf, draw, &v.x); + m_Real.glClearNamedFramebufferfv(framebuffer, buf, drawbuf, &v.x); } else { @@ -2432,11 +2422,11 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferfv(GLuint framebuffer, GLen if(m_State == READING) name = "glClearBufferfv(" + ToStr::Get(buf) + ", " + - ToStr::Get(draw) + ", " + + ToStr::Get(drawbuf) + ", " + ToStr::Get(val) + ")"; if(m_State <= EXECUTING) - m_Real.glClearNamedFramebufferfv(framebuffer, buf, draw, &val); + m_Real.glClearNamedFramebufferfv(framebuffer, buf, drawbuf, &val); } const string desc = m_pSerialiser->GetDebugStr(); @@ -2496,7 +2486,7 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferiv(GLuint framebuffer, GLen { SERIALISE_ELEMENT(ResourceId, Id, (framebuffer ? GetResourceManager()->GetID(FramebufferRes(GetCtx(), framebuffer)) : ResourceId())); SERIALISE_ELEMENT(GLenum, buf, buffer); - SERIALISE_ELEMENT(int32_t, draw, drawbuffer); + SERIALISE_ELEMENT(int32_t, drawbuf, drawbuffer); if(m_State <= EXECUTING) { @@ -2518,7 +2508,7 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferiv(GLuint framebuffer, GLen if(m_State == READING) name = "glClearBufferiv(" + ToStr::Get(buf) + ", " + - ToStr::Get(draw) + ", " + + ToStr::Get(drawbuf) + ", " + ToStr::Get(v[0]) + ", " + ToStr::Get(v[1]) + ", " + ToStr::Get(v[2]) + ", " + @@ -2529,7 +2519,7 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferiv(GLuint framebuffer, GLen // necessary since these functions can be serialised even if ARB_dsa was not used originally, and // we need to support this case. if(m_State <= EXECUTING) - m_Real.glClearNamedFramebufferiv(framebuffer, buf, draw, v); + m_Real.glClearNamedFramebufferiv(framebuffer, buf, drawbuf, v); } else { @@ -2538,11 +2528,11 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferiv(GLuint framebuffer, GLen if(m_State == READING) name = "glClearBufferiv(" + ToStr::Get(buf) + ", " + - ToStr::Get(draw) + ", " + + ToStr::Get(drawbuf) + ", " + ToStr::Get(val) + ")"; if(m_State <= EXECUTING) - m_Real.glClearNamedFramebufferiv(framebuffer, buf, draw, &val); + m_Real.glClearNamedFramebufferiv(framebuffer, buf, drawbuf, &val); } const string desc = m_pSerialiser->GetDebugStr(); @@ -2602,7 +2592,7 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferuiv(GLuint framebuffer, GLe { SERIALISE_ELEMENT(ResourceId, Id, (framebuffer ? GetResourceManager()->GetID(FramebufferRes(GetCtx(), framebuffer)) : ResourceId())); SERIALISE_ELEMENT(GLenum, buf, buffer); - SERIALISE_ELEMENT(int32_t, draw, drawbuffer); + SERIALISE_ELEMENT(int32_t, drawbuf, drawbuffer); if(m_State <= EXECUTING) { @@ -2623,7 +2613,7 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferuiv(GLuint framebuffer, GLe if(m_State == READING) name = "glClearBufferuiv(" + ToStr::Get(buf) + ", " + - ToStr::Get(draw) + ", " + + ToStr::Get(drawbuf) + ", " + ToStr::Get(v[0]) + ", " + ToStr::Get(v[1]) + ", " + ToStr::Get(v[2]) + ", " + @@ -2634,7 +2624,7 @@ bool WrappedOpenGL::Serialise_glClearNamedFramebufferuiv(GLuint framebuffer, GLe // necessary since these functions can be serialised even if ARB_dsa was not used originally, and // we need to support this case. if(m_State <= EXECUTING) - m_Real.glClearNamedFramebufferuiv(framebuffer, buf, draw, v); + m_Real.glClearNamedFramebufferuiv(framebuffer, buf, drawbuf, v); } const string desc = m_pSerialiser->GetDebugStr(); diff --git a/renderdoc/driver/gl/wrappers/gl_query_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_query_funcs.cpp index c17d3eb04..6cf3c28a3 100644 --- a/renderdoc/driver/gl/wrappers/gl_query_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_query_funcs.cpp @@ -34,7 +34,7 @@ bool WrappedOpenGL::Serialise_glFenceSync(GLsync real, GLenum condition, GLbitfi if(m_State < WRITING) { - GLsync real = m_Real.glFenceSync(Condition, Flags); + real = m_Real.glFenceSync(Condition, Flags); GLuint name = 0; ResourceId liveid = ResourceId(); diff --git a/renderdoc/hooks/gl_win32_hooks.cpp b/renderdoc/hooks/gl_win32_hooks.cpp index 9dece7ed6..03f5f698c 100644 --- a/renderdoc/hooks/gl_win32_hooks.cpp +++ b/renderdoc/hooks/gl_win32_hooks.cpp @@ -237,7 +237,7 @@ class OpenGLHook : LibraryHook if(!m_EnabledHooks) return false; - bool success = SetupHooks(GL); + bool success = SetupHooks(); if(!success) return false; @@ -615,7 +615,7 @@ class OpenGLHook : LibraryHook set m_Contexts; - bool SetupHooks(GLHookSet &GL) + bool SetupHooks() { bool success = true; diff --git a/renderdoc/maths/matrix.cpp b/renderdoc/maths/matrix.cpp index 9e3ef7dcb..342498617 100644 --- a/renderdoc/maths/matrix.cpp +++ b/renderdoc/maths/matrix.cpp @@ -200,7 +200,7 @@ Matrix4f Matrix4f::Inverse() const float b5 = (*this)[10]*(*this)[15] - (*this)[11]*(*this)[14]; float det = a0*b5 - a1*b4 + a2*b3 + a3*b2 - a4*b1 + a5*b0; - if (fabs(det) > FLT_EPSILON) + if (fabsf(det) > FLT_EPSILON) { Matrix4f inverse; inverse[ 0] = + (*this)[ 5]*b5 - (*this)[ 6]*b4 + (*this)[ 7]*b3; @@ -349,8 +349,8 @@ Matrix4f Matrix4f::Orthographic(const float near, const float far) float T = 10.0f; float B = -10.0f; - float N = -fabs(far-near)*0.5f; - float F = fabs(far-near)*0.5f; + float N = -fabsf(far-near)*0.5f; + float F = fabsf(far-near)*0.5f; if(far < near) { diff --git a/renderdoc/maths/vec.h b/renderdoc/maths/vec.h index 7570b3dc7..a580b8ed8 100644 --- a/renderdoc/maths/vec.h +++ b/renderdoc/maths/vec.h @@ -55,7 +55,7 @@ class Vec3f inline float Length() const { - return sqrt(Dot(*this)); + return sqrtf(Dot(*this)); } inline void Normalise() diff --git a/renderdoc/os/win32/win32_hook.cpp b/renderdoc/os/win32/win32_hook.cpp index 3162c6474..8e9e85159 100644 --- a/renderdoc/os/win32/win32_hook.cpp +++ b/renderdoc/os/win32/win32_hook.cpp @@ -104,7 +104,7 @@ struct DllHookset struct CachedHookData { map DllHooks; - HMODULE module; + HMODULE ownmodule; Threading::CriticalSection lock; char lowername[512]; @@ -344,7 +344,7 @@ FARPROC WINAPI Hooked_GetProcAddress(HMODULE mod, LPCSTR func) if(mod == NULL || func == NULL) return (FARPROC)NULL; - if(mod == s_HookData->module || OrdinalAsString((void *)func)) + if(mod == s_HookData->ownmodule || OrdinalAsString((void *)func)) return GetProcAddress(mod, func); for(auto it=s_HookData->DllHooks.begin(); it != s_HookData->DllHooks.end(); ++it) @@ -383,11 +383,11 @@ void Win32_IAT_BeginHooks() GetModuleHandleEx( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS|GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCTSTR)&s_HookData, - &s_HookData->module); + &s_HookData->ownmodule); for(auto it=s_HookData->DllHooks.begin(); it != s_HookData->DllHooks.end(); ++it) for(size_t i=0; i < it->second.FunctionHooks.size(); i++) - it->second.FunctionHooks[i].excludeModule = s_HookData->module; + it->second.FunctionHooks[i].excludeModule = s_HookData->ownmodule; } // hook all functions for currently loaded modules. diff --git a/renderdoc/os/win32/win32_network.cpp b/renderdoc/os/win32/win32_network.cpp index b2d1bec71..748f7f201 100644 --- a/renderdoc/os/win32/win32_network.cpp +++ b/renderdoc/os/win32/win32_network.cpp @@ -283,10 +283,10 @@ Socket *CreateClientSocket(const char *host, uint16_t port, int timeoutMS) std::wstring whost = StringFormat::UTF82Wide(string(host)); - addrinfoW *result = NULL; - GetAddrInfoW(whost.c_str(), portwstr, &hints, &result); + addrinfoW *addrResult = NULL; + GetAddrInfoW(whost.c_str(), portwstr, &hints, &addrResult); - for(addrinfoW *ptr = result; ptr != NULL; ptr = ptr->ai_next) + for(addrinfoW *ptr = addrResult; ptr != NULL; ptr = ptr->ai_next) { SOCKET s = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_NO_HANDLE_INHERIT); diff --git a/renderdoc/serialise/serialiser.cpp b/renderdoc/serialise/serialiser.cpp index eca9d25ce..028ff522a 100644 --- a/renderdoc/serialise/serialiser.cpp +++ b/renderdoc/serialise/serialiser.cpp @@ -29,6 +29,11 @@ #include "serialise/string_utils.h" +#ifdef _MSC_VER +#pragma warning (disable : 4422) // warning C4422: 'snprintf' : too many arguments passed for format string + // false positive as VS is trying to parse renderdoc's custom format strings +#endif + #if !defined(RELEASE) int64_t Chunk::m_LiveChunks = 0; @@ -531,7 +536,7 @@ uint64_t Serialiser::FlushToDisk() { Chunk *chunk = m_Chunks[i]; - size_t alignedoffs = AlignUp16(offs); + alignedoffs = AlignUp16(offs); if(offs != alignedoffs && chunk->IsAligned()) { @@ -1033,7 +1038,7 @@ template<> string ToStrHelper::Get(void* const &el) { char tostrBuf[256] = {0}; - StringFormat::snprintf(tostrBuf, 255, "0x%X", el); + StringFormat::snprintf(tostrBuf, 255, "0x%p", el); return tostrBuf; } diff --git a/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs b/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs index aa3bedf20..c7a751641 100644 --- a/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs +++ b/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs @@ -906,7 +906,7 @@ namespace renderdocui.Windows.PipelineState restartIndex.Text = ""; } - if (state.m_VtxIn.ibuffer != null) + if (state.m_VtxIn.ibuffer != ResourceId.Null) { if (ibufferUsed || showDisabled.Checked) { diff --git a/renderdocui/Windows/TextureViewer.cs b/renderdocui/Windows/TextureViewer.cs index b01d32846..f91aa7366 100644 --- a/renderdocui/Windows/TextureViewer.cs +++ b/renderdocui/Windows/TextureViewer.cs @@ -2154,11 +2154,11 @@ namespace renderdocui.Windows #region Mouse movement and scrolling - private Point m_DragStartScroll; - private Point m_DragStartPos; + private Point m_DragStartScroll = Point.Empty; + private Point m_DragStartPos = Point.Empty; - private Point m_CurHoverPixel; - private Point m_PickedPoint; + private Point m_CurHoverPixel = Point.Empty; + private Point m_PickedPoint = Point.Empty; private PixelValue m_CurRealValue = null; private PixelValue m_CurPixelValue = null; @@ -2547,7 +2547,7 @@ namespace renderdocui.Windows m_Core.Renderer.BeginInvoke(RT_UpdateVisualRange); - if (m_Output != null && m_PickedPoint != null && m_PickedPoint.X > 0 && m_PickedPoint.Y > 0) + if (m_Output != null && m_PickedPoint.X >= 0 && m_PickedPoint.Y >= 0) { m_Core.Renderer.BeginInvoke((ReplayRenderer r) => { @@ -2575,7 +2575,7 @@ namespace renderdocui.Windows m_Core.Renderer.BeginInvoke(RT_UpdateVisualRange); - if (m_Output != null && m_PickedPoint != null && m_PickedPoint.X > 0 && m_PickedPoint.Y > 0) + if (m_Output != null && m_PickedPoint.X >= 0 && m_PickedPoint.Y >= 0) { m_Core.Renderer.BeginInvoke((ReplayRenderer r) => {