summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/trace/tr_context.c
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-15 10:31:23 +0100
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-15 10:35:19 +0100
commitf40de50def1b7ee75dd320b151c025b7ddff45be (patch)
treea1c12271055e5703e1da3627148f5f304c9f9dc4 /src/gallium/drivers/trace/tr_context.c
parentf121d0e54f39d8f6361dcf0bf4d938ccb5ae4b5e (diff)
trace: Wrap all textures and surface created by the pipe driver.
That is, Unfortunately, this causes a regression in softpipe, where the output gets tyled.
Diffstat (limited to 'src/gallium/drivers/trace/tr_context.c')
-rw-r--r--src/gallium/drivers/trace/tr_context.c73
1 files changed, 72 insertions, 1 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index e81cab252c..529bed3c6b 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -30,9 +30,53 @@
#include "tr_dump.h"
#include "tr_state.h"
+#include "tr_screen.h"
+#include "tr_texture.h"
#include "tr_context.h"
+static INLINE struct pipe_texture *
+trace_texture_unwrap(struct trace_context *tr_ctx,
+ struct pipe_texture *texture)
+{
+ struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
+ struct trace_texture *tr_tex;
+
+ if(!texture)
+ return NULL;
+
+ tr_tex = trace_texture(tr_scr, texture);
+
+ assert(tr_tex->texture);
+ assert(tr_tex->texture->screen == tr_scr->screen);
+ return tr_tex->texture;
+}
+
+
+static INLINE struct pipe_surface *
+trace_surface_unwrap(struct trace_context *tr_ctx,
+ struct pipe_surface *surface)
+{
+ struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
+ struct trace_texture *tr_tex;
+ struct trace_surface *tr_surf;
+
+ if(!surface)
+ return NULL;
+
+ assert(surface->texture);
+ if(!surface->texture)
+ return surface;
+
+ tr_tex = trace_texture(tr_scr, surface->texture);
+ tr_surf = trace_surface(tr_tex, surface);
+
+ assert(tr_surf->surface);
+ assert(tr_surf->surface->texture->screen == tr_scr->screen);
+ return tr_surf->surface;
+}
+
+
static INLINE void
trace_context_set_edgeflags(struct pipe_context *_pipe,
const unsigned *bitfield)
@@ -666,7 +710,18 @@ trace_context_set_framebuffer_state(struct pipe_context *_pipe,
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
-
+ struct pipe_framebuffer_state unwrapped_state;
+ unsigned i;
+
+ /* Unwrap the input state */
+ memcpy(&unwrapped_state, state, sizeof(unwrapped_state));
+ for(i = 0; i < state->num_cbufs; ++i)
+ unwrapped_state.cbufs[i] = trace_surface_unwrap(tr_ctx, state->cbufs[i]);
+ for(i = state->num_cbufs; i < PIPE_MAX_COLOR_BUFS; ++i)
+ unwrapped_state.cbufs[i] = NULL;
+ unwrapped_state.zsbuf = trace_surface_unwrap(tr_ctx, state->zsbuf);
+ state = &unwrapped_state;
+
trace_dump_call_begin("pipe_context", "set_framebuffer_state");
trace_dump_arg(ptr, pipe);
@@ -739,6 +794,12 @@ trace_context_set_sampler_textures(struct pipe_context *_pipe,
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
+ struct pipe_texture *unwrapped_textures[PIPE_MAX_SAMPLERS];
+ unsigned i;
+
+ for(i = 0; i < num_textures; ++i)
+ unwrapped_textures[i] = trace_texture_unwrap(tr_ctx, textures[i]);
+ textures = unwrapped_textures;
trace_dump_call_begin("pipe_context", "set_sampler_textures");
@@ -810,6 +871,9 @@ trace_context_surface_copy(struct pipe_context *_pipe,
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
+ dest = trace_surface_unwrap(tr_ctx, dest);
+ src = trace_surface_unwrap(tr_ctx, src);
+
trace_dump_call_begin("pipe_context", "surface_copy");
trace_dump_arg(ptr, pipe);
@@ -841,6 +905,8 @@ trace_context_surface_fill(struct pipe_context *_pipe,
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
+ dst = trace_surface_unwrap(tr_ctx, dst);
+
trace_dump_call_begin("pipe_context", "surface_fill");
trace_dump_arg(ptr, pipe);
@@ -864,6 +930,8 @@ trace_context_clear(struct pipe_context *_pipe,
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
+ surface = trace_surface_unwrap(tr_ctx, surface);
+
trace_dump_call_begin("pipe_context", "clear");
trace_dump_arg(ptr, pipe);
@@ -925,6 +993,9 @@ trace_context_create(struct pipe_screen *screen,
if(!pipe)
goto error1;
+ if(!trace_dump_enabled())
+ goto error1;
+
tr_ctx = CALLOC_STRUCT(trace_context);
if(!tr_ctx)
goto error1;