summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c13
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h12
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_validate.c30
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h7
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c6
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_post_vs.c11
7 files changed, 58 insertions, 23 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index b4dbdccd61..b916b27877 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -122,6 +122,19 @@ void draw_set_rasterizer_state( struct draw_context *draw,
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
draw->rasterizer = raster;
+ draw->bypass_clipping = (draw->rasterizer->bypass_clipping ||
+ draw->driver.bypass_clipping);
+}
+
+
+void draw_set_driver_clipping( struct draw_context *draw,
+ boolean bypass_clipping )
+{
+ draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
+
+ draw->driver.bypass_clipping = bypass_clipping;
+ draw->bypass_clipping = (draw->rasterizer->bypass_clipping ||
+ draw->driver.bypass_clipping);
}
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 2742001698..c5c3d3b09e 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -148,4 +148,16 @@ struct vbuf_render;
void draw_set_render( struct draw_context *draw,
struct vbuf_render *render );
+void draw_set_driver_clipping( struct draw_context *draw,
+ boolean bypass_clipping );
+
+/*******************************************************************************
+ * Draw pipeline
+ */
+boolean draw_need_pipeline(const struct draw_context *draw,
+ const struct pipe_rasterizer_state *rasterizer,
+ unsigned prim );
+
+
+
#endif /* DRAW_CONTEXT_H */
diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c
index a2e0812c89..6be1d369c3 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_validate.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c
@@ -32,6 +32,7 @@
#include "pipe/p_defines.h"
#include "draw_private.h"
#include "draw_pipe.h"
+#include "draw_context.h"
static boolean points( unsigned prim )
{
@@ -57,7 +58,8 @@ static boolean triangles( unsigned prim )
* pipeline stages.
*/
boolean
-draw_need_pipeline(const struct draw_context *draw,
+draw_need_pipeline(const struct draw_context *draw,
+ const struct pipe_rasterizer_state *rasterizer,
unsigned int prim )
{
/* Don't have to worry about triangles turning into lines/points
@@ -67,30 +69,30 @@ draw_need_pipeline(const struct draw_context *draw,
if (lines(prim))
{
/* line stipple */
- if (draw->rasterizer->line_stipple_enable && draw->pipeline.line_stipple)
+ if (rasterizer->line_stipple_enable && draw->pipeline.line_stipple)
return TRUE;
/* wide lines */
- if (draw->rasterizer->line_width > draw->pipeline.wide_line_threshold)
+ if (rasterizer->line_width > draw->pipeline.wide_line_threshold)
return TRUE;
/* AA lines */
- if (draw->rasterizer->line_smooth && draw->pipeline.aaline)
+ if (rasterizer->line_smooth && draw->pipeline.aaline)
return TRUE;
}
if (points(prim))
{
/* large points */
- if (draw->rasterizer->point_size > draw->pipeline.wide_point_threshold)
+ if (rasterizer->point_size > draw->pipeline.wide_point_threshold)
return TRUE;
/* AA points */
- if (draw->rasterizer->point_smooth && draw->pipeline.aapoint)
+ if (rasterizer->point_smooth && draw->pipeline.aapoint)
return TRUE;
/* point sprites */
- if (draw->rasterizer->point_sprite && draw->pipeline.point_sprite)
+ if (rasterizer->point_sprite && draw->pipeline.point_sprite)
return TRUE;
}
@@ -98,20 +100,20 @@ draw_need_pipeline(const struct draw_context *draw,
if (triangles(prim))
{
/* polygon stipple */
- if (draw->rasterizer->poly_stipple_enable && draw->pipeline.pstipple)
+ if (rasterizer->poly_stipple_enable && draw->pipeline.pstipple)
return TRUE;
/* unfilled polygons */
- if (draw->rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL ||
- draw->rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL)
+ if (rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL ||
+ rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL)
return TRUE;
/* polygon offset */
- if (draw->rasterizer->offset_cw || draw->rasterizer->offset_ccw)
+ if (rasterizer->offset_cw || rasterizer->offset_ccw)
return TRUE;
/* two-side lighting */
- if (draw->rasterizer->light_twoside)
+ if (rasterizer->light_twoside)
return TRUE;
}
@@ -120,7 +122,7 @@ draw_need_pipeline(const struct draw_context *draw,
*
* Generally this isn't a reason to require the pipeline, though.
*
- if (draw->rasterizer->cull_mode)
+ if (rasterizer->cull_mode)
return TRUE;
*/
@@ -239,7 +241,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
/* Clip stage
*/
- if (!draw->rasterizer->bypass_clipping)
+ if (!draw->bypass_clipping)
{
draw->pipeline.clip->next = next;
next = draw->pipeline.clip;
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index da973e868b..83b81f66a0 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -174,7 +174,12 @@ struct draw_context
} pt;
+ struct {
+ boolean bypass_clipping;
+ } driver;
+
boolean flushing;
+ boolean bypass_clipping; /* set if either api or driver bypass_clipping true */
/* pipe state that we need: */
const struct pipe_rasterizer_state *rasterizer;
@@ -243,8 +248,6 @@ void draw_pipeline_run( struct draw_context *draw,
void draw_pipeline_flush( struct draw_context *draw,
unsigned flags );
-boolean draw_need_pipeline(const struct draw_context *draw,
- unsigned prim );
/*******************************************************************************
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index 9f8e8d3d62..f5a3bf390e 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -58,11 +58,13 @@ draw_pt_arrays(struct draw_context *draw,
opt |= PT_PIPELINE;
}
- if (draw_need_pipeline(draw, prim)) {
+ if (draw_need_pipeline(draw,
+ draw->rasterizer,
+ prim)) {
opt |= PT_PIPELINE;
}
- if (!draw->rasterizer->bypass_clipping) {
+ if (!draw->bypass_clipping) {
opt |= PT_CLIPTEST;
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
index 98a2cb45e4..f0763dad8d 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
@@ -81,7 +81,7 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
* but gl vs dx9 clip spaces.
*/
draw_pt_post_vs_prepare( fpme->post_vs,
- draw->rasterizer->bypass_clipping,
+ draw->bypass_clipping,
draw->identity_viewport,
draw->rasterizer->gl_rasterization_rules );
diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
index 581f044dae..e5e38fa264 100644
--- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c
+++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
@@ -94,8 +94,10 @@ static boolean post_vs_cliptest_viewport_gl( struct pt_post_vs *pvs,
struct vertex_header *out = vertices;
const float *scale = pvs->draw->viewport.scale;
const float *trans = pvs->draw->viewport.translate;
+ boolean clipped = FALSE;
unsigned j;
- unsigned clipped = 0;
+
+ if (0) debug_printf("%s\n");
for (j = 0; j < count; j++) {
out->clip[0] = out->data[0][0];
@@ -108,10 +110,11 @@ static boolean post_vs_cliptest_viewport_gl( struct pt_post_vs *pvs,
out->clipmask = compute_clipmask_gl(out->clip,
pvs->draw->plane,
pvs->draw->nr_planes);
- clipped += out->clipmask;
if (out->clipmask == 0)
{
+ clipped = TRUE;
+
/* divide by w */
float w = 1.0f / out->data[0][3];
@@ -142,7 +145,7 @@ static boolean post_vs_viewport( struct pt_post_vs *pvs,
const float *trans = pvs->draw->viewport.translate;
unsigned j;
- debug_printf("%s\n", __FUNCTION__);
+ if (0) debug_printf("%s\n", __FUNCTION__);
for (j = 0; j < count; j++) {
/* Viewport mapping only, no cliptest/rhw divide
*/
@@ -165,7 +168,7 @@ static boolean post_vs_none( struct pt_post_vs *pvs,
unsigned count,
unsigned stride )
{
- debug_printf("%s\n", __FUNCTION__);
+ if (0) debug_printf("%s\n", __FUNCTION__);
return FALSE;
}