summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
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/mesa/main
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/mesa/main')
-rw-r--r--src/mesa/main/mtypes.h6
-rw-r--r--src/mesa/main/shader_query.cpp8
-rw-r--r--src/mesa/main/transformfeedback.c2
3 files changed, 9 insertions, 7 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8842791913e..9b736bb9a3f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1950,6 +1950,9 @@ struct gl_program
struct {
struct gl_active_atomic_buffer **AtomicBuffers;
+ /** Post-link transform feedback info. */
+ struct gl_transform_feedback_info *LinkedTransformFeedback;
+
/**
* Number of types for subroutine uniforms.
*/
@@ -2737,8 +2740,7 @@ struct gl_shader_program
GLchar **VaryingNames; /**< Array [NumVarying] of char * */
} TransformFeedback;
- /** Post-link transform feedback info. */
- struct gl_transform_feedback_info LinkedTransformFeedback;
+ struct gl_program *xfb_program;
/** Post-link gl_FragDepth layout for ARB_conservative_depth. */
enum gl_frag_depth_layout FragDepthLayout;
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 2f157733a48..0f4b2829ce4 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -1041,10 +1041,10 @@ get_buffer_property(struct gl_shader_program *shProg,
*val = RESOURCE_XFB(res)->NumVaryings;
return 1;
case GL_ACTIVE_VARIABLES:
- int i = 0;
- for ( ; i < shProg->LinkedTransformFeedback.NumVarying; i++) {
- unsigned index =
- shProg->LinkedTransformFeedback.Varyings[i].BufferIndex;
+ struct gl_transform_feedback_info *linked_xfb =
+ shProg->xfb_program->sh.LinkedTransformFeedback;
+ for (int i = 0; i < linked_xfb->NumVarying; i++) {
+ unsigned index = linked_xfb->Varyings[i].BufferIndex;
struct gl_program_resource *buf_res =
_mesa_program_resource_find_index(shProg,
GL_TRANSFORM_FEEDBACK_BUFFER,
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 738d63eee37..2088c76e5ea 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -418,7 +418,7 @@ _mesa_BeginTransformFeedback(GLenum mode)
return;
}
- info = &source->LinkedTransformFeedback;
+ info = source->xfb_program->sh.LinkedTransformFeedback;
if (info->NumOutputs == 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,