diff options
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/ast_to_hir.cpp | 11 | ||||
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 7 | ||||
-rw-r--r-- | src/compiler/glsl/ir.cpp | 2 | ||||
-rw-r--r-- | src/compiler/glsl/ir.h | 8 | ||||
-rw-r--r-- | src/compiler/glsl/linker.cpp | 4 | ||||
-rw-r--r-- | src/compiler/nir/nir.h | 8 | ||||
-rw-r--r-- | src/compiler/nir/nir_lower_system_values.c | 6 | ||||
-rw-r--r-- | src/compiler/nir/nir_lower_wpos_ytransform.c | 4 | ||||
-rw-r--r-- | src/compiler/shader_info.h | 6 | ||||
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 6 | ||||
-rw-r--r-- | src/compiler/spirv/vtn_private.h | 2 | ||||
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 6 |
12 files changed, 26 insertions, 44 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 620153e6a34..f68ed46435b 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -3670,8 +3670,6 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual, state->fs_redeclares_gl_fragcoord_with_no_layout_qualifiers; } - var->data.pixel_center_integer = qual->flags.q.pixel_center_integer; - var->data.origin_upper_left = qual->flags.q.origin_upper_left; if ((qual->flags.q.origin_upper_left || qual->flags.q.pixel_center_integer) && (strcmp(var->name, "gl_FragCoord") != 0)) { const char *const qual_string = (qual->flags.q.origin_upper_left) @@ -4290,10 +4288,13 @@ get_variable_being_redeclared(ir_variable **var_ptr, YYLTYPE loc, && strcmp(var->name, "gl_FragCoord") == 0) { /* Allow redeclaration of gl_FragCoord for ARB_fcc layout * qualifiers. + * + * We don't really need to do anything here, just allow the + * redeclaration. Any error on the gl_FragCoord is handled on the ast + * level at apply_layout_qualifier_to_variable using the + * ast_type_qualifier and _mesa_glsl_parse_state, or later at + * linker.cpp. */ - earlier->data.origin_upper_left = var->data.origin_upper_left; - earlier->data.pixel_center_integer = var->data.pixel_center_integer; - /* According to section 4.3.7 of the GLSL 1.30 spec, * the following built-in varaibles can be redeclared with an * interpolation qualifier: diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index d62de862fac..09a4f19f6f2 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -168,6 +168,11 @@ glsl_to_nir(const struct gl_shader_program *shader_prog, shader->info.has_transform_feedback_varyings |= shader_prog->last_vert_prog->sh.LinkedTransformFeedback->NumVarying > 0; + if (shader->info.stage == MESA_SHADER_FRAGMENT) { + shader->info.fs.pixel_center_integer = sh->Program->info.fs.pixel_center_integer; + shader->info.fs.origin_upper_left = sh->Program->info.fs.origin_upper_left; + } + return shader; } @@ -398,8 +403,6 @@ nir_visitor::visit(ir_variable *ir) } var->data.interpolation = ir->data.interpolation; - var->data.origin_upper_left = ir->data.origin_upper_left; - var->data.pixel_center_integer = ir->data.pixel_center_integer; var->data.location_frac = ir->data.location_frac; switch (ir->data.depth_layout) { diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp index 1d1a56ae9a5..77e37161b74 100644 --- a/src/compiler/glsl/ir.cpp +++ b/src/compiler/glsl/ir.cpp @@ -1725,8 +1725,6 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name, this->data.warn_extension_index = 0; this->constant_value = NULL; this->constant_initializer = NULL; - this->data.origin_upper_left = false; - this->data.pixel_center_integer = false; this->data.depth_layout = ir_depth_layout_none; this->data.used = false; this->data.always_active_io = false; diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h index d05d1998a50..fa124863d09 100644 --- a/src/compiler/glsl/ir.h +++ b/src/compiler/glsl/ir.h @@ -712,14 +712,6 @@ public: unsigned interpolation:2; /** - * \name ARB_fragment_coord_conventions - * @{ - */ - unsigned origin_upper_left:1; - unsigned pixel_center_integer:1; - /*@}*/ - - /** * Was the location explicitly set in the shader? * * If the location is explicitly set in the shader, it \b cannot be changed diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 2d76e852f47..5a950950b7c 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2049,9 +2049,11 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, shader->SampleInterlockOrdered; linked_shader->Program->info.fs.sample_interlock_unordered |= shader->SampleInterlockUnordered; - linked_shader->Program->sh.fs.BlendSupport |= shader->BlendSupport; } + + linked_shader->Program->info.fs.pixel_center_integer = pixel_center_integer; + linked_shader->Program->info.fs.origin_upper_left = origin_upper_left; } /** diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 94ca6c46468..190b7af7c28 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -238,14 +238,6 @@ typedef struct nir_variable { unsigned interpolation:2; /** - * \name ARB_fragment_coord_conventions - * @{ - */ - unsigned origin_upper_left:1; - unsigned pixel_center_integer:1; - /*@}*/ - - /** * If non-zero, then this variable may be packed along with other variables * into a single varying slot, so this offset should be applied when * accessing components. For example, an offset of 1 means that the x diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c index 7c1aa5fa801..68b0ea89c8d 100644 --- a/src/compiler/nir/nir_lower_system_values.c +++ b/src/compiler/nir/nir_lower_system_values.c @@ -254,12 +254,6 @@ 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; } diff --git a/src/compiler/nir/nir_lower_wpos_ytransform.c b/src/compiler/nir/nir_lower_wpos_ytransform.c index 444e211b680..34a4801d66b 100644 --- a/src/compiler/nir/nir_lower_wpos_ytransform.c +++ b/src/compiler/nir/nir_lower_wpos_ytransform.c @@ -181,7 +181,7 @@ lower_fragcoord(lower_wpos_ytransform_state *state, * u,h -> l,i: (99.5 + 0.5) * -1 + 100 = 0 */ - if (fragcoord->data.origin_upper_left) { + if (state->shader->info.fs.origin_upper_left) { /* Fragment shader wants origin in upper-left */ if (options->fs_coord_origin_upper_left) { /* the driver supports upper-left origin */ @@ -203,7 +203,7 @@ lower_fragcoord(lower_wpos_ytransform_state *state, } } - if (fragcoord->data.pixel_center_integer) { + if (state->shader->info.fs.pixel_center_integer) { /* Fragment shader wants pixel center integer */ if (options->fs_coord_pixel_center_integer) { /* the driver supports pixel center integer */ diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index ea6f9a16375..8fbdfab1a8e 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -195,7 +195,13 @@ typedef struct shader_info { bool post_depth_coverage; + /** + * \name ARB_fragment_coord_conventions + * @{ + */ bool pixel_center_integer; + bool origin_upper_left; + /*@}*/ bool pixel_interlock_ordered; bool pixel_interlock_unordered; diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 8c07542f832..f5511587be8 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -3785,7 +3785,8 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, switch(mode->exec_mode) { case SpvExecutionModeOriginUpperLeft: case SpvExecutionModeOriginLowerLeft: - b->origin_upper_left = + vtn_assert(b->shader->info.stage == MESA_SHADER_FRAGMENT); + b->shader->info.fs.origin_upper_left = (mode->exec_mode == SpvExecutionModeOriginUpperLeft); break; @@ -3908,7 +3909,8 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, break; case SpvExecutionModePixelCenterInteger: - b->pixel_center_integer = true; + vtn_assert(b->shader->info.stage == MESA_SHADER_FRAGMENT); + b->shader->info.fs.pixel_center_integer = true; break; case SpvExecutionModeXfb: diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index 63313034ba6..f3d54051885 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -601,8 +601,6 @@ struct vtn_builder { const char *entry_point_name; struct vtn_value *entry_point; struct vtn_value *workgroup_size_builtin; - bool origin_upper_left; - bool pixel_center_integer; bool variable_pointers; struct vtn_function *func; diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index f6b458b7e78..51152520bb6 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -1448,12 +1448,6 @@ apply_var_decoration(struct vtn_builder *b, case SpvBuiltInCullDistance: var_data->compact = true; break; - case SpvBuiltInFragCoord: - var_data->pixel_center_integer = b->pixel_center_integer; - /* fallthrough */ - case SpvBuiltInSamplePosition: - var_data->origin_upper_left = b->origin_upper_left; - break; default: break; } |