d3d12: Support creating PSOs with no attachments with MSAA without TIR
authorJesse Natalie <jenatali@microsoft.com>
Mon, 10 Apr 2023 16:59:51 +0000 (09:59 -0700)
committerMarge Bot <emma+marge@anholt.net>
Tue, 11 Apr 2023 03:32:41 +0000 (03:32 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22402>

src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp
src/gallium/drivers/d3d12/d3d12_screen.cpp
src/gallium/drivers/d3d12/d3d12_screen.h

index 0d9d74c..8d7359f 100644 (file)
@@ -302,8 +302,8 @@ create_gfx_pipeline_state(struct d3d12_context *ctx)
       pso_desc.RTVFormats[i] = d3d12_rtv_format(ctx, i);
    pso_desc.DSVFormat = state->dsv_format;
 
+   pso_desc.SampleDesc.Count = state->samples;
    if (state->num_cbufs || state->dsv_format != DXGI_FORMAT_UNKNOWN) {
-      pso_desc.SampleDesc.Count = state->samples;
       if (!state->zsa->desc.DepthEnable &&
           !state->zsa->desc.StencilEnable &&
           !state->rast->desc.MultisampleEnable &&
@@ -312,8 +312,13 @@ create_gfx_pipeline_state(struct d3d12_context *ctx)
          pso_desc.DSVFormat = DXGI_FORMAT_UNKNOWN;
       }
    } else if (state->samples > 1) {
-      pso_desc.SampleDesc.Count = 1;
-      pso_desc.RasterizerState.ForcedSampleCount = state->samples;
+#if D3D12_SDK_VERSION >= 609
+      if (!(screen->opts19.SupportedSampleCountsWithNoOutputs & (1 << state->samples)))
+#endif
+      {
+         pso_desc.SampleDesc.Count = 1;
+         pso_desc.RasterizerState.ForcedSampleCount = state->samples;
+      }
    }
    pso_desc.SampleDesc.Quality = 0;
 
index caadc80..7d551fa 100644 (file)
@@ -1474,6 +1474,9 @@ d3d12_init_screen(struct d3d12_screen *screen, IUnknown *adapter)
       debug_printf("D3D12: failed to get device options\n");
       return false;
    }
+#if D3D12_SDK_VERSION >= 609
+   screen->dev->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS19, &screen->opts19, sizeof(screen->opts19));
+#endif
 
    screen->architecture.NodeIndex = 0;
    if (FAILED(screen->dev->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE,
index 738637c..2fed933 100644 (file)
@@ -115,6 +115,9 @@ struct d3d12_screen {
    D3D12_FEATURE_DATA_D3D12_OPTIONS2 opts2;
    D3D12_FEATURE_DATA_D3D12_OPTIONS3 opts3;
    D3D12_FEATURE_DATA_D3D12_OPTIONS4 opts4;
+#if D3D12_SDK_VERSION >= 610
+   D3D12_FEATURE_DATA_D3D12_OPTIONS19 opts19;
+#endif
 
    nir_shader_compiler_options nir_options;