glsl: add transform feedback buffers to resource list
authorTimothy Arceri <timothy.arceri@collabora.com>
Thu, 10 Mar 2016 04:04:02 +0000 (15:04 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Thu, 31 Mar 2016 01:52:57 +0000 (12:52 +1100)
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/compiler/glsl/linker.cpp
src/compiler/glsl/program.h
src/mesa/drivers/dri/i965/brw_link.cpp
src/mesa/program/ir_to_mesa.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 4f191c5002db86ee8d19852d6c9c9fa5bdedcb11..510a22e5bd3dbc9ddef67933f6f1893ffd2c37f8 100644 (file)
@@ -3852,7 +3852,8 @@ write_top_level_array_size_and_stride:
  * resource data.
  */
 void
-build_program_resource_list(struct gl_shader_program *shProg)
+build_program_resource_list(struct gl_context *ctx,
+                            struct gl_shader_program *shProg)
 {
    /* Rebuild resource list. */
    if (shProg->ProgramResourceList) {
@@ -3910,6 +3911,17 @@ build_program_resource_list(struct gl_shader_program *shProg)
       }
    }
 
+   /* 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 (!add_program_resource(shProg, GL_TRANSFORM_FEEDBACK_BUFFER,
+                                   &shProg->LinkedTransformFeedback.Buffers[i],
+                                   0))
+         return;
+      }
+   }
+
    /* Add uniforms from uniform storage. */
    for (unsigned i = 0; i < shProg->NumUniformStorage; i++) {
       /* Do not add uniforms internally used by Mesa. */
index 31bb9aa243530f79f18c0e2a316cf4bf7d5b5bd3..8f5a31bd5ba6010f688380e68a80a756a63f83fd 100644 (file)
@@ -43,7 +43,8 @@ extern void
 link_shaders(struct gl_context *ctx, struct gl_shader_program *prog);
 
 extern void
-build_program_resource_list(struct gl_shader_program *shProg);
+build_program_resource_list(struct gl_context *ctx,
+                            struct gl_shader_program *shProg);
 
 extern void
 linker_error(struct gl_shader_program *prog, const char *fmt, ...)
index b512f8b6ee162ff41f9d61b2ff74c7a8a05c0be7..c7d6fb8c79b8847cd4fe5ff7ffd24fbb810ddbc8 100644 (file)
@@ -260,6 +260,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
    if (brw->precompile && !brw_shader_precompile(ctx, shProg))
       return false;
 
-   build_program_resource_list(shProg);
+   build_program_resource_list(ctx, shProg);
    return true;
 }
index 1d9047ee6fdedaf50cdabbb1e77e2505c92b73df..35a685620018309399d816f858c59a0493063eb8 100644 (file)
@@ -2976,7 +2976,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
       _mesa_reference_program(ctx, &linked_prog, NULL);
    }
 
-   build_program_resource_list(prog);
+   build_program_resource_list(ctx, prog);
    return prog->LinkStatus;
 }
 
index 5e18e8be02952a9bcdac6e031d6660da683a0635..23786b855294706f96e409fb3db9c8985936f75b 100644 (file)
@@ -6811,7 +6811,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
       validate_ir_tree(ir);
    }
 
-   build_program_resource_list(prog);
+   build_program_resource_list(ctx, prog);
 
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       struct gl_program *linked_prog;