diff options
| author | 2024-02-19 16:00:46 +0100 | |
|---|---|---|
| committer | 2024-02-19 16:00:46 +0100 | |
| commit | 310c1f50beb77fc5c6f9075029973161d4e51a4a (patch) | |
| tree | 43a5699123e4930560fc5016faac7efb15b63f4e /src/video_core | |
| parent | core/CMakeLists: Sort alphabetically (diff) | |
| download | yuzu-310c1f50beb77fc5c6f9075029973161d4e51a4a.tar.gz yuzu-310c1f50beb77fc5c6f9075029973161d4e51a4a.tar.xz yuzu-310c1f50beb77fc5c6f9075029973161d4e51a4a.zip | |
scope_exit: Make constexpr
Allows the use of the macro in constexpr-contexts.
Also avoids some potential problems when nesting braces inside it.
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/fence_manager.h | 4 | ||||
| -rw-r--r-- | src/video_core/gpu_thread.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/host1x/ffmpeg/ffmpeg.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/macro/macro_hle.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/present/layer.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/renderer_vulkan.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/nsight_aftermath_tracker.cpp | 4 |
10 files changed, 36 insertions, 16 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index a94e1f043..0d47b032c 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -291,7 +291,9 @@ u32 Maxwell3D::ProcessShadowRam(u32 method, u32 argument) { | |||
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | void Maxwell3D::ConsumeSinkImpl() { | 293 | void Maxwell3D::ConsumeSinkImpl() { |
| 294 | SCOPE_EXIT({ method_sink.clear(); }); | 294 | SCOPE_EXIT { |
| 295 | method_sink.clear(); | ||
| 296 | }; | ||
| 295 | const auto control = shadow_state.shadow_ram_control; | 297 | const auto control = shadow_state.shadow_ram_control; |
| 296 | if (control == Regs::ShadowRamControl::Track || | 298 | if (control == Regs::ShadowRamControl::Track || |
| 297 | control == Regs::ShadowRamControl::TrackWithFilter) { | 299 | control == Regs::ShadowRamControl::TrackWithFilter) { |
diff --git a/src/video_core/fence_manager.h b/src/video_core/fence_manager.h index c3eda6893..2135f1f2d 100644 --- a/src/video_core/fence_manager.h +++ b/src/video_core/fence_manager.h | |||
| @@ -197,7 +197,9 @@ private: | |||
| 197 | MicroProfileOnThreadCreate(name.c_str()); | 197 | MicroProfileOnThreadCreate(name.c_str()); |
| 198 | 198 | ||
| 199 | // Cleanup | 199 | // Cleanup |
| 200 | SCOPE_EXIT({ MicroProfileOnThreadExit(); }); | 200 | SCOPE_EXIT { |
| 201 | MicroProfileOnThreadExit(); | ||
| 202 | }; | ||
| 201 | 203 | ||
| 202 | Common::SetCurrentThreadName(name.c_str()); | 204 | Common::SetCurrentThreadName(name.c_str()); |
| 203 | Common::SetCurrentThreadPriority(Common::ThreadPriority::High); | 205 | Common::SetCurrentThreadPriority(Common::ThreadPriority::High); |
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index 58d8110b8..477e11457 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp | |||
| @@ -22,7 +22,9 @@ static void RunThread(std::stop_token stop_token, Core::System& system, | |||
| 22 | Tegra::Control::Scheduler& scheduler, SynchState& state) { | 22 | Tegra::Control::Scheduler& scheduler, SynchState& state) { |
| 23 | std::string name = "GPU"; | 23 | std::string name = "GPU"; |
| 24 | MicroProfileOnThreadCreate(name.c_str()); | 24 | MicroProfileOnThreadCreate(name.c_str()); |
| 25 | SCOPE_EXIT({ MicroProfileOnThreadExit(); }); | 25 | SCOPE_EXIT { |
| 26 | MicroProfileOnThreadExit(); | ||
| 27 | }; | ||
| 26 | 28 | ||
| 27 | Common::SetCurrentThreadName(name.c_str()); | 29 | Common::SetCurrentThreadName(name.c_str()); |
| 28 | Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); | 30 | Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); |
diff --git a/src/video_core/host1x/ffmpeg/ffmpeg.cpp b/src/video_core/host1x/ffmpeg/ffmpeg.cpp index 96686da59..1003cd38d 100644 --- a/src/video_core/host1x/ffmpeg/ffmpeg.cpp +++ b/src/video_core/host1x/ffmpeg/ffmpeg.cpp | |||
| @@ -273,10 +273,10 @@ DeinterlaceFilter::DeinterlaceFilter(const Frame& frame) { | |||
| 273 | const AVFilter* buffer_sink = avfilter_get_by_name("buffersink"); | 273 | const AVFilter* buffer_sink = avfilter_get_by_name("buffersink"); |
| 274 | AVFilterInOut* inputs = avfilter_inout_alloc(); | 274 | AVFilterInOut* inputs = avfilter_inout_alloc(); |
| 275 | AVFilterInOut* outputs = avfilter_inout_alloc(); | 275 | AVFilterInOut* outputs = avfilter_inout_alloc(); |
| 276 | SCOPE_EXIT({ | 276 | SCOPE_EXIT { |
| 277 | avfilter_inout_free(&inputs); | 277 | avfilter_inout_free(&inputs); |
| 278 | avfilter_inout_free(&outputs); | 278 | avfilter_inout_free(&outputs); |
| 279 | }); | 279 | }; |
| 280 | 280 | ||
| 281 | // Don't know how to get the accurate time_base but it doesn't matter for yadif filter | 281 | // Don't know how to get the accurate time_base but it doesn't matter for yadif filter |
| 282 | // so just use 1/1 to make buffer filter happy | 282 | // so just use 1/1 to make buffer filter happy |
diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 46e853e04..fb529f88b 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp | |||
| @@ -92,12 +92,12 @@ public: | |||
| 92 | 92 | ||
| 93 | private: | 93 | private: |
| 94 | void Fallback(const std::vector<u32>& parameters) { | 94 | void Fallback(const std::vector<u32>& parameters) { |
| 95 | SCOPE_EXIT({ | 95 | SCOPE_EXIT { |
| 96 | if (extended) { | 96 | if (extended) { |
| 97 | maxwell3d.engine_state = Maxwell3D::EngineHint::None; | 97 | maxwell3d.engine_state = Maxwell3D::EngineHint::None; |
| 98 | maxwell3d.replace_table.clear(); | 98 | maxwell3d.replace_table.clear(); |
| 99 | } | 99 | } |
| 100 | }); | 100 | }; |
| 101 | maxwell3d.RefreshParameters(); | 101 | maxwell3d.RefreshParameters(); |
| 102 | const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); | 102 | const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); |
| 103 | 103 | ||
| @@ -281,12 +281,12 @@ public: | |||
| 281 | 281 | ||
| 282 | private: | 282 | private: |
| 283 | void Fallback(const std::vector<u32>& parameters) { | 283 | void Fallback(const std::vector<u32>& parameters) { |
| 284 | SCOPE_EXIT({ | 284 | SCOPE_EXIT { |
| 285 | // Clean everything. | 285 | // Clean everything. |
| 286 | maxwell3d.regs.vertex_id_base = 0x0; | 286 | maxwell3d.regs.vertex_id_base = 0x0; |
| 287 | maxwell3d.engine_state = Maxwell3D::EngineHint::None; | 287 | maxwell3d.engine_state = Maxwell3D::EngineHint::None; |
| 288 | maxwell3d.replace_table.clear(); | 288 | maxwell3d.replace_table.clear(); |
| 289 | }); | 289 | }; |
| 290 | maxwell3d.RefreshParameters(); | 290 | maxwell3d.RefreshParameters(); |
| 291 | const u32 start_indirect = parameters[0]; | 291 | const u32 start_indirect = parameters[0]; |
| 292 | const u32 end_indirect = parameters[1]; | 292 | const u32 end_indirect = parameters[1]; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index b42fb110c..16af8e6bd 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -230,7 +230,9 @@ template <typename Func> | |||
| 230 | void RasterizerOpenGL::PrepareDraw(bool is_indexed, Func&& draw_func) { | 230 | void RasterizerOpenGL::PrepareDraw(bool is_indexed, Func&& draw_func) { |
| 231 | MICROPROFILE_SCOPE(OpenGL_Drawing); | 231 | MICROPROFILE_SCOPE(OpenGL_Drawing); |
| 232 | 232 | ||
| 233 | SCOPE_EXIT({ gpu.TickWork(); }); | 233 | SCOPE_EXIT { |
| 234 | gpu.TickWork(); | ||
| 235 | }; | ||
| 234 | gpu_memory->FlushCaching(); | 236 | gpu_memory->FlushCaching(); |
| 235 | 237 | ||
| 236 | GraphicsPipeline* const pipeline{shader_cache.CurrentGraphicsPipeline()}; | 238 | GraphicsPipeline* const pipeline{shader_cache.CurrentGraphicsPipeline()}; |
| @@ -355,7 +357,9 @@ void RasterizerOpenGL::DrawIndirect() { | |||
| 355 | void RasterizerOpenGL::DrawTexture() { | 357 | void RasterizerOpenGL::DrawTexture() { |
| 356 | MICROPROFILE_SCOPE(OpenGL_Drawing); | 358 | MICROPROFILE_SCOPE(OpenGL_Drawing); |
| 357 | 359 | ||
| 358 | SCOPE_EXIT({ gpu.TickWork(); }); | 360 | SCOPE_EXIT { |
| 361 | gpu.TickWork(); | ||
| 362 | }; | ||
| 359 | 363 | ||
| 360 | texture_cache.SynchronizeGraphicsDescriptors(); | 364 | texture_cache.SynchronizeGraphicsDescriptors(); |
| 361 | texture_cache.UpdateRenderTargets(false); | 365 | texture_cache.UpdateRenderTargets(false); |
diff --git a/src/video_core/renderer_vulkan/present/layer.cpp b/src/video_core/renderer_vulkan/present/layer.cpp index 3847a9a13..4e41afe5b 100644 --- a/src/video_core/renderer_vulkan/present/layer.cpp +++ b/src/video_core/renderer_vulkan/present/layer.cpp | |||
| @@ -82,7 +82,9 @@ void Layer::ConfigureDraw(PresentPushConstants* out_push_constants, | |||
| 82 | // Finish any pending renderpass | 82 | // Finish any pending renderpass |
| 83 | scheduler.RequestOutsideRenderPassOperationContext(); | 83 | scheduler.RequestOutsideRenderPassOperationContext(); |
| 84 | scheduler.Wait(resource_ticks[image_index]); | 84 | scheduler.Wait(resource_ticks[image_index]); |
| 85 | SCOPE_EXIT({ resource_ticks[image_index] = scheduler.CurrentTick(); }); | 85 | SCOPE_EXIT { |
| 86 | resource_ticks[image_index] = scheduler.CurrentTick(); | ||
| 87 | }; | ||
| 86 | 88 | ||
| 87 | if (!use_accelerated) { | 89 | if (!use_accelerated) { |
| 88 | UpdateRawImage(framebuffer, image_index); | 90 | UpdateRawImage(framebuffer, image_index); |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index d50417116..c553f5b3d 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp | |||
| @@ -144,7 +144,9 @@ void RendererVulkan::Composite(std::span<const Tegra::FramebufferConfig> framebu | |||
| 144 | return; | 144 | return; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | SCOPE_EXIT({ render_window.OnFrameDisplayed(); }); | 147 | SCOPE_EXIT { |
| 148 | render_window.OnFrameDisplayed(); | ||
| 149 | }; | ||
| 148 | 150 | ||
| 149 | RenderAppletCaptureLayer(framebuffers); | 151 | RenderAppletCaptureLayer(framebuffers); |
| 150 | 152 | ||
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index aa0a027bb..74f9f099e 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -196,7 +196,9 @@ template <typename Func> | |||
| 196 | void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) { | 196 | void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) { |
| 197 | MICROPROFILE_SCOPE(Vulkan_Drawing); | 197 | MICROPROFILE_SCOPE(Vulkan_Drawing); |
| 198 | 198 | ||
| 199 | SCOPE_EXIT({ gpu.TickWork(); }); | 199 | SCOPE_EXIT { |
| 200 | gpu.TickWork(); | ||
| 201 | }; | ||
| 200 | FlushWork(); | 202 | FlushWork(); |
| 201 | gpu_memory->FlushCaching(); | 203 | gpu_memory->FlushCaching(); |
| 202 | 204 | ||
| @@ -288,7 +290,9 @@ void RasterizerVulkan::DrawIndirect() { | |||
| 288 | void RasterizerVulkan::DrawTexture() { | 290 | void RasterizerVulkan::DrawTexture() { |
| 289 | MICROPROFILE_SCOPE(Vulkan_Drawing); | 291 | MICROPROFILE_SCOPE(Vulkan_Drawing); |
| 290 | 292 | ||
| 291 | SCOPE_EXIT({ gpu.TickWork(); }); | 293 | SCOPE_EXIT { |
| 294 | gpu.TickWork(); | ||
| 295 | }; | ||
| 292 | FlushWork(); | 296 | FlushWork(); |
| 293 | 297 | ||
| 294 | query_cache.NotifySegment(true); | 298 | query_cache.NotifySegment(true); |
diff --git a/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp b/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp index 5fa0d9620..f41c3e506 100644 --- a/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp +++ b/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp | |||
| @@ -116,7 +116,9 @@ void NsightAftermathTracker::OnGpuCrashDumpCallback(const void* gpu_crash_dump, | |||
| 116 | LOG_ERROR(Render_Vulkan, "Failed to create decoder"); | 116 | LOG_ERROR(Render_Vulkan, "Failed to create decoder"); |
| 117 | return; | 117 | return; |
| 118 | } | 118 | } |
| 119 | SCOPE_EXIT({ GFSDK_Aftermath_GpuCrashDump_DestroyDecoder(decoder); }); | 119 | SCOPE_EXIT { |
| 120 | GFSDK_Aftermath_GpuCrashDump_DestroyDecoder(decoder); | ||
| 121 | }; | ||
| 120 | 122 | ||
| 121 | u32 json_size = 0; | 123 | u32 json_size = 0; |
| 122 | if (!GFSDK_Aftermath_SUCCEED(GFSDK_Aftermath_GpuCrashDump_GenerateJSON( | 124 | if (!GFSDK_Aftermath_SUCCEED(GFSDK_Aftermath_GpuCrashDump_GenerateJSON( |