glsl: fix recording of variables for XFB in TCS shaders

This is purely for conformance, since it's not actually possible to do
XFB on TCS output varyings. However we do have to make sure we record
the names correctly, and this removes an extra level of array-ness from
the names in question.

Fixes KHR-GL45.tessellation_shader.single.xfb_captures_data_from_correct_stage

v2: Add comment to the new program_resource_visitor::process function.
    (Ilia Mirkin)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108457
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: 19.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
Ilia Mirkin
2019-02-22 01:13:39 -05:00
committed by Jose Maria Casanova Crespo
parent bf1f49482d
commit 4eec3a2a36
3 changed files with 44 additions and 5 deletions

View File

@@ -2124,9 +2124,11 @@ class tfeedback_candidate_generator : public program_resource_visitor
{
public:
tfeedback_candidate_generator(void *mem_ctx,
hash_table *tfeedback_candidates)
hash_table *tfeedback_candidates,
gl_shader_stage stage)
: mem_ctx(mem_ctx),
tfeedback_candidates(tfeedback_candidates),
stage(stage),
toplevel_var(NULL),
varying_floats(0)
{
@@ -2136,10 +2138,17 @@ public:
{
/* All named varying interface blocks should be flattened by now */
assert(!var->is_interface_instance());
assert(var->data.mode == ir_var_shader_out);
this->toplevel_var = var;
this->varying_floats = 0;
program_resource_visitor::process(var, false);
const glsl_type *t =
var->data.from_named_ifc_block ? var->get_interface_type() : var->type;
if (!var->data.patch && stage == MESA_SHADER_TESS_CTRL) {
assert(t->is_array());
t = t->fields.array;
}
program_resource_visitor::process(var, t, false);
}
private:
@@ -2173,6 +2182,8 @@ private:
*/
hash_table * const tfeedback_candidates;
gl_shader_stage stage;
/**
* Pointer to the toplevel variable that is being traversed.
*/
@@ -2503,7 +2514,7 @@ assign_varying_locations(struct gl_context *ctx,
producer->Stage == MESA_SHADER_GEOMETRY));
if (num_tfeedback_decls > 0) {
tfeedback_candidate_generator g(mem_ctx, tfeedback_candidates);
tfeedback_candidate_generator g(mem_ctx, tfeedback_candidates, producer->Stage);
/* From OpenGL 4.6 (Core Profile) spec, section 11.1.2.1
* ("Vertex Shader Variables / Output Variables")
*