r300g: convert query to a state for emitting.
This means we don't emit in the begin query but when we have to flush. Similiar to classic. TODO: make query object actually work.
This commit is contained in:
parent
c1bee7bdea
commit
47791697ab
|
@ -141,6 +141,7 @@ struct r300_viewport_state {
|
|||
#define R300_NEW_VERTEX_FORMAT 0x04000000
|
||||
#define R300_NEW_VERTEX_SHADER 0x08000000
|
||||
#define R300_NEW_VIEWPORT 0x10000000
|
||||
#define R300_NEW_QUERY 0x20000000
|
||||
#define R300_NEW_KITCHEN_SINK 0x1fffffff
|
||||
|
||||
/* The next several objects are not pure Radeon state; they inherit from
|
||||
|
@ -239,6 +240,7 @@ struct r300_context {
|
|||
/* Occlusion query buffer. */
|
||||
struct pipe_buffer* oqbo;
|
||||
/* Query list. */
|
||||
struct r300_query *query_current;
|
||||
struct r300_query query_list;
|
||||
|
||||
/* Various CSO state objects. */
|
||||
|
|
|
@ -320,12 +320,16 @@ void r300_emit_fb_state(struct r300_context* r300,
|
|||
END_CS;
|
||||
}
|
||||
|
||||
void r300_emit_query_begin(struct r300_context* r300,
|
||||
struct r300_query* query)
|
||||
void r300_emit_query_start(struct r300_context *r300)
|
||||
|
||||
{
|
||||
struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
|
||||
struct r300_capabilities *caps = r300_screen(r300->context.screen)->caps;
|
||||
struct r300_query *query = r300->query_current;
|
||||
CS_LOCALS(r300);
|
||||
|
||||
if (!query)
|
||||
return;
|
||||
|
||||
/* XXX This will almost certainly not return good results
|
||||
* for overlapping queries. */
|
||||
BEGIN_CS(4);
|
||||
|
@ -772,6 +776,11 @@ validate:
|
|||
goto validate;
|
||||
}
|
||||
|
||||
if (r300->dirty_state & R300_NEW_QUERY) {
|
||||
r300_emit_query_start(r300);
|
||||
r300->dirty_state &= ~R300_NEW_QUERY;
|
||||
}
|
||||
|
||||
if (r300->dirty_state & R300_NEW_BLEND) {
|
||||
r300_emit_blend_state(r300, r300->blend_state);
|
||||
r300->dirty_state &= ~R300_NEW_BLEND;
|
||||
|
|
|
@ -74,6 +74,8 @@ static void r300_begin_query(struct pipe_context* pipe,
|
|||
struct r300_context* r300 = r300_context(pipe);
|
||||
struct r300_query* q = (struct r300_query*)query;
|
||||
|
||||
assert(r300->query_current == NULL);
|
||||
|
||||
map = pipe->screen->buffer_map(pipe->screen, r300->oqbo,
|
||||
PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||
map += q->offset / 4;
|
||||
|
@ -81,8 +83,8 @@ static void r300_begin_query(struct pipe_context* pipe,
|
|||
pipe->screen->buffer_unmap(pipe->screen, r300->oqbo);
|
||||
|
||||
q->flushed = FALSE;
|
||||
r300_emit_dirty_state(r300);
|
||||
r300_emit_query_begin(r300, q);
|
||||
r300->query_current = q;
|
||||
r300->dirty_state |= R300_NEW_QUERY;
|
||||
}
|
||||
|
||||
static void r300_end_query(struct pipe_context* pipe,
|
||||
|
@ -93,6 +95,8 @@ static void r300_end_query(struct pipe_context* pipe,
|
|||
|
||||
r300_emit_dirty_state(r300);
|
||||
r300_emit_query_end(r300, q);
|
||||
|
||||
r300->query_current = NULL;
|
||||
}
|
||||
|
||||
static boolean r300_get_query_result(struct pipe_context* pipe,
|
||||
|
|
Loading…
Reference in New Issue