glsl: Pack integer and double varyings as flat even if interpolation mode is none
v2: Also update varying_matches::compute_packing_class(). Suggested by Timothy Arceri. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96358 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Cc: "12.0" <mesa-stable@lists.freedesktop.org> Cc: Gregory Hainaut <gregory.hainaut@gmail.com> Cc: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
@@ -590,6 +590,13 @@ public:
|
|||||||
return this->u.state_slots;
|
return this->u.state_slots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool is_interpolation_flat() const
|
||||||
|
{
|
||||||
|
return this->data.interpolation == INTERP_QUALIFIER_FLAT ||
|
||||||
|
this->type->contains_integer() ||
|
||||||
|
this->type->contains_double();
|
||||||
|
}
|
||||||
|
|
||||||
inline bool is_name_ralloced() const
|
inline bool is_name_ralloced() const
|
||||||
{
|
{
|
||||||
return this->name != ir_variable::tmp_name;
|
return this->name != ir_variable::tmp_name;
|
||||||
|
@@ -1611,7 +1611,8 @@ varying_matches::compute_packing_class(const ir_variable *var)
|
|||||||
unsigned packing_class = var->data.centroid | (var->data.sample << 1) |
|
unsigned packing_class = var->data.centroid | (var->data.sample << 1) |
|
||||||
(var->data.patch << 2);
|
(var->data.patch << 2);
|
||||||
packing_class *= 4;
|
packing_class *= 4;
|
||||||
packing_class += var->data.interpolation;
|
packing_class += var->is_interpolation_flat()
|
||||||
|
? unsigned(INTERP_QUALIFIER_FLAT) : var->data.interpolation;
|
||||||
return packing_class;
|
return packing_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -273,11 +273,11 @@ lower_packed_varyings_visitor::run(struct gl_linked_shader *shader)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* This lowering pass is only capable of packing floats and ints
|
/* This lowering pass is only capable of packing floats and ints
|
||||||
* together when their interpolation mode is "flat". Therefore, to be
|
* together when their interpolation mode is "flat". Treat integers as
|
||||||
* safe, caller should ensure that integral varyings always use flat
|
* being flat when the interpolation mode is none.
|
||||||
* interpolation, even when this is not required by GLSL.
|
|
||||||
*/
|
*/
|
||||||
assert(var->data.interpolation == INTERP_QUALIFIER_FLAT ||
|
assert(var->data.interpolation == INTERP_QUALIFIER_FLAT ||
|
||||||
|
var->data.interpolation == INTERP_QUALIFIER_NONE ||
|
||||||
!var->type->contains_integer());
|
!var->type->contains_integer());
|
||||||
|
|
||||||
/* Clone the variable for program resource list before
|
/* Clone the variable for program resource list before
|
||||||
@@ -607,7 +607,7 @@ lower_packed_varyings_visitor::get_packed_varying_deref(
|
|||||||
if (this->packed_varyings[slot] == NULL) {
|
if (this->packed_varyings[slot] == NULL) {
|
||||||
char *packed_name = ralloc_asprintf(this->mem_ctx, "packed:%s", name);
|
char *packed_name = ralloc_asprintf(this->mem_ctx, "packed:%s", name);
|
||||||
const glsl_type *packed_type;
|
const glsl_type *packed_type;
|
||||||
if (unpacked_var->data.interpolation == INTERP_QUALIFIER_FLAT)
|
if (unpacked_var->is_interpolation_flat())
|
||||||
packed_type = glsl_type::ivec4_type;
|
packed_type = glsl_type::ivec4_type;
|
||||||
else
|
else
|
||||||
packed_type = glsl_type::vec4_type;
|
packed_type = glsl_type::vec4_type;
|
||||||
@@ -627,7 +627,8 @@ lower_packed_varyings_visitor::get_packed_varying_deref(
|
|||||||
packed_var->data.centroid = unpacked_var->data.centroid;
|
packed_var->data.centroid = unpacked_var->data.centroid;
|
||||||
packed_var->data.sample = unpacked_var->data.sample;
|
packed_var->data.sample = unpacked_var->data.sample;
|
||||||
packed_var->data.patch = unpacked_var->data.patch;
|
packed_var->data.patch = unpacked_var->data.patch;
|
||||||
packed_var->data.interpolation = unpacked_var->data.interpolation;
|
packed_var->data.interpolation = packed_type == glsl_type::ivec4_type
|
||||||
|
? unsigned(INTERP_QUALIFIER_FLAT) : unpacked_var->data.interpolation;
|
||||||
packed_var->data.location = location;
|
packed_var->data.location = location;
|
||||||
packed_var->data.precision = unpacked_var->data.precision;
|
packed_var->data.precision = unpacked_var->data.precision;
|
||||||
packed_var->data.always_active_io = unpacked_var->data.always_active_io;
|
packed_var->data.always_active_io = unpacked_var->data.always_active_io;
|
||||||
|
Reference in New Issue
Block a user