renderer: handle illegal so values better

This stops the guest from crashing the parser here,
if it gives us so entries that are invalid.
macos/master
Dave Airlie 10 years ago
parent ac972775ef
commit 9e5bd0dbf0
  1. 9
      src/vrend_renderer.c
  2. 5
      src/vrend_shader.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]);
}

@ -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 {

Loading…
Cancel
Save