[Mesa-dev] [PATCH] glsl: move xfb BufferStride into gl_transform_feedback_info

Alejandro Piñeiro apinheiro at igalia.com
Fri Sep 23 16:48:56 UTC 2016


Looks good to me.

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>

On 23/09/16 05:05, Timothy Arceri wrote:
> It makes more sense to have this here where we store the other values
> from xfb qualifiers. The struct it was previously part of is now only
> used to store values to come from the api.
> ---
>  src/compiler/glsl/link_varyings.cpp | 4 ++--
>  src/compiler/glsl/linker.cpp        | 8 ++++----
>  src/mesa/main/mtypes.h              | 5 +++--
>  3 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
> index e622b3e..e339823 100644
> --- a/src/compiler/glsl/link_varyings.cpp
> +++ b/src/compiler/glsl/link_varyings.cpp
> @@ -1136,11 +1136,11 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog,
>        /* Apply any xfb_stride global qualifiers */
>        if (has_xfb_qualifiers) {
>           for (unsigned j = 0; j < MAX_FEEDBACK_BUFFERS; j++) {
> -            if (prog->TransformFeedback.BufferStride[j]) {
> +            if (prog->LinkedTransformFeedback.BufferStride[j]) {
>                 buffers |= 1 << j;
>                 explicit_stride[j] = true;
>                 prog->LinkedTransformFeedback.Buffers[j].Stride =
> -                  prog->TransformFeedback.BufferStride[j] / 4;
> +                  prog->LinkedTransformFeedback.BufferStride[j] / 4;
>              }
>           }
>        }
> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
> index b8dc8a7..d040b92 100644
> --- a/src/compiler/glsl/linker.cpp
> +++ b/src/compiler/glsl/linker.cpp
> @@ -1695,19 +1695,19 @@ link_xfb_stride_layout_qualifiers(struct gl_context *ctx,
>  
>     for (unsigned j = 0; j < MAX_FEEDBACK_BUFFERS; j++) {
>        if (linked_shader->info.TransformFeedback.BufferStride[j]) {
> -         prog->TransformFeedback.BufferStride[j] =
> +         prog->LinkedTransformFeedback.BufferStride[j] =
>              linked_shader->info.TransformFeedback.BufferStride[j];
>  
>           /* We will validate doubles at a later stage */
> -         if (prog->TransformFeedback.BufferStride[j] % 4) {
> +         if (prog->LinkedTransformFeedback.BufferStride[j] % 4) {
>              linker_error(prog, "invalid qualifier xfb_stride=%d must be a "
>                           "multiple of 4 or if its applied to a type that is "
>                           "or contains a double a multiple of 8.",
> -                         prog->TransformFeedback.BufferStride[j]);
> +                         prog->LinkedTransformFeedback.BufferStride[j]);
>              return;
>           }
>  
> -         if (prog->TransformFeedback.BufferStride[j] / 4 >
> +         if (prog->LinkedTransformFeedback.BufferStride[j] / 4 >
>               ctx->Const.MaxTransformFeedbackInterleavedComponents) {
>              linker_error(prog,
>                           "The MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS "
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 1ad93c3..b621431 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -1696,6 +1696,9 @@ struct gl_transform_feedback_info
>     struct gl_transform_feedback_varying_info *Varyings;
>     GLint NumVarying;
>  
> +   /** Global xfb_stride out qualifier if any */
> +   GLuint BufferStride[MAX_FEEDBACK_BUFFERS];
> +
>     struct gl_transform_feedback_buffer Buffers[MAX_FEEDBACK_BUFFERS];
>  };
>  
> @@ -2756,8 +2759,6 @@ struct gl_shader_program
>      */
>     struct {
>        GLenum BufferMode;
> -      /** Global xfb_stride out qualifier if any */
> -      GLuint BufferStride[MAX_FEEDBACK_BUFFERS];
>        GLuint NumVarying;
>        GLchar **VaryingNames;  /**< Array [NumVarying] of char * */
>     } TransformFeedback;
> 

-- 
Alejandro Piñeiro <apinheiro at igalia.com>


More information about the mesa-dev mailing list