nvk: Set up clip and cull distances

Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/12
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand 2023-01-30 20:11:56 -06:00 committed by Marge Bot
parent 7696f8c8d2
commit c88cf7828d

View file

@ -273,8 +273,30 @@ nvk_graphics_pipeline_create(struct nvk_device *device,
P_IMMD(p, NV9097, SET_PIPELINE_REGISTER_COUNT(idx), shader->num_gprs);
switch (stage) {
case MESA_SHADER_VERTEX:
case MESA_SHADER_VERTEX: {
uint8_t clip_cull = shader->vs.clip_enable | shader->vs.cull_enable;
P_IMMD(p, NV9097, SET_USER_CLIP_ENABLE, {
.plane0 = (clip_cull >> 0) & 1,
.plane1 = (clip_cull >> 1) & 1,
.plane2 = (clip_cull >> 2) & 1,
.plane3 = (clip_cull >> 3) & 1,
.plane4 = (clip_cull >> 4) & 1,
.plane5 = (clip_cull >> 5) & 1,
.plane6 = (clip_cull >> 6) & 1,
.plane7 = (clip_cull >> 7) & 1,
});
P_IMMD(p, NV9097, SET_USER_CLIP_OP, {
.plane0 = (shader->vs.cull_enable >> 0) & 1,
.plane1 = (shader->vs.cull_enable >> 1) & 1,
.plane2 = (shader->vs.cull_enable >> 2) & 1,
.plane3 = (shader->vs.cull_enable >> 3) & 1,
.plane4 = (shader->vs.cull_enable >> 4) & 1,
.plane5 = (shader->vs.cull_enable >> 5) & 1,
.plane6 = (shader->vs.cull_enable >> 6) & 1,
.plane7 = (shader->vs.cull_enable >> 7) & 1,
});
break;
}
case MESA_SHADER_FRAGMENT:
P_IMMD(p, NV9097, SET_SUBTILING_PERF_KNOB_A, {