summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/softpipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/softpipe')
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c35
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h7
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_occlusion.c10
3 files changed, 39 insertions, 13 deletions
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index 26453d97852..92357808e29 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -195,19 +195,37 @@ static void softpipe_destroy( struct pipe_context *pipe )
}
-static void softpipe_reset_occlusion_counter(struct pipe_context *pipe)
+static void
+softpipe_begin_query(struct pipe_context *pipe, struct pipe_query_object *q)
{
struct softpipe_context *softpipe = softpipe_context( pipe );
- softpipe->occlusion_counter = 0;
+ assert(q->type < PIPE_QUERY_TYPES);
+ assert(!softpipe->queries[q->type]);
+ softpipe->queries[q->type] = q;
}
-/* XXX pipe param should be const */
-static unsigned softpipe_get_occlusion_counter(struct pipe_context *pipe)
+
+static void
+softpipe_end_query(struct pipe_context *pipe, struct pipe_query_object *q)
{
struct softpipe_context *softpipe = softpipe_context( pipe );
- return softpipe->occlusion_counter;
+ assert(q->type < PIPE_QUERY_TYPES);
+ assert(softpipe->queries[q->type]);
+ q->ready = 1; /* software rendering is synchronous */
+ softpipe->queries[q->type] = NULL;
+}
+
+
+static void
+softpipe_wait_query(struct pipe_context *pipe, struct pipe_query_object *q)
+{
+ /* Should never get here since we indicated that the result was
+ * ready in softpipe_end_query().
+ */
+ assert(0);
}
+
static const char *softpipe_get_name( struct pipe_context *pipe )
{
return "softpipe";
@@ -260,8 +278,11 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
softpipe->pipe.clear = softpipe_clear;
softpipe->pipe.flush = softpipe_flush;
- softpipe->pipe.reset_occlusion_counter = softpipe_reset_occlusion_counter;
- softpipe->pipe.get_occlusion_counter = softpipe_get_occlusion_counter;
+
+ softpipe->pipe.begin_query = softpipe_begin_query;
+ softpipe->pipe.end_query = softpipe_end_query;
+ softpipe->pipe.wait_query = softpipe_wait_query;
+
softpipe->pipe.get_name = softpipe_get_name;
softpipe->pipe.get_vendor = softpipe_get_vendor;
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index 2a6b932523a..13d1143c890 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -94,6 +94,11 @@ struct softpipe_context {
unsigned dirty;
/*
+ * Active queries
+ */
+ struct pipe_query_object *queries[PIPE_QUERY_TYPES];
+
+ /*
* Mapped vertex buffers
*/
ubyte *mapped_vbuffer[PIPE_ATTRIB_MAX];
@@ -120,8 +125,6 @@ struct softpipe_context {
/** Derived from scissor and surface bounds: */
struct pipe_scissor_state cliprect;
- unsigned occlusion_counter;
-
unsigned line_stipple_counter;
/** Software quad rendering pipeline */
diff --git a/src/mesa/pipe/softpipe/sp_quad_occlusion.c b/src/mesa/pipe/softpipe/sp_quad_occlusion.c
index 6b094a5befb..4f178f0557e 100644
--- a/src/mesa/pipe/softpipe/sp_quad_occlusion.c
+++ b/src/mesa/pipe/softpipe/sp_quad_occlusion.c
@@ -44,11 +44,13 @@ static void
occlusion_count_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
+ struct pipe_query_object *occ
+ = softpipe->queries[PIPE_QUERY_OCCLUSION_COUNTER];
- softpipe->occlusion_counter += (quad->mask ) & 1;
- softpipe->occlusion_counter += (quad->mask >> 1) & 1;
- softpipe->occlusion_counter += (quad->mask >> 2) & 1;
- softpipe->occlusion_counter += (quad->mask >> 3) & 1;
+ occ->count += (quad->mask ) & 1;
+ occ->count += (quad->mask >> 1) & 1;
+ occ->count += (quad->mask >> 2) & 1;
+ occ->count += (quad->mask >> 3) & 1;
if (quad->mask)
qs->next->run(qs->next, quad);