summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/identity
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/identity')
-rw-r--r--src/gallium/drivers/identity/id_context.c159
-rw-r--r--src/gallium/drivers/identity/id_objects.c132
-rw-r--r--src/gallium/drivers/identity/id_objects.h97
-rw-r--r--src/gallium/drivers/identity/id_screen.c198
4 files changed, 176 insertions, 410 deletions
diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c
index 00a542215a..3b7eaecc02 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -28,6 +28,7 @@
#include "pipe/p_context.h"
#include "util/u_memory.h"
+#include "util/u_inlines.h"
#include "id_context.h"
#include "id_objects.h"
@@ -61,19 +62,19 @@ identity_draw_arrays(struct pipe_context *_pipe,
static void
identity_draw_elements(struct pipe_context *_pipe,
- struct pipe_buffer *_indexBuffer,
+ struct pipe_resource *_indexResource,
unsigned indexSize,
unsigned prim,
unsigned start,
unsigned count)
{
struct identity_context *id_pipe = identity_context(_pipe);
- struct identity_buffer *id_buffer = identity_buffer(_indexBuffer);
+ struct identity_resource *id_resource = identity_resource(_indexResource);
struct pipe_context *pipe = id_pipe->pipe;
- struct pipe_buffer *indexBuffer = id_buffer->buffer;
+ struct pipe_resource *indexResource = id_resource->resource;
pipe->draw_elements(pipe,
- indexBuffer,
+ indexResource,
indexSize,
prim,
start,
@@ -82,7 +83,7 @@ identity_draw_elements(struct pipe_context *_pipe,
static void
identity_draw_range_elements(struct pipe_context *_pipe,
- struct pipe_buffer *_indexBuffer,
+ struct pipe_resource *_indexResource,
unsigned indexSize,
unsigned minIndex,
unsigned maxIndex,
@@ -91,12 +92,12 @@ identity_draw_range_elements(struct pipe_context *_pipe,
unsigned count)
{
struct identity_context *id_pipe = identity_context(_pipe);
- struct identity_buffer *id_buffer = identity_buffer(_indexBuffer);
+ struct identity_resource *id_resource = identity_resource(_indexResource);
struct pipe_context *pipe = id_pipe->pipe;
- struct pipe_buffer *indexBuffer = id_buffer->buffer;
+ struct pipe_resource *indexResource = id_resource->resource;
pipe->draw_range_elements(pipe,
- indexBuffer,
+ indexResource,
indexSize,
minIndex,
maxIndex,
@@ -450,23 +451,23 @@ static void
identity_set_constant_buffer(struct pipe_context *_pipe,
uint shader,
uint index,
- struct pipe_buffer *_buffer)
+ struct pipe_resource *_resource)
{
struct identity_context *id_pipe = identity_context(_pipe);
struct pipe_context *pipe = id_pipe->pipe;
- struct pipe_buffer *unwrapped_buffer;
- struct pipe_buffer *buffer = NULL;
+ struct pipe_resource *unwrapped_resource;
+ struct pipe_resource *resource = NULL;
/* XXX hmm? unwrap the input state */
- if (_buffer) {
- unwrapped_buffer = identity_buffer_unwrap(_buffer);
- buffer = unwrapped_buffer;
+ if (_resource) {
+ unwrapped_resource = identity_resource_unwrap(_resource);
+ resource = unwrapped_resource;
}
pipe->set_constant_buffer(pipe,
shader,
index,
- buffer);
+ resource);
}
static void
@@ -587,7 +588,7 @@ identity_set_vertex_buffers(struct pipe_context *_pipe,
if (num_buffers) {
memcpy(unwrapped_buffers, _buffers, num_buffers * sizeof(*_buffers));
for (i = 0; i < num_buffers; i++)
- unwrapped_buffers[i].buffer = identity_buffer_unwrap(_buffers[i].buffer);
+ unwrapped_buffers[i].buffer = identity_resource_unwrap(_buffers[i].buffer);
buffers = unwrapped_buffers;
}
@@ -678,44 +679,31 @@ identity_flush(struct pipe_context *_pipe,
}
static unsigned int
-identity_is_texture_referenced(struct pipe_context *_pipe,
- struct pipe_texture *_texture,
+identity_is_resource_referenced(struct pipe_context *_pipe,
+ struct pipe_resource *_resource,
unsigned face,
unsigned level)
{
struct identity_context *id_pipe = identity_context(_pipe);
- struct identity_texture *id_texture = identity_texture(_texture);
+ struct identity_resource *id_resource = identity_resource(_resource);
struct pipe_context *pipe = id_pipe->pipe;
- struct pipe_texture *texture = id_texture->texture;
+ struct pipe_resource *texture = id_resource->resource;
- return pipe->is_texture_referenced(pipe,
+ return pipe->is_resource_referenced(pipe,
texture,
face,
level);
}
-static unsigned int
-identity_is_buffer_referenced(struct pipe_context *_pipe,
- struct pipe_buffer *_buffer)
-{
- struct identity_context *id_pipe = identity_context(_pipe);
- struct identity_buffer *id_buffer = identity_buffer(_buffer);
- struct pipe_context *pipe = id_pipe->pipe;
- struct pipe_buffer *buffer = id_buffer->buffer;
-
- return pipe->is_buffer_referenced(pipe,
- buffer);
-}
-
static struct pipe_sampler_view *
identity_create_sampler_view(struct pipe_context *pipe,
- struct pipe_texture *texture,
+ struct pipe_resource *texture,
const struct pipe_sampler_view *templ)
{
struct identity_context *id_pipe = identity_context(pipe);
- struct identity_texture *id_texture = identity_texture(texture);
+ struct identity_resource *id_resource = identity_resource(texture);
struct pipe_context *pipe_unwrapped = id_pipe->pipe;
- struct pipe_texture *texture_unwrapped = id_texture->texture;
+ 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,
@@ -725,7 +713,7 @@ identity_create_sampler_view(struct pipe_context *pipe,
view->base = *templ;
view->base.reference.count = 1;
view->base.texture = NULL;
- pipe_texture_reference(&view->base.texture, texture);
+ pipe_resource_reference(&view->base.texture, texture);
view->base.context = pipe;
return &view->base;
@@ -743,47 +731,36 @@ identity_sampler_view_destroy(struct pipe_context *pipe,
pipe_unwrapped->sampler_view_destroy(pipe_unwrapped,
view_unwrapped);
- pipe_texture_reference(&view->texture, NULL);
+ pipe_resource_reference(&view->texture, NULL);
free(view);
}
-
static struct pipe_transfer *
-identity_context_get_tex_transfer(struct pipe_context *_context,
- struct pipe_texture *_texture,
- unsigned face,
- unsigned level,
- unsigned zslice,
- enum pipe_transfer_usage usage,
- unsigned x,
- unsigned y,
- unsigned w,
- unsigned h)
+identity_context_get_transfer(struct pipe_context *_context,
+ 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_texture *id_texture = identity_texture(_texture);
+ struct identity_resource *id_resource = identity_resource(_resource);
struct pipe_context *context = id_context->pipe;
- struct pipe_texture *texture = id_texture->texture;
+ struct pipe_resource *texture = id_resource->resource;
struct pipe_transfer *result;
- result = context->get_tex_transfer(context,
- texture,
- face,
- level,
- zslice,
- usage,
- x,
- y,
- w,
- h);
+ result = context->get_transfer(context,
+ texture,
+ sr,
+ usage,
+ box);
if (result)
- return identity_transfer_create(id_context, id_texture, result);
+ return identity_transfer_create(id_context, id_resource, result);
return NULL;
}
static void
-identity_context_tex_transfer_destroy(struct pipe_context *_pipe,
+identity_context_transfer_destroy(struct pipe_context *_pipe,
struct pipe_transfer *_transfer)
{
identity_transfer_destroy(identity_context(_pipe),
@@ -803,6 +780,24 @@ identity_context_transfer_map(struct pipe_context *_context,
transfer);
}
+
+
+static void
+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);
+ struct pipe_context *context = id_context->pipe;
+ struct pipe_transfer *transfer = id_transfer->transfer;
+
+ context->transfer_flush_region(context,
+ transfer,
+ box);
+}
+
+
static void
identity_context_transfer_unmap(struct pipe_context *_context,
struct pipe_transfer *_transfer)
@@ -816,6 +811,33 @@ identity_context_transfer_unmap(struct pipe_context *_context,
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)
+{
+ 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;
+
+ context->transfer_inline_write(context,
+ texture,
+ sr,
+ usage,
+ box,
+ data,
+ stride,
+ slice_stride);
+}
+
+
struct pipe_context *
identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
{
@@ -878,14 +900,15 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
id_pipe->base.surface_fill = identity_surface_fill;
id_pipe->base.clear = identity_clear;
id_pipe->base.flush = identity_flush;
- id_pipe->base.is_texture_referenced = identity_is_texture_referenced;
- id_pipe->base.is_buffer_referenced = identity_is_buffer_referenced;
+ 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.get_tex_transfer = identity_context_get_tex_transfer;
- id_pipe->base.tex_transfer_destroy = identity_context_tex_transfer_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;
id_pipe->base.transfer_unmap = identity_context_transfer_unmap;
+ id_pipe->base.transfer_flush_region = identity_context_transfer_flush_region;
+ id_pipe->base.transfer_inline_write = identity_context_transfer_inline_write;
id_pipe->pipe = pipe;
diff --git a/src/gallium/drivers/identity/id_objects.c b/src/gallium/drivers/identity/id_objects.c
index d37fb0042e..d50914e7d5 100644
--- a/src/gallium/drivers/identity/id_objects.c
+++ b/src/gallium/drivers/identity/id_objects.c
@@ -32,80 +32,46 @@
#include "id_objects.h"
#include "id_context.h"
-struct pipe_buffer *
-identity_buffer_create(struct identity_screen *id_screen,
- struct pipe_buffer *buffer)
-{
- struct identity_buffer *id_buffer;
-
- if(!buffer)
- goto error;
-
- assert(buffer->screen == id_screen->screen);
-
- id_buffer = CALLOC_STRUCT(identity_buffer);
- if(!id_buffer)
- goto error;
-
- memcpy(&id_buffer->base, buffer, sizeof(struct pipe_buffer));
-
- pipe_reference_init(&id_buffer->base.reference, 1);
- id_buffer->base.screen = &id_screen->base;
- id_buffer->buffer = buffer;
-
- return &id_buffer->base;
-
-error:
- pipe_buffer_reference(&buffer, NULL);
- return NULL;
-}
-
-void
-identity_buffer_destroy(struct identity_buffer *id_buffer)
-{
- pipe_buffer_reference(&id_buffer->buffer, NULL);
- FREE(id_buffer);
-}
-struct pipe_texture *
-identity_texture_create(struct identity_screen *id_screen,
- struct pipe_texture *texture)
+struct pipe_resource *
+identity_resource_create(struct identity_screen *id_screen,
+ struct pipe_resource *resource)
{
- struct identity_texture *id_texture;
+ struct identity_resource *id_resource;
- if(!texture)
+ if(!resource)
goto error;
- assert(texture->screen == id_screen->screen);
+ assert(resource->screen == id_screen->screen);
- id_texture = CALLOC_STRUCT(identity_texture);
- if(!id_texture)
+ id_resource = CALLOC_STRUCT(identity_resource);
+ if(!id_resource)
goto error;
- memcpy(&id_texture->base, texture, sizeof(struct pipe_texture));
+ memcpy(&id_resource->base, resource, sizeof(struct pipe_resource));
- pipe_reference_init(&id_texture->base.reference, 1);
- id_texture->base.screen = &id_screen->base;
- id_texture->texture = texture;
+ pipe_reference_init(&id_resource->base.reference, 1);
+ id_resource->base.screen = &id_screen->base;
+ id_resource->resource = resource;
- return &id_texture->base;
+ return &id_resource->base;
error:
- pipe_texture_reference(&texture, NULL);
+ pipe_resource_reference(&resource, NULL);
return NULL;
}
void
-identity_texture_destroy(struct identity_texture *id_texture)
+identity_resource_destroy(struct identity_resource *id_resource)
{
- pipe_texture_reference(&id_texture->texture, NULL);
- FREE(id_texture);
+ pipe_resource_reference(&id_resource->resource, NULL);
+ FREE(id_resource);
}
struct pipe_surface *
-identity_surface_create(struct identity_texture *id_texture,
+identity_surface_create(struct identity_resource *id_resource,
struct pipe_surface *surface)
{
struct identity_surface *id_surface;
@@ -113,7 +79,7 @@ identity_surface_create(struct identity_texture *id_texture,
if(!surface)
goto error;
- assert(surface->texture == id_texture->texture);
+ assert(surface->texture == id_resource->resource);
id_surface = CALLOC_STRUCT(identity_surface);
if(!id_surface)
@@ -123,7 +89,7 @@ identity_surface_create(struct identity_texture *id_texture,
pipe_reference_init(&id_surface->base.reference, 1);
id_surface->base.texture = NULL;
- pipe_texture_reference(&id_surface->base.texture, &id_texture->base);
+ pipe_resource_reference(&id_surface->base.texture, &id_resource->base);
id_surface->surface = surface;
return &id_surface->base;
@@ -136,7 +102,7 @@ error:
void
identity_surface_destroy(struct identity_surface *id_surface)
{
- pipe_texture_reference(&id_surface->base.texture, NULL);
+ pipe_resource_reference(&id_surface->base.texture, NULL);
pipe_surface_reference(&id_surface->surface, NULL);
FREE(id_surface);
}
@@ -144,7 +110,7 @@ identity_surface_destroy(struct identity_surface *id_surface)
struct pipe_transfer *
identity_transfer_create(struct identity_context *id_context,
- struct identity_texture *id_texture,
+ struct identity_resource *id_resource,
struct pipe_transfer *transfer)
{
struct identity_transfer *id_transfer;
@@ -152,7 +118,7 @@ identity_transfer_create(struct identity_context *id_context,
if(!transfer)
goto error;
- assert(transfer->texture == id_texture->texture);
+ assert(transfer->resource == id_resource->resource);
id_transfer = CALLOC_STRUCT(identity_transfer);
if(!id_transfer)
@@ -160,16 +126,16 @@ identity_transfer_create(struct identity_context *id_context,
memcpy(&id_transfer->base, transfer, sizeof(struct pipe_transfer));
- id_transfer->base.texture = NULL;
+ id_transfer->base.resource = NULL;
id_transfer->transfer = transfer;
- pipe_texture_reference(&id_transfer->base.texture, &id_texture->base);
- assert(id_transfer->base.texture == &id_texture->base);
+ pipe_resource_reference(&id_transfer->base.resource, &id_resource->base);
+ assert(id_transfer->base.resource == &id_resource->base);
return &id_transfer->base;
error:
- id_context->pipe->tex_transfer_destroy(id_context->pipe, transfer);
+ id_context->pipe->transfer_destroy(id_context->pipe, transfer);
return NULL;
}
@@ -177,47 +143,9 @@ void
identity_transfer_destroy(struct identity_context *id_context,
struct identity_transfer *id_transfer)
{
- pipe_texture_reference(&id_transfer->base.texture, NULL);
- id_context->pipe->tex_transfer_destroy(id_context->pipe,
- id_transfer->transfer);
+ pipe_resource_reference(&id_transfer->base.resource, NULL);
+ id_context->pipe->transfer_destroy(id_context->pipe,
+ id_transfer->transfer);
FREE(id_transfer);
}
-struct pipe_video_surface *
-identity_video_surface_create(struct identity_screen *id_screen,
- struct pipe_video_surface *video_surface)
-{
- struct identity_video_surface *id_video_surface;
-
- if (!video_surface) {
- goto error;
- }
-
- assert(video_surface->screen == id_screen->screen);
-
- id_video_surface = CALLOC_STRUCT(identity_video_surface);
- if (!id_video_surface) {
- goto error;
- }
-
- memcpy(&id_video_surface->base,
- video_surface,
- sizeof(struct pipe_video_surface));
-
- pipe_reference_init(&id_video_surface->base.reference, 1);
- id_video_surface->base.screen = &id_screen->base;
- id_video_surface->video_surface = video_surface;
-
- return &id_video_surface->base;
-
-error:
- pipe_video_surface_reference(&video_surface, NULL);
- return NULL;
-}
-
-void
-identity_video_surface_destroy(struct identity_video_surface *id_video_surface)
-{
- pipe_video_surface_reference(&id_video_surface->video_surface, NULL);
- FREE(id_video_surface);
-}
diff --git a/src/gallium/drivers/identity/id_objects.h b/src/gallium/drivers/identity/id_objects.h
index 9a07ebe8d7..058cf3009d 100644
--- a/src/gallium/drivers/identity/id_objects.h
+++ b/src/gallium/drivers/identity/id_objects.h
@@ -31,25 +31,17 @@
#include "pipe/p_compiler.h"
#include "pipe/p_state.h"
-#include "pipe/p_video_state.h"
#include "id_screen.h"
struct identity_context;
-struct identity_buffer
-{
- struct pipe_buffer base;
-
- struct pipe_buffer *buffer;
-};
-
-struct identity_texture
+struct identity_resource
{
- struct pipe_texture base;
+ struct pipe_resource base;
- struct pipe_texture *texture;
+ struct pipe_resource *resource;
};
@@ -78,30 +70,13 @@ struct identity_transfer
};
-struct identity_video_surface
-{
- struct pipe_video_surface base;
-
- struct pipe_video_surface *video_surface;
-};
-
-
-static INLINE struct identity_buffer *
-identity_buffer(struct pipe_buffer *_buffer)
+static INLINE struct identity_resource *
+identity_resource(struct pipe_resource *_resource)
{
- if(!_buffer)
+ if(!_resource)
return NULL;
- (void)identity_screen(_buffer->screen);
- return (struct identity_buffer *)_buffer;
-}
-
-static INLINE struct identity_texture *
-identity_texture(struct pipe_texture *_texture)
-{
- if(!_texture)
- return NULL;
- (void)identity_screen(_texture->screen);
- return (struct identity_texture *)_texture;
+ (void)identity_screen(_resource->screen);
+ return (struct identity_resource *)_resource;
}
static INLINE struct identity_sampler_view *
@@ -118,7 +93,7 @@ identity_surface(struct pipe_surface *_surface)
{
if(!_surface)
return NULL;
- (void)identity_texture(_surface->texture);
+ (void)identity_resource(_surface->texture);
return (struct identity_surface *)_surface;
}
@@ -127,34 +102,16 @@ identity_transfer(struct pipe_transfer *_transfer)
{
if(!_transfer)
return NULL;
- (void)identity_texture(_transfer->texture);
+ (void)identity_resource(_transfer->resource);
return (struct identity_transfer *)_transfer;
}
-static INLINE struct identity_video_surface *
-identity_video_surface(struct pipe_video_surface *_video_surface)
-{
- if (!_video_surface) {
- return NULL;
- }
- (void)identity_screen(_video_surface->screen);
- return (struct identity_video_surface *)_video_surface;
-}
-
-static INLINE struct pipe_buffer *
-identity_buffer_unwrap(struct pipe_buffer *_buffer)
-{
- if(!_buffer)
- return NULL;
- return identity_buffer(_buffer)->buffer;
-}
-
-static INLINE struct pipe_texture *
-identity_texture_unwrap(struct pipe_texture *_texture)
+static INLINE struct pipe_resource *
+identity_resource_unwrap(struct pipe_resource *_resource)
{
- if(!_texture)
+ if(!_resource)
return NULL;
- return identity_texture(_texture)->texture;
+ return identity_resource(_resource)->resource;
}
static INLINE struct pipe_sampler_view *
@@ -183,22 +140,15 @@ identity_transfer_unwrap(struct pipe_transfer *_transfer)
}
-struct pipe_buffer *
-identity_buffer_create(struct identity_screen *id_screen,
- struct pipe_buffer *buffer);
-
-void
-identity_buffer_destroy(struct identity_buffer *id_buffer);
-
-struct pipe_texture *
-identity_texture_create(struct identity_screen *id_screen,
- struct pipe_texture *texture);
+struct pipe_resource *
+identity_resource_create(struct identity_screen *id_screen,
+ struct pipe_resource *resource);
void
-identity_texture_destroy(struct identity_texture *id_texture);
+identity_resource_destroy(struct identity_resource *id_resource);
struct pipe_surface *
-identity_surface_create(struct identity_texture *id_texture,
+identity_surface_create(struct identity_resource *id_resource,
struct pipe_surface *surface);
void
@@ -206,19 +156,12 @@ identity_surface_destroy(struct identity_surface *id_surface);
struct pipe_transfer *
identity_transfer_create(struct identity_context *id_context,
- struct identity_texture *id_texture,
+ struct identity_resource *id_resource,
struct pipe_transfer *transfer);
void
identity_transfer_destroy(struct identity_context *id_context,
struct identity_transfer *id_transfer);
-struct pipe_video_surface *
-identity_video_surface_create(struct identity_screen *id_screen,
- struct pipe_video_surface *video_surface);
-
-void
-identity_video_surface_destroy(struct identity_video_surface *id_video_surface);
-
#endif /* ID_OBJECTS_H */
diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c
index 419b146578..52573b211f 100644
--- a/src/gallium/drivers/identity/id_screen.c
+++ b/src/gallium/drivers/identity/id_screen.c
@@ -118,75 +118,76 @@ identity_screen_context_create(struct pipe_screen *_screen,
return NULL;
}
-static struct pipe_texture *
-identity_screen_texture_create(struct pipe_screen *_screen,
- const struct pipe_texture *templat)
+static struct pipe_resource *
+identity_screen_resource_create(struct pipe_screen *_screen,
+ const struct pipe_resource *templat)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct pipe_screen *screen = id_screen->screen;
- struct pipe_texture *result;
+ struct pipe_resource *result;
- result = screen->texture_create(screen,
+ result = screen->resource_create(screen,
templat);
if (result)
- return identity_texture_create(id_screen, result);
+ return identity_resource_create(id_screen, result);
return NULL;
}
-static struct pipe_texture *
-identity_screen_texture_from_handle(struct pipe_screen *_screen,
- const struct pipe_texture *templ,
+static struct pipe_resource *
+identity_screen_resource_from_handle(struct pipe_screen *_screen,
+ const struct pipe_resource *templ,
struct winsys_handle *handle)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct pipe_screen *screen = id_screen->screen;
- struct pipe_texture *result;
+ struct pipe_resource *result;
/* TODO trace call */
- result = screen->texture_from_handle(screen, templ, handle);
+ result = screen->resource_from_handle(screen, templ, handle);
- result = identity_texture_create(identity_screen(_screen), result);
+ result = identity_resource_create(identity_screen(_screen), result);
return result;
}
static boolean
-identity_screen_texture_get_handle(struct pipe_screen *_screen,
- struct pipe_texture *_texture,
+identity_screen_resource_get_handle(struct pipe_screen *_screen,
+ struct pipe_resource *_texture,
struct winsys_handle *handle)
{
struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_texture *id_texture = identity_texture(_texture);
+ struct identity_resource *id_resource = identity_resource(_texture);
struct pipe_screen *screen = id_screen->screen;
- struct pipe_texture *texture = id_texture->texture;
+ struct pipe_resource *texture = id_resource->resource;
/* TODO trace call */
- return screen->texture_get_handle(screen, texture, handle);
+ return screen->resource_get_handle(screen, texture, handle);
}
static void
-identity_screen_texture_destroy(struct pipe_texture *_texture)
+identity_screen_resource_destroy(struct pipe_screen *screen,
+ struct pipe_resource *_texture)
{
- identity_texture_destroy(identity_texture(_texture));
+ identity_resource_destroy(identity_resource(_texture));
}
static struct pipe_surface *
identity_screen_get_tex_surface(struct pipe_screen *_screen,
- struct pipe_texture *_texture,
+ struct pipe_resource *_texture,
unsigned face,
unsigned level,
unsigned zslice,
unsigned usage)
{
struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_texture *id_texture = identity_texture(_texture);
+ struct identity_resource *id_resource = identity_resource(_texture);
struct pipe_screen *screen = id_screen->screen;
- struct pipe_texture *texture = id_texture->texture;
+ struct pipe_resource *texture = id_resource->resource;
struct pipe_surface *result;
result = screen->get_tex_surface(screen,
@@ -197,7 +198,7 @@ identity_screen_get_tex_surface(struct pipe_screen *_screen,
usage);
if (result)
- return identity_surface_create(id_texture, result);
+ return identity_surface_create(id_resource, result);
return NULL;
}
@@ -208,141 +209,28 @@ identity_screen_tex_surface_destroy(struct pipe_surface *_surface)
}
-static struct pipe_buffer *
-identity_screen_buffer_create(struct pipe_screen *_screen,
- unsigned alignment,
- unsigned usage,
- unsigned size)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_buffer *result;
-
- result = screen->buffer_create(screen,
- alignment,
- usage,
- size);
- if (result)
- return identity_buffer_create(id_screen, result);
- return NULL;
-}
-
-static struct pipe_buffer *
+static struct pipe_resource *
identity_screen_user_buffer_create(struct pipe_screen *_screen,
void *ptr,
- unsigned bytes)
+ unsigned bytes,
+ unsigned usage)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct pipe_screen *screen = id_screen->screen;
- struct pipe_buffer *result;
+ struct pipe_resource *result;
result = screen->user_buffer_create(screen,
ptr,
- bytes);
+ bytes,
+ usage);
if (result)
- return identity_buffer_create(id_screen, result);
+ return identity_resource_create(id_screen, result);
return NULL;
}
-static void *
-identity_screen_buffer_map(struct pipe_screen *_screen,
- struct pipe_buffer *_buffer,
- unsigned usage)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_buffer *id_buffer = identity_buffer(_buffer);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_buffer *buffer = id_buffer->buffer;
-
- return screen->buffer_map(screen,
- buffer,
- usage);
-}
-
-static void *
-identity_screen_buffer_map_range(struct pipe_screen *_screen,
- struct pipe_buffer *_buffer,
- unsigned offset,
- unsigned length,
- unsigned usage)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_buffer *id_buffer = identity_buffer(_buffer);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_buffer *buffer = id_buffer->buffer;
-
- return screen->buffer_map_range(screen,
- buffer,
- offset,
- length,
- usage);
-}
-
-static void
-identity_screen_buffer_flush_mapped_range(struct pipe_screen *_screen,
- struct pipe_buffer *_buffer,
- unsigned offset,
- unsigned length)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_buffer *id_buffer = identity_buffer(_buffer);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_buffer *buffer = id_buffer->buffer;
-
- screen->buffer_flush_mapped_range(screen,
- buffer,
- offset,
- length);
-}
-
-static void
-identity_screen_buffer_unmap(struct pipe_screen *_screen,
- struct pipe_buffer *_buffer)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_buffer *id_buffer = identity_buffer(_buffer);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_buffer *buffer = id_buffer->buffer;
-
- screen->buffer_unmap(screen,
- buffer);
-}
-
-static void
-identity_screen_buffer_destroy(struct pipe_buffer *_buffer)
-{
- identity_buffer_destroy(identity_buffer(_buffer));
-}
-
-static struct pipe_video_surface *
-identity_screen_video_surface_create(struct pipe_screen *_screen,
- enum pipe_video_chroma_format chroma_format,
- unsigned width,
- unsigned height)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_video_surface *result;
-
- result = screen->video_surface_create(screen,
- chroma_format,
- width,
- height);
-
- if (result) {
- return identity_video_surface_create(id_screen, result);
- }
- return NULL;
-}
-
-static void
-identity_screen_video_surface_destroy(struct pipe_video_surface *_vsfc)
-{
- identity_video_surface_destroy(identity_video_surface(_vsfc));
-}
static void
identity_screen_flush_frontbuffer(struct pipe_screen *_screen,
@@ -417,29 +305,13 @@ identity_screen_create(struct pipe_screen *screen)
id_screen->base.get_paramf = identity_screen_get_paramf;
id_screen->base.is_format_supported = identity_screen_is_format_supported;
id_screen->base.context_create = identity_screen_context_create;
- id_screen->base.texture_create = identity_screen_texture_create;
- id_screen->base.texture_from_handle = identity_screen_texture_from_handle;
- id_screen->base.texture_get_handle = identity_screen_texture_get_handle;
- id_screen->base.texture_destroy = identity_screen_texture_destroy;
+ id_screen->base.resource_create = identity_screen_resource_create;
+ 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.buffer_create = identity_screen_buffer_create;
id_screen->base.user_buffer_create = identity_screen_user_buffer_create;
- if (screen->buffer_map)
- id_screen->base.buffer_map = identity_screen_buffer_map;
- if (screen->buffer_map_range)
- id_screen->base.buffer_map_range = identity_screen_buffer_map_range;
- if (screen->buffer_flush_mapped_range)
- id_screen->base.buffer_flush_mapped_range = identity_screen_buffer_flush_mapped_range;
- if (screen->buffer_unmap)
- id_screen->base.buffer_unmap = identity_screen_buffer_unmap;
- id_screen->base.buffer_destroy = identity_screen_buffer_destroy;
- if (screen->video_surface_create) {
- id_screen->base.video_surface_create = identity_screen_video_surface_create;
- }
- if (screen->video_surface_destroy) {
- id_screen->base.video_surface_destroy = identity_screen_video_surface_destroy;
- }
id_screen->base.flush_frontbuffer = identity_screen_flush_frontbuffer;
id_screen->base.fence_reference = identity_screen_fence_reference;
id_screen->base.fence_signalled = identity_screen_fence_signalled;