summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2010-05-14 20:36:08 +0100
committerKeith Whitwell <keithw@vmware.com>2010-05-14 20:36:08 +0100
commit4ff1274e2312c7d9d8538dc443af500ec3b769cf (patch)
tree0f5274218d6852aceb4c8e99f7a732b56fb98d18
parent9c264642c385557d64b9bc6bbe31d2d15e703aff (diff)
softpipe: restore culling code
-rw-r--r--src/gallium/drivers/softpipe/sp_setup.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index ca02d4df489..5d727dc00df 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -111,6 +111,7 @@ struct setup_context {
uint numFragsWritten; /**< per primitive */
#endif
+ unsigned cull_face; /* which faces cull */
unsigned nr_vertex_attrs;
};
@@ -374,6 +375,14 @@ setup_sort_vertices(struct setup_context *setup,
((det < 0.0) ^
(setup->softpipe->rasterizer->front_ccw));
+ {
+ unsigned face = setup->facing == 0 ? PIPE_FACE_FRONT : PIPE_FACE_BACK;
+
+ if (face & setup->cull_face)
+ return FALSE;
+ }
+
+
/* Prepare pixel offset for rasterisation:
* - pixel center (0.5, 0.5) for GL, or
* - assume (0.0, 0.0) for other APIs.
@@ -810,11 +819,9 @@ sp_setup_tri(struct setup_context *setup,
setup->numFragsWritten = 0;
#endif
- /* Culling already done by draw module.
- */
-
if (!setup_sort_vertices( setup, det, v0, v1, v2 ))
return;
+
setup_tri_coefficients( setup );
setup_tri_edges( setup );
@@ -1396,6 +1403,17 @@ sp_setup_prepare(struct setup_context *setup)
setup->nr_vertex_attrs = draw_num_shader_outputs(sp->draw);
sp->quad.first->begin( sp->quad.first );
+
+ if (sp->reduced_api_prim == PIPE_PRIM_TRIANGLES &&
+ sp->rasterizer->fill_front == PIPE_POLYGON_MODE_FILL &&
+ sp->rasterizer->fill_back == PIPE_POLYGON_MODE_FILL) {
+ /* we'll do culling */
+ setup->cull_face = sp->rasterizer->cull_face;
+ }
+ else {
+ /* 'draw' will do culling */
+ setup->cull_face = PIPE_FACE_NONE;
+ }
}