aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/linker.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-03 16:00:37 +1100
committerTimothy Arceri <[email protected]>2016-12-30 10:57:16 +1100
commit700bc94dcebf4257740483d2ba467b138234fa1a (patch)
treeda45fbee155479d7692bbe68c534a3c1c67385b3 /src/compiler/glsl/linker.cpp
parent31c04e4e229bec4e059779b4034cf597ceeadf97 (diff)
mesa/glsl: move LinkedTransformFeedback from gl_shader_program to gl_program
This will help allow us to store gl_program in the CurrentProgram array rather than gl_shader_program which will allow a bunch of simplifications. Note that we make LinkedTransformFeedback a pointer so we don't waste memory creating a struct for each stage. We also store a pointer to the gl_program that will contain the pointer in gl_shader_program so we can get easy access to the correct stage. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler/glsl/linker.cpp')
-rw-r--r--src/compiler/glsl/linker.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index e5cc6de2d12..209129c3ea0 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4242,25 +4242,26 @@ build_program_resource_list(struct gl_context *ctx,
output_stage, GL_PROGRAM_OUTPUT))
return;
+ struct gl_transform_feedback_info *linked_xfb =
+ shProg->xfb_program->sh.LinkedTransformFeedback;
+
/* Add transform feedback varyings. */
- if (shProg->LinkedTransformFeedback.NumVarying > 0) {
- for (int i = 0; i < shProg->LinkedTransformFeedback.NumVarying; i++) {
+ if (linked_xfb->NumVarying > 0) {
+ for (int i = 0; i < linked_xfb->NumVarying; i++) {
if (!add_program_resource(shProg, resource_set,
GL_TRANSFORM_FEEDBACK_VARYING,
- &shProg->LinkedTransformFeedback.Varyings[i],
- 0))
+ &linked_xfb->Varyings[i], 0))
return;
}
}
/* Add transform feedback buffers. */
for (unsigned i = 0; i < ctx->Const.MaxTransformFeedbackBuffers; i++) {
- if ((shProg->LinkedTransformFeedback.ActiveBuffers >> i) & 1) {
- shProg->LinkedTransformFeedback.Buffers[i].Binding = i;
+ if ((linked_xfb->ActiveBuffers >> i) & 1) {
+ linked_xfb->Buffers[i].Binding = i;
if (!add_program_resource(shProg, resource_set,
GL_TRANSFORM_FEEDBACK_BUFFER,
- &shProg->LinkedTransformFeedback.Buffers[i],
- 0))
+ &linked_xfb->Buffers[i], 0))
return;
}
}
@@ -4587,6 +4588,18 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
varying_names = prog->TransformFeedback.VaryingNames;
}
+ /* Find the program used for xfb. Even if we don't use xfb we still want to
+ * set this so we can fill the default values for program interface query.
+ */
+ prog->xfb_program = prog->_LinkedShaders[last]->Program;
+ for (int i = MESA_SHADER_GEOMETRY; i >= MESA_SHADER_VERTEX; i--) {
+ if (prog->_LinkedShaders[i] == NULL)
+ continue;
+
+ prog->xfb_program = prog->_LinkedShaders[i]->Program;
+ break;
+ }
+
if (num_tfeedback_decls != 0) {
/* From GL_EXT_transform_feedback:
* A program will fail to link if: