summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/identity/id_context.c
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2010-05-04 15:58:29 +0200
committerRoland Scheidegger <[email protected]>2010-05-04 15:58:29 +0200
commit0ae2f59c0287f4baec6c7de5f2f0fdf736fba26d (patch)
treeee14bf3e8bba80649541c4e13fc07c60baf6c248 /src/gallium/drivers/identity/id_context.c
parent7662e3519bef3802024da3050b886068281e02b1 (diff)
parent1c920c61764b17fd9fb4a89d2db7355fbe1d7565 (diff)
Merge commit 'origin/master' into gallium-msaa
Diffstat (limited to 'src/gallium/drivers/identity/id_context.c')
-rw-r--r--src/gallium/drivers/identity/id_context.c136
1 files changed, 62 insertions, 74 deletions
diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c
index 0bc8bf21966..7e62213597c 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -684,79 +684,67 @@ identity_flush(struct pipe_context *_pipe,
static unsigned int
identity_is_resource_referenced(struct pipe_context *_pipe,
- struct pipe_resource *_resource,
- unsigned face,
- unsigned level)
+ struct pipe_resource *_resource,
+ unsigned face,
+ unsigned level)
{
struct identity_context *id_pipe = identity_context(_pipe);
struct identity_resource *id_resource = identity_resource(_resource);
struct pipe_context *pipe = id_pipe->pipe;
- struct pipe_resource *texture = id_resource->resource;
+ struct pipe_resource *resource = id_resource->resource;
return pipe->is_resource_referenced(pipe,
- texture,
- face,
- level);
+ resource,
+ face,
+ level);
}
static struct pipe_sampler_view *
-identity_create_sampler_view(struct pipe_context *pipe,
- struct pipe_resource *texture,
- const struct pipe_sampler_view *templ)
+identity_context_create_sampler_view(struct pipe_context *_pipe,
+ struct pipe_resource *_resource,
+ const struct pipe_sampler_view *templ)
{
- struct identity_context *id_pipe = identity_context(pipe);
- struct identity_resource *id_resource = identity_resource(texture);
- struct pipe_context *pipe_unwrapped = id_pipe->pipe;
- struct pipe_resource *texture_unwrapped = id_resource->resource;
- struct identity_sampler_view *view = MALLOC(sizeof(struct identity_sampler_view));
-
- view->sampler_view = pipe_unwrapped->create_sampler_view(pipe_unwrapped,
- texture_unwrapped,
- templ);
+ struct identity_context *id_context = identity_context(_pipe);
+ struct identity_resource *id_resource = identity_resource(_resource);
+ struct pipe_context *pipe = id_context->pipe;
+ struct pipe_resource *resource = id_resource->resource;
+ struct pipe_sampler_view *result;
- view->base = *templ;
- view->base.reference.count = 1;
- view->base.texture = NULL;
- pipe_resource_reference(&view->base.texture, texture);
- view->base.context = pipe;
+ result = pipe->create_sampler_view(pipe,
+ resource,
+ templ);
- return &view->base;
+ if (result)
+ return identity_sampler_view_create(id_context, id_resource, result);
+ return NULL;
}
static void
-identity_sampler_view_destroy(struct pipe_context *pipe,
- struct pipe_sampler_view *view)
+identity_context_sampler_view_destroy(struct pipe_context *_pipe,
+ struct pipe_sampler_view *_view)
{
- struct identity_context *id_pipe = identity_context(pipe);
- struct identity_sampler_view *id_view = identity_sampler_view(view);
- struct pipe_context *pipe_unwrapped = id_pipe->pipe;
- struct pipe_sampler_view *view_unwrapped = id_view->sampler_view;
-
- pipe_unwrapped->sampler_view_destroy(pipe_unwrapped,
- view_unwrapped);
-
- pipe_resource_reference(&view->texture, NULL);
- FREE(view);
+ identity_sampler_view_destroy(identity_context(_pipe),
+ identity_sampler_view(_view));
}
static struct pipe_transfer *
identity_context_get_transfer(struct pipe_context *_context,
- struct pipe_resource *_resource,
- struct pipe_subresource sr,
- unsigned usage,
- const struct pipe_box *box)
+ struct pipe_resource *_resource,
+ struct pipe_subresource sr,
+ unsigned usage,
+ const struct pipe_box *box)
{
struct identity_context *id_context = identity_context(_context);
struct identity_resource *id_resource = identity_resource(_resource);
struct pipe_context *context = id_context->pipe;
- struct pipe_resource *texture = id_resource->resource;
+ struct pipe_resource *resource = id_resource->resource;
struct pipe_transfer *result;
result = context->get_transfer(context,
- texture,
- sr,
- usage,
- box);
+ resource,
+ sr,
+ usage,
+ box);
if (result)
return identity_transfer_create(id_context, id_resource, result);
@@ -765,7 +753,7 @@ identity_context_get_transfer(struct pipe_context *_context,
static void
identity_context_transfer_destroy(struct pipe_context *_pipe,
- struct pipe_transfer *_transfer)
+ struct pipe_transfer *_transfer)
{
identity_transfer_destroy(identity_context(_pipe),
identity_transfer(_transfer));
@@ -773,7 +761,7 @@ identity_context_transfer_destroy(struct pipe_context *_pipe,
static void *
identity_context_transfer_map(struct pipe_context *_context,
- struct pipe_transfer *_transfer)
+ struct pipe_transfer *_transfer)
{
struct identity_context *id_context = identity_context(_context);
struct identity_transfer *id_transfer = identity_transfer(_transfer);
@@ -781,15 +769,15 @@ identity_context_transfer_map(struct pipe_context *_context,
struct pipe_transfer *transfer = id_transfer->transfer;
return context->transfer_map(context,
- transfer);
+ transfer);
}
static void
-identity_context_transfer_flush_region( struct pipe_context *_context,
- struct pipe_transfer *_transfer,
- const struct pipe_box *box)
+identity_context_transfer_flush_region(struct pipe_context *_context,
+ struct pipe_transfer *_transfer,
+ const struct pipe_box *box)
{
struct identity_context *id_context = identity_context(_context);
struct identity_transfer *id_transfer = identity_transfer(_transfer);
@@ -797,14 +785,14 @@ identity_context_transfer_flush_region( struct pipe_context *_context,
struct pipe_transfer *transfer = id_transfer->transfer;
context->transfer_flush_region(context,
- transfer,
- box);
+ transfer,
+ box);
}
static void
identity_context_transfer_unmap(struct pipe_context *_context,
- struct pipe_transfer *_transfer)
+ struct pipe_transfer *_transfer)
{
struct identity_context *id_context = identity_context(_context);
struct identity_transfer *id_transfer = identity_transfer(_transfer);
@@ -812,33 +800,33 @@ identity_context_transfer_unmap(struct pipe_context *_context,
struct pipe_transfer *transfer = id_transfer->transfer;
context->transfer_unmap(context,
- transfer);
+ transfer);
}
static void
-identity_context_transfer_inline_write( struct pipe_context *_context,
- struct pipe_resource *_resource,
- struct pipe_subresource sr,
- unsigned usage,
- const struct pipe_box *box,
- const void *data,
- unsigned stride,
- unsigned slice_stride)
+identity_context_transfer_inline_write(struct pipe_context *_context,
+ struct pipe_resource *_resource,
+ struct pipe_subresource sr,
+ unsigned usage,
+ const struct pipe_box *box,
+ const void *data,
+ unsigned stride,
+ unsigned slice_stride)
{
struct identity_context *id_context = identity_context(_context);
struct identity_resource *id_resource = identity_resource(_resource);
struct pipe_context *context = id_context->pipe;
- struct pipe_resource *texture = id_resource->resource;
+ struct pipe_resource *resource = id_resource->resource;
context->transfer_inline_write(context,
- texture,
- sr,
- usage,
- box,
- data,
- stride,
- slice_stride);
+ resource,
+ sr,
+ usage,
+ box,
+ data,
+ stride,
+ slice_stride);
}
@@ -905,8 +893,8 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
id_pipe->base.clear = identity_clear;
id_pipe->base.flush = identity_flush;
id_pipe->base.is_resource_referenced = identity_is_resource_referenced;
- id_pipe->base.create_sampler_view = identity_create_sampler_view;
- id_pipe->base.sampler_view_destroy = identity_sampler_view_destroy;
+ id_pipe->base.create_sampler_view = identity_context_create_sampler_view;
+ id_pipe->base.sampler_view_destroy = identity_context_sampler_view_destroy;
id_pipe->base.get_transfer = identity_context_get_transfer;
id_pipe->base.transfer_destroy = identity_context_transfer_destroy;
id_pipe->base.transfer_map = identity_context_transfer_map;