[Mesa-dev] [PATCH] anv/pipeline: Enable only one dispatch width in case of per sample shading

Anuj Phogat anuj.phogat at gmail.com
Tue Jul 26 19:53:39 UTC 2016


Fixes ~45 DEQP sample shading tests:
./deqp-vk --deqp-case=dEQP-VK.pipeline.multisample.min_sample_shading*

Many tests exited with VK_ERROR_OUT_OF_DEVICE_MEMORY without this patch.

Cc: Jason Ekstrand <jason at jlekstrand.net>
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>

---
Another patch enabling the sample shading is required to test this patch.
I'll send out the enabling patch once we pass all the sample shading tests.
Use https://github.com/aphogat/mesa, branch: review to test the patch.
---
 src/intel/vulkan/gen7_pipeline.c |  9 ++++++++-
 src/intel/vulkan/gen8_pipeline.c | 12 ++++++++----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/intel/vulkan/gen7_pipeline.c b/src/intel/vulkan/gen7_pipeline.c
index 8ce50be..23535f5 100644
--- a/src/intel/vulkan/gen7_pipeline.c
+++ b/src/intel/vulkan/gen7_pipeline.c
@@ -249,6 +249,8 @@ genX(graphics_pipeline_create)(
          anv_finishme("primitive_id needs sbe swizzling setup");
 
       emit_3dstate_sbe(pipeline);
+      bool per_sample_ps = pCreateInfo->pMultisampleState &&
+                           pCreateInfo->pMultisampleState->sampleShadingEnable;
 
       anv_batch_emit(&pipeline->batch, GENX(3DSTATE_PS), ps) {
          ps.KernelStartPointer0           = pipeline->ps_ksp0;
@@ -274,7 +276,12 @@ genX(graphics_pipeline_create)(
 
          ps._32PixelDispatchEnable        = false;
          ps._16PixelDispatchEnable        = wm_prog_data->dispatch_16;
-         ps._8PixelDispatchEnable         = wm_prog_data->dispatch_8;
+         /* On all hardware generations, the only configurations supporting
+          * persample dispatch are in which only one dispatch width is enabled.
+          */
+         ps._8PixelDispatchEnable         = wm_prog_data->dispatch_8 &&
+                                            (!per_sample_ps ||
+                                             !wm_prog_data->dispatch_16);
 
          ps.DispatchGRFStartRegisterforConstantSetupData0 =
             wm_prog_data->base.dispatch_grf_start_reg,
diff --git a/src/intel/vulkan/gen8_pipeline.c b/src/intel/vulkan/gen8_pipeline.c
index cc10d3a..bde7660 100644
--- a/src/intel/vulkan/gen8_pipeline.c
+++ b/src/intel/vulkan/gen8_pipeline.c
@@ -333,12 +333,19 @@ genX(graphics_pipeline_create)(
       }
    } else {
       emit_3dstate_sbe(pipeline);
+      bool per_sample_ps = pCreateInfo->pMultisampleState &&
+                           pCreateInfo->pMultisampleState->sampleShadingEnable;
 
       anv_batch_emit(&pipeline->batch, GENX(3DSTATE_PS), ps) {
          ps.KernelStartPointer0     = pipeline->ps_ksp0;
          ps.KernelStartPointer1     = 0;
          ps.KernelStartPointer2     = pipeline->ps_ksp0 + wm_prog_data->prog_offset_2;
-         ps._8PixelDispatchEnable   = wm_prog_data->dispatch_8;
+         /* On all hardware generations, the only configurations supporting
+          * persample dispatch are in which only one dispatch width is enabled.
+          */
+         ps._8PixelDispatchEnable   = wm_prog_data->dispatch_8 &&
+                                      (!per_sample_ps ||
+                                       !wm_prog_data->dispatch_16);
          ps._16PixelDispatchEnable  = wm_prog_data->dispatch_16;
          ps._32PixelDispatchEnable  = false;
          ps.SingleProgramFlow       = false;
@@ -365,9 +372,6 @@ genX(graphics_pipeline_create)(
             wm_prog_data->dispatch_grf_start_reg_2;
       }
 
-      bool per_sample_ps = pCreateInfo->pMultisampleState &&
-                           pCreateInfo->pMultisampleState->sampleShadingEnable;
-
       anv_batch_emit(&pipeline->batch, GENX(3DSTATE_PS_EXTRA), ps) {
          ps.PixelShaderValid              = true;
          ps.PixelShaderKillsPixel         = wm_prog_data->uses_kill;
-- 
2.5.5



More information about the mesa-dev mailing list