diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 03362ab..3cc5ebb 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -644,18 +644,19 @@ static void set_stream_out_varyings(int prog_id, struct vrend_shader_info *sinfo struct pipe_stream_output_info *so = &sinfo->so_info; char *varyings[PIPE_MAX_SHADER_OUTPUTS]; int i; - + int n_outputs = 0; if (!so->num_outputs) return; for (i = 0; i < so->num_outputs; i++) { - varyings[i] = strdup(sinfo->so_names[i]); + if (sinfo->so_names[i]) + varyings[n_outputs++] = strdup(sinfo->so_names[i]); } - glTransformFeedbackVaryings(prog_id, so->num_outputs, + glTransformFeedbackVaryings(prog_id, n_outputs, (const GLchar **)varyings, GL_INTERLEAVED_ATTRIBS_EXT); - for (i = 0; i < so->num_outputs; i++) + for (i = 0; i < n_outputs; i++) if (varyings[i]) free(varyings[i]); } diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 5378a29..77ae0a6 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -759,7 +759,10 @@ static int emit_so_movs(struct dump_ctx *ctx) writemask[0] = 0; if (ctx->so->output[i].num_components == 4 && writemask[0] == 0 && !(ctx->outputs[ctx->so->output[i].register_index].name == TGSI_SEMANTIC_CLIPDIST)) { - ctx->so_names[i] = strdup(ctx->outputs[ctx->so->output[i].register_index].glsl_name); + if (ctx->so->output[i].register_index > ctx->num_outputs) + ctx->so_names[i] = NULL; + else + ctx->so_names[i] = strdup(ctx->outputs[ctx->so->output[i].register_index].glsl_name); ctx->write_so_outputs[i] = false; } else {