From c88cf7828ddfa16498b58adbed85c417e8dcf5f2 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 30 Jan 2023 20:11:56 -0600 Subject: [PATCH] nvk: Set up clip and cull distances Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/12 Part-of: --- src/nouveau/vulkan/nvk_graphics_pipeline.c | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/nouveau/vulkan/nvk_graphics_pipeline.c b/src/nouveau/vulkan/nvk_graphics_pipeline.c index 9f1e74bba6d..a0c26f67630 100644 --- a/src/nouveau/vulkan/nvk_graphics_pipeline.c +++ b/src/nouveau/vulkan/nvk_graphics_pipeline.c @@ -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, {