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

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
(cherry picked from commit d36da7c5f8)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25188>
This commit is contained in:
Iván Briano 2023-09-04 21:40:46 -07:00 committed by Dylan Baker
parent 3932095156
commit c3a84ff48d
2 changed files with 19 additions and 1 deletions

View file

@ -539,11 +539,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

@ -545,6 +545,7 @@ populate_wm_prog_key(const struct anv_graphics_base_pipeline *pipeline,
const struct vk_multisample_state *ms,
const struct vk_fragment_shading_rate_state *fsr,
const struct vk_render_pass_state *rp,
const enum brw_sometimes is_mesh,
struct brw_wm_prog_key *key)
{
const struct anv_device *device = pipeline->base.device;
@ -609,6 +610,8 @@ populate_wm_prog_key(const struct anv_graphics_base_pipeline *pipeline,
key->persample_interp = BRW_SOMETIMES;
}
key->mesh_input = is_mesh;
/* Vulkan doesn't support fixed-function alpha test */
key->alpha_test_replicate_alpha = false;
@ -1691,11 +1694,23 @@ 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(pipeline,
pipeline->base.device->robust_buffer_access,
state->dynamic,
raster_enabled ? state->ms : NULL,
state->fsr, state->rp,
is_mesh,
&stages[s].key.wm);
break;
}