From 0f9d7dd10dae290973b8d4407f378eca539e7c89 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Fri, 8 Apr 2022 16:36:34 +0200 Subject: [PATCH] vkd3d: Force RT count to 0 when PS does not exist. Signed-off-by: Hans-Kristian Arntzen --- libs/vkd3d/state.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 8e70bc2d..90688cd2 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -3059,6 +3059,14 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s rt_count = ARRAY_SIZE(graphics->blend_attachments); } + if (!desc->ps.pShaderBytecode || !desc->ps.BytecodeLength) + { + /* Avoids validation errors where app might bind bogus RTV format which does not match the PSO. + * D3D12 validation does not complain about this when PS is NULL since RTVs are not accessed to begin with. + * We can just pretend we have no render targets in this case, which is fine. */ + rt_count = 0; + } + graphics->null_attachment_mask = 0; graphics->rtv_active_mask = 0; for (i = 0; i < rt_count; ++i)