From 700bc94dcebf4257740483d2ba467b138234fa1a Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 3 Nov 2016 16:00:37 +1100 Subject: 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 --- src/mesa/main/mtypes.h | 6 ++++-- src/mesa/main/shader_query.cpp | 8 ++++---- src/mesa/main/transformfeedback.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/mesa/main') 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, -- cgit v1.2.3