turnip: set shader key msaa field
authorJonathan Marek <jonathan@marek.ca>
Tue, 21 Apr 2020 16:19:56 +0000 (12:19 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 22 Apr 2020 18:46:46 +0000 (18:46 +0000)
Fixes per-sample interpolation.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4665>

src/freedreno/vulkan/tu_shader.c

index 85bf6bbc50ffa269213f5342b8fea34f49c7bc8a..aa07f5df0663ef2b0a7354195fbdfbe4bc231030 100644 (file)
@@ -596,6 +596,7 @@ tu_shader_compile_options_init(
    const VkGraphicsPipelineCreateInfo *pipeline_info)
 {
    bool has_gs = false;
+   bool msaa = false;
    if (pipeline_info) {
       for (uint32_t i = 0; i < pipeline_info->stageCount; i++) {
          if (pipeline_info->pStages[i].stage == VK_SHADER_STAGE_GEOMETRY_BIT) {
@@ -603,12 +604,17 @@ tu_shader_compile_options_init(
             break;
          }
       }
+
+      if (!pipeline_info->pRasterizationState->rasterizerDiscardEnable &&
+          pipeline_info->pMultisampleState->rasterizationSamples > 1)
+         msaa = true;
    }
 
    *options = (struct tu_shader_compile_options) {
       /* TODO: Populate the remaining fields of ir3_shader_key. */
       .key = {
          .has_gs = has_gs,
+         .msaa = msaa,
       },
       /* TODO: VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT
        * some optimizations need to happen otherwise shader might not compile