draw: make sure geometry shader correctly iterates the output buffer
This commit is contained in:
parent
f571a569a0
commit
1d11eac93f
|
@ -223,11 +223,14 @@ static void draw_fetch_geometry_input(struct draw_geometry_shader *shader,
|
||||||
static INLINE void
|
static INLINE void
|
||||||
draw_geometry_fetch_outputs(struct draw_geometry_shader *shader,
|
draw_geometry_fetch_outputs(struct draw_geometry_shader *shader,
|
||||||
int num_primitives,
|
int num_primitives,
|
||||||
float (*output)[4],
|
float (**p_output)[4],
|
||||||
unsigned vertex_size)
|
unsigned vertex_size)
|
||||||
{
|
{
|
||||||
struct tgsi_exec_machine *machine = shader->machine;
|
struct tgsi_exec_machine *machine = shader->machine;
|
||||||
unsigned prim_idx, j, slot;
|
unsigned prim_idx, j, slot;
|
||||||
|
float (*output)[4];
|
||||||
|
|
||||||
|
output = *p_output;
|
||||||
|
|
||||||
/* Unswizzle all output results.
|
/* Unswizzle all output results.
|
||||||
*/
|
*/
|
||||||
|
@ -240,7 +243,7 @@ draw_geometry_fetch_outputs(struct draw_geometry_shader *shader,
|
||||||
int idx = (prim_idx * num_verts_per_prim + j) *
|
int idx = (prim_idx * num_verts_per_prim + j) *
|
||||||
shader->info.num_outputs;
|
shader->info.num_outputs;
|
||||||
#ifdef DEBUG_OUTPUTS
|
#ifdef DEBUG_OUTPUTS
|
||||||
debug_printf("%d) Output vert:\n", idx);
|
debug_printf("%d) Output vert:\n", idx / shader->info.num_outputs);
|
||||||
#endif
|
#endif
|
||||||
for (slot = 0; slot < shader->info.num_outputs; slot++) {
|
for (slot = 0; slot < shader->info.num_outputs; slot++) {
|
||||||
output[slot][0] = machine->Outputs[idx + slot].xyzw[0].f[0];
|
output[slot][0] = machine->Outputs[idx + slot].xyzw[0].f[0];
|
||||||
|
@ -259,6 +262,7 @@ draw_geometry_fetch_outputs(struct draw_geometry_shader *shader,
|
||||||
output = (float (*)[4])((char *)output + vertex_size);
|
output = (float (*)[4])((char *)output + vertex_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*p_output = output;
|
||||||
}
|
}
|
||||||
|
|
||||||
int draw_geometry_shader_run(struct draw_geometry_shader *shader,
|
int draw_geometry_shader_run(struct draw_geometry_shader *shader,
|
||||||
|
@ -274,6 +278,7 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader,
|
||||||
unsigned num_in_vertices = u_vertices_per_prim(shader->input_primitive);
|
unsigned num_in_vertices = u_vertices_per_prim(shader->input_primitive);
|
||||||
unsigned num_in_primitives = count/num_in_vertices;
|
unsigned num_in_primitives = count/num_in_vertices;
|
||||||
unsigned inputs_from_vs = 0;
|
unsigned inputs_from_vs = 0;
|
||||||
|
float (*tmp_output)[4];
|
||||||
|
|
||||||
if (0) debug_printf("%s count = %d\n", __FUNCTION__, count);
|
if (0) debug_printf("%s count = %d\n", __FUNCTION__, count);
|
||||||
|
|
||||||
|
@ -288,7 +293,7 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader,
|
||||||
if (shader->info.input_semantic_name[i] != TGSI_SEMANTIC_PRIMID)
|
if (shader->info.input_semantic_name[i] != TGSI_SEMANTIC_PRIMID)
|
||||||
++inputs_from_vs;
|
++inputs_from_vs;
|
||||||
}
|
}
|
||||||
|
tmp_output = output;
|
||||||
for (i = 0; i < num_in_primitives; ++i) {
|
for (i = 0; i < num_in_primitives; ++i) {
|
||||||
unsigned int max_input_primitives = 1;
|
unsigned int max_input_primitives = 1;
|
||||||
/* FIXME: handle all the primitives produced by the gs, not just
|
/* FIXME: handle all the primitives produced by the gs, not just
|
||||||
|
@ -311,7 +316,7 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader,
|
||||||
machine->Temps[TGSI_EXEC_TEMP_PRIMITIVE_I].xyzw[TGSI_EXEC_TEMP_PRIMITIVE_C].u[0];
|
machine->Temps[TGSI_EXEC_TEMP_PRIMITIVE_I].xyzw[TGSI_EXEC_TEMP_PRIMITIVE_C].u[0];
|
||||||
|
|
||||||
draw_geometry_fetch_outputs(shader, out_prim_count,
|
draw_geometry_fetch_outputs(shader, out_prim_count,
|
||||||
output, vertex_size);
|
&tmp_output, vertex_size);
|
||||||
}
|
}
|
||||||
return shader->emitted_vertices;
|
return shader->emitted_vertices;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,8 @@ static int max_out_vertex_count(
|
||||||
if (gs_max_verts > count)
|
if (gs_max_verts > count)
|
||||||
alloc_count = align(gs_max_verts, 4);
|
alloc_count = align(gs_max_verts, 4);
|
||||||
}
|
}
|
||||||
|
/*debug_printf("------- alloc count = %d (input = %d)\n",
|
||||||
|
alloc_count, count);*/
|
||||||
return alloc_count;
|
return alloc_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue