gallium/draw: additional comments in the clipping code
This commit is contained in:
parent
3965bc5d22
commit
74fb08018a
|
@ -157,6 +157,10 @@ static void interp( const struct clip_stage *clip,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emit a post-clip polygon to the next pipeline stage. The polygon
|
||||||
|
* will be convex and the provoking vertex will always be vertex[0].
|
||||||
|
*/
|
||||||
static void emit_poly( struct draw_stage *stage,
|
static void emit_poly( struct draw_stage *stage,
|
||||||
struct vertex_header **inlist,
|
struct vertex_header **inlist,
|
||||||
unsigned n,
|
unsigned n,
|
||||||
|
@ -183,16 +187,16 @@ static void emit_poly( struct draw_stage *stage,
|
||||||
header.pad = 0;
|
header.pad = 0;
|
||||||
|
|
||||||
for (i = 2; i < n; i++, header.flags = edge_middle) {
|
for (i = 2; i < n; i++, header.flags = edge_middle) {
|
||||||
/* keep in provoking vertex for flatshading */
|
/* order the triangle verts to respect the provoking vertex mode */
|
||||||
if (stage->draw->rasterizer->flatshade_first) {
|
if (stage->draw->rasterizer->flatshade_first) {
|
||||||
header.v[0] = inlist[0];
|
header.v[0] = inlist[0]; /* the provoking vertex */
|
||||||
header.v[1] = inlist[i-1];
|
header.v[1] = inlist[i-1];
|
||||||
header.v[2] = inlist[i];
|
header.v[2] = inlist[i];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
header.v[0] = inlist[i-1];
|
header.v[0] = inlist[i-1];
|
||||||
header.v[1] = inlist[i];
|
header.v[1] = inlist[i];
|
||||||
header.v[2] = inlist[0];
|
header.v[2] = inlist[0]; /* the provoking vertex */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == n-1)
|
if (i == n-1)
|
||||||
|
@ -201,7 +205,8 @@ static void emit_poly( struct draw_stage *stage,
|
||||||
if (0) {
|
if (0) {
|
||||||
const struct draw_vertex_shader *vs = stage->draw->vs.vertex_shader;
|
const struct draw_vertex_shader *vs = stage->draw->vs.vertex_shader;
|
||||||
uint j, k;
|
uint j, k;
|
||||||
debug_printf("Clipped tri:\n");
|
debug_printf("Clipped tri: (flat-shade-first = %d)\n",
|
||||||
|
stage->draw->rasterizer->flatshade_first);
|
||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
for (k = 0; k < vs->info.num_outputs; k++) {
|
for (k = 0; k < vs->info.num_outputs; k++) {
|
||||||
debug_printf(" Vert %d: Attr %d: %f %f %f %f\n", j, k,
|
debug_printf(" Vert %d: Attr %d: %f %f %f %f\n", j, k,
|
||||||
|
@ -307,7 +312,7 @@ do_clip_tri( struct draw_stage *stage,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If flat-shading, copy color to new provoking vertex.
|
/* If flat-shading, copy provoking vertex color to polygon vertex[0]
|
||||||
*/
|
*/
|
||||||
if (clipper->flat) {
|
if (clipper->flat) {
|
||||||
if (stage->draw->rasterizer->flatshade_first) {
|
if (stage->draw->rasterizer->flatshade_first) {
|
||||||
|
|
Loading…
Reference in New Issue