diff options
Diffstat (limited to 'src/gallium/drivers/identity')
-rw-r--r-- | src/gallium/drivers/identity/SConscript | 2 | ||||
-rw-r--r-- | src/gallium/drivers/identity/id_context.c | 70 | ||||
-rw-r--r-- | src/gallium/drivers/identity/id_objects.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/identity/id_objects.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/identity/id_screen.c | 45 |
5 files changed, 64 insertions, 68 deletions
diff --git a/src/gallium/drivers/identity/SConscript b/src/gallium/drivers/identity/SConscript index b364e0acc84..d24d1ec7c61 100644 --- a/src/gallium/drivers/identity/SConscript +++ b/src/gallium/drivers/identity/SConscript @@ -10,4 +10,6 @@ identity = env.ConvenienceLibrary( 'id_screen.c', ]) +env.Alias('identity', identity) + Export('identity') diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index de83c249057..3efbd6a246d 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -577,17 +577,13 @@ identity_set_index_buffer(struct pipe_context *_pipe, static void identity_resource_copy_region(struct pipe_context *_pipe, struct pipe_resource *_dst, - struct pipe_subresource subdst, + unsigned dst_level, unsigned dstx, unsigned dsty, unsigned dstz, struct pipe_resource *_src, - struct pipe_subresource subsrc, - unsigned srcx, - unsigned srcy, - unsigned srcz, - unsigned width, - unsigned height) + unsigned src_level, + const struct pipe_box *src_box) { struct identity_context *id_pipe = identity_context(_pipe); struct identity_resource *id_resource_dst = identity_resource(_dst); @@ -598,17 +594,13 @@ identity_resource_copy_region(struct pipe_context *_pipe, pipe->resource_copy_region(pipe, dst, - subdst, + dst_level, dstx, dsty, dstz, src, - subsrc, - srcx, - srcy, - srcz, - width, - height); + src_level, + src_box); } static void @@ -690,8 +682,8 @@ 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) + unsigned level, + int layer) { struct identity_context *id_pipe = identity_context(_pipe); struct identity_resource *id_resource = identity_resource(_resource); @@ -700,8 +692,8 @@ identity_is_resource_referenced(struct pipe_context *_pipe, return pipe->is_resource_referenced(pipe, resource, - face, - level); + level, + layer); } static struct pipe_sampler_view * @@ -732,10 +724,38 @@ identity_context_sampler_view_destroy(struct pipe_context *_pipe, identity_sampler_view(_view)); } +static struct pipe_surface * +identity_context_create_surface(struct pipe_context *_pipe, + struct pipe_resource *_resource, + const struct pipe_surface *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_surface *result; + + result = pipe->create_surface(pipe, + resource, + templ); + + if (result) + return identity_surface_create(id_context, id_resource, result); + return NULL; +} + +static void +identity_context_surface_destroy(struct pipe_context *_pipe, + struct pipe_surface *_surf) +{ + identity_surface_destroy(identity_context(_pipe), + identity_surface(_surf)); +} + static struct pipe_transfer * identity_context_get_transfer(struct pipe_context *_context, struct pipe_resource *_resource, - struct pipe_subresource sr, + unsigned level, unsigned usage, const struct pipe_box *box) { @@ -747,7 +767,7 @@ identity_context_get_transfer(struct pipe_context *_context, result = context->get_transfer(context, resource, - sr, + level, usage, box); @@ -812,12 +832,12 @@ identity_context_transfer_unmap(struct pipe_context *_context, static void identity_context_transfer_inline_write(struct pipe_context *_context, struct pipe_resource *_resource, - struct pipe_subresource sr, + unsigned level, unsigned usage, const struct pipe_box *box, const void *data, unsigned stride, - unsigned slice_stride) + unsigned layer_stride) { struct identity_context *id_context = identity_context(_context); struct identity_resource *id_resource = identity_resource(_resource); @@ -826,12 +846,12 @@ identity_context_transfer_inline_write(struct pipe_context *_context, context->transfer_inline_write(context, resource, - sr, + level, usage, box, data, stride, - slice_stride); + layer_stride); } @@ -899,6 +919,8 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) id_pipe->base.clear_depth_stencil = identity_clear_depth_stencil; id_pipe->base.flush = identity_flush; id_pipe->base.is_resource_referenced = identity_is_resource_referenced; + id_pipe->base.create_surface = identity_context_create_surface; + id_pipe->base.surface_destroy = identity_context_surface_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; diff --git a/src/gallium/drivers/identity/id_objects.c b/src/gallium/drivers/identity/id_objects.c index 593928f399c..63454410525 100644 --- a/src/gallium/drivers/identity/id_objects.c +++ b/src/gallium/drivers/identity/id_objects.c @@ -71,7 +71,8 @@ identity_resource_destroy(struct identity_resource *id_resource) struct pipe_surface * -identity_surface_create(struct identity_resource *id_resource, +identity_surface_create(struct identity_context *id_context, + struct identity_resource *id_resource, struct pipe_surface *surface) { struct identity_surface *id_surface; @@ -100,10 +101,12 @@ error: } void -identity_surface_destroy(struct identity_surface *id_surface) +identity_surface_destroy(struct identity_context *id_context, + struct identity_surface *id_surface) { pipe_resource_reference(&id_surface->base.texture, NULL); - pipe_surface_reference(&id_surface->surface, NULL); + id_context->pipe->surface_destroy(id_context->pipe, + id_surface->surface); FREE(id_surface); } diff --git a/src/gallium/drivers/identity/id_objects.h b/src/gallium/drivers/identity/id_objects.h index e8deabf4fc7..181f2d6623e 100644 --- a/src/gallium/drivers/identity/id_objects.h +++ b/src/gallium/drivers/identity/id_objects.h @@ -147,11 +147,13 @@ void identity_resource_destroy(struct identity_resource *id_resource); struct pipe_surface * -identity_surface_create(struct identity_resource *id_resource, +identity_surface_create(struct identity_context *id_context, + struct identity_resource *id_resource, struct pipe_surface *surface); void -identity_surface_destroy(struct identity_surface *id_surface); +identity_surface_destroy(struct identity_context *id_context, + struct identity_surface *id_surface); struct pipe_sampler_view * identity_sampler_view_create(struct identity_context *id_context, diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c index 5fb464b4148..644481bb748 100644 --- a/src/gallium/drivers/identity/id_screen.c +++ b/src/gallium/drivers/identity/id_screen.c @@ -189,39 +189,6 @@ identity_screen_resource_destroy(struct pipe_screen *screen, identity_resource_destroy(identity_resource(_resource)); } -static struct pipe_surface * -identity_screen_get_tex_surface(struct pipe_screen *_screen, - struct pipe_resource *_resource, - unsigned face, - unsigned level, - unsigned zslice, - unsigned usage) -{ - struct identity_screen *id_screen = identity_screen(_screen); - struct identity_resource *id_resource = identity_resource(_resource); - struct pipe_screen *screen = id_screen->screen; - struct pipe_resource *resource = id_resource->resource; - struct pipe_surface *result; - - result = screen->get_tex_surface(screen, - resource, - face, - level, - zslice, - usage); - - if (result) - return identity_surface_create(id_resource, result); - return NULL; -} - -static void -identity_screen_tex_surface_destroy(struct pipe_surface *_surface) -{ - identity_surface_destroy(identity_surface(_surface)); -} - - static struct pipe_resource * identity_screen_user_buffer_create(struct pipe_screen *_screen, @@ -247,16 +214,18 @@ identity_screen_user_buffer_create(struct pipe_screen *_screen, static void identity_screen_flush_frontbuffer(struct pipe_screen *_screen, - struct pipe_surface *_surface, + struct pipe_resource *_resource, + unsigned level, unsigned layer, void *context_private) { struct identity_screen *id_screen = identity_screen(_screen); - struct identity_surface *id_surface = identity_surface(_surface); + struct identity_resource *id_resource = identity_resource(_resource); struct pipe_screen *screen = id_screen->screen; - struct pipe_surface *surface = id_surface->surface; + struct pipe_resource *resource = id_resource->resource; screen->flush_frontbuffer(screen, - surface, + resource, + level, layer, context_private); } @@ -323,8 +292,6 @@ identity_screen_create(struct pipe_screen *screen) id_screen->base.resource_from_handle = identity_screen_resource_from_handle; id_screen->base.resource_get_handle = identity_screen_resource_get_handle; id_screen->base.resource_destroy = identity_screen_resource_destroy; - id_screen->base.get_tex_surface = identity_screen_get_tex_surface; - id_screen->base.tex_surface_destroy = identity_screen_tex_surface_destroy; id_screen->base.user_buffer_create = identity_screen_user_buffer_create; id_screen->base.flush_frontbuffer = identity_screen_flush_frontbuffer; id_screen->base.fence_reference = identity_screen_fence_reference; |