diff options
-rw-r--r-- | src/gallium/auxiliary/draw/draw_gs.c | 11 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 12 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 15 |
3 files changed, 27 insertions, 11 deletions
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c index fe9c55826a..2015b3b24d 100644 --- a/src/gallium/auxiliary/draw/draw_gs.c +++ b/src/gallium/auxiliary/draw/draw_gs.c @@ -231,29 +231,32 @@ draw_geometry_fetch_outputs(struct draw_geometry_shader *shader, */ /* FIXME: handle all the primitives produced by the gs, not just * the first one - unsigned prim_count = + unsigned prim_count = mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0];*/ for (prim_idx = 0; prim_idx < num_primitives; ++prim_idx) { unsigned num_verts_per_prim = machine->Primitives[0]; for (j = 0; j < num_verts_per_prim; j++) { int idx = (prim_idx * num_verts_per_prim + j) * shader->info.num_outputs; +#ifdef DEBUG_OUTPUTS debug_printf("%d) Output vert:\n", idx); +#endif for (slot = 0; slot < shader->info.num_outputs; slot++) { output[slot][0] = machine->Outputs[idx + slot].xyzw[0].f[prim_idx]; output[slot][1] = machine->Outputs[idx + slot].xyzw[1].f[prim_idx]; output[slot][2] = machine->Outputs[idx + slot].xyzw[2].f[prim_idx]; output[slot][3] = machine->Outputs[idx + slot].xyzw[3].f[prim_idx]; +#ifdef DEBUG_OUTPUTS debug_printf("\t%d: %f %f %f %f\n", slot, output[slot][0], output[slot][1], output[slot][2], output[slot][3]); - assert(!util_is_inf_or_nan(output[slot][0])); +#endif + debug_assert(!util_is_inf_or_nan(output[slot][0])); } + output = (float (*)[4])((char *)output + vertex_size); } - - output = (float (*)[4])((char *)output + (num_verts_per_prim * vertex_size)); } } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index bb48cd5a83..4580a401e9 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -225,12 +225,12 @@ typedef enum typedef enum { GEOM_ATTRIB_VERTICES = 0, /*gl_VerticesIn*/ - GEOM_ATTRIB_COLOR0 = 1, - GEOM_ATTRIB_COLOR1 = 2, - GEOM_ATTRIB_SECONDARY_COLOR0 = 3, - GEOM_ATTRIB_SECONDARY_COLOR1 = 4, - GEOM_ATTRIB_FOG_FRAG_COORD = 5, - GEOM_ATTRIB_POSITION = 6, + GEOM_ATTRIB_POSITION = 1, + GEOM_ATTRIB_COLOR0 = 2, + GEOM_ATTRIB_COLOR1 = 3, + GEOM_ATTRIB_SECONDARY_COLOR0 = 4, + GEOM_ATTRIB_SECONDARY_COLOR1 = 5, + GEOM_ATTRIB_FOG_FRAG_COORD = 6, GEOM_ATTRIB_POINT_SIZE = 7, GEOM_ATTRIB_CLIP_VERTEX = 8, GEOM_ATTRIB_PRIMITIVE_ID = 9, diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 432e239bcd..ea1b1bdf30 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -598,6 +598,8 @@ st_translate_geometry_program(struct st_context *st, GLuint num_tokens; uint gs_num_inputs = 0; + uint gs_builtin_inputs = 0; + uint gs_array_offset = 0; ubyte gs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; ubyte gs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; @@ -636,11 +638,22 @@ st_translate_geometry_program(struct st_context *st, defaultInputMapping[attr] = slot; - stgp->input_map[slot] = vslot; + stgp->input_map[slot + gs_array_offset] = vslot - gs_builtin_inputs; stgp->input_to_index[attr] = vslot; stgp->index_to_input[vslot] = attr; ++vslot; + if (attr != GEOM_ATTRIB_VERTICES && + attr != GEOM_ATTRIB_PRIMITIVE_ID) { + gs_array_offset += 2; + } else + ++gs_builtin_inputs; + +#if 0 + debug_printf("input map at %d = %d\n", + slot + gs_array_offset, stgp->input_map[slot + gs_array_offset]); +#endif + switch (attr) { case GEOM_ATTRIB_VERTICES: stgp->input_semantic_name[slot] = TGSI_SEMANTIC_VERTICES; |