[Mesa-dev] [PATCH 04/20] anv/pipeline: Stop claiming to support running without a vertex shader

Jason Ekstrand jason at jlekstrand.net
Sat Nov 12 21:34:46 UTC 2016


>From the Vulkan spec version 1.0.32 docs for vkCreateGraphicsPipelines:

    The stage member of one element of pStages must be
    VK_SHADER_STAGE_VERTEX_BIT

Since a vertex shader is always required, this hasn't been used since we
deleted meta.  Let's get rid of the complexity.
---
 src/intel/vulkan/gen7_pipeline.c | 54 ++++++++++------------
 src/intel/vulkan/gen8_pipeline.c | 98 ++++++++++++++++++----------------------
 2 files changed, 69 insertions(+), 83 deletions(-)

diff --git a/src/intel/vulkan/gen7_pipeline.c b/src/intel/vulkan/gen7_pipeline.c
index 6c54b6c..2c96a8d 100644
--- a/src/intel/vulkan/gen7_pipeline.c
+++ b/src/intel/vulkan/gen7_pipeline.c
@@ -106,35 +106,31 @@ genX(graphics_pipeline_create)(
       gen7_emit_vs_workaround_flush(brw);
 #endif
 
-   if (!anv_pipeline_has_stage(pipeline, MESA_SHADER_VERTEX)) {
-      anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VS), vs);
-   } else {
-      const struct anv_shader_bin *vs_bin =
-         pipeline->shaders[MESA_SHADER_VERTEX];
-
-      anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VS), vs) {
-         vs.KernelStartPointer         = vs_bin->kernel.offset;
-
-         vs.ScratchSpaceBasePointer = (struct anv_address) {
-            .bo = anv_scratch_pool_alloc(device, &device->scratch_pool,
-                                         MESA_SHADER_VERTEX,
-                                         vs_prog_data->base.base.total_scratch),
-            .offset = 0,
-         };
-         vs.PerThreadScratchSpace      = scratch_space(&vs_prog_data->base.base);
-
-         vs.DispatchGRFStartRegisterForURBData    =
-            vs_prog_data->base.base.dispatch_grf_start_reg;
-
-         vs.SamplerCount              = get_sampler_count(vs_bin);
-         vs.BindingTableEntryCount    = get_binding_table_entry_count(vs_bin);
-
-         vs.VertexURBEntryReadLength   = vs_prog_data->base.urb_read_length;
-         vs.VertexURBEntryReadOffset   = 0;
-         vs.MaximumNumberofThreads     = devinfo->max_vs_threads - 1;
-         vs.StatisticsEnable           = true;
-         vs.FunctionEnable             = true;
-      }
+   assert(anv_pipeline_has_stage(pipeline, MESA_SHADER_VERTEX));
+   const struct anv_shader_bin *vs_bin =
+      pipeline->shaders[MESA_SHADER_VERTEX];
+   anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VS), vs) {
+      vs.KernelStartPointer         = vs_bin->kernel.offset;
+
+      vs.ScratchSpaceBasePointer = (struct anv_address) {
+         .bo = anv_scratch_pool_alloc(device, &device->scratch_pool,
+                                      MESA_SHADER_VERTEX,
+                                      vs_prog_data->base.base.total_scratch),
+         .offset = 0,
+      };
+      vs.PerThreadScratchSpace      = scratch_space(&vs_prog_data->base.base);
+
+      vs.DispatchGRFStartRegisterForURBData    =
+         vs_prog_data->base.base.dispatch_grf_start_reg;
+
+      vs.SamplerCount              = get_sampler_count(vs_bin);
+      vs.BindingTableEntryCount    = get_binding_table_entry_count(vs_bin);
+
+      vs.VertexURBEntryReadLength   = vs_prog_data->base.urb_read_length;
+      vs.VertexURBEntryReadOffset   = 0;
+      vs.MaximumNumberofThreads     = devinfo->max_vs_threads - 1;
+      vs.StatisticsEnable           = true;
+      vs.FunctionEnable             = true;
    }
 
    const struct brw_gs_prog_data *gs_prog_data = get_gs_prog_data(pipeline);
