Mesa (main): glsl/nir: Set sample_shading if a FS output ever shows up as an rvalue
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jul 13 21:04:29 UTC 2022
Module: Mesa
Branch: main
Commit: 1124bee4baba49466d84b2bf274017dbba6360a7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1124bee4baba49466d84b2bf274017dbba6360a7
Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date: Mon May 2 18:19:30 2022 -0500
glsl/nir: Set sample_shading if a FS output ever shows up as an rvalue
If framebuffer fetch is used, we have to enable sample shading because
the fetched framebuffer value is per-sample.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14020>
---
src/compiler/glsl/glsl_to_nir.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 7dff79114c4..0a8c33aa00a 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -81,6 +81,9 @@ public:
void create_function(ir_function_signature *ir);
+ /* True if we have any output rvalues */
+ bool has_output_rvalue;
+
private:
void add_instr(nir_instr *instr, unsigned num_components, unsigned bit_size);
nir_ssa_def *evaluate_rvalue(ir_rvalue *ir);
@@ -271,6 +274,9 @@ glsl_to_nir(const struct gl_constants *consts,
if (var->data.mode == nir_var_shader_in && var->data.sample)
shader->info.fs.uses_sample_shading = true;
}
+
+ if (v1.has_output_rvalue)
+ shader->info.fs.uses_sample_shading = true;
}
return shader;
@@ -281,6 +287,7 @@ nir_visitor::nir_visitor(const struct gl_constants *consts, nir_shader *shader)
this->supports_std430 = consts->UseSTD430AsDefaultPacking;
this->shader = shader;
this->is_global = true;
+ this->has_output_rvalue = false;
this->var_table = _mesa_pointer_hash_table_create(NULL);
this->overload_table = _mesa_pointer_hash_table_create(NULL);
this->sparse_variable_set = _mesa_pointer_set_create(NULL);
@@ -1838,6 +1845,9 @@ nir_visitor::evaluate_rvalue(ir_rvalue* ir)
enum gl_access_qualifier access = deref_get_qualifier(this->deref);
this->result = nir_load_deref_with_access(&b, this->deref, access);
+
+ if (nir_deref_mode_is(this->deref, nir_var_shader_out))
+ this->has_output_rvalue = true;
}
return this->result;
More information about the mesa-commit
mailing list