Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11511 from TellowKrinkle/MTLHD4000
VideoCommon: Avoid creating pipelines with no render targets
  • Loading branch information
phire committed Jan 30, 2023
2 parents 5a8b865 + e4e425b commit 13d1428
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Source/Core/VideoBackends/Metal/MTLObjectCache.mm
Expand Up @@ -418,6 +418,12 @@ StoredPipeline CreatePipeline(const AbstractPipelineConfig& config)
// 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)];
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/VideoCommon/PostProcessing.cpp
Expand Up @@ -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 =
Expand Down
7 changes: 7 additions & 0 deletions Source/Core/VideoCommon/RenderBase.cpp
Expand Up @@ -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<AbstractShader> vertex_shader =
CreateShaderFromSource(ShaderStage::Vertex, FramebufferShaderGen::GenerateImGuiVertexShader(),
"ImGui vertex shader");
Expand Down

0 comments on commit 13d1428

Please sign in to comment.