diff options
author | Timothy Arceri <[email protected]> | 2016-11-20 21:44:29 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-01-23 14:48:04 +1100 |
commit | f86d15ed94df59e4b3cdb4099d69cdd81f52fc27 (patch) | |
tree | 5d6f13c0b405bb2ee1e79b6ed6142794cd4a6af4 /src/mesa | |
parent | c505d6d852220f4aaaee161465dd2c579647e672 (diff) |
st/mesa/glsl: change xfb_program field to last_vert_prog
Now that the i965 backend doesn't depend on this field we can
make it more generic and short circuit a bunch of code paths.
The new field will be used in a following patch for another
clean-up.
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/mtypes.h | 2 | ||||
-rw-r--r-- | src/mesa/main/shader_query.cpp | 2 | ||||
-rw-r--r-- | src/mesa/main/transformfeedback.c | 5 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 5 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 10 |
5 files changed, 17 insertions, 7 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index c733911c476..e8eddce0603 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2742,7 +2742,7 @@ struct gl_shader_program GLchar **VaryingNames; /**< Array [NumVarying] of char * */ } TransformFeedback; - struct gl_program *xfb_program; + struct gl_program *last_vert_prog; /** 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 f465b3959e5..30e5b087abb 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -1047,7 +1047,7 @@ get_buffer_property(struct gl_shader_program *shProg, return 1; case GL_ACTIVE_VARIABLES: struct gl_transform_feedback_info *linked_xfb = - shProg->xfb_program->sh.LinkedTransformFeedback; + shProg->last_vert_prog->sh.LinkedTransformFeedback; for (int i = 0; i < linked_xfb->NumVarying; i++) { unsigned index = linked_xfb->Varyings[i].BufferIndex; struct gl_program_resource *buf_res = diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 06fa56ab993..96f3df1c961 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -65,9 +65,12 @@ bool _mesa_transform_feedback_is_using_program(struct gl_context *ctx, struct gl_shader_program *shProg) { + if (!shProg->last_vert_prog) + return false; + struct using_program_tuple callback_data; callback_data.found = false; - callback_data.prog = shProg->xfb_program; + callback_data.prog = shProg->last_vert_prog; _mesa_HashWalk(ctx->TransformFeedback.Objects, active_xfb_object_references_program, &callback_data); diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index a99e99178c6..46952dcd3a2 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -7003,8 +7003,11 @@ st_translate_stream_output_info(glsl_to_tgsi_visitor *glsl_to_tgsi, const GLuint outputMapping[], struct pipe_stream_output_info *so) { + if (!glsl_to_tgsi->shader_program->last_vert_prog) + return; + struct gl_transform_feedback_info *info = - glsl_to_tgsi->shader_program->xfb_program->sh.LinkedTransformFeedback; + glsl_to_tgsi->shader_program->last_vert_prog->sh.LinkedTransformFeedback; st_translate_stream_output_info2(info, outputMapping, so); } diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index e1242795670..fb0a138c245 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -390,9 +390,13 @@ st_translate_vertex_program(struct st_context *st, stvp->tgsi.type = PIPE_SHADER_IR_NIR; stvp->tgsi.ir.nir = nir; - st_translate_stream_output_info2(stvp->shader_program->xfb_program->sh.LinkedTransformFeedback, - stvp->result_to_output, - &stvp->tgsi.stream_output); + struct gl_program *prog = stvp->shader_program->last_vert_prog; + if (prog) { + st_translate_stream_output_info2(prog->sh.LinkedTransformFeedback, + stvp->result_to_output, + &stvp->tgsi.stream_output); + } + return true; } |