summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-09-21 23:33:30 +0200
committerMarek Olšák <[email protected]>2013-09-29 15:18:08 +0200
commite9162672850548310bd29fa6f0f924e4e8767af1 (patch)
tree7f7e902d3357bd8d3a36420b020879aff6bc4715 /src/gallium
parent31169400a0f2cbb76502dfc004db901ec23fcd9a (diff)
radeonsi: move radeonsi-specific functions out of r600_texture.c
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/radeonsi/r600_texture.c42
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_pipe.c1
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_pipe.h3
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c38
4 files changed, 38 insertions, 46 deletions
diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c
index e6e8e200e5c..9a2f7101850 100644
--- a/src/gallium/drivers/radeonsi/r600_texture.c
+++ b/src/gallium/drivers/radeonsi/r600_texture.c
@@ -546,42 +546,6 @@ struct pipe_resource *si_texture_create(struct pipe_screen *screen,
0, NULL, &surface);
}
-static struct pipe_surface *r600_create_surface(struct pipe_context *pipe,
- struct pipe_resource *texture,
- const struct pipe_surface *surf_tmpl)
-{
- struct r600_texture *rtex = (struct r600_texture*)texture;
- struct r600_surface *surface = CALLOC_STRUCT(r600_surface);
- unsigned level = surf_tmpl->u.tex.level;
-
- assert(surf_tmpl->u.tex.first_layer <= util_max_layer(texture, surf_tmpl->u.tex.level));
- assert(surf_tmpl->u.tex.last_layer <= util_max_layer(texture, surf_tmpl->u.tex.level));
- assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
- if (surface == NULL)
- return NULL;
- /* XXX no offset */
-/* offset = r600_texture_get_offset(rtex, level, surf_tmpl->u.tex.first_layer);*/
- pipe_reference_init(&surface->base.reference, 1);
- pipe_resource_reference(&surface->base.texture, texture);
- surface->base.context = pipe;
- surface->base.format = surf_tmpl->format;
- surface->base.width = rtex->surface.level[level].npix_x;
- surface->base.height = rtex->surface.level[level].npix_y;
- surface->base.texture = texture;
- surface->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer;
- surface->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer;
- surface->base.u.tex.level = level;
-
- return &surface->base;
-}
-
-static void r600_surface_destroy(struct pipe_context *pipe,
- struct pipe_surface *surface)
-{
- pipe_resource_reference(&surface->texture, NULL);
- FREE(surface);
-}
-
struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen,
const struct pipe_resource *templ,
struct winsys_handle *whandle)
@@ -881,12 +845,6 @@ static void si_texture_transfer_unmap(struct pipe_context *ctx,
FREE(transfer);
}
-void si_init_surface_functions(struct r600_context *r600)
-{
- r600->b.b.create_surface = r600_create_surface;
- r600->b.b.surface_destroy = r600_surface_destroy;
-}
-
static const struct u_resource_vtbl r600_texture_vtbl =
{
r600_texture_get_handle, /* get_handle */
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
index 814f16b0275..5275c6f41e9 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
@@ -228,7 +228,6 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
si_init_blit_functions(rctx);
r600_init_query_functions(rctx);
r600_init_context_resource_functions(rctx);
- si_init_surface_functions(rctx);
si_init_compute_functions(rctx);
if (rscreen->b.info.has_uvd) {
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index 942d235680e..60988710942 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -240,9 +240,6 @@ void r600_init_query_functions(struct r600_context *rctx);
/* r600_resource.c */
void r600_init_context_resource_functions(struct r600_context *r600);
-/* r600_texture.c */
-void si_init_surface_functions(struct r600_context *r600);
-
/* r600_translate.c */
void r600_translate_index_buffer(struct r600_context *r600,
struct pipe_index_buffer *ib,
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 8cec3e234d8..400d947376d 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2919,6 +2919,42 @@ static void *si_create_blend_custom(struct r600_context *rctx, unsigned mode)
return si_create_blend_state_mode(&rctx->b.b, &blend, mode);
}
+static struct pipe_surface *r600_create_surface(struct pipe_context *pipe,
+ struct pipe_resource *texture,
+ const struct pipe_surface *surf_tmpl)
+{
+ struct r600_texture *rtex = (struct r600_texture*)texture;
+ struct r600_surface *surface = CALLOC_STRUCT(r600_surface);
+ unsigned level = surf_tmpl->u.tex.level;
+
+ if (surface == NULL)
+ return NULL;
+
+ assert(surf_tmpl->u.tex.first_layer <= util_max_layer(texture, surf_tmpl->u.tex.level));
+ assert(surf_tmpl->u.tex.last_layer <= util_max_layer(texture, surf_tmpl->u.tex.level));
+ assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
+
+ pipe_reference_init(&surface->base.reference, 1);
+ pipe_resource_reference(&surface->base.texture, texture);
+ surface->base.context = pipe;
+ surface->base.format = surf_tmpl->format;
+ surface->base.width = rtex->surface.level[level].npix_x;
+ surface->base.height = rtex->surface.level[level].npix_y;
+ surface->base.texture = texture;
+ surface->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer;
+ surface->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer;
+ surface->base.u.tex.level = level;
+
+ return &surface->base;
+}
+
+static void r600_surface_destroy(struct pipe_context *pipe,
+ struct pipe_surface *surface)
+{
+ pipe_resource_reference(&surface->texture, NULL);
+ FREE(surface);
+}
+
void si_init_state_functions(struct r600_context *rctx)
{
int i;
@@ -2980,6 +3016,8 @@ void si_init_state_functions(struct r600_context *rctx)
rctx->b.b.texture_barrier = si_texture_barrier;
rctx->b.b.set_polygon_stipple = si_set_polygon_stipple;
+ rctx->b.b.create_surface = r600_create_surface;
+ rctx->b.b.surface_destroy = r600_surface_destroy;
rctx->b.b.draw_vbo = si_draw_vbo;
}