GPUDevice: Replace explicit GL_PUSH/GL_POP with nested GL_SCOPE

This commit is contained in:
Stenzek 2025-01-18 18:53:32 +10:00
parent d62261e7a4
commit 88b43370dc
No known key found for this signature in database
3 changed files with 2 additions and 30 deletions

View File

@ -4055,7 +4055,7 @@ void GPU_HW::DownsampleFramebuffer()
void GPU_HW::DownsampleFramebufferAdaptive(GPUTexture* source, u32 left, u32 top, u32 width, u32 height)
{
GL_PUSH_FMT("DownsampleFramebufferAdaptive ({},{} => {},{})", left, top, left + width, left + height);
GL_SCOPE_FMT("DownsampleFramebufferAdaptive ({},{} => {},{})", left, top, left + width, left + height);
struct SmoothingUBOData
{
@ -4081,7 +4081,6 @@ void GPU_HW::DownsampleFramebufferAdaptive(GPUTexture* source, u32 left, u32 top
if (!m_downsample_texture || !level_texture || !weight_texture)
{
ERROR_LOG("Failed to create {}x{} RTs for adaptive downsampling", width, height);
GL_POP();
return;
}
@ -4166,8 +4165,6 @@ void GPU_HW::DownsampleFramebufferAdaptive(GPUTexture* source, u32 left, u32 top
m_downsample_texture->MakeReadyForSampling();
}
GL_POP();
RestoreDeviceContext();
m_presenter.SetDisplayTexture(m_downsample_texture.get(), 0, 0, width, height);

View File

@ -1030,18 +1030,6 @@ struct GLAutoPop
};
#define GL_SCOPE(name) GLAutoPop GL_TOKEN_PASTE2(gl_auto_pop_, __LINE__)(name)
#define GL_PUSH(name) \
do \
{ \
if (g_gpu_device->IsDebugDevice()) [[unlikely]] \
g_gpu_device->PushDebugGroup(name); \
} while (0)
#define GL_POP() \
do \
{ \
if (g_gpu_device->IsDebugDevice()) [[unlikely]] \
g_gpu_device->PopDebugGroup(); \
} while (0)
#define GL_INS(msg) \
do \
{ \
@ -1056,12 +1044,6 @@ struct GLAutoPop
} while (0)
#define GL_SCOPE_FMT(...) GLAutoPop GL_TOKEN_PASTE2(gl_auto_pop_, __LINE__)(__VA_ARGS__)
#define GL_PUSH_FMT(...) \
do \
{ \
if (g_gpu_device->IsDebugDevice()) [[unlikely]] \
g_gpu_device->PushDebugGroup(__VA_ARGS__); \
} while (0)
#define GL_INS_FMT(...) \
do \
{ \
@ -1076,13 +1058,10 @@ struct GLAutoPop
} while (0)
#else
#define GL_SCOPE(name) (void)0
#define GL_PUSH(name) (void)0
#define GL_POP() (void)0
#define GL_INS(msg) (void)0
#define GL_OBJECT_NAME(obj, name) (void)0
#define GL_SCOPE_FMT(...) (void)0
#define GL_PUSH_FMT(...) (void)0
#define GL_INS_FMT(...) (void)0
#define GL_OBJECT_NAME_FMT(obj, ...) (void)0
#endif

View File

@ -1472,7 +1472,7 @@ GPUDevice::PresentResult PostProcessing::ReShadeFXShader::Apply(GPUTexture* inpu
s32 native_height, u32 target_width, u32 target_height,
float time)
{
GL_PUSH_FMT("PostProcessingShaderFX {}", m_name);
GL_SCOPE_FMT("PostProcessingShaderFX {}", m_name);
m_frame_count++;
@ -1764,11 +1764,8 @@ GPUDevice::PresentResult PostProcessing::ReShadeFXShader::Apply(GPUTexture* inpu
// Special case: drawing to final buffer.
const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(g_gpu_device->GetMainSwapChain());
if (pres != GPUDevice::PresentResult::OK)
{
GL_POP();
return pres;
}
}
else
{
std::array<GPUTexture*, GPUDevice::MAX_RENDER_TARGETS> render_targets;
@ -1820,7 +1817,6 @@ GPUDevice::PresentResult PostProcessing::ReShadeFXShader::Apply(GPUTexture* inpu
for (u32 i = 0; i < GPUDevice::MAX_TEXTURE_SAMPLERS; i++)
g_gpu_device->SetTextureSampler(i, nullptr, nullptr);
GL_POP();
m_frame_timer.Reset();
return GPUDevice::PresentResult::OK;
}