From e1464a1cf892b08902785d81c2e1f1c95e1083de Mon Sep 17 00:00:00 2001 From: Antia Puentes Date: Sat, 15 Dec 2018 18:33:18 +0100 Subject: [PATCH] nir/linker: Add XFB resources to the program resource list Reviewed-by: Caio Marcelo de Oliveira Filho --- src/compiler/glsl/gl_nir_linker.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 4bf94c05a15..57ee435fa27 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -154,6 +154,33 @@ nir_build_program_resource_list(struct gl_context *ctx, return; } + /* Add transform feedback varyings and buffers. */ + if (prog->last_vert_prog) { + struct gl_transform_feedback_info *linked_xfb = + prog->last_vert_prog->sh.LinkedTransformFeedback; + + /* Add varyings. */ + if (linked_xfb->NumVarying > 0) { + for (int i = 0; i < linked_xfb->NumVarying; i++) { + if (!link_util_add_program_resource(prog, resource_set, + GL_TRANSFORM_FEEDBACK_VARYING, + &linked_xfb->Varyings[i], 0)) + return; + } + } + + /* Add buffers. */ + for (unsigned i = 0; i < ctx->Const.MaxTransformFeedbackBuffers; i++) { + if ((linked_xfb->ActiveBuffers >> i) & 1) { + linked_xfb->Buffers[i].Binding = i; + if (!link_util_add_program_resource(prog, resource_set, + GL_TRANSFORM_FEEDBACK_BUFFER, + &linked_xfb->Buffers[i], 0)) + return; + } + } + } + /* Add uniforms * * Here, it is expected that nir_link_uniforms() has already been -- 2.30.2