mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-26 08:26:50 +00:00
Remove redundant/dead code identified by PVS Studio
This commit is contained in:
@@ -114,11 +114,6 @@ public:
|
||||
{
|
||||
if(e->buttons() & Qt::LeftButton)
|
||||
{
|
||||
if(m_DragStartPos.x() < 0)
|
||||
{
|
||||
m_DragStartPos = e->pos();
|
||||
}
|
||||
|
||||
m_DragStartPos = e->pos();
|
||||
}
|
||||
else
|
||||
@@ -332,20 +327,15 @@ private:
|
||||
|
||||
void RotateArcball(QPoint from, QPoint to)
|
||||
{
|
||||
float ax = ((float)from.x() / (float)m_WinSize.width()) * 2.0f - 1.0f;
|
||||
float ay = ((float)from.y() / (float)m_WinSize.height()) * 2.0f - 1.0f;
|
||||
float bx = ((float)to.x() / (float)m_WinSize.width()) * 2.0f - 1.0f;
|
||||
float by = ((float)to.y() / (float)m_WinSize.height()) * 2.0f - 1.0f;
|
||||
|
||||
// this isn't a 'true arcball' but it handles extreme aspect ratios
|
||||
// better. We basically 'centre' around the from point always being
|
||||
// 0,0 (straight out of the screen) as if you're always dragging
|
||||
// the arcball from the middle, and just use the relative movement
|
||||
int minDimension = qMin(m_WinSize.width(), m_WinSize.height());
|
||||
|
||||
ax = ay = 0;
|
||||
bx = ((float)(to.x() - from.x()) / (float)minDimension) * 2.0f;
|
||||
by = ((float)(to.y() - from.y()) / (float)minDimension) * 2.0f;
|
||||
float ax = 0.0f, ay = 0.0f;
|
||||
float bx = ((float)(to.x() - from.x()) / (float)minDimension) * 2.0f;
|
||||
float by = ((float)(to.y() - from.y()) / (float)minDimension) * 2.0f;
|
||||
|
||||
ay = -ay;
|
||||
by = -by;
|
||||
|
||||
@@ -1170,13 +1170,8 @@ void ShaderViewer::disassembly_buttonReleased(QMouseEvent *event)
|
||||
m_DisassemblyView->setIndicatorCurrent(INDICATOR_REGHIGHLIGHT);
|
||||
m_DisassemblyView->indicatorClearRange(start, end);
|
||||
|
||||
sptr_t flags = SCFIND_MATCHCASE | SCFIND_WHOLEWORD;
|
||||
|
||||
if(tag.cat != VariableCategory::Unknown)
|
||||
{
|
||||
flags |= SCFIND_REGEXP | SCFIND_POSIX;
|
||||
text += lit("\\.[xyzwrgba]+");
|
||||
}
|
||||
sptr_t flags = SCFIND_MATCHCASE | SCFIND_WHOLEWORD | SCFIND_REGEXP | SCFIND_POSIX;
|
||||
text += lit("\\.[xyzwrgba]+");
|
||||
|
||||
QByteArray findUtf8 = text.toUtf8();
|
||||
|
||||
|
||||
@@ -1548,7 +1548,6 @@ rdcpair<ReplayStatus, IReplayController *> RemoteServer::OpenCapture(
|
||||
if(proxyid != ~0U && proxyid >= m_Proxies.size())
|
||||
{
|
||||
RDCERR("Invalid proxy driver id %d specified for remote renderer", proxyid);
|
||||
ret.first = ReplayStatus::InternalError;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -1300,12 +1300,6 @@ ReplayStatus WrappedID3D11DeviceContext::ReplayLog(CaptureState readType, uint32
|
||||
it != WrappedID3D11Texture3D1::m_TextureList.end(); ++it)
|
||||
m_ResourceUses[it->first];
|
||||
|
||||
#define CHECK_UNUSED_INITIAL_STATES 0
|
||||
|
||||
#if CHECK_UNUSED_INITIAL_STATES
|
||||
int initialSkips = 0;
|
||||
#endif
|
||||
|
||||
// it's easier to remove duplicate usages here than check it as we go.
|
||||
// this means if textures are bound in multiple places in the same draw
|
||||
// we don't have duplicate uses
|
||||
@@ -1314,53 +1308,7 @@ ReplayStatus WrappedID3D11DeviceContext::ReplayLog(CaptureState readType, uint32
|
||||
rdcarray<EventUsage> &v = it->second;
|
||||
std::sort(v.begin(), v.end());
|
||||
v.erase(std::unique(v.begin(), v.end()) - v.begin(), ~0U);
|
||||
|
||||
#if CHECK_UNUSED_INITIAL_STATES
|
||||
ResourceId resid = m_pDevice->GetResourceManager()->GetOriginalID(it->first);
|
||||
|
||||
if(m_pDevice->GetResourceManager()->GetInitialContents(resid).resource == NULL)
|
||||
continue;
|
||||
|
||||
// code disabled for now as skipping these initial states
|
||||
// doesn't seem to produce any measurable improvement in any case
|
||||
// I've checked
|
||||
RDCDEBUG("Resource %llu", resid);
|
||||
if(v.empty())
|
||||
{
|
||||
RDCDEBUG("Never used!");
|
||||
initialSkips++;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool written = false;
|
||||
|
||||
for(auto usit = v.begin(); usit != v.end(); ++usit)
|
||||
{
|
||||
ResourceUsage u = usit->usage;
|
||||
|
||||
if(u == ResourceUsage::StreamOut ||
|
||||
(u >= ResourceUsage::VS_RWResource && u <= ResourceUsage::CS_RWResource) ||
|
||||
u == ResourceUsage::DepthStencilTarget || u == ResourceUsage::ColorTarget)
|
||||
{
|
||||
written = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(written)
|
||||
{
|
||||
RDCDEBUG("Written in frame - needs initial state");
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("Never written to in the frame");
|
||||
initialSkips++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// RDCDEBUG("Can skip %d initial states.", initialSkips);
|
||||
}
|
||||
|
||||
// swap the structure back now that we've accumulated the frame as well.
|
||||
|
||||
@@ -199,12 +199,6 @@ void D3D11Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
|
||||
WrappedID3D11Shader<ID3D11VertexShader> *wrappedVS = (WrappedID3D11Shader<ID3D11VertexShader> *)vs;
|
||||
|
||||
if(!wrappedVS)
|
||||
{
|
||||
RDCERR("Couldn't find wrapped vertex shader!");
|
||||
return;
|
||||
}
|
||||
|
||||
const DrawcallDescription *drawcall = m_pDevice->GetDrawcall(eventId);
|
||||
|
||||
if(drawcall->numIndices == 0 ||
|
||||
@@ -222,12 +216,6 @@ void D3D11Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
WrappedID3D11Shader<ID3D11GeometryShader> *wrappedGS =
|
||||
(WrappedID3D11Shader<ID3D11GeometryShader> *)gs;
|
||||
|
||||
if(!wrappedGS)
|
||||
{
|
||||
RDCERR("Couldn't find wrapped geometry shader!");
|
||||
return;
|
||||
}
|
||||
|
||||
dxbcGS = wrappedGS->GetDXBC();
|
||||
|
||||
RDCASSERT(dxbcGS);
|
||||
@@ -240,12 +228,6 @@ void D3D11Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
WrappedID3D11Shader<ID3D11DomainShader> *wrappedDS =
|
||||
(WrappedID3D11Shader<ID3D11DomainShader> *)ds;
|
||||
|
||||
if(!wrappedDS)
|
||||
{
|
||||
RDCERR("Couldn't find wrapped domain shader!");
|
||||
return;
|
||||
}
|
||||
|
||||
dxbcDS = wrappedDS->GetDXBC();
|
||||
|
||||
RDCASSERT(dxbcDS);
|
||||
|
||||
@@ -449,7 +449,6 @@ bool D3D12Replay::RenderTextureInternal(D3D12_CPU_DESCRIPTOR_HANDLE rtv, Texture
|
||||
vertexData.VertexScale.y = (tex_y / m_OutputHeight) * cfg.scale * 2.0f;
|
||||
|
||||
pixelData.MipLevel = (float)cfg.subresource.mip;
|
||||
pixelData.OutputDisplayFormat = RESTYPE_TEX2D;
|
||||
|
||||
if(resourceDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D)
|
||||
pixelData.Slice =
|
||||
|
||||
@@ -84,11 +84,7 @@ D3D12Pipe::RegisterSpace &get_space(rdcarray<D3D12Pipe::RegisterSpace> &dstSpace
|
||||
D3D12Replay::D3D12Replay(WrappedID3D12Device *d)
|
||||
{
|
||||
m_pDevice = d;
|
||||
m_Proxy = false;
|
||||
|
||||
m_HighlightCache.driver = this;
|
||||
|
||||
RDCEraseEl(m_DriverInfo);
|
||||
}
|
||||
|
||||
void D3D12Replay::Shutdown()
|
||||
|
||||
@@ -28,33 +28,6 @@
|
||||
#include "d3d12_manager.h"
|
||||
#include "d3d12_resources.h"
|
||||
|
||||
D3D12RenderState &D3D12RenderState::operator=(const D3D12RenderState &o)
|
||||
{
|
||||
views = o.views;
|
||||
scissors = o.scissors;
|
||||
|
||||
rts = o.rts;
|
||||
dsv = o.dsv;
|
||||
|
||||
pipe = o.pipe;
|
||||
|
||||
heaps = o.heaps;
|
||||
|
||||
graphics.rootsig = o.graphics.rootsig;
|
||||
graphics.sigelems = o.graphics.sigelems;
|
||||
compute.rootsig = o.compute.rootsig;
|
||||
compute.sigelems = o.compute.sigelems;
|
||||
|
||||
topo = o.topo;
|
||||
stencilRef = o.stencilRef;
|
||||
memcpy(blendFactor, o.blendFactor, sizeof(blendFactor));
|
||||
|
||||
ibuffer = o.ibuffer;
|
||||
vbuffers = o.vbuffers;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
rdcarray<ResourceId> D3D12RenderState::GetRTVIDs() const
|
||||
{
|
||||
rdcarray<ResourceId> ret;
|
||||
|
||||
@@ -44,7 +44,8 @@ enum SignatureElementType
|
||||
struct D3D12RenderState
|
||||
{
|
||||
D3D12RenderState() = default;
|
||||
D3D12RenderState &operator=(const D3D12RenderState &o);
|
||||
D3D12RenderState(const D3D12RenderState &o) = default;
|
||||
D3D12RenderState &operator=(const D3D12RenderState &o) = default;
|
||||
|
||||
void ApplyState(WrappedID3D12Device *dev, ID3D12GraphicsCommandListX *list) const;
|
||||
void ApplyDescriptorHeaps(ID3D12GraphicsCommandListX *list) const;
|
||||
|
||||
@@ -260,7 +260,7 @@ HRESULT __stdcall WrappedD3DDevice8::Present(CONST RECT *pSourceRect, CONST RECT
|
||||
HRESULT res = S_OK;
|
||||
res = m_device->BeginScene();
|
||||
DWORD stateBlock;
|
||||
HRESULT stateBlockRes = m_device->CreateStateBlock(D3DSBT_ALL, &stateBlock);
|
||||
m_device->CreateStateBlock(D3DSBT_ALL, &stateBlock);
|
||||
|
||||
IDirect3DSurface8 *backBuffer;
|
||||
res |= m_device->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &backBuffer);
|
||||
@@ -285,7 +285,7 @@ HRESULT __stdcall WrappedD3DDevice8::Present(CONST RECT *pSourceRect, CONST RECT
|
||||
|
||||
GetDebugManager()->RenderText(0.0f, 0.0f, overlayText);
|
||||
|
||||
stateBlockRes = m_device->ApplyStateBlock(stateBlock);
|
||||
m_device->ApplyStateBlock(stateBlock);
|
||||
res |= m_device->EndScene();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ HRESULT __stdcall WrappedD3DDevice9::Present(CONST RECT *pSourceRect, CONST RECT
|
||||
HRESULT res = S_OK;
|
||||
res = m_device->BeginScene();
|
||||
IDirect3DStateBlock9 *stateBlock;
|
||||
HRESULT stateBlockRes = m_device->CreateStateBlock(D3DSBT_ALL, &stateBlock);
|
||||
m_device->CreateStateBlock(D3DSBT_ALL, &stateBlock);
|
||||
|
||||
IDirect3DSurface9 *backBuffer;
|
||||
res |= m_device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backBuffer);
|
||||
@@ -253,7 +253,7 @@ HRESULT __stdcall WrappedD3DDevice9::Present(CONST RECT *pSourceRect, CONST RECT
|
||||
|
||||
GetDebugManager()->RenderText(0.0f, 0.0f, overlayText);
|
||||
|
||||
stateBlockRes = stateBlock->Apply();
|
||||
stateBlock->Apply();
|
||||
res |= m_device->EndScene();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +364,6 @@ UINT GetRowPitch(int Width, DXGI_FORMAT Format, int mip)
|
||||
case DXGI_FORMAT_NV11:
|
||||
// similar to NV12 - planar 4:1:1 4 horizontal downsampling but no vertical downsampling. For
|
||||
// row pitch calculation amounts to the same result.
|
||||
ret = ret;
|
||||
break;
|
||||
case DXGI_FORMAT_AI44:
|
||||
// special format, 1 byte per pixel, palletised values in 4 most significant bits, alpha in 4
|
||||
|
||||
@@ -335,9 +335,6 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
|
||||
ClearGLErrors();
|
||||
drv.glUseProgram(solidProg);
|
||||
GLenum err = drv.glGetError();
|
||||
|
||||
err = eGL_NONE;
|
||||
}
|
||||
|
||||
MeshUBOData *soliddata = (MeshUBOData *)drv.glMapBufferRange(
|
||||
|
||||
@@ -869,7 +869,6 @@ void GLReplay::SavePipelineState(uint32_t eventId)
|
||||
ResourceFormat fmt;
|
||||
|
||||
fmt.type = ResourceFormatType::Regular;
|
||||
fmt.compCount = 4;
|
||||
GLint compCount;
|
||||
drv.glGetVertexAttribiv(i, eGL_VERTEX_ATTRIB_ARRAY_SIZE, (GLint *)&compCount);
|
||||
|
||||
|
||||
@@ -294,7 +294,6 @@ public:
|
||||
done = false;
|
||||
trace = NULL;
|
||||
program = NULL;
|
||||
program = NULL;
|
||||
RDCEraseEl(semantics);
|
||||
}
|
||||
State(int quadIdx, const ShaderDebugTrace *t, const DXBC::Reflection *r,
|
||||
|
||||
@@ -302,8 +302,6 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, VkRenderPassBeginIn
|
||||
|
||||
int sampleIdx = (int)RDCCLAMP(cfg.subresource.sample, 0U, (uint32_t)SampleCount(iminfo.samples));
|
||||
|
||||
sampleIdx = cfg.subresource.sample;
|
||||
|
||||
if(cfg.subresource.sample == ~0U)
|
||||
sampleIdx = -SampleCount(iminfo.samples);
|
||||
|
||||
|
||||
@@ -240,11 +240,6 @@ rdcarray<uint32_t> VulkanReplay::GetPassEvents(uint32_t eventId)
|
||||
|
||||
// step back
|
||||
start = start->previous;
|
||||
|
||||
// something went wrong, start->previous was non-zero but we didn't
|
||||
// get a draw. Abort
|
||||
if(!start)
|
||||
return passEvents;
|
||||
}
|
||||
|
||||
// store all the draw eventIDs up to the one specified at the start
|
||||
|
||||
@@ -556,12 +556,10 @@ static void ForAllModules(std::function<void(const MODULEENTRY32 &me32)> callbac
|
||||
return;
|
||||
}
|
||||
|
||||
uintptr_t ret = 0;
|
||||
|
||||
do
|
||||
{
|
||||
callback(me32);
|
||||
} while(ret == 0 && Module32Next(hModuleSnap, &me32));
|
||||
} while(Module32Next(hModuleSnap, &me32));
|
||||
|
||||
CloseHandle(hModuleSnap);
|
||||
}
|
||||
|
||||
@@ -639,19 +639,13 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_UpdateInstalledVersionNumbe
|
||||
|
||||
// allow the value to silently not exist
|
||||
if(ret != ERROR_SUCCESS)
|
||||
{
|
||||
DisplayName[0] = 0;
|
||||
ret = ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
len = sizeof(Publisher) - 1;
|
||||
ret = RegGetValueA(subkey, NULL, "Publisher", RRF_RT_ANY, NULL, Publisher, &len);
|
||||
|
||||
if(ret != ERROR_SUCCESS)
|
||||
{
|
||||
Publisher[0] = 0;
|
||||
ret = ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
// if this is our key, set the version number
|
||||
if(!strcmp(DisplayName, "RenderDoc") && !strcmp(Publisher, "Baldur Karlsson"))
|
||||
|
||||
@@ -386,7 +386,6 @@ struct InjectCommand : public Command
|
||||
virtual int Execute(cmdline::parser &parser, const CaptureOptions &opts)
|
||||
{
|
||||
uint32_t PID = parser.get<uint32_t>("PID");
|
||||
std::string workingDir = parser.get<std::string>("working-dir");
|
||||
std::string logFile = parser.get<std::string>("capture-file");
|
||||
|
||||
std::cout << "Injecting into PID " << PID << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user