summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_screen.c
diff options
context:
space:
mode:
authorJerome Glisse <[email protected]>2010-07-28 12:18:19 -0400
committerJerome Glisse <[email protected]>2010-07-28 12:18:19 -0400
commit742ee7935da60dda974795243d2e0fcf31accb59 (patch)
treefd2ac432637f39d85e8e6060d30389db196b9ba3 /src/gallium/drivers/r600/r600_screen.c
parentb346c4205dc19c9ffbff48ed8bd89687772a96f8 (diff)
r600g: cleanup resource buffer/texture mess
Use a common function, fix the mess it was before. Signed-off-by: Jerome Glisse <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_screen.c')
-rw-r--r--src/gallium/drivers/r600/r600_screen.c69
1 files changed, 5 insertions, 64 deletions
diff --git a/src/gallium/drivers/r600/r600_screen.c b/src/gallium/drivers/r600/r600_screen.c
index dec6fa8d272..e0d74ca558f 100644
--- a/src/gallium/drivers/r600/r600_screen.c
+++ b/src/gallium/drivers/r600/r600_screen.c
@@ -24,15 +24,14 @@
* Jerome Glisse
* Corbin Simpson
*/
-#include <util/u_inlines.h>
-#include <util/u_format.h>
-#include <util/u_memory.h>
-#include "r600_resource.h"
+#include <stdio.h>
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+#include "util/u_memory.h"
#include "r600_screen.h"
-#include "r600_texture.h"
#include "r600_context.h"
#include "r600_public.h"
-#include <stdio.h>
+#include "r600_resource.h"
static const char* r600_get_vendor(struct pipe_screen* pscreen)
{
@@ -180,64 +179,6 @@ static boolean r600_is_format_supported(struct pipe_screen* screen,
return FALSE;
}
-struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
- struct pipe_resource *texture,
- struct pipe_subresource sr,
- unsigned usage,
- const struct pipe_box *box)
-{
- struct r600_texture *rtex = (struct r600_texture*)texture;
- struct r600_transfer *trans;
-
- trans = CALLOC_STRUCT(r600_transfer);
- if (trans == NULL)
- return NULL;
- pipe_resource_reference(&trans->transfer.resource, texture);
- trans->transfer.sr = sr;
- trans->transfer.usage = usage;
- trans->transfer.box = *box;
- trans->transfer.stride = rtex->stride[sr.level];
- trans->offset = r600_texture_get_offset(rtex, sr.level, box->z, sr.face);
- return &trans->transfer;
-}
-
-void r600_texture_transfer_destroy(struct pipe_context *ctx,
- struct pipe_transfer *trans)
-{
- pipe_resource_reference(&trans->resource, NULL);
- FREE(trans);
-}
-
-void* r600_texture_transfer_map(struct pipe_context *ctx,
- struct pipe_transfer* transfer)
-{
- struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
- struct r600_texture *rtex = (struct r600_texture*)transfer->resource;
- char *map;
- enum pipe_format format = rtex->b.b.format;
-
- map = pipe_buffer_map(ctx, rtex->buffer,
- transfer->usage,
- &rtransfer->buffer_transfer);
-
- if (!map) {
- return NULL;
- }
-
- return map + rtransfer->offset +
- transfer->box.y / util_format_get_blockheight(format) * transfer->stride +
- transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
-}
-
-void r600_texture_transfer_unmap(struct pipe_context *ctx,
- struct pipe_transfer* transfer)
-{
- struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
- struct r600_texture *rtex = (struct r600_texture*)transfer->resource;
-
- pipe_buffer_unmap(ctx, rtex->buffer, rtransfer->buffer_transfer);
-}
-
static void r600_destroy_screen(struct pipe_screen* pscreen)
{
struct r600_screen* rscreen = r600_screen(pscreen);