Remove some dead code that's no longer needed

* Reported by Coverity Scan
This commit is contained in:
baldurk
2017-11-22 19:11:18 +00:00
parent e4555e0d53
commit 2514ad4126
6 changed files with 56 additions and 103 deletions
@@ -441,22 +441,6 @@ void RDHeaderView::resizeSectionsWithHints()
}
}
}
for(int pix = 0; pix < available; pix++)
{
int minSection = 0;
for(int i = 1; i < sizes.count(); i++)
{
// don't assign any space to sections with negative hints
if(i < m_sectionStretchHints.count() && m_sectionStretchHints[i] <= 0)
continue;
if(sizes[i] < sizes[minSection])
minSection = i;
}
sizes[minSection]++;
}
}
resizeSections(sizes.toList());
+2 -2
View File
@@ -824,8 +824,8 @@ void TextureViewer::UI_UpdateStatusText()
y = qMax(0, y);
int x = m_CurHoverPixel.x() >> (int)m_TexDisplay.mip;
float invWidth = mipWidth > 0 ? 1.0f / mipWidth : 0.0f;
float invHeight = mipHeight > 0 ? 1.0f / mipHeight : 0.0f;
float invWidth = 1.0f / mipWidth;
float invHeight = 1.0f / mipHeight;
QString hoverCoords = QFormatStr("%1, %2 (%3, %4)")
.arg(x, 4)
+12 -22
View File
@@ -218,7 +218,6 @@ struct D3D11CounterContext
{
uint32_t eventStart;
vector<GPUTimer> timers;
int reuseIdx;
};
void D3D11DebugManager::FillTimers(D3D11CounterContext &ctx, const DrawcallDescription &drawnode)
@@ -243,27 +242,20 @@ void D3D11DebugManager::FillTimers(D3D11CounterContext &ctx, const DrawcallDescr
HRESULT hr = S_OK;
{
if(ctx.reuseIdx == -1)
{
ctx.timers.push_back(GPUTimer());
ctx.timers.push_back(GPUTimer());
timer = &ctx.timers.back();
timer->eventID = d.eventID;
timer->before = timer->after = timer->stats = timer->occlusion = NULL;
timer = &ctx.timers.back();
timer->eventID = d.eventID;
timer->before = timer->after = timer->stats = timer->occlusion = NULL;
hr = m_pDevice->CreateQuery(&qtimedesc, &timer->before);
RDCASSERTEQUAL(hr, S_OK);
hr = m_pDevice->CreateQuery(&qtimedesc, &timer->after);
RDCASSERTEQUAL(hr, S_OK);
hr = m_pDevice->CreateQuery(&qstatsdesc, &timer->stats);
RDCASSERTEQUAL(hr, S_OK);
hr = m_pDevice->CreateQuery(&qoccldesc, &timer->occlusion);
RDCASSERTEQUAL(hr, S_OK);
}
else
{
timer = &ctx.timers[ctx.reuseIdx++];
}
hr = m_pDevice->CreateQuery(&qtimedesc, &timer->before);
RDCASSERTEQUAL(hr, S_OK);
hr = m_pDevice->CreateQuery(&qtimedesc, &timer->after);
RDCASSERTEQUAL(hr, S_OK);
hr = m_pDevice->CreateQuery(&qstatsdesc, &timer->stats);
RDCASSERTEQUAL(hr, S_OK);
hr = m_pDevice->CreateQuery(&qoccldesc, &timer->occlusion);
RDCASSERTEQUAL(hr, S_OK);
}
m_WrappedDevice->ReplayLog(ctx.eventStart, d.eventID, eReplay_WithoutDraw);
@@ -498,7 +490,6 @@ vector<CounterResult> D3D11DebugManager::FetchCounters(const vector<GPUCounter>
D3D11CounterContext ctx;
for(int loop = 0; loop < 1; loop++)
{
{
m_pImmediateContext->Begin(disjoint);
@@ -506,7 +497,6 @@ vector<CounterResult> D3D11DebugManager::FetchCounters(const vector<GPUCounter>
m_pImmediateContext->End(start);
ctx.eventStart = 0;
ctx.reuseIdx = loop == 0 ? -1 : 0;
FillTimers(ctx, m_WrappedContext->GetRootDraw());
m_pImmediateContext->End(disjoint);
+41 -54
View File
@@ -190,7 +190,6 @@ struct GLCounterContext
{
uint32_t eventStart;
vector<GPUQueries> queries;
int reuseIdx;
};
GLenum glCounters[] = {
@@ -227,25 +226,18 @@ void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallDescription &draw
GPUQueries *queries = NULL;
{
if(ctx.reuseIdx == -1)
{
ctx.queries.push_back(GPUQueries());
ctx.queries.push_back(GPUQueries());
queries = &ctx.queries.back();
queries->eventID = d.eventID;
for(auto q : indices<GPUCounter>())
queries->obj[q] = 0;
queries = &ctx.queries.back();
queries->eventID = d.eventID;
for(auto q : indices<GPUCounter>())
queries->obj[q] = 0;
for(uint32_t c = 0; c < counters.size(); c++)
{
m_pDriver->glGenQueries(1, &queries->obj[(uint32_t)counters[c]]);
if(m_pDriver->glGetError())
queries->obj[(uint32_t)counters[c]] = 0;
}
}
else
for(uint32_t c = 0; c < counters.size(); c++)
{
queries = &ctx.queries[ctx.reuseIdx++];
m_pDriver->glGenQueries(1, &queries->obj[(uint32_t)counters[c]]);
if(m_pDriver->glGetError())
queries->obj[(uint32_t)counters[c]] = 0;
}
}
@@ -286,55 +278,50 @@ vector<CounterResult> GLReplay::FetchCounters(const vector<GPUCounter> &counters
MakeCurrentReplayContext(&m_ReplayCtx);
GLCounterContext ctx;
ctx.eventStart = 0;
for(int loop = 0; loop < 1; loop++)
m_pDriver->SetFetchCounters(true);
FillTimers(ctx, m_pDriver->GetRootDraw(), counters);
m_pDriver->SetFetchCounters(false);
double nanosToSecs = 1.0 / 1000000000.0;
GLuint prevbind = 0;
m_pDriver->glGetIntegerv(eGL_QUERY_BUFFER_BINDING, (GLint *)&prevbind);
m_pDriver->glBindBuffer(eGL_QUERY_BUFFER, 0);
for(size_t i = 0; i < ctx.queries.size(); i++)
{
ctx.eventStart = 0;
ctx.reuseIdx = loop == 0 ? -1 : 0;
m_pDriver->SetFetchCounters(true);
FillTimers(ctx, m_pDriver->GetRootDraw(), counters);
m_pDriver->SetFetchCounters(false);
double nanosToSecs = 1.0 / 1000000000.0;
GLuint prevbind = 0;
m_pDriver->glGetIntegerv(eGL_QUERY_BUFFER_BINDING, (GLint *)&prevbind);
m_pDriver->glBindBuffer(eGL_QUERY_BUFFER, 0);
for(size_t i = 0; i < ctx.queries.size(); i++)
for(uint32_t c = 0; c < counters.size(); c++)
{
for(uint32_t c = 0; c < counters.size(); c++)
if(ctx.queries[i].obj[(uint32_t)counters[c]])
{
if(ctx.queries[i].obj[(uint32_t)counters[c]])
GLuint64 data = 0;
m_pDriver->glGetQueryObjectui64v(ctx.queries[i].obj[(uint32_t)counters[c]],
eGL_QUERY_RESULT, &data);
double duration = double(data) * nanosToSecs;
if(m_pDriver->glGetError())
{
GLuint64 data = 0;
m_pDriver->glGetQueryObjectui64v(ctx.queries[i].obj[(uint32_t)counters[c]],
eGL_QUERY_RESULT, &data);
data = (uint64_t)-1;
duration = -1;
}
double duration = double(data) * nanosToSecs;
if(m_pDriver->glGetError())
{
data = (uint64_t)-1;
duration = -1;
}
if(counters[c] == GPUCounter::EventGPUDuration)
{
ret.push_back(
CounterResult(ctx.queries[i].eventID, GPUCounter::EventGPUDuration, duration));
}
else
ret.push_back(CounterResult(ctx.queries[i].eventID, counters[c], data));
if(counters[c] == GPUCounter::EventGPUDuration)
{
ret.push_back(CounterResult(ctx.queries[i].eventID, GPUCounter::EventGPUDuration, duration));
}
else
ret.push_back(CounterResult(ctx.queries[i].eventID, counters[c], (uint64_t)-1));
ret.push_back(CounterResult(ctx.queries[i].eventID, counters[c], data));
}
else
ret.push_back(CounterResult(ctx.queries[i].eventID, counters[c], (uint64_t)-1));
}
m_pDriver->glBindBuffer(eGL_QUERY_BUFFER, prevbind);
}
m_pDriver->glBindBuffer(eGL_QUERY_BUFFER, prevbind);
for(size_t i = 0; i < ctx.queries.size(); i++)
for(uint32_t c = 0; c < counters.size(); c++)
if(ctx.queries[i].obj[(uint32_t)counters[c]])
+1 -3
View File
@@ -2216,10 +2216,8 @@ void GLReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip,
if(newtarget == eGL_TEXTURE_3D)
gl.glFramebufferTexture3D(eGL_FRAMEBUFFER, eGL_COLOR_ATTACHMENT0, eGL_TEXTURE_3D, tempTex,
0, 0);
else if(newtarget == eGL_TEXTURE_2D || newtarget == eGL_TEXTURE_2D_MULTISAMPLE)
else if(newtarget == eGL_TEXTURE_2D)
gl.glFramebufferTexture2D(eGL_FRAMEBUFFER, eGL_COLOR_ATTACHMENT0, newtarget, tempTex, 0);
else
gl.glFramebufferTexture(eGL_FRAMEBUFFER, eGL_COLOR_ATTACHMENT0, tempTex, 0);
float col[] = {0.0f, 0.0f, 0.0f, 1.0f};
gl.glClearBufferfv(eGL_COLOR, 0, col);
-6
View File
@@ -445,9 +445,6 @@ ReplayStatus CaptureFile::Convert(const char *filename, const char *filetype, fl
delete reader;
delete writer;
if(!success)
return ReplayStatus::FileIOFailed;
}
if(!success)
@@ -477,9 +474,6 @@ ReplayStatus CaptureFile::Convert(const char *filename, const char *filetype, fl
return ReplayStatus::FileIOFailed;
}
if(!success)
return ReplayStatus::FileIOFailed;
return ReplayStatus::Succeeded;
}