trace_resource_unwrap(struct trace_context *tr_ctx,
struct pipe_resource *resource)
{
- struct trace_resource *tr_tex;
+ struct trace_resource *tr_res;
if(!resource)
return NULL;
- tr_tex = trace_resource(resource);
+ tr_res = trace_resource(resource);
- assert(tr_tex->resource);
- return tr_tex->resource;
+ assert(tr_res->resource);
+ return tr_res->resource;
}
const struct pipe_sampler_view *templ)
{
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_resource *tr_tex = trace_resource(_resource);
+ struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_context *pipe = tr_ctx->pipe;
- struct pipe_resource *texture = tr_tex->resource;
+ struct pipe_resource *resource = tr_res->resource;
struct pipe_sampler_view *result;
struct trace_sampler_view *tr_view;
trace_dump_call_begin("pipe_context", "create_sampler_view");
trace_dump_arg(ptr, pipe);
- trace_dump_arg(ptr, texture);
- trace_dump_arg(sampler_view_template, templ);
+ trace_dump_arg(ptr, resource);
+
+ trace_dump_arg_begin("templ");
+ trace_dump_sampler_view_template(templ, resource->target);
+ trace_dump_arg_end();
- result = pipe->create_sampler_view(pipe, texture, templ);
+ result = pipe->create_sampler_view(pipe, resource, templ);
trace_dump_ret(ptr, result);
static struct pipe_surface *
trace_create_surface(struct pipe_context *_pipe,
- struct pipe_resource *_texture,
+ struct pipe_resource *_resource,
const struct pipe_surface *surf_tmpl)
{
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_resource *tr_tex = trace_resource(_texture);
+ struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_context *pipe = tr_ctx->pipe;
- struct pipe_resource *texture = tr_tex->resource;
+ struct pipe_resource *resource = tr_res->resource;
struct pipe_surface *result = NULL;
trace_dump_call_begin("pipe_context", "create_surface");
trace_dump_arg(ptr, pipe);
- trace_dump_arg(ptr, texture);
- /* hmm some values unitialized there */
- trace_dump_arg(surface, surf_tmpl);
+ trace_dump_arg(ptr, resource);
+
+ trace_dump_arg_begin("surf_tmpl");
+ trace_dump_surface_template(surf_tmpl, resource->target);
+ trace_dump_arg_end();
+
- result = pipe->create_surface(pipe, texture, surf_tmpl);
+ result = pipe->create_surface(pipe, resource, surf_tmpl);
trace_dump_ret(ptr, result);
trace_dump_call_end();
- result = trace_surf_create(tr_tex, result);
+ result = trace_surf_create(tr_res, result);
return result;
}
const struct pipe_box *box)
{
struct trace_context *tr_context = trace_context(_context);
- struct trace_resource *tr_tex = trace_resource(_resource);
+ struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_context *context = tr_context->pipe;
- struct pipe_resource *texture = tr_tex->resource;
+ struct pipe_resource *texture = tr_res->resource;
struct pipe_transfer *result = NULL;
assert(texture->screen == context->screen);
result = context->get_transfer(context, texture, level, usage, box);
if (result)
- result = trace_transfer_create(tr_context, tr_tex, result);
+ result = trace_transfer_create(tr_context, tr_res, result);
return result;
}
unsigned layer_stride)
{
struct trace_context *tr_context = trace_context(_context);
- struct trace_resource *tr_tex = trace_resource(_resource);
+ struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_context *context = tr_context->pipe;
- struct pipe_resource *resource = tr_tex->resource;
+ struct pipe_resource *resource = tr_res->resource;
assert(resource->screen == context->screen);
unsigned offset, unsigned size)
{
struct trace_context *tr_context = trace_context(_context);
- struct trace_resource *tr_tex = trace_resource(_resource);
+ struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_context *context = tr_context->pipe;
- struct pipe_resource *resource = tr_tex->resource;
+ struct pipe_resource *resource = tr_res->resource;
assert(resource->screen == context->screen);
}
-void trace_dump_sampler_view_template(const struct pipe_sampler_view *state)
+void trace_dump_sampler_view_template(const struct pipe_sampler_view *state,
+ enum pipe_texture_target target)
{
if (!trace_dumping_enabled_locked())
return;
trace_dump_struct_begin("pipe_sampler_view");
trace_dump_member(format, state, format);
- /* XXX */
- trace_dump_member(uint, state, u.tex.first_level);
- trace_dump_member(uint, state, u.tex.last_level);
- trace_dump_member(uint, state, u.tex.first_layer);
- trace_dump_member(uint, state, u.tex.last_layer);
- trace_dump_member(uint, state, u.buf.first_element);
- trace_dump_member(uint, state, u.buf.last_element);
+
+ trace_dump_member_begin("u");
+ trace_dump_struct_begin(""); /* anonymous */
+ if (target == PIPE_BUFFER) {
+ trace_dump_member_begin("buf");
+ trace_dump_struct_begin(""); /* anonymous */
+ trace_dump_member(uint, &state->u.buf, first_element);
+ trace_dump_member(uint, &state->u.buf, last_element);
+ trace_dump_struct_end(); /* anonymous */
+ trace_dump_member_end(); /* buf */
+ } else {
+ trace_dump_member_begin("tex");
+ trace_dump_struct_begin(""); /* anonymous */
+ trace_dump_member(uint, &state->u.tex, first_layer);
+ trace_dump_member(uint, &state->u.tex, last_layer);
+ trace_dump_member(uint, &state->u.tex, first_level);
+ trace_dump_member(uint, &state->u.tex, last_level);
+ trace_dump_struct_end(); /* anonymous */
+ trace_dump_member_end(); /* tex */
+ }
+ trace_dump_struct_end(); /* anonymous */
+ trace_dump_member_end(); /* u */
+
trace_dump_member(uint, state, swizzle_r);
trace_dump_member(uint, state, swizzle_g);
trace_dump_member(uint, state, swizzle_b);
}
-void trace_dump_surface(const struct pipe_surface *state)
+void trace_dump_surface_template(const struct pipe_surface *state,
+ enum pipe_texture_target target)
{
if (!trace_dumping_enabled_locked())
return;
trace_dump_member(uint, state, usage);
- trace_dump_member(ptr, state, texture);
- trace_dump_member(uint, state, u.tex.level);
- trace_dump_member(uint, state, u.tex.first_layer);
- trace_dump_member(uint, state, u.tex.last_layer);
- trace_dump_member(uint, state, u.buf.first_element);
- trace_dump_member(uint, state, u.buf.last_element);
+ trace_dump_member_begin("u");
+ trace_dump_struct_begin(""); /* anonymous */
+ if (target == PIPE_BUFFER) {
+ trace_dump_member_begin("buf");
+ trace_dump_struct_begin(""); /* anonymous */
+ trace_dump_member(uint, &state->u.buf, first_element);
+ trace_dump_member(uint, &state->u.buf, last_element);
+ trace_dump_struct_end(); /* anonymous */
+ trace_dump_member_end(); /* buf */
+ } else {
+ trace_dump_member_begin("tex");
+ trace_dump_struct_begin(""); /* anonymous */
+ trace_dump_member(uint, &state->u.tex, level);
+ trace_dump_member(uint, &state->u.tex, first_layer);
+ trace_dump_member(uint, &state->u.tex, last_layer);
+ trace_dump_struct_end(); /* anonymous */
+ trace_dump_member_end(); /* tex */
+ }
+ trace_dump_struct_end(); /* anonymous */
+ trace_dump_member_end(); /* u */
trace_dump_struct_end();
}
void trace_dump_sampler_state(const struct pipe_sampler_state *state);
-void trace_dump_sampler_view_template(const struct pipe_sampler_view *view);
+void trace_dump_sampler_view_template(const struct pipe_sampler_view *view,
+ enum pipe_texture_target target);
-void trace_dump_surface(const struct pipe_surface *state);
+void trace_dump_surface_template(const struct pipe_surface *state,
+ enum pipe_texture_target target);
void trace_dump_transfer(const struct pipe_transfer *state);
trace_dump_call_begin("pipe_screen", "get_shader_param");
trace_dump_arg(ptr, screen);
- trace_dump_arg(int, shader);
+ trace_dump_arg(uint, shader);
trace_dump_arg(int, param);
result = screen->get_shader_param(screen, shader, param);
static boolean
trace_screen_resource_get_handle(struct pipe_screen *_screen,
- struct pipe_resource *_texture,
+ struct pipe_resource *_resource,
struct winsys_handle *handle)
{
struct trace_screen *tr_screen = trace_screen(_screen);
- struct trace_resource *tr_texture = trace_resource(_texture);
+ struct trace_resource *tr_resource = trace_resource(_resource);
struct pipe_screen *screen = tr_screen->screen;
- struct pipe_resource *texture = tr_texture->resource;
+ struct pipe_resource *resource = tr_resource->resource;
/* TODO trace call */
- return screen->resource_get_handle(screen, texture, handle);
+ return screen->resource_get_handle(screen, resource, handle);
}
static void
trace_screen_resource_destroy(struct pipe_screen *_screen,
- struct pipe_resource *_texture)
+ struct pipe_resource *_resource)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_resource *tr_tex = trace_resource(_texture);
+ struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_screen *screen = tr_scr->screen;
- struct pipe_resource *texture = tr_tex->resource;
+ struct pipe_resource *resource = tr_res->resource;
- assert(texture->screen == screen);
+ assert(resource->screen == screen);
- trace_dump_call_begin("pipe_screen", "texture_destroy");
+ trace_dump_call_begin("pipe_screen", "resource_destroy");
trace_dump_arg(ptr, screen);
- trace_dump_arg(ptr, texture);
+ trace_dump_arg(ptr, resource);
trace_dump_call_end();
- trace_resource_destroy(tr_scr, tr_tex);
+ trace_resource_destroy(tr_scr, tr_res);
}
trace_resource_create(struct trace_screen *tr_scr,
struct pipe_resource *texture)
{
- struct trace_resource *tr_tex;
+ struct trace_resource *tr_res;
if(!texture)
goto error;
assert(texture->screen == tr_scr->screen);
- tr_tex = CALLOC_STRUCT(trace_resource);
- if(!tr_tex)
+ tr_res = CALLOC_STRUCT(trace_resource);
+ if(!tr_res)
goto error;
- memcpy(&tr_tex->base, texture, sizeof(struct pipe_resource));
+ memcpy(&tr_res->base, texture, sizeof(struct pipe_resource));
- pipe_reference_init(&tr_tex->base.reference, 1);
- tr_tex->base.screen = &tr_scr->base;
- tr_tex->resource = texture;
+ pipe_reference_init(&tr_res->base.reference, 1);
+ tr_res->base.screen = &tr_scr->base;
+ tr_res->resource = texture;
- return &tr_tex->base;
+ return &tr_res->base;
error:
pipe_resource_reference(&texture, NULL);
void
trace_resource_destroy(struct trace_screen *tr_scr,
- struct trace_resource *tr_tex)
+ struct trace_resource *tr_res)
{
- pipe_resource_reference(&tr_tex->resource, NULL);
- FREE(tr_tex);
+ pipe_resource_reference(&tr_res->resource, NULL);
+ FREE(tr_res);
}
struct pipe_surface *
-trace_surf_create(struct trace_resource *tr_tex,
+trace_surf_create(struct trace_resource *tr_res,
struct pipe_surface *surface)
{
struct trace_surface *tr_surf;
if(!surface)
goto error;
- assert(surface->texture == tr_tex->resource);
+ assert(surface->texture == tr_res->resource);
tr_surf = CALLOC_STRUCT(trace_surface);
if(!tr_surf)
pipe_reference_init(&tr_surf->base.reference, 1);
tr_surf->base.texture = NULL;
- pipe_resource_reference(&tr_surf->base.texture, &tr_tex->base);
+ pipe_resource_reference(&tr_surf->base.texture, &tr_res->base);
tr_surf->surface = surface;
return &tr_surf->base;
struct pipe_transfer *
trace_transfer_create(struct trace_context *tr_ctx,
- struct trace_resource *tr_tex,
+ struct trace_resource *tr_res,
struct pipe_transfer *transfer)
{
struct trace_transfer *tr_trans;
if(!transfer)
goto error;
- assert(transfer->resource == tr_tex->resource);
+ assert(transfer->resource == tr_res->resource);
tr_trans = CALLOC_STRUCT(trace_transfer);
if(!tr_trans)
tr_trans->base.resource = NULL;
tr_trans->transfer = transfer;
- pipe_resource_reference(&tr_trans->base.resource, &tr_tex->base);
- assert(tr_trans->base.resource == &tr_tex->base);
+ pipe_resource_reference(&tr_trans->base.resource, &tr_res->base);
+ assert(tr_trans->base.resource == &tr_res->base);
return &tr_trans->base;
void
trace_resource_destroy(struct trace_screen *tr_scr,
- struct trace_resource *tr_tex);
+ struct trace_resource *tr_res);
struct pipe_surface *
-trace_surf_create(struct trace_resource *tr_tex,
+trace_surf_create(struct trace_resource *tr_res,
struct pipe_surface *surface);
void
struct pipe_transfer *
trace_transfer_create(struct trace_context *tr_ctx,
- struct trace_resource *tr_tex,
+ struct trace_resource *tr_res,
struct pipe_transfer *transfer);
void