diff --git a/src/intel/vulkan/gen8_pipeline.c b/src/intel/vulkan/gen8_pipeline.c
index 20fd4ba..40cfe3f 100644
--- a/src/intel/vulkan/gen8_pipeline.c
+++ b/src/intel/vulkan/gen8_pipeline.c
@@ -177,60 +177,50 @@ genX(graphics_pipeline_create)(
    offset = 1;
    length = (vs_prog_data->base.vue_map.num_slots + 1) / 2 - offset;
 
-   if (!anv_pipeline_has_stage(pipeline, MESA_SHADER_VERTEX)) {
-      anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VS), vs) {
-         vs.FunctionEnable = false;
-         /* Even if VS is disabled, SBE still gets the amount of
-          * vertex data to read from this field. */
-         vs.VertexURBEntryOutputReadOffset = offset;
-         vs.VertexURBEntryOutputLength = length;
-      }
-   } else {
-      const struct anv_shader_bin *vs_bin =
-         pipeline->shaders[MESA_SHADER_VERTEX];
-
-      anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VS), vs) {
-         vs.KernelStartPointer            = vs_bin->kernel.offset;
-         vs.SingleVertexDispatch          = false;
-         vs.VectorMaskEnable              = false;
-
-         vs.SamplerCount                  = get_sampler_count(vs_bin);
-         vs.BindingTableEntryCount        = get_binding_table_entry_count(vs_bin);
-
-         vs.ThreadDispatchPriority        = false;
-         vs.FloatingPointMode             = IEEE754;
-         vs.IllegalOpcodeExceptionEnable  = false;
-         vs.AccessesUAV                   = false;
-         vs.SoftwareExceptionEnable       = false;
-
-         vs.ScratchSpaceBasePointer = (struct anv_address) {
-            .bo = anv_scratch_pool_alloc(device, &device->scratch_pool,
-                                         MESA_SHADER_VERTEX,
-                                         vs_prog_data->base.base.total_scratch),
-            .offset = 0,
-         };
-         vs.PerThreadScratchSpace   = scratch_space(&vs_prog_data->base.base);
-
-         vs.DispatchGRFStartRegisterForURBData =
-            vs_prog_data->base.base.dispatch_grf_start_reg;
-
-         vs.VertexURBEntryReadLength      = vs_prog_data->base.urb_read_length;
-         vs.VertexURBEntryReadOffset      = 0;
-
-         vs.MaximumNumberofThreads        = devinfo->max_vs_threads - 1;
-         vs.StatisticsEnable              = false;
-         vs.SIMD8DispatchEnable           =
-            vs_prog_data->base.dispatch_mode == DISPATCH_MODE_SIMD8;
-         vs.VertexCacheDisable            = false;
-         vs.FunctionEnable                = true;
-
-         vs.VertexURBEntryOutputReadOffset = offset;
-         vs.VertexURBEntryOutputLength    = length;
-
-         /* TODO */
-         vs.UserClipDistanceClipTestEnableBitmask = 0;
-         vs.UserClipDistanceCullTestEnableBitmask = 0;
-      }
+   assert(anv_pipeline_has_stage(pipeline, MESA_SHADER_VERTEX));
+   const struct anv_shader_bin *vs_bin =
+      pipeline->shaders[MESA_SHADER_VERTEX];
+   anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VS), vs) {
+      vs.KernelStartPointer            = vs_bin->kernel.offset;
+      vs.SingleVertexDispatch          = false;
+      vs.VectorMaskEnable              = false;
+
+      vs.SamplerCount                  = get_sampler_count(vs_bin);
+      vs.BindingTableEntryCount        = get_binding_table_entry_count(vs_bin);
+
+      vs.ThreadDispatchPriority        = false;
+      vs.FloatingPointMode             = IEEE754;
+      vs.IllegalOpcodeExceptionEnable  = false;
+      vs.AccessesUAV                   = false;
+      vs.SoftwareExceptionEnable       = false;
+
+      vs.ScratchSpaceBasePointer = (struct anv_address) {
+         .bo = anv_scratch_pool_alloc(device, &device->scratch_pool,
+                                      MESA_SHADER_VERTEX,
+                                      vs_prog_data->base.base.total_scratch),
+         .offset = 0,
+      };
+      vs.PerThreadScratchSpace   = scratch_space(&vs_prog_data->base.base);
+
+      vs.DispatchGRFStartRegisterForURBData =
+         vs_prog_data->base.base.dispatch_grf_start_reg;
+
+      vs.VertexURBEntryReadLength      = vs_prog_data->base.urb_read_length;
+      vs.VertexURBEntryReadOffset      = 0;
+
+      vs.MaximumNumberofThreads        = devinfo->max_vs_threads - 1;
+      vs.StatisticsEnable              = false;
+      vs.SIMD8DispatchEnable           =
+         vs_prog_data->base.dispatch_mode == DISPATCH_MODE_SIMD8;
+      vs.VertexCacheDisable            = false;
+      vs.FunctionEnable                = true;
+
+      vs.VertexURBEntryOutputReadOffset = offset;
+      vs.VertexURBEntryOutputLength    = length;
+
+      /* TODO */
+      vs.UserClipDistanceClipTestEnableBitmask = 0;
+      vs.UserClipDistanceCullTestEnableBitmask = 0;
    }
 
    const int num_thread_bias = GEN_GEN == 8 ? 2 : 1;
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list