Mesa (main): dzn: Add support for sampleRateShading

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 19 09:12:22 UTC 2022


Module: Mesa
Branch: main
Commit: 3e97d37c6348199eb6cc66a2c15990a200390f94
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e97d37c6348199eb6cc66a2c15990a200390f94

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Tue Apr 12 07:31:50 2022 -0700

dzn: Add support for sampleRateShading

Forward the sample-rate shading info to spirv_to_dxil() so we can
claim to support sampleRateShading.

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15916>

---

 src/microsoft/ci/warp-fails.txt       |  2 ++
 src/microsoft/vulkan/dzn_device.cpp   |  8 ++++----
 src/microsoft/vulkan/dzn_pipeline.cpp | 16 +++++++++++-----
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/microsoft/ci/warp-fails.txt b/src/microsoft/ci/warp-fails.txt
index e64478e339f..6922d1f7fc8 100644
--- a/src/microsoft/ci/warp-fails.txt
+++ b/src/microsoft/ci/warp-fails.txt
@@ -875,7 +875,9 @@ dEQP-VK.api.copy_and_blit.dedicated_allocation.blit_image.all_formats.depth_sten
 dEQP-VK.api.copy_and_blit.dedicated_allocation.blit_image.all_formats.depth_stencil.2d.d32_sfloat_s8_uint_d32_sfloat_s8_uint_separate_layouts.optimal_general_nearest,Fail
 dEQP-VK.api.copy_and_blit.dedicated_allocation.blit_image.all_formats.depth_stencil.2d.d32_sfloat_s8_uint_d32_sfloat_s8_uint_separate_layouts.optimal_optimal_nearest,Fail
 dEQP-VK.draw.renderpass.multiple_interpolation.separate.no_sample_decoration.4_samples,Fail
+dEQP-VK.draw.renderpass.multiple_interpolation.separate.with_sample_decoration.4_samples,Fail
 dEQP-VK.draw.renderpass.multiple_interpolation.structured.no_sample_decoration.4_samples,Fail
+dEQP-VK.draw.renderpass.multiple_interpolation.structured.with_sample_decoration.4_samples,Fail
 dEQP-VK.draw.renderpass.output_location.array.r8g8-uint-highp,Fail
 dEQP-VK.draw.renderpass.output_location.array.r8g8-uint-highp-output-uint,Fail
 dEQP-VK.draw.renderpass.output_location.array.r8g8-uint-mediump,Fail
diff --git a/src/microsoft/vulkan/dzn_device.cpp b/src/microsoft/vulkan/dzn_device.cpp
index 3312a06aeee..4b9c8eb09ec 100644
--- a/src/microsoft/vulkan/dzn_device.cpp
+++ b/src/microsoft/vulkan/dzn_device.cpp
@@ -994,7 +994,7 @@ dzn_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
       .independentBlend = false,
       .geometryShader = false,
       .tessellationShader = false,
-      .sampleRateShading = false,
+      .sampleRateShading = true,
       .dualSrcBlend = false,
       .logicOp = false,
       .multiDrawIndirect = false,
@@ -1234,9 +1234,9 @@ dzn_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
       .maxTexelOffset                           = 7,
       .minTexelGatherOffset                     = 0,
       .maxTexelGatherOffset                     = 0,
-      .minInterpolationOffset                   = 0.0f,
-      .maxInterpolationOffset                   = 0.0f,
-      .subPixelInterpolationOffsetBits          = 0,
+      .minInterpolationOffset                   = -0.5f,
+      .maxInterpolationOffset                   = 0.5f,
+      .subPixelInterpolationOffsetBits          = 4,
       .maxFramebufferWidth                      = 4096,
       .maxFramebufferHeight                     = 4096,
       .maxFramebufferLayers                     = 256,
diff --git a/src/microsoft/vulkan/dzn_pipeline.cpp b/src/microsoft/vulkan/dzn_pipeline.cpp
index 276ef05ef4c..9d2a3064eda 100644
--- a/src/microsoft/vulkan/dzn_pipeline.cpp
+++ b/src/microsoft/vulkan/dzn_pipeline.cpp
@@ -54,6 +54,7 @@ dzn_pipeline_compile_shader(dzn_device *device,
                             const VkPipelineShaderStageCreateInfo *stage_info,
                             enum dxil_spirv_yz_flip_mode yz_flip_mode,
                             uint16_t y_flip_mask, uint16_t z_flip_mask,
+                            bool force_sample_rate_shading,
                             D3D12_SHADER_BYTECODE *slot)
 {
    dzn_instance *instance =
@@ -121,6 +122,7 @@ dzn_pipeline_compile_shader(dzn_device *device,
          .z_mask = z_flip_mask,
       },
       .read_only_images_as_srvs = true,
+      .force_sample_rate_shading = force_sample_rate_shading,
    };
 
    struct dxil_spirv_debug_options dbg_opts = {
@@ -392,9 +394,7 @@ dzn_graphics_pipeline_translate_ms(dzn_graphics_pipeline *pipeline,
    const VkPipelineMultisampleStateCreateInfo *in_ms =
       in_rast->rasterizerDiscardEnable ? NULL : in->pMultisampleState;
 
-   /* TODO: sampleShadingEnable, minSampleShading,
-    *       alphaToOneEnable
-    */
+   /* TODO: minSampleShading (use VRS), alphaToOneEnable */
    out->SampleDesc.Count = in_ms ? in_ms->rasterizationSamples : 1;
    out->SampleDesc.Quality = 0;
    out->SampleMask = in_ms && in_ms->pSampleMask ?
@@ -890,9 +890,15 @@ dzn_graphics_pipeline_create(dzn_device *device,
          }
       }
 
+      bool force_sample_rate_shading =
+         pCreateInfo->pStages[i].stage == VK_SHADER_STAGE_FRAGMENT_BIT &&
+         pCreateInfo->pMultisampleState &&
+         pCreateInfo->pMultisampleState->sampleShadingEnable;
+
       ret = dzn_pipeline_compile_shader(device, pAllocator,
                                         layout, &pCreateInfo->pStages[i],
-                                        yz_flip_mode, y_flip_mask, z_flip_mask, slot);
+                                        yz_flip_mode, y_flip_mask, z_flip_mask,
+                                        force_sample_rate_shading, slot);
       if (ret != VK_SUCCESS)
          goto out;
    }
@@ -1067,7 +1073,7 @@ dzn_compute_pipeline_create(dzn_device *device,
       dzn_pipeline_compile_shader(device, pAllocator, layout,
                                   &pCreateInfo->stage,
                                   DXIL_SPIRV_YZ_FLIP_NONE, 0, 0,
-                                  &desc.CS);
+                                  false, &desc.CS);
    if (ret != VK_SUCCESS)
       goto out;
 



More information about the mesa-commit mailing list