unsigned num_tfeedback_decls,
tfeedback_decl *tfeedback_decls, bool has_xfb_qualifiers)
{
+ if (!prog->last_vert_prog)
+ return true;
+
/* Make sure MaxTransformFeedbackBuffers is less than 32 so the bitmask for
* tracking the number of buffers doesn't overflow.
*/
bool separate_attribs_mode =
prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS;
- struct gl_program *xfb_prog = prog->xfb_program;
+ struct gl_program *xfb_prog = prog->last_vert_prog;
xfb_prog->sh.LinkedTransformFeedback =
rzalloc(xfb_prog, struct gl_transform_feedback_info);
output_stage, GL_PROGRAM_OUTPUT))
return;
- struct gl_transform_feedback_info *linked_xfb =
- shProg->xfb_program->sh.LinkedTransformFeedback;
-
- /* Add transform feedback varyings. */
- if (linked_xfb->NumVarying > 0) {
- for (int i = 0; i < linked_xfb->NumVarying; i++) {
- if (!add_program_resource(shProg, resource_set,
- GL_TRANSFORM_FEEDBACK_VARYING,
- &linked_xfb->Varyings[i], 0))
- return;
+ if (shProg->last_vert_prog) {
+ struct gl_transform_feedback_info *linked_xfb =
+ shProg->last_vert_prog->sh.LinkedTransformFeedback;
+
+ /* Add transform feedback varyings. */
+ if (linked_xfb->NumVarying > 0) {
+ for (int i = 0; i < linked_xfb->NumVarying; i++) {
+ if (!add_program_resource(shProg, resource_set,
+ GL_TRANSFORM_FEEDBACK_VARYING,
+ &linked_xfb->Varyings[i], 0))
+ return;
+ }
}
- }
- /* Add transform feedback buffers. */
- for (unsigned i = 0; i < ctx->Const.MaxTransformFeedbackBuffers; i++) {
- if ((linked_xfb->ActiveBuffers >> i) & 1) {
- linked_xfb->Buffers[i].Binding = i;
- if (!add_program_resource(shProg, resource_set,
- GL_TRANSFORM_FEEDBACK_BUFFER,
- &linked_xfb->Buffers[i], 0))
- return;
+ /* Add transform feedback buffers. */
+ for (unsigned i = 0; i < ctx->Const.MaxTransformFeedbackBuffers; i++) {
+ if ((linked_xfb->ActiveBuffers >> i) & 1) {
+ linked_xfb->Buffers[i].Binding = i;
+ if (!add_program_resource(shProg, resource_set,
+ GL_TRANSFORM_FEEDBACK_BUFFER,
+ &linked_xfb->Buffers[i], 0))
+ return;
+ }
}
}
return false;
}
- /* 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;
+ prog->last_vert_prog = NULL;
for (int i = MESA_SHADER_GEOMETRY; i >= MESA_SHADER_VERTEX; i--) {
if (prog->_LinkedShaders[i] == NULL)
continue;
- prog->xfb_program = prog->_LinkedShaders[i]->Program;
+ prog->last_vert_prog = prog->_LinkedShaders[i]->Program;
break;
}
_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);
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;
}