#include "compute_memory_pool.h"
#include "evergreen_compute_internal.h"
-static struct r600_resource_texture * create_pool_texture(struct r600_screen * screen,
+static struct r600_texture * create_pool_texture(struct r600_screen * screen,
unsigned size_in_dw)
{
struct pipe_resource templ;
- struct r600_resource_texture * tex;
+ struct r600_texture * tex;
if (size_in_dw == 0) {
return NULL;
templ.depth0 = 1;
templ.array_size = 1;
- tex = (struct r600_resource_texture *)r600_texture_create(
+ tex = (struct r600_texture *)r600_texture_create(
&screen->screen, &templ);
/* XXX: Propagate this error */
assert(tex && "Out of memory");
{
struct evergreen_compute_resource* res =
get_empty_res(pipe, COMPUTE_RESOURCE_TEX, id);
- struct r600_resource_texture *tmp =
- (struct r600_resource_texture*)view->base.texture;
+ struct r600_texture *tmp =
+ (struct r600_texture*)view->base.texture;
unsigned format, endian;
uint32_t word4 = 0, yuv_format = 0, pitch = 0;
{
struct r600_screen *rscreen = (struct r600_screen*)ctx->screen;
struct r600_pipe_sampler_view *view = CALLOC_STRUCT(r600_pipe_sampler_view);
- struct r600_resource_texture *tmp = (struct r600_resource_texture*)texture;
+ struct r600_texture *tmp = (struct r600_texture*)texture;
unsigned format, endian;
uint32_t word4 = 0, yuv_format = 0, pitch = 0;
unsigned char swizzle[4], array_mode = 0, tile_type = 0;
struct r600_surface *surf)
{
struct r600_screen *rscreen = rctx->screen;
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)surf->base.texture;
+ struct r600_texture *rtex = (struct r600_texture*)surf->base.texture;
struct pipe_resource *pipe_tex = surf->base.texture;
unsigned level = surf->base.u.tex.level;
unsigned pitch, slice;
{
struct r600_screen *rscreen = rctx->screen;
struct pipe_screen *screen = &rscreen->screen;
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)surf->base.texture;
+ struct r600_texture *rtex = (struct r600_texture*)surf->base.texture;
uint64_t offset;
unsigned level, pitch, slice, format, array_mode;
unsigned macro_aspect, tile_split, bankh, bankw, nbanks;
surf->cb_color_attrib, res, RADEON_USAGE_READWRITE);
}
/* set CB_COLOR1_INFO for possible dual-src blending */
- if (i == 1 && !((struct r600_resource_texture*)res)->is_rat) {
+ if (i == 1 && !((struct r600_texture*)res)->is_rat) {
r600_pipe_state_add_reg_bo(rstate, R_028C70_CB_COLOR0_INFO + 1 * 0x3C,
surf->cb_color_info, res, RADEON_USAGE_READWRITE);
i++;
}
void r600_blit_uncompress_depth(struct pipe_context *ctx,
- struct r600_resource_texture *texture,
- struct r600_resource_texture *staging,
+ struct r600_texture *texture,
+ struct r600_texture *staging,
unsigned first_level, unsigned last_level,
unsigned first_layer, unsigned last_layer,
unsigned first_sample, unsigned last_sample)
{
struct r600_context *rctx = (struct r600_context *)ctx;
unsigned layer, level, sample, checked_last_layer, max_layer, max_sample;
- struct r600_resource_texture *flushed_depth_texture = staging ?
+ struct r600_texture *flushed_depth_texture = staging ?
staging : texture->flushed_depth_texture;
const struct util_format_description *desc =
util_format_description(texture->resource.b.b.format);
while (depth_texture_mask) {
struct pipe_sampler_view *view;
- struct r600_resource_texture *tex;
+ struct r600_texture *tex;
i = u_bit_scan(&depth_texture_mask);
view = &textures->views[i]->base;
assert(view);
- tex = (struct r600_resource_texture *)view->texture;
+ tex = (struct r600_texture *)view->texture;
assert(tex->is_depth && !tex->is_flushing_texture);
r600_blit_uncompress_depth(&rctx->context, tex, NULL,
const struct pipe_resolve_info *info)
{
struct r600_context *rctx = (struct r600_context *)ctx;
- struct r600_resource_texture *rsrc = (struct r600_resource_texture*)info->src.res;
+ struct r600_texture *rsrc = (struct r600_texture*)info->src.res;
struct pipe_surface *dst_view, dst_templ;
struct pipe_sampler_view src_templ, *src_view;
struct pipe_box box;
unsigned level,
struct texture_orig_info *orig)
{
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
+ struct r600_texture *rtex = (struct r600_texture*)tex;
unsigned pixsize = util_format_get_blocksize(rtex->resource.b.b.format);
int new_format;
int new_height, new_width;
struct texture_orig_info *orig,
enum pipe_format format)
{
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
+ struct r600_texture *rtex = (struct r600_texture*)tex;
orig->format = tex->format;
orig->width0 = tex->width0;
unsigned level,
struct texture_orig_info *orig)
{
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
+ struct r600_texture *rtex = (struct r600_texture*)tex;
tex->format = orig->format;
tex->width0 = orig->width0;
const struct pipe_box *src_box)
{
struct r600_context *rctx = (struct r600_context *)ctx;
- struct r600_resource_texture *rsrc = (struct r600_resource_texture*)src;
+ struct r600_texture *rsrc = (struct r600_texture*)src;
struct texture_orig_info orig_info[2];
struct pipe_box sbox;
const struct pipe_box *psbox = src_box;
struct pipe_resource *src, const struct pipe_box *src_box);
void r600_init_blit_functions(struct r600_context *rctx);
void r600_blit_uncompress_depth(struct pipe_context *ctx,
- struct r600_resource_texture *texture,
- struct r600_resource_texture *staging,
+ struct r600_texture *texture,
+ struct r600_texture *staging,
unsigned first_level, unsigned last_level,
unsigned first_layer, unsigned last_layer,
unsigned first_sample, unsigned last_sample);
uint32_t r600_translate_texformat(struct pipe_screen *screen, enum pipe_format format,
const unsigned char *swizzle_view,
uint32_t *word4_p, uint32_t *yuv_format_p);
-unsigned r600_texture_get_offset(struct r600_resource_texture *rtex,
+unsigned r600_texture_get_offset(struct r600_texture *rtex,
unsigned level, unsigned layer);
/* r600_translate.c */
struct compute_memory_item *chunk;
};
-struct r600_resource_texture {
+struct r600_texture {
struct r600_resource resource;
unsigned array_mode[PIPE_MAX_TEXTURE_LEVELS];
bool is_depth;
bool is_rat;
unsigned dirty_db_mask; /* each bit says if that miplevel is dirty */
- struct r600_resource_texture *flushed_depth_texture;
+ struct r600_texture *flushed_depth_texture;
boolean is_flushing_texture;
struct radeon_surface surface;
};
bool r600_init_flushed_depth_texture(struct pipe_context *ctx,
struct pipe_resource *texture,
- struct r600_resource_texture **staging);
+ struct r600_texture **staging);
/* r600_texture.c texture transfer functions. */
struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
const struct pipe_sampler_view *state)
{
struct r600_pipe_sampler_view *view = CALLOC_STRUCT(r600_pipe_sampler_view);
- struct r600_resource_texture *tmp = (struct r600_resource_texture*)texture;
+ struct r600_texture *tmp = (struct r600_texture*)texture;
unsigned format, endian;
uint32_t word4 = 0, yuv_format = 0, pitch = 0;
unsigned char swizzle[4], array_mode = 0, tile_type = 0;
static void r600_init_color_surface(struct r600_context *rctx,
struct r600_surface *surf)
{
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)surf->base.texture;
+ struct r600_texture *rtex = (struct r600_texture*)surf->base.texture;
unsigned level = surf->base.u.tex.level;
unsigned pitch, slice;
unsigned color_info;
static void r600_init_depth_surface(struct r600_context *rctx,
struct r600_surface *surf)
{
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)surf->base.texture;
+ struct r600_texture *rtex = (struct r600_texture*)surf->base.texture;
unsigned level, pitch, slice, format, offset, array_mode;
level = surf->base.u.tex.level;
}
if (rviews[i]) {
- struct r600_resource_texture *rtex =
- (struct r600_resource_texture*)rviews[i]->base.texture;
+ struct r600_texture *rtex =
+ (struct r600_texture*)rviews[i]->base.texture;
if (rtex->is_depth && !rtex->is_flushing_texture) {
dst->views.depth_texture_mask |= 1 << i;
/* Set the depth buffer as dirty. */
if (rctx->framebuffer.zsbuf) {
struct pipe_surface *surf = rctx->framebuffer.zsbuf;
- struct r600_resource_texture *rtex = (struct r600_resource_texture *)surf->texture;
+ struct r600_texture *rtex = (struct r600_texture *)surf->texture;
rtex->dirty_db_mask |= 1 << surf->u.tex.level;
}
0, &sbox);
}
-unsigned r600_texture_get_offset(struct r600_resource_texture *rtex,
+unsigned r600_texture_get_offset(struct r600_texture *rtex,
unsigned level, unsigned layer)
{
return rtex->surface.level[level].offset +
}
static int r600_setup_surface(struct pipe_screen *screen,
- struct r600_resource_texture *rtex,
+ struct r600_texture *rtex,
unsigned pitch_in_bytes_override)
{
struct pipe_resource *ptex = &rtex->resource.b.b;
struct pipe_resource *ptex,
struct winsys_handle *whandle)
{
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)ptex;
+ struct r600_texture *rtex = (struct r600_texture*)ptex;
struct r600_resource *resource = &rtex->resource;
struct radeon_surface *surface = &rtex->surface;
struct r600_screen *rscreen = (struct r600_screen*)screen;
static void r600_texture_destroy(struct pipe_screen *screen,
struct pipe_resource *ptex)
{
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)ptex;
+ struct r600_texture *rtex = (struct r600_texture*)ptex;
struct r600_resource *resource = &rtex->resource;
if (rtex->flushed_depth_texture)
NULL /* transfer_inline_write */
};
-static struct r600_resource_texture *
+static struct r600_texture *
r600_texture_create_object(struct pipe_screen *screen,
const struct pipe_resource *base,
unsigned pitch_in_bytes_override,
boolean alloc_bo,
struct radeon_surface *surface)
{
- struct r600_resource_texture *rtex;
+ struct r600_texture *rtex;
struct r600_resource *resource;
struct r600_screen *rscreen = (struct r600_screen*)screen;
int r;
- rtex = CALLOC_STRUCT(r600_resource_texture);
+ rtex = CALLOC_STRUCT(r600_texture);
if (rtex == NULL)
return NULL;
bool r600_init_flushed_depth_texture(struct pipe_context *ctx,
struct pipe_resource *texture,
- struct r600_resource_texture **staging)
+ struct r600_texture **staging)
{
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
+ struct r600_texture *rtex = (struct r600_texture*)texture;
struct pipe_resource resource;
- struct r600_resource_texture **flushed_depth_texture = staging ?
+ struct r600_texture **flushed_depth_texture = staging ?
staging : &rtex->flushed_depth_texture;
if (!staging && rtex->flushed_depth_texture)
if (staging)
resource.flags |= R600_RESOURCE_FLAG_TRANSFER;
- *flushed_depth_texture = (struct r600_resource_texture *)ctx->screen->resource_create(ctx->screen, &resource);
+ *flushed_depth_texture = (struct r600_texture *)ctx->screen->resource_create(ctx->screen, &resource);
if (*flushed_depth_texture == NULL) {
R600_ERR("failed to create temporary texture to hold flushed depth\n");
return false;
const struct pipe_box *box)
{
struct r600_context *rctx = (struct r600_context*)ctx;
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
+ struct r600_texture *rtex = (struct r600_texture*)texture;
struct pipe_resource resource;
struct r600_transfer *trans;
boolean use_staging_texture = FALSE;
*/
/* XXX: when discard is true, no need to read back from depth texture
*/
- struct r600_resource_texture *staging_depth;
+ struct r600_texture *staging_depth;
if (!r600_init_flushed_depth_texture(ctx, texture, &staging_depth)) {
R600_ERR("failed to create temporary texture to hold untiled copy\n");
}
trans->transfer.stride =
- ((struct r600_resource_texture *)trans->staging)->surface.level[0].pitch_bytes;
+ ((struct r600_texture *)trans->staging)->surface.level[0].pitch_bytes;
if (usage & PIPE_TRANSFER_READ) {
r600_copy_to_staging_texture(ctx, trans);
/* Always referenced in the blit. */
{
struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
struct pipe_resource *texture = transfer->resource;
- struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
+ struct r600_texture *rtex = (struct r600_texture*)texture;
if ((transfer->usage & PIPE_TRANSFER_WRITE) && rtransfer->staging) {
if (rtex->is_depth) {
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
struct radeon_winsys_cs_handle *buf;
- struct r600_resource_texture *rtex =
- (struct r600_resource_texture*)transfer->resource;
+ struct r600_texture *rtex =
+ (struct r600_texture*)transfer->resource;
enum pipe_format format = transfer->resource->format;
unsigned offset = 0;
char *map;