nvk: Set GEOMETRY_SHADER_SELECTS_LAYER properly

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand 2023-01-30 20:11:55 -06:00 committed by Marge Bot
parent 2d108bb672
commit 91c1be22ed

View file

@ -247,6 +247,7 @@ nvk_graphics_pipeline_create(struct nvk_device *device,
sizeof(pipeline->push_data));
struct nouveau_ws_push *p = &pipeline->push;
struct nvk_shader *last_geom = NULL;
for (gl_shader_stage stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) {
struct nvk_shader *shader = &pipeline->base.shaders[stage];
uint32_t idx = mesa_to_nv9097_shader_type[stage];
@ -259,6 +260,9 @@ nvk_graphics_pipeline_create(struct nvk_device *device,
if (shader->bo == NULL)
continue;
if (stage != MESA_SHADER_FRAGMENT)
last_geom = shader;
uint64_t addr = nvk_shader_address(shader);
assert(device->ctx->eng3d.cls >= VOLTA_A);
P_MTHD(p, NVC397, SET_PIPELINE_PROGRAM_ADDRESS_A(idx));
@ -292,7 +296,9 @@ nvk_graphics_pipeline_create(struct nvk_device *device,
/* TODO: prog_selects_layer */
P_IMMD(p, NV9097, SET_RT_LAYER, {
.v = 0,
.control = CONTROL_V_SELECTS_LAYER,
.control = (last_geom->hdr[13] & (1 << 9)) ?
CONTROL_GEOMETRY_SHADER_SELECTS_LAYER :
CONTROL_V_SELECTS_LAYER,
});
struct vk_graphics_pipeline_all_state all;