Merge pull request #11511 from TellowKrinkle/MTLHD4000

VideoCommon: Avoid creating pipelines with no render targets
This commit is contained in:
Scott Mansell 2023-01-30 19:31:36 +13:00 committed by GitHub
commit 13d14282a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -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)];

View File

@ -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 =

View File

@ -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");