renderer: handle gaps in vertex shader inputs

We are seeing shaders with 0 and 2 inputs, but no 1, so we need
to handle gaps properly.

This fixes some regressions in drawpixels after some mesa changes
on the guest.
macos/master
Dave Airlie 9 years ago
parent d6ade3c0c3
commit d413cba1e9
  1. 4
      src/vrend_renderer.c
  2. 5
      src/vrend_shader.c
  3. 2
      src/vrend_shader.h

@ -863,7 +863,9 @@ static struct vrend_linked_shader_program *add_shader_program(struct vrend_conte
sprog->dual_src_linked = false;
if (vrend_state.have_vertex_attrib_binding) {
for (i = 0; i < vs->sel->sinfo.num_inputs; i++) {
uint32_t mask = vs->sel->sinfo.attrib_input_mask;
while (mask) {
i = u_bit_scan(&mask);
snprintf(name, 10, "in_%d", i);
glBindAttribLocation(prog_id, i, name);
}

@ -83,6 +83,7 @@ struct dump_ctx {
int num_interps;
int num_inputs;
uint32_t attrib_input_mask;
struct vrend_shader_io inputs[32];
int num_outputs;
struct vrend_shader_io outputs[32];
@ -245,6 +246,9 @@ iter_declaration(struct tgsi_iterate_context *iter,
switch (decl->Declaration.File) {
case TGSI_FILE_INPUT:
i = ctx->num_inputs++;
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) {
ctx->attrib_input_mask |= (1 << decl->Range.First);
}
ctx->inputs[i].name = decl->Semantic.Name;
ctx->inputs[i].sid = decl->Semantic.Index;
ctx->inputs[i].interpolate = decl->Interp.Interpolate;
@ -2403,6 +2407,7 @@ char *vrend_convert_shader(struct vrend_shader_cfg *cfg,
sinfo->glsl_ver = ctx.glsl_ver_required;
sinfo->gs_out_prim = ctx.gs_out_prim;
sinfo->so_names = ctx.so_names;
sinfo->attrib_input_mask = ctx.attrib_input_mask;
return glsl_final;
fail:
free(ctx.glsl_main);

@ -45,7 +45,7 @@ struct vrend_shader_info {
int glsl_ver;
uint32_t shadow_samp_mask;
int gs_out_prim;
uint32_t attrib_input_mask;
struct pipe_stream_output_info so_info;
struct vrend_interp_info *interpinfo;

Loading…
Cancel
Save