anv/pipeline: Make emit_3dstate_sbe safe to call without a FS
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 12 Nov 2016 18:58:48 +0000 (10:58 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 16 Nov 2016 18:08:56 +0000 (10:08 -0800)
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
src/intel/vulkan/gen7_pipeline.c
src/intel/vulkan/gen8_pipeline.c
src/intel/vulkan/genX_pipeline_util.h

index 52577f5ecae4a81709781b5431aa8d41de5cf019..3765d14b90934a343936f4c66cca9bbf3dbe668d 100644 (file)
@@ -106,10 +106,9 @@ genX(graphics_pipeline_create)(
 
    emit_3dstate_vs(pipeline);
    emit_3dstate_gs(pipeline);
+   emit_3dstate_sbe(pipeline);
 
    if (!anv_pipeline_has_stage(pipeline, MESA_SHADER_FRAGMENT)) {
-      anv_batch_emit(&pipeline->batch, GENX(3DSTATE_SBE), sbe);
-
       anv_batch_emit(&pipeline->batch, GENX(3DSTATE_WM), wm) {
          wm.StatisticsEnable                    = true;
          wm.ThreadDispatchEnable                = false;
@@ -136,8 +135,6 @@ genX(graphics_pipeline_create)(
       if (wm_prog_data->urb_setup[VARYING_SLOT_PRIMITIVE_ID] != -1)
          anv_finishme("primitive_id needs sbe swizzling setup");
 
-      emit_3dstate_sbe(pipeline);
-
       anv_batch_emit(&pipeline->batch, GENX(3DSTATE_PS), ps) {
          ps.KernelStartPointer0           = fs_bin->kernel.offset;
          ps.KernelStartPointer1           = 0;
index 5816bd42284b74f4830fc4e788957ffd2fc8542a..f2499dc0f5351efe9c5c87f922e92bc2a4440f82 100644 (file)
@@ -111,6 +111,7 @@ genX(graphics_pipeline_create)(
 
    emit_3dstate_gs(pipeline);
    emit_3dstate_vs(pipeline);
+   emit_3dstate_sbe(pipeline);
 
    const int num_thread_bias = GEN_GEN == 8 ? 2 : 1;
    if (!anv_pipeline_has_stage(pipeline, MESA_SHADER_FRAGMENT)) {
@@ -122,8 +123,6 @@ genX(graphics_pipeline_create)(
       const struct anv_shader_bin *fs_bin =
          pipeline->shaders[MESA_SHADER_FRAGMENT];
 
-      emit_3dstate_sbe(pipeline);
-
       anv_batch_emit(&pipeline->batch, GENX(3DSTATE_PS), ps) {
          ps.KernelStartPointer0     = fs_bin->kernel.offset;
          ps.KernelStartPointer1     = 0;
index 515cc9a0a488360c75359c5173842e3a8d664fc4..3906529713ff0596cf6daa865ce2df15a507a816 100644 (file)
@@ -366,6 +366,14 @@ emit_3dstate_sbe(struct anv_pipeline *pipeline)
    const struct brw_wm_prog_data *wm_prog_data = get_wm_prog_data(pipeline);
    const struct brw_vue_map *fs_input_map;
 
+   if (!anv_pipeline_has_stage(pipeline, MESA_SHADER_FRAGMENT)) {
+      anv_batch_emit(&pipeline->batch, GENX(3DSTATE_SBE), sbe);
+#if GEN_GEN >= 8
+      anv_batch_emit(&pipeline->batch, GENX(3DSTATE_SBE_SWIZ), sbe);
+#endif
+      return;
+   }
+
    if (gs_prog_data)
       fs_input_map = &gs_prog_data->base.vue_map;
    else