summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2009-04-17 15:52:05 +0200
committerJakob Bornecrantz <[email protected]>2009-04-17 16:03:01 +0200
commit5800e0aad1e803fbe2a1e1a7f8abcdff58699901 (patch)
tree68907cb724217711d81eaeeb6f158495c4fb5653 /src
parentdbb90436f8385a33b9938c66a0fa3eff8c36a4cc (diff)
trace: Simplify trace_buffer function
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/trace/tr_buffer.c3
-rw-r--r--src/gallium/drivers/trace/tr_buffer.h6
-rw-r--r--src/gallium/drivers/trace/tr_context.c8
-rw-r--r--src/gallium/drivers/trace/tr_dump.c3
-rw-r--r--src/gallium/drivers/trace/tr_screen.c10
5 files changed, 13 insertions, 17 deletions
diff --git a/src/gallium/drivers/trace/tr_buffer.c b/src/gallium/drivers/trace/tr_buffer.c
index 6ffce1660ec..3cdb107dc6b 100644
--- a/src/gallium/drivers/trace/tr_buffer.c
+++ b/src/gallium/drivers/trace/tr_buffer.c
@@ -64,7 +64,8 @@ void
trace_buffer_destroy(struct trace_screen *tr_scr,
struct pipe_buffer *buffer)
{
- struct trace_buffer *tr_buf = trace_buffer(tr_scr, buffer);
+ struct trace_buffer *tr_buf = trace_buffer(buffer);
+
pipe_buffer_reference(&tr_buf->buffer, NULL);
FREE(tr_buf);
}
diff --git a/src/gallium/drivers/trace/tr_buffer.h b/src/gallium/drivers/trace/tr_buffer.h
index e9e4d354dad..bb8a3b2c3aa 100644
--- a/src/gallium/drivers/trace/tr_buffer.h
+++ b/src/gallium/drivers/trace/tr_buffer.h
@@ -47,13 +47,11 @@ struct trace_buffer
static INLINE struct trace_buffer *
-trace_buffer(struct trace_screen *tr_scr,
- struct pipe_buffer *buffer)
+trace_buffer(struct pipe_buffer *buffer)
{
if(!buffer)
return NULL;
- assert(tr_scr);
- assert(buffer->screen == &tr_scr->base);
+ (void)trace_screen(buffer->screen);
return (struct trace_buffer *)buffer;
}
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index 556b5e003ff..179c8fd354d 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -46,7 +46,7 @@ trace_buffer_unwrap(struct trace_context *tr_ctx,
if(!buffer)
return NULL;
- tr_buf = trace_buffer(tr_scr, buffer);
+ tr_buf = trace_buffer(buffer);
assert(tr_buf->buffer);
assert(tr_buf->buffer->screen == tr_scr->screen);
@@ -142,9 +142,8 @@ trace_context_draw_elements(struct pipe_context *_pipe,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
- struct trace_screen *tr_scr = trace_screen(_pipe->screen);
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_buffer *tr_buf = trace_buffer(tr_scr, _indexBuffer);
+ struct trace_buffer *tr_buf = trace_buffer(_indexBuffer);
struct pipe_context *pipe = tr_ctx->pipe;
struct pipe_buffer *indexBuffer = tr_buf->buffer;
boolean result;
@@ -180,9 +179,8 @@ trace_context_draw_range_elements(struct pipe_context *_pipe,
unsigned start,
unsigned count)
{
- struct trace_screen *tr_scr = trace_screen(_pipe->screen);
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_buffer *tr_buf = trace_buffer(tr_scr, _indexBuffer);
+ struct trace_buffer *tr_buf = trace_buffer(_indexBuffer);
struct pipe_context *pipe = tr_ctx->pipe;
struct pipe_buffer *indexBuffer = tr_buf->buffer;
boolean result;
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index 2618883e70d..d2a7664ed9b 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -425,8 +425,7 @@ void trace_dump_ptr(const void *value)
void trace_dump_buffer_ptr(struct pipe_buffer *_buffer)
{
if (_buffer) {
- struct trace_screen *tr_scr = trace_screen(_buffer->screen);
- struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+ struct trace_buffer *tr_buf = trace_buffer(_buffer);
trace_dump_ptr(tr_buf->buffer);
} else {
trace_dump_null();
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 28506da4dc0..3e676f01559 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -603,7 +603,7 @@ trace_screen_buffer_map(struct pipe_screen *_screen,
unsigned usage)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+ struct trace_buffer *tr_buf = trace_buffer(_buffer);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_buffer *buffer = tr_buf->buffer;
void *map;
@@ -628,7 +628,7 @@ trace_screen_buffer_map_range(struct pipe_screen *_screen,
unsigned usage)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+ struct trace_buffer *tr_buf = trace_buffer(_buffer);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_buffer *buffer = tr_buf->buffer;
void *map;
@@ -680,7 +680,7 @@ trace_screen_buffer_flush_mapped_range(struct pipe_screen *_screen,
unsigned length)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+ struct trace_buffer *tr_buf = trace_buffer(_buffer);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_buffer *buffer = tr_buf->buffer;
@@ -696,7 +696,7 @@ trace_screen_buffer_unmap(struct pipe_screen *_screen,
struct pipe_buffer *_buffer)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+ struct trace_buffer *tr_buf = trace_buffer(_buffer);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_buffer *buffer = tr_buf->buffer;
@@ -712,7 +712,7 @@ static void
trace_screen_buffer_destroy(struct pipe_buffer *_buffer)
{
struct trace_screen *tr_scr = trace_screen(_buffer->screen);
- struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+ struct trace_buffer *tr_buf = trace_buffer(_buffer);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_buffer *buffer = tr_buf->buffer;