summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/transformfeedback.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-03 14:35:08 +1100
committerTimothy Arceri <[email protected]>2016-12-30 10:57:16 +1100
commit3177eef39277b64af3213603b58ff934b5218e39 (patch)
tree7471af703fe3298068df96476c6ec4a725104ba5 /src/mesa/main/transformfeedback.c
parent700bc94dcebf4257740483d2ba467b138234fa1a (diff)
mesa: store gl_program in gl_transform_feedback_object rather than gl_shader_program
This will allow us to make the CurrentProgram array store gl_program which allows us to do a bunch of simplifications. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main/transformfeedback.c')
-rw-r--r--src/mesa/main/transformfeedback.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 2088c76e5ea..771223aff99 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -45,7 +45,7 @@
struct using_program_tuple
{
- struct gl_shader_program *shProg;
+ struct gl_program *prog;
bool found;
};
@@ -54,7 +54,7 @@ active_xfb_object_references_program(GLuint key, void *data, void *user_data)
{
struct using_program_tuple *callback_data = user_data;
struct gl_transform_feedback_object *obj = data;
- if (obj->Active && obj->shader_program == callback_data->shProg)
+ if (obj->Active && obj->program == callback_data->prog)
callback_data->found = true;
}
@@ -66,8 +66,8 @@ _mesa_transform_feedback_is_using_program(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
struct using_program_tuple callback_data;
- callback_data.shProg = shProg;
callback_data.found = false;
+ callback_data.prog = shProg->xfb_program;
_mesa_HashWalk(ctx->TransformFeedback.Objects,
active_xfb_object_references_program, &callback_data);
@@ -379,18 +379,18 @@ _mesa_compute_max_transform_feedback_vertices(struct gl_context *ctx,
/**
* Figure out which stage of the pipeline is the source of transform feedback
- * data given the current context state, and return its gl_shader_program.
+ * data given the current context state, and return its gl_program.
*
* If no active program can generate transform feedback data (i.e. no vertex
* shader is active), returns NULL.
*/
-static struct gl_shader_program *
+static struct gl_program *
get_xfb_source(struct gl_context *ctx)
{
int i;
for (i = MESA_SHADER_GEOMETRY; i >= MESA_SHADER_VERTEX; i--) {
if (ctx->_Shader->CurrentProgram[i] != NULL)
- return ctx->_Shader->CurrentProgram[i];
+ return ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i]->Program;
}
return NULL;
}
@@ -401,7 +401,6 @@ _mesa_BeginTransformFeedback(GLenum mode)
{
struct gl_transform_feedback_object *obj;
struct gl_transform_feedback_info *info = NULL;
- struct gl_shader_program *source;
GLuint i;
unsigned vertices_per_prim;
GET_CURRENT_CONTEXT(ctx);
@@ -411,14 +410,14 @@ _mesa_BeginTransformFeedback(GLenum mode)
/* Figure out what pipeline stage is the source of data for transform
* feedback.
*/
- source = get_xfb_source(ctx);
+ struct gl_program *source = get_xfb_source(ctx);
if (source == NULL) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBeginTransformFeedback(no program active)");
return;
}
- info = source->xfb_program->sh.LinkedTransformFeedback;
+ info = source->sh.LinkedTransformFeedback;
if (info->NumOutputs == 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -478,9 +477,9 @@ _mesa_BeginTransformFeedback(GLenum mode)
obj->GlesRemainingPrims = max_vertices / vertices_per_prim;
}
- if (obj->shader_program != source) {
+ if (obj->program != source) {
ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedbackProg;
- obj->shader_program = source;
+ obj->program = source;
}
assert(ctx->Driver.BeginTransformFeedback);
@@ -1199,7 +1198,7 @@ _mesa_ResumeTransformFeedback(void)
* the program object being used by the current transform feedback object
* is not active."
*/
- if (obj->shader_program != get_xfb_source(ctx)) {
+ if (obj->program != get_xfb_source(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glResumeTransformFeedback(wrong program bound)");
return;