From 99d497c5b6912c5a8b2fec48084e3e00c7c80395 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 12 Jan 2017 17:07:08 -0800 Subject: anv/pipeline: Replace get_fs_input_map with get_last_vue_prog_data This lets us delete a helper from genX_pipeline.c Reviewed-by: Lionel Landwerlin --- src/intel/vulkan/anv_pipeline.c | 2 +- src/intel/vulkan/anv_private.h | 10 +++++----- src/intel/vulkan/genX_pipeline.c | 20 ++++---------------- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 7d939ebabe9..2060c6d2f60 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -270,7 +270,7 @@ populate_wm_prog_key(const struct anv_pipeline *pipeline, /* TODO: we could set this to 0 based on the information in nir_shader, but * this function is called before spirv_to_nir. */ const struct brw_vue_map *vue_map = - anv_pipeline_get_fs_input_map(pipeline); + &anv_pipeline_get_last_vue_prog_data(pipeline)->vue_map; key->input_slots_valid = vue_map->slots_valid; /* Vulkan doesn't specify a default */ diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 2342fcbfeb4..a3b0af799e5 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1498,15 +1498,15 @@ 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) +static inline const struct brw_vue_prog_data * +anv_pipeline_get_last_vue_prog_data(const struct anv_pipeline *pipeline) { if (anv_pipeline_has_stage(pipeline, MESA_SHADER_GEOMETRY)) - return &get_gs_prog_data(pipeline)->base.vue_map; + return &get_gs_prog_data(pipeline)->base; else if (anv_pipeline_has_stage(pipeline, MESA_SHADER_TESS_EVAL)) - return &get_tes_prog_data(pipeline)->base.vue_map; + return &get_tes_prog_data(pipeline)->base; else - return &get_vs_prog_data(pipeline)->base.vue_map; + return &get_vs_prog_data(pipeline)->base; } VkResult diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index b58aac4da7a..7fa68c004eb 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -286,7 +286,6 @@ static void 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); @@ -296,7 +295,8 @@ emit_3dstate_sbe(struct anv_pipeline *pipeline) return; } - fs_input_map = anv_pipeline_get_fs_input_map(pipeline); + const struct brw_vue_map *fs_input_map = + &anv_pipeline_get_last_vue_prog_data(pipeline)->vue_map; struct GENX(3DSTATE_SBE) sbe = { GENX(3DSTATE_SBE_header), @@ -846,19 +846,6 @@ emit_cb_state(struct anv_pipeline *pipeline, } } -/** - * Get the brw_vue_prog_data for the last stage which outputs VUEs. - */ -static inline struct brw_vue_prog_data * -get_last_vue_prog_data(struct anv_pipeline *pipeline) -{ - for (int s = MESA_SHADER_GEOMETRY; s >= 0; s--) { - if (pipeline->shaders[s]) - return (struct brw_vue_prog_data *) pipeline->shaders[s]->prog_data; - } - return NULL; -} - static void emit_3dstate_clip(struct anv_pipeline *pipeline, const VkPipelineViewportStateCreateInfo *vp_info, @@ -886,7 +873,8 @@ emit_3dstate_clip(struct anv_pipeline *pipeline, clip.FrontWinding = vk_to_gen_front_face[rs_info->frontFace]; clip.CullMode = vk_to_gen_cullmode[rs_info->cullMode]; clip.ViewportZClipTestEnable = !pipeline->depth_clamp_enable; - const struct brw_vue_prog_data *last = get_last_vue_prog_data(pipeline); + const struct brw_vue_prog_data *last = + anv_pipeline_get_last_vue_prog_data(pipeline); if (last) { clip.UserClipDistanceClipTestEnableBitmask = last->clip_distance_mask; clip.UserClipDistanceCullTestEnableBitmask = last->cull_distance_mask; -- cgit v1.2.3