From 45c2ebc341db2dafbdc6994f483068e7b080caeb Mon Sep 17 00:00:00 2001 From: Rebecca Mckeever Date: Mon, 21 Nov 2022 18:45:01 -0600 Subject: [PATCH] nvk: Convert system values for gl_PointCoord and PointCoord into inputs Currently, any attempt to use gl_PointCoord (GLSL) or PointCoord (SPIR-V) results in an assert in codegen: ERROR: unknown nir_intrinsic_op load_point_coord This patch addresses the error by converting nir_intrinsic_load_point_coord system value into VARYING_SLOT_PNTC. The following tests now pass: dEQP-VK.glsl.builtin_var.simple.pointcoord dEQP-VK.glsl.builtin_var.simple.pointcoord_uniform_frag dEQP-VK.glsl.builtin_var.simple.pointcoord_uniform_vert Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/33 Part-of: --- src/nouveau/vulkan/nvk_shader.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/nouveau/vulkan/nvk_shader.c b/src/nouveau/vulkan/nvk_shader.c index 1c5d2d9..41039e1 100644 --- a/src/nouveau/vulkan/nvk_shader.c +++ b/src/nouveau/vulkan/nvk_shader.c @@ -203,6 +203,12 @@ lower_fragcoord_instr(nir_builder *b, nir_instr *instr, UNUSED void *_data) VARYING_SLOT_POS); val = nir_load_var(b, var); break; + case nir_intrinsic_load_point_coord: + var = find_or_create_input(b, glsl_vector_type(GLSL_TYPE_FLOAT, 2), + "gl_PointCoord", + VARYING_SLOT_PNTC); + val = nir_load_var(b, var); + break; case nir_intrinsic_load_sample_pos: var = find_or_create_input(b, glsl_vec4_type(), "gl_FragCoord", -- 2.7.4