Mesa (master): anv: add helper to get vue map for fragment shader

Lionel Landwerlin llandwerlin at kemper.freedesktop.org
Tue Jan 10 18:17:42 UTC 2017


Module: Mesa
Branch: master
Commit: 4b44ca72250745228f5eeb0fd3e0fddf51e99963
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b44ca72250745228f5eeb0fd3e0fddf51e99963

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Tue Jan 10 12:46:25 2017 +0000

anv: add helper to get vue map for fragment shader

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/intel/vulkan/anv_private.h   | 11 +++++++++++
 src/intel/vulkan/genX_pipeline.c |  7 +------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 8a69aa2..dbc8c3c 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1482,6 +1482,17 @@ ANV_DECL_GET_PROG_DATA_FUNC(gs, MESA_SHADER_GEOMETRY)
 ANV_DECL_GET_PROG_DATA_FUNC(wm, MESA_SHADER_FRAGMENT)
 ANV_DECL_GET_PROG_DATA_FUNC(cs, MESA_SHADER_COMPUTE)
 
+static inline const struct brw_vue_map *
+anv_pipeline_get_fs_input_map(const struct anv_pipeline *pipeline)
+{
+   if (anv_pipeline_has_stage(pipeline, MESA_SHADER_GEOMETRY))
+      return &get_gs_prog_data(pipeline)->base.vue_map;
+   else if (anv_pipeline_has_stage(pipeline, MESA_SHADER_TESS_EVAL))
+      return &get_tes_prog_data(pipeline)->base.vue_map;
+   else
+      return &get_vs_prog_data(pipeline)->base.vue_map;
+}
+
 VkResult
 anv_pipeline_init(struct anv_pipeline *pipeline, struct anv_device *device,
                   struct anv_pipeline_cache *cache,
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 90968b4..20ba5b6 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -285,8 +285,6 @@ emit_urb_setup(struct anv_pipeline *pipeline)
 static void
 emit_3dstate_sbe(struct anv_pipeline *pipeline)
 {
-   const struct brw_vs_prog_data *vs_prog_data = get_vs_prog_data(pipeline);
-   const struct brw_gs_prog_data *gs_prog_data = get_gs_prog_data(pipeline);
    const struct brw_wm_prog_data *wm_prog_data = get_wm_prog_data(pipeline);
    const struct brw_vue_map *fs_input_map;
 
@@ -298,10 +296,7 @@ emit_3dstate_sbe(struct anv_pipeline *pipeline)
       return;
    }
 
-   if (gs_prog_data)
-      fs_input_map = &gs_prog_data->base.vue_map;
-   else
-      fs_input_map = &vs_prog_data->base.vue_map;
+   fs_input_map = anv_pipeline_get_fs_input_map(pipeline);
 
    struct GENX(3DSTATE_SBE) sbe = {
       GENX(3DSTATE_SBE_header),




More information about the mesa-commit mailing list