anv: track what kind of pipeline a fragment shader may be used with

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25047>
This commit is contained in:
Iván Briano 2023-09-04 21:40:46 -07:00 committed by Marge Bot
parent b200e5765c
commit d36da7c5f8
2 changed files with 20 additions and 3 deletions

View file

@ -557,11 +557,14 @@ struct brw_wm_prog_key {
enum brw_sometimes line_aa:2;
/* Whether the preceding shader stage is mesh */
enum brw_sometimes mesh_input:2;
bool coherent_fb_fetch:1;
bool ignore_sample_mask_out:1;
bool coarse_pixel:1;
uint64_t padding:55;
uint64_t padding:53;
};
struct brw_cs_prog_key {

View file

@ -585,7 +585,8 @@ populate_wm_prog_key(struct anv_pipeline_stage *stage,
const BITSET_WORD *dynamic,
const struct vk_multisample_state *ms,
const struct vk_fragment_shading_rate_state *fsr,
const struct vk_render_pass_state *rp)
const struct vk_render_pass_state *rp,
const enum brw_sometimes is_mesh)
{
const struct anv_device *device = pipeline->base.device;
@ -651,6 +652,8 @@ populate_wm_prog_key(struct anv_pipeline_stage *stage,
key->persample_interp = BRW_SOMETIMES;
}
key->mesh_input = is_mesh;
/* Vulkan doesn't support fixed-function alpha test */
key->alpha_test_replicate_alpha = false;
@ -1728,11 +1731,22 @@ anv_graphics_pipeline_init_keys(struct anv_graphics_base_pipeline *pipeline,
state->rs == NULL ||
!state->rs->rasterizer_discard_enable ||
BITSET_TEST(state->dynamic, MESA_VK_DYNAMIC_RS_RASTERIZER_DISCARD_ENABLE);
enum brw_sometimes is_mesh = BRW_NEVER;
if (device->vk.enabled_extensions.EXT_mesh_shader) {
if (anv_pipeline_base_has_stage(pipeline, MESA_SHADER_VERTEX))
is_mesh = BRW_NEVER;
else if (anv_pipeline_base_has_stage(pipeline, MESA_SHADER_MESH))
is_mesh = BRW_ALWAYS;
else {
assert(pipeline->base.type == ANV_PIPELINE_GRAPHICS_LIB);
is_mesh = BRW_SOMETIMES;
}
}
populate_wm_prog_key(&stages[s],
pipeline,
state->dynamic,
raster_enabled ? state->ms : NULL,
state->fsr, state->rp);
state->fsr, state->rp, is_mesh);
break;
}