Mesa (main): spirv: Always declare FragCoord as a sysval
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Oct 7 20:13:56 UTC 2021
Module: Mesa
Branch: main
Commit: b47090c5b33c89e5c29dd4f95230863ec018e2bc
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b47090c5b33c89e5c29dd4f95230863ec018e2bc
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Mon Sep 27 15:16:43 2021 +0200
spirv: Always declare FragCoord as a sysval
Now that all spirv_to_nir() users take care of converting sysvals to
varyings, we can unconditionally declare FragCoord as a sysval.
Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13017>
---
src/amd/vulkan/radv_shader.c | 1 -
src/broadcom/vulkan/v3dv_pipeline.c | 1 -
src/compiler/spirv/nir_spirv.h | 5 -----
src/compiler/spirv/vtn_variables.c | 8 ++------
src/freedreno/vulkan/tu_shader.c | 2 --
src/gallium/frontends/lavapipe/lvp_pipeline.c | 1 -
src/intel/vulkan/anv_pipeline.c | 1 -
src/mesa/main/glspirv.c | 1 -
8 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 5de1d488d88..e174d7a3b77 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -521,7 +521,6 @@ radv_shader_compile_to_nir(struct radv_device *device, struct vk_shader_module *
.push_const_addr_format = nir_address_format_logical,
.shared_addr_format = nir_address_format_32bit_offset,
.constant_addr_format = nir_address_format_64bit_global,
- .frag_coord_is_sysval = true,
.use_deref_buffer_array_length = true,
.debug =
{
diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c
index 42e30323953..fdc5a681e61 100644
--- a/src/broadcom/vulkan/v3dv_pipeline.c
+++ b/src/broadcom/vulkan/v3dv_pipeline.c
@@ -190,7 +190,6 @@ static const struct spirv_to_nir_options default_spirv_options = {
.phys_ssbo_addr_format = nir_address_format_64bit_global,
.push_const_addr_format = nir_address_format_logical,
.shared_addr_format = nir_address_format_32bit_offset,
- .frag_coord_is_sysval = false,
};
const nir_shader_compiler_options v3dv_nir_options = {
diff --git a/src/compiler/spirv/nir_spirv.h b/src/compiler/spirv/nir_spirv.h
index 3e637ef497d..1cb370c323f 100644
--- a/src/compiler/spirv/nir_spirv.h
+++ b/src/compiler/spirv/nir_spirv.h
@@ -58,11 +58,6 @@ enum nir_spirv_execution_environment {
struct spirv_to_nir_options {
enum nir_spirv_execution_environment environment;
- /* Whether to make FragCoord to a system value, the same as
- * GLSLFragCoordIsSysVal in GLSL.
- */
- bool frag_coord_is_sysval;
-
/* Whether to keep ViewIndex as an input instead of rewriting to a sysval.
*/
bool view_index_is_input;
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index e93e05f663d..98d7f9fb023 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -879,12 +879,8 @@ vtn_get_builtin_location(struct vtn_builder *b,
break;
case SpvBuiltInFragCoord:
vtn_assert(*mode == nir_var_shader_in);
- if (b->options && b->options->frag_coord_is_sysval) {
- *mode = nir_var_system_value;
- *location = SYSTEM_VALUE_FRAG_COORD;
- } else {
- *location = VARYING_SLOT_POS;
- }
+ *mode = nir_var_system_value;
+ *location = SYSTEM_VALUE_FRAG_COORD;
break;
case SpvBuiltInPointCoord:
*location = VARYING_SLOT_PNTC;
diff --git a/src/freedreno/vulkan/tu_shader.c b/src/freedreno/vulkan/tu_shader.c
index f4d4e079c3d..a0baf0921b6 100644
--- a/src/freedreno/vulkan/tu_shader.c
+++ b/src/freedreno/vulkan/tu_shader.c
@@ -38,8 +38,6 @@ tu_spirv_to_nir(struct tu_device *dev,
{
/* TODO these are made-up */
const struct spirv_to_nir_options spirv_options = {
- .frag_coord_is_sysval = true,
-
.ubo_addr_format = nir_address_format_vec2_index_32bit_offset,
.ssbo_addr_format = nir_address_format_vec2_index_32bit_offset,
diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c
index ea3972c0b5b..6cd2d0ee44c 100644
--- a/src/gallium/frontends/lavapipe/lvp_pipeline.c
+++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c
@@ -514,7 +514,6 @@ lvp_shader_compile_to_ir(struct lvp_pipeline *pipeline,
.phys_ssbo_addr_format = nir_address_format_64bit_global,
.push_const_addr_format = nir_address_format_logical,
.shared_addr_format = nir_address_format_32bit_offset,
- .frag_coord_is_sysval = false,
};
nir = spirv_to_nir(spirv, module->size / 4,
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 61e6cdd3e83..02561ca075b 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -108,7 +108,6 @@ anv_shader_compile_to_nir(struct anv_device *device,
.module = module,
};
struct spirv_to_nir_options spirv_options = {
- .frag_coord_is_sysval = true,
.caps = {
.demote_to_helper_invocation = true,
.derivative_group = true,
diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c
index eecb91a5944..a5513bfc12a 100644
--- a/src/mesa/main/glspirv.c
+++ b/src/mesa/main/glspirv.c
@@ -243,7 +243,6 @@ _mesa_spirv_to_nir(struct gl_context *ctx,
const struct spirv_to_nir_options spirv_options = {
.environment = NIR_SPIRV_OPENGL,
- .frag_coord_is_sysval = ctx->Const.GLSLFragCoordIsSysVal,
.use_deref_buffer_array_length = true,
.caps = ctx->Const.SpirVCapabilities,
.ubo_addr_format = nir_address_format_32bit_index_offset,
More information about the mesa-commit
mailing list