summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-02-02 00:43:42 -0800
committerKenneth Graunke <[email protected]>2019-02-05 13:51:52 -0800
commit3327c93510b2956ef979778e52848331b597cbf0 (patch)
treec0c1a656e01c176767fe02a20713126567c648f1 /src/compiler
parent536abd453bfedd4a424d94f4559371fd38cfaa7b (diff)
nir: Record info->fs.pixel_center_integer in lower_system_values
radeonsi uses a system value for gl_FragCoord rather than an input var. These get translated into load_frag_coord NIR intrinsics, which lose the pixel_center_integer and origin_upper_left decorations. To cope with this, Tim added a shader_info field for pixel_center_integer, and made glsl_to_nir set it accordingly. prog_to_nir also needs to handle these fragcoord conventions. Instead of duplicating the logic to set the info field, just move it to nir_lower_system_values so it'll happen regardless of who makes the NIR. (For what it's worth, we don't need an info flag for origin_upper_left, because radeonsi lowers origin conventions in nir_lower_wpos_ytransform before nir_lower_system_values destroys the variable and qualifiers.) Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp5
-rw-r--r--src/compiler/nir/nir_lower_system_values.c6
2 files changed, 6 insertions, 5 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index d2db0f95aca..90aa21f3149 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -389,11 +389,6 @@ nir_visitor::visit(ir_variable *ir)
var->data.pixel_center_integer = ir->data.pixel_center_integer;
var->data.location_frac = ir->data.location_frac;
- if (var->data.pixel_center_integer) {
- assert(shader->info.stage == MESA_SHADER_FRAGMENT);
- shader->info.fs.pixel_center_integer = true;
- }
-
switch (ir->data.depth_layout) {
case ir_depth_layout_none:
var->data.depth_layout = nir_depth_layout_none;
diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c
index 68b0ea89c8d..7c1aa5fa801 100644
--- a/src/compiler/nir/nir_lower_system_values.c
+++ b/src/compiler/nir/nir_lower_system_values.c
@@ -254,6 +254,12 @@ convert_block(nir_block *block, nir_builder *b)
break;
}
+ case SYSTEM_VALUE_FRAG_COORD:
+ assert(b->shader->info.stage == MESA_SHADER_FRAGMENT);
+ b->shader->info.fs.pixel_center_integer =
+ var->data.pixel_center_integer;
+ break;
+
default:
break;
}