From 1119a9ba327fb86cb03f303539ce5b9697158379 Mon Sep 17 00:00:00 2001 From: TellowKrinkle Date: Sun, 29 Jan 2023 14:35:23 -0600 Subject: [PATCH 1/2] VideoCommon: Don't create pipelines with no render targets Some backends don't like it when you do that --- Source/Core/VideoCommon/PostProcessing.cpp | 3 +++ Source/Core/VideoCommon/RenderBase.cpp | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index 69e4327bdd..0a1e995c15 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -709,6 +709,9 @@ bool PostProcessing::CompilePixelShader() bool PostProcessing::CompilePipeline() { + if (m_framebuffer_format == AbstractTextureFormat::Undefined) + return true; // Not needed (some backends don't like making pipelines with no targets) + AbstractPipelineConfig config = {}; config.vertex_shader = m_vertex_shader.get(); config.geometry_shader = diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index b4a40195c7..209fa8293a 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -1068,6 +1068,13 @@ bool Renderer::InitializeImGui() bool Renderer::RecompileImGuiPipeline() { + if (m_backbuffer_format == AbstractTextureFormat::Undefined) + { + // No backbuffer (nogui) means no imgui rendering will happen + // Some backends don't like making pipelines with no render targets + return true; + } + std::unique_ptr vertex_shader = CreateShaderFromSource(ShaderStage::Vertex, FramebufferShaderGen::GenerateImGuiVertexShader(), "ImGui vertex shader"); From e4e425b93038aa485b4432ada5626c2f8e8ccc02 Mon Sep 17 00:00:00 2001 From: TellowKrinkle Date: Sun, 29 Jan 2023 14:36:28 -0600 Subject: [PATCH 2/2] VideoBackends:Metal: Assert on pipelines with no render targets This only actually fails on specific Metal drivers, this way doing it will actually fail the CI and we'll notice --- Source/Core/VideoBackends/Metal/MTLObjectCache.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm index 48a8ad7dae..979c1b7627 100644 --- a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm +++ b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm @@ -418,6 +418,12 @@ public: // clang-format on } FramebufferState fs = config.framebuffer_state; + if (fs.color_texture_format == AbstractTextureFormat::Undefined && + fs.depth_texture_format == AbstractTextureFormat::Undefined) + { + // Intel HD 4000's Metal driver asserts if you try to make one of these + PanicAlertFmt("Attempted to create pipeline with no render targets!"); + } [desc setRasterSampleCount:fs.samples]; [color0 setPixelFormat:Util::FromAbstract(fs.color_texture_format)]; [desc setDepthAttachmentPixelFormat:Util::FromAbstract(fs.depth_texture_format)];