[Mesa-dev] [PATCH 08/70] mesa/glsl: move LinkedTransformFeedback from gl_shader_program to gl_program
Eric Anholt
eric at anholt.net
Tue Dec 27 18:06:34 UTC 2016
Timothy Arceri <timothy.arceri at collabora.com> writes:
> 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.
> ---
> src/compiler/glsl/link_varyings.cpp | 34 +++++++++++++--------------
> src/compiler/glsl/linker.cpp | 30 ++++++++++++++++-------
> src/mesa/drivers/dri/i965/brw_ff_gs.c | 2 +-
> src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp | 2 +-
> src/mesa/drivers/dri/i965/gen6_sol.c | 9 +++----
> src/mesa/drivers/dri/i965/gen7_sol_state.c | 6 ++---
> src/mesa/main/mtypes.h | 6 +++--
> src/mesa/main/shader_query.cpp | 8 +++----
> src/mesa/main/transformfeedback.c | 2 +-
> src/mesa/state_tracker/st_cb_xformfb.c | 8 +++----
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
> src/mesa/state_tracker/st_program.c | 2 +-
> 12 files changed, 63 insertions(+), 48 deletions(-)
>
> @@ -4589,6 +4590,19 @@ 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;
> + int next = last == MESA_SHADER_FRAGMENT ? last - 1 : last;
> + for (int i = next; i >= 0; i--) {
> + if (prog->_LinkedShaders[i] == NULL)
> + continue;
> +
> + prog->xfb_program = prog->_LinkedShaders[i]->Program;
> + break;
> + }
I think the loop would be nicer as
for (int i = MESA_SHADER_GEOMETRY; i >= MESA_SHADER_VERTEX; i--)
to match transformfeedback.c's get_xfb_source(). Other than that,
Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161227/5907f603/attachment.sig>
More information about the mesa-dev
mailing list