diff --git a/qrenderdoc/Widgets/Extended/RDHeaderView.cpp b/qrenderdoc/Widgets/Extended/RDHeaderView.cpp index 749eca72e..77913591d 100644 --- a/qrenderdoc/Widgets/Extended/RDHeaderView.cpp +++ b/qrenderdoc/Widgets/Extended/RDHeaderView.cpp @@ -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()); diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index 608ac2cf2..5076bab81 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -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) diff --git a/renderdoc/driver/d3d11/d3d11_counters.cpp b/renderdoc/driver/d3d11/d3d11_counters.cpp index a1360aa5c..ff0984011 100644 --- a/renderdoc/driver/d3d11/d3d11_counters.cpp +++ b/renderdoc/driver/d3d11/d3d11_counters.cpp @@ -218,7 +218,6 @@ struct D3D11CounterContext { uint32_t eventStart; vector 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 D3D11DebugManager::FetchCounters(const vector D3D11CounterContext ctx; - for(int loop = 0; loop < 1; loop++) { { m_pImmediateContext->Begin(disjoint); @@ -506,7 +497,6 @@ vector D3D11DebugManager::FetchCounters(const vector m_pImmediateContext->End(start); ctx.eventStart = 0; - ctx.reuseIdx = loop == 0 ? -1 : 0; FillTimers(ctx, m_WrappedContext->GetRootDraw()); m_pImmediateContext->End(disjoint); diff --git a/renderdoc/driver/gl/gl_counters.cpp b/renderdoc/driver/gl/gl_counters.cpp index 40bdc3896..e47a29191 100644 --- a/renderdoc/driver/gl/gl_counters.cpp +++ b/renderdoc/driver/gl/gl_counters.cpp @@ -190,7 +190,6 @@ struct GLCounterContext { uint32_t eventStart; vector 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()) - queries->obj[q] = 0; + queries = &ctx.queries.back(); + queries->eventID = d.eventID; + for(auto q : indices()) + 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 GLReplay::FetchCounters(const vector &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]]) diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index a4a194fe0..b020ce025 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -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); diff --git a/renderdoc/replay/capture_file.cpp b/renderdoc/replay/capture_file.cpp index ff40f0d6d..52392dbdb 100644 --- a/renderdoc/replay/capture_file.cpp +++ b/renderdoc/replay/capture_file.cpp @@ -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; }