#include "pipe/p_context.h"
#include "pipe/p_state.h"
-#include "util/u_transfer.h"
/* Hardware vertex fetcher limitations can be described by this structure. */
struct u_vbuf_caps {
void *vertex_elements;
};
-/* XXX this is no longer needed and can be removed */
-struct u_vbuf_resource {
- struct u_resource b;
- uint8_t *user_ptr;
-};
-
enum u_fetch_alignment {
U_VERTEX_FETCH_BYTE_ALIGNED,
U_VERTEX_FETCH_DWORD_ALIGNED
unsigned u_vbuf_draw_max_vertex_count(struct u_vbuf *mgr);
-
-static INLINE struct u_vbuf_resource *u_vbuf_resource(struct pipe_resource *r)
-{
- return (struct u_vbuf_resource*)r;
-}
-
#endif
struct r300_resource
{
- struct u_vbuf_resource b;
+ struct u_resource b;
/* Winsys buffer backing this resource. */
struct pb_buffer *buf;
case RC_STATE_R300_TEXSCALE_FACTOR:
tex = r300_resource(texstate->sampler_views[constant->u.State[1]]->base.texture);
/* Add a small number to the texture size to work around rounding errors in hw. */
- vec[0] = tex->b.b.b.width0 / (tex->tex.width0 + 0.001f);
- vec[1] = tex->b.b.b.height0 / (tex->tex.height0 + 0.001f);
- vec[2] = tex->b.b.b.depth0 / (tex->tex.depth0 + 0.001f);
+ vec[0] = tex->b.b.width0 / (tex->tex.width0 + 0.001f);
+ vec[1] = tex->b.b.height0 / (tex->tex.height0 + 0.001f);
+ vec[2] = tex->b.b.depth0 / (tex->tex.depth0 + 0.001f);
vec[3] = 1;
break;
state->unit[i].wrap_mode = RC_WRAP_NONE;
}
- if (t->b.b.b.target == PIPE_TEXTURE_3D)
+ if (t->b.b.target == PIPE_TEXTURE_3D)
state->unit[i].clamp_and_scale_before_fetch = TRUE;
}
}
switch (index_size) {
case 1:
- ptr1 = r300_resource(r300->index_buffer.buffer)->b.user_ptr;
+ ptr1 = r300->index_buffer.buffer->user_ptr;
ptr1 += info->start;
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (info->count << 16) |
break;
case 2:
- ptr2 = (uint16_t*)r300_resource(r300->index_buffer.buffer)->b.user_ptr;
+ ptr2 = (uint16_t*)r300->index_buffer.buffer->user_ptr;
ptr2 += info->start;
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (info->count << 16) |
break;
case 4:
- ptr4 = (uint32_t*)r300_resource(r300->index_buffer.buffer)->b.user_ptr;
+ ptr4 = (uint32_t*)r300->index_buffer.buffer->user_ptr;
ptr4 += info->start;
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (info->count << 16) |
/* Fallback for misaligned ushort indices. */
if (indexSize == 2 && (start & 1) &&
- !r300_resource(indexBuffer)->b.user_ptr) {
+ !indexBuffer->user_ptr) {
/* If we got here, then orgIndexBuffer == indexBuffer. */
uint16_t *ptr = r300->rws->buffer_map(r300_resource(orgIndexBuffer)->buf,
r300->cs,
}
r300->rws->buffer_unmap(r300_resource(orgIndexBuffer)->buf);
} else {
- if (r300_resource(indexBuffer)->b.user_ptr)
+ if (indexBuffer->user_ptr)
r300_upload_index_buffer(r300, &indexBuffer, indexSize,
&start, count,
- r300_resource(indexBuffer)->b.user_ptr);
+ indexBuffer->user_ptr);
}
/* 19 dwords for emit_draw_elements. Give up if the function fails. */
if (info.instance_count <= 1) {
if (info.count <= 8 &&
- r300_resource(r300->index_buffer.buffer)->b.user_ptr) {
+ r300->index_buffer.buffer->user_ptr) {
r300_draw_elements_immediate(r300, &info);
} else {
r300_draw_elements(r300, &info, -1);
uint8_t *map;
enum pipe_transfer_usage usage;
- if (rbuf->b.user_ptr)
- return (uint8_t *) rbuf->b.user_ptr + transfer->box.x;
+ if (rbuf->b.b.user_ptr)
+ return rbuf->b.b.user_ptr + transfer->box.x;
if (rbuf->constant_buffer)
return (uint8_t *) rbuf->constant_buffer + transfer->box.x;
memcpy(rbuf->constant_buffer + box->x, data, box->width);
return;
}
- assert(rbuf->b.user_ptr == NULL);
+ assert(rbuf->b.b.user_ptr == NULL);
map = rws->buffer_map(rbuf->buf, r300->cs,
PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE | usage);
rbuf = util_slab_alloc(&r300screen->pool_buffers);
- rbuf->b.b.b = *templ;
- rbuf->b.b.vtbl = &r300_buffer_vtbl;
- pipe_reference_init(&rbuf->b.b.b.reference, 1);
- rbuf->b.b.b.screen = screen;
- rbuf->b.b.b.user_ptr = NULL;
- rbuf->b.user_ptr = NULL;
+ rbuf->b.b = *templ;
+ rbuf->b.vtbl = &r300_buffer_vtbl;
+ pipe_reference_init(&rbuf->b.b.reference, 1);
+ rbuf->b.b.screen = screen;
+ rbuf->b.b.user_ptr = NULL;
rbuf->domain = RADEON_DOMAIN_GTT;
rbuf->buf = NULL;
rbuf->constant_buffer = NULL;
/* Alloc constant buffers in RAM. */
if (templ->bind & PIPE_BIND_CONSTANT_BUFFER) {
rbuf->constant_buffer = MALLOC(templ->width0);
- return &rbuf->b.b.b;
+ return &rbuf->b.b;
}
rbuf->buf =
r300screen->rws->buffer_create(r300screen->rws,
- rbuf->b.b.b.width0, alignment,
- rbuf->b.b.b.bind, rbuf->domain);
+ rbuf->b.b.width0, alignment,
+ rbuf->b.b.bind, rbuf->domain);
if (!rbuf->buf) {
util_slab_free(&r300screen->pool_buffers, rbuf);
return NULL;
rbuf->cs_buf =
r300screen->rws->buffer_get_cs_handle(rbuf->buf);
- return &rbuf->b.b.b;
+ return &rbuf->b.b;
}
struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
rbuf = util_slab_alloc(&r300screen->pool_buffers);
- pipe_reference_init(&rbuf->b.b.b.reference, 1);
- rbuf->b.b.b.screen = screen;
- rbuf->b.b.b.target = PIPE_BUFFER;
- rbuf->b.b.b.format = PIPE_FORMAT_R8_UNORM;
- rbuf->b.b.b.usage = PIPE_USAGE_IMMUTABLE;
- rbuf->b.b.b.bind = bind;
- rbuf->b.b.b.width0 = ~0;
- rbuf->b.b.b.height0 = 1;
- rbuf->b.b.b.depth0 = 1;
- rbuf->b.b.b.array_size = 1;
- rbuf->b.b.b.flags = 0;
- rbuf->b.b.b.user_ptr = ptr;
- rbuf->b.b.vtbl = &r300_buffer_vtbl;
- rbuf->b.user_ptr = ptr;
+ pipe_reference_init(&rbuf->b.b.reference, 1);
+ rbuf->b.b.screen = screen;
+ rbuf->b.b.target = PIPE_BUFFER;
+ rbuf->b.b.format = PIPE_FORMAT_R8_UNORM;
+ rbuf->b.b.usage = PIPE_USAGE_IMMUTABLE;
+ rbuf->b.b.bind = bind;
+ rbuf->b.b.width0 = ~0;
+ rbuf->b.b.height0 = 1;
+ rbuf->b.b.depth0 = 1;
+ rbuf->b.b.array_size = 1;
+ rbuf->b.b.flags = 0;
+ rbuf->b.b.user_ptr = ptr;
+ rbuf->b.vtbl = &r300_buffer_vtbl;
rbuf->domain = RADEON_DOMAIN_GTT;
rbuf->buf = NULL;
rbuf->constant_buffer = NULL;
- return &rbuf->b.b.b;
+ return &rbuf->b.b;
}
if (buf == NULL || buf->width0 == 0)
return;
- if (rbuf->b.user_ptr)
- mapped = (uint32_t*)rbuf->b.user_ptr;
+ if (rbuf->b.b.user_ptr)
+ mapped = (uint32_t*)rbuf->b.b.user_ptr;
else if (rbuf->constant_buffer)
mapped = (uint32_t*)rbuf->constant_buffer;
else
base_level = view->base.u.tex.first_level;
min_level = sampler->min_lod;
level_count = MIN3(sampler->max_lod,
- tex->b.b.b.last_level - base_level,
+ tex->b.b.last_level - base_level,
view->base.u.tex.last_level - base_level);
if (base_level + min_level) {
}
/* to emulate 1D textures through 2D ones correctly */
- if (tex->b.b.b.target == PIPE_TEXTURE_1D) {
+ if (tex->b.b.target == PIPE_TEXTURE_1D) {
texstate->filter0 &= ~R300_TX_WRAP_T_MASK;
texstate->filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE);
}
/* The hardware doesn't like CLAMP and CLAMP_TO_BORDER
* for the 3rd coordinate if the texture isn't 3D. */
- if (tex->b.b.b.target != PIPE_TEXTURE_3D) {
+ if (tex->b.b.target != PIPE_TEXTURE_3D) {
texstate->filter0 &= ~R300_TX_WRAP_R_MASK;
}
unsigned height0_override,
struct r300_texture_format_state *out)
{
- struct pipe_resource *pt = &tex->b.b.b;
+ struct pipe_resource *pt = &tex->b.b;
struct r300_texture_desc *desc = &tex->tex;
boolean is_r500 = screen->caps.is_r500;
unsigned width, height, depth;
if (base->nr_samples > 1)
return NULL;
- pipe_reference_init(&tex->b.b.b.reference, 1);
- tex->b.b.b.screen = &rscreen->screen;
- tex->b.b.b.usage = base->usage;
- tex->b.b.b.bind = base->bind;
- tex->b.b.b.flags = base->flags;
- tex->b.b.vtbl = &r300_texture_vtbl;
+ pipe_reference_init(&tex->b.b.reference, 1);
+ tex->b.b.screen = &rscreen->screen;
+ tex->b.b.usage = base->usage;
+ tex->b.b.bind = base->bind;
+ tex->b.b.flags = base->flags;
+ tex->b.vtbl = &r300_texture_vtbl;
tex->tex.microtile = microtile;
tex->tex.macrotile[0] = macrotile;
tex->tex.stride_in_bytes_override = stride_in_bytes_override;
/* Height must be aligned to the size of a tile. */
tile_height = r300_get_pixel_alignment(surface->base.format,
- tex->b.b.b.nr_samples,
+ tex->b.b.nr_samples,
tex->tex.microtile,
tex->tex.macrotile[level],
DIM_HEIGHT, 0);
{
unsigned tile, texdim;
- tile = r300_get_pixel_alignment(tex->b.b.b.format, tex->b.b.b.nr_samples,
+ tile = r300_get_pixel_alignment(tex->b.b.format, tex->b.b.nr_samples,
tex->tex.microtile, RADEON_LAYOUT_TILED, dim, 0);
if (dim == DIM_WIDTH) {
texdim = u_minify(tex->tex.width0, level);
return tex->tex.stride_in_bytes_override;
/* Check the level. */
- if (level > tex->b.b.b.last_level) {
+ if (level > tex->b.b.last_level) {
SCREEN_DBG(screen, DBG_TEX, "%s: level (%u) > last_level (%u)\n",
- __FUNCTION__, level, tex->b.b.b.last_level);
+ __FUNCTION__, level, tex->b.b.last_level);
return 0;
}
width = u_minify(tex->tex.width0, level);
- if (util_format_is_plain(tex->b.b.b.format)) {
- tile_width = r300_get_pixel_alignment(tex->b.b.b.format,
- tex->b.b.b.nr_samples,
+ if (util_format_is_plain(tex->b.b.format)) {
+ tile_width = r300_get_pixel_alignment(tex->b.b.format,
+ tex->b.b.nr_samples,
tex->tex.microtile,
tex->tex.macrotile[level],
DIM_WIDTH, is_rs690);
width = align(width, tile_width);
- stride = util_format_get_stride(tex->b.b.b.format, width);
+ stride = util_format_get_stride(tex->b.b.format, width);
/* The alignment to 32 bytes is sort of implied by the layout... */
return stride;
} else {
- return align(util_format_get_stride(tex->b.b.b.format, width), is_rs690 ? 64 : 32);
+ return align(util_format_get_stride(tex->b.b.format, width), is_rs690 ? 64 : 32);
}
}
height = u_minify(tex->tex.height0, level);
/* Mipmapped and 3D textures must have their height aligned to POT. */
- if ((tex->b.b.b.target != PIPE_TEXTURE_1D &&
- tex->b.b.b.target != PIPE_TEXTURE_2D &&
- tex->b.b.b.target != PIPE_TEXTURE_RECT) ||
- tex->b.b.b.last_level != 0) {
+ if ((tex->b.b.target != PIPE_TEXTURE_1D &&
+ tex->b.b.target != PIPE_TEXTURE_2D &&
+ tex->b.b.target != PIPE_TEXTURE_RECT) ||
+ tex->b.b.last_level != 0) {
height = util_next_power_of_two(height);
}
- if (util_format_is_plain(tex->b.b.b.format)) {
- tile_height = r300_get_pixel_alignment(tex->b.b.b.format,
- tex->b.b.b.nr_samples,
+ if (util_format_is_plain(tex->b.b.format)) {
+ tile_height = r300_get_pixel_alignment(tex->b.b.format,
+ tex->b.b.nr_samples,
tex->tex.microtile,
tex->tex.macrotile[level],
DIM_HEIGHT, 0);
/* Align the height so that there is an even number of macrotiles.
* Do so for 3 or more macrotiles in the Y direction. */
- if (level == 0 && tex->b.b.b.last_level == 0 &&
- (tex->b.b.b.target == PIPE_TEXTURE_1D ||
- tex->b.b.b.target == PIPE_TEXTURE_2D ||
- tex->b.b.b.target == PIPE_TEXTURE_RECT) &&
+ if (level == 0 && tex->b.b.last_level == 0 &&
+ (tex->b.b.target == PIPE_TEXTURE_1D ||
+ tex->b.b.target == PIPE_TEXTURE_2D ||
+ tex->b.b.target == PIPE_TEXTURE_RECT) &&
height >= tile_height * 3) {
height = align(height, tile_height * 2);
}
}
}
- return util_format_get_nblocksy(tex->b.b.b.format, height);
+ return util_format_get_nblocksy(tex->b.b.format, height);
}
/* Get a width in pixels from a stride in bytes. */
struct r300_resource *tex,
boolean align_for_cbzb)
{
- struct pipe_resource *base = &tex->b.b.b;
+ struct pipe_resource *base = &tex->b.b;
unsigned stride, size, layer_size, nblocksy, i;
boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_R350;
boolean aligned_for_cbzb;
static void r300_setup_flags(struct r300_resource *tex)
{
tex->tex.uses_stride_addressing =
- !util_is_power_of_two(tex->b.b.b.width0) ||
+ !util_is_power_of_two(tex->b.b.width0) ||
(tex->tex.stride_in_bytes_override &&
- r300_stride_to_width(tex->b.b.b.format,
- tex->tex.stride_in_bytes_override) != tex->b.b.b.width0);
+ r300_stride_to_width(tex->b.b.format,
+ tex->tex.stride_in_bytes_override) != tex->b.b.width0);
tex->tex.is_npot =
tex->tex.uses_stride_addressing ||
- !util_is_power_of_two(tex->b.b.b.height0) ||
- !util_is_power_of_two(tex->b.b.b.depth0);
+ !util_is_power_of_two(tex->b.b.height0) ||
+ !util_is_power_of_two(tex->b.b.depth0);
}
static void r300_setup_cbzb_flags(struct r300_screen *rscreen,
unsigned i, bpp;
boolean first_level_valid;
- bpp = util_format_get_blocksizebits(tex->b.b.b.format);
+ bpp = util_format_get_blocksizebits(tex->b.b.format);
/* 1) The texture must be point-sampled,
* 2) The depth must be 16 or 32 bits.
* 3) If the midpoint ZB offset is not aligned to 2048, it returns garbage
* with certain texture sizes. Macrotiling ensures the alignment. */
- first_level_valid = tex->b.b.b.nr_samples <= 1 &&
+ first_level_valid = tex->b.b.nr_samples <= 1 &&
(bpp == 16 || bpp == 32) &&
tex->tex.macrotile[0];
if (SCREEN_DBG_ON(rscreen, DBG_NO_CBZB))
first_level_valid = FALSE;
- for (i = 0; i <= tex->b.b.b.last_level; i++)
+ for (i = 0; i <= tex->b.b.last_level; i++)
tex->tex.cbzb_allowed[i] = first_level_valid && tex->tex.macrotile[i];
}
static unsigned hiz_align_x[4] = {8, 32, 48, 32};
static unsigned hiz_align_y[4] = {8, 8, 8, 32};
- if (util_format_is_depth_or_stencil(tex->b.b.b.format) &&
- util_format_get_blocksizebits(tex->b.b.b.format) == 32 &&
+ if (util_format_is_depth_or_stencil(tex->b.b.format) &&
+ util_format_get_blocksizebits(tex->b.b.format) == 32 &&
tex->tex.microtile) {
unsigned i, pipes;
pipes = screen->info.r300_num_gb_pipes;
}
- for (i = 0; i <= tex->b.b.b.last_level; i++) {
+ for (i = 0; i <= tex->b.b.last_level; i++) {
unsigned zcomp_numdw, zcompsize, hiz_numdw, stride, height;
- stride = r300_stride_to_width(tex->b.b.b.format,
+ stride = r300_stride_to_width(tex->b.b.format,
tex->tex.stride_in_bytes[i]);
stride = align(stride, 16);
- height = u_minify(tex->b.b.b.height0, i);
+ height = u_minify(tex->b.b.height0, i);
/* The 8x8 compression mode needs macrotiling. */
zcompsize = screen->caps.z_compress == R300_ZCOMP_8X8 &&
tex->tex.macrotile[i] &&
- tex->b.b.b.nr_samples <= 1 ? 8 : 4;
+ tex->b.b.nr_samples <= 1 ? 8 : 4;
/* Get the ZMASK buffer size in dwords. */
zcomp_numdw = r300_pixels_to_dwords(stride, height,
zmask_blocks_y_per_dw[pipes-1] * zcompsize);
/* Check whether we have enough ZMASK memory. */
- if (util_format_get_blocksizebits(tex->b.b.b.format) == 32 &&
+ if (util_format_get_blocksizebits(tex->b.b.format) == 32 &&
zcomp_numdw <= screen->caps.zmask_ram * pipes) {
tex->tex.zmask_dwords[i] = zcomp_numdw;
tex->tex.zcomp8x8[i] = zcompsize == 8;
static void r300_setup_tiling(struct r300_screen *screen,
struct r300_resource *tex)
{
- enum pipe_format format = tex->b.b.b.format;
+ enum pipe_format format = tex->b.b.format;
boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_R350;
boolean is_zb = util_format_is_depth_or_stencil(format);
boolean dbg_no_tiling = SCREEN_DBG_ON(screen, DBG_NO_TILING);
}
/* If height == 1, disable microtiling except for zbuffer. */
- if (!is_zb && (tex->b.b.b.height0 == 1 || dbg_no_tiling)) {
+ if (!is_zb && (tex->b.b.height0 == 1 || dbg_no_tiling)) {
return;
}
func,
tex->tex.macrotile[0] ? "YES" : " NO",
tex->tex.microtile ? "YES" : " NO",
- r300_stride_to_width(tex->b.b.b.format, tex->tex.stride_in_bytes[0]),
- tex->b.b.b.width0, tex->b.b.b.height0, tex->b.b.b.depth0,
- tex->b.b.b.last_level, tex->tex.size_in_bytes,
- util_format_short_name(tex->b.b.b.format));
+ r300_stride_to_width(tex->b.b.format, tex->tex.stride_in_bytes[0]),
+ tex->b.b.width0, tex->b.b.height0, tex->b.b.depth0,
+ tex->b.b.last_level, tex->tex.size_in_bytes,
+ util_format_short_name(tex->b.b.format));
}
void r300_texture_desc_init(struct r300_screen *rscreen,
struct r300_resource *tex,
const struct pipe_resource *base)
{
- tex->b.b.b.target = base->target;
- tex->b.b.b.format = base->format;
- tex->b.b.b.width0 = base->width0;
- tex->b.b.b.height0 = base->height0;
- tex->b.b.b.depth0 = base->depth0;
- tex->b.b.b.array_size = base->array_size;
- tex->b.b.b.last_level = base->last_level;
- tex->b.b.b.nr_samples = base->nr_samples;
+ tex->b.b.target = base->target;
+ tex->b.b.format = base->format;
+ tex->b.b.width0 = base->width0;
+ tex->b.b.height0 = base->height0;
+ tex->b.b.depth0 = base->depth0;
+ tex->b.b.array_size = base->array_size;
+ tex->b.b.last_level = base->last_level;
+ tex->b.b.nr_samples = base->nr_samples;
tex->tex.width0 = base->width0;
tex->tex.height0 = base->height0;
tex->tex.depth0 = base->depth0;
{
unsigned offset = tex->tex.offset_in_bytes[level];
- switch (tex->b.b.b.target) {
+ switch (tex->b.b.target) {
case PIPE_TEXTURE_3D:
case PIPE_TEXTURE_CUBE:
return offset + layer * tex->tex.layer_size_in_bytes[level];
struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
struct pipe_resource *tex = transfer->resource;
- ctx->resource_copy_region(ctx, &r300transfer->linear_texture->b.b.b, 0,
+ ctx->resource_copy_region(ctx, &r300transfer->linear_texture->b.b, 0,
0, 0, 0,
tex, transfer->level, &transfer->box);
}
ctx->resource_copy_region(ctx, tex, transfer->level,
transfer->box.x, transfer->box.y, transfer->box.z,
- &r300transfer->linear_texture->b.b.b, 0, &src_box);
+ &r300transfer->linear_texture->b.b, 0, &src_box);
/* XXX remove this. */
r300_flush(ctx, 0, NULL);
struct r300_transfer *r300transfer = r300_transfer(transfer);
struct r300_resource *tex = r300_resource(transfer->resource);
char *map;
- enum pipe_format format = tex->b.b.b.format;
+ enum pipe_format format = tex->b.b.format;
if (r300transfer->linear_texture) {
/* The detiled texture is of the same size as the region being mapped
format = r600_translate_colorformat(surf->base.format);
swap = r600_translate_colorswap(surf->base.format);
- if (rtex->resource.b.b.b.usage == PIPE_USAGE_STAGING) {
+ if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) {
endian = ENDIAN_NONE;
} else {
endian = r600_colorformat_endian_swap(format);
continue;
}
- va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b.b);
+ va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b);
va += vb[i].buffer_offset;
/* fetch resources start at index 992 */
rbuffer = (struct r600_resource*)cb->buffer;
assert(rbuffer);
- va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b.b);
+ va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b);
va += cb->buffer_offset;
r600_write_context_reg(cs, reg_alu_constbuf_size + buffer_index * 4,
#include "../../winsys/radeon/drm/radeon_winsys.h"
#include "util/u_double_list.h"
+#include "util/u_transfer.h"
#include "util/u_vbuf.h"
#define R600_ERR(fmt, args...) \
};
struct r600_resource {
- struct u_vbuf_resource b;
+ struct u_resource b;
/* Winsys objects. */
struct pb_buffer *buf;
rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635)
depth = 0.0f;
- for (level = 0; level <= texture->resource.b.b.b.last_level; level++) {
- unsigned num_layers = u_num_layers(&texture->resource.b.b.b, level);
+ for (level = 0; level <= texture->resource.b.b.last_level; level++) {
+ unsigned num_layers = u_num_layers(&texture->resource.b.b, level);
for (layer = 0; layer < num_layers; layer++) {
struct pipe_surface *zsurf, *cbsurf, surf_tmpl;
surf_tmpl.u.tex.last_layer = layer;
surf_tmpl.usage = PIPE_BIND_DEPTH_STENCIL;
- zsurf = ctx->create_surface(ctx, &texture->resource.b.b.b, &surf_tmpl);
+ zsurf = ctx->create_surface(ctx, &texture->resource.b.b, &surf_tmpl);
surf_tmpl.format = texture->flushed_depth_texture->real_format;
surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
struct pipe_box sbox;
sbox.x = sbox.y = sbox.z = 0;
- sbox.width = texture->resource.b.b.b.width0;
- sbox.height = texture->resource.b.b.b.height0;
+ sbox.width = texture->resource.b.b.width0;
+ sbox.height = texture->resource.b.b.height0;
/* XXX that might be wrong */
sbox.depth = 1;
while (mask) {
unsigned i = u_bit_scan(&mask);
- if (state->cb[i].buffer == &rbuffer->b.b.b) {
+ if (state->cb[i].buffer == &rbuffer->b.b) {
found = true;
state->dirty_mask |= 1 << i;
}
/* Create a new one in the same pipe_resource. */
/* XXX We probably want a different alignment for buffers and textures. */
- r600_init_resource(rctx->screen, rbuffer, rbuffer->b.b.b.width0, 4096,
- rbuffer->b.b.b.bind, rbuffer->b.b.b.usage);
+ r600_init_resource(rctx->screen, rbuffer, rbuffer->b.b.width0, 4096,
+ rbuffer->b.b.bind, rbuffer->b.b.usage);
/* We changed the buffer, now we need to bind it where the old one was bound. */
/* Vertex buffers. */
for (i = 0; i < rctx->vbuf_mgr->nr_vertex_buffers; i++) {
- if (rctx->vbuf_mgr->vertex_buffer[i].buffer == &rbuffer->b.b.b) {
+ if (rctx->vbuf_mgr->vertex_buffer[i].buffer == &rbuffer->b.b) {
r600_inval_vertex_cache(rctx);
r600_atom_dirty(rctx, &rctx->vertex_buffer_state);
}
}
/* Streamout buffers. */
for (i = 0; i < rctx->num_so_targets; i++) {
- if (rctx->so_targets[i]->b.buffer == &rbuffer->b.b.b) {
+ if (rctx->so_targets[i]->b.buffer == &rbuffer->b.b) {
r600_context_streamout_end(rctx);
rctx->streamout_start = TRUE;
rctx->streamout_append_bitmask = ~0;
}
}
- if (rbuffer->b.user_ptr)
- return (uint8_t*)rbuffer->b.user_ptr + transfer->box.x;
+ if (rbuffer->b.b.user_ptr)
+ return rbuffer->b.b.user_ptr + transfer->box.x;
data = rctx->ws->buffer_map(rbuffer->buf, rctx->cs, transfer->usage);
if (!data)
struct r600_resource *rbuffer = r600_resource(transfer->resource);
struct r600_context *rctx = (struct r600_context*)pipe;
- if (rbuffer->b.user_ptr)
+ if (rbuffer->b.b.user_ptr)
return;
rctx->ws->buffer_unmap(rbuffer->buf);
rbuffer = util_slab_alloc(&rscreen->pool_buffers);
- rbuffer->b.b.b = *templ;
- pipe_reference_init(&rbuffer->b.b.b.reference, 1);
- rbuffer->b.b.b.screen = screen;
- rbuffer->b.b.b.user_ptr = NULL;
- rbuffer->b.b.vtbl = &r600_buffer_vtbl;
- rbuffer->b.user_ptr = NULL;
+ rbuffer->b.b = *templ;
+ pipe_reference_init(&rbuffer->b.b.reference, 1);
+ rbuffer->b.b.screen = screen;
+ rbuffer->b.b.user_ptr = NULL;
+ rbuffer->b.vtbl = &r600_buffer_vtbl;
if (!r600_init_resource(rscreen, rbuffer, templ->width0, alignment, templ->bind, templ->usage)) {
util_slab_free(&rscreen->pool_buffers, rbuffer);
return NULL;
}
- return &rbuffer->b.b.b;
+ return &rbuffer->b.b;
}
struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
rbuffer = util_slab_alloc(&rscreen->pool_buffers);
- pipe_reference_init(&rbuffer->b.b.b.reference, 1);
- rbuffer->b.b.vtbl = &r600_buffer_vtbl;
- rbuffer->b.b.b.screen = screen;
- rbuffer->b.b.b.target = PIPE_BUFFER;
- rbuffer->b.b.b.format = PIPE_FORMAT_R8_UNORM;
- rbuffer->b.b.b.usage = PIPE_USAGE_IMMUTABLE;
- rbuffer->b.b.b.bind = bind;
- rbuffer->b.b.b.width0 = bytes;
- rbuffer->b.b.b.height0 = 1;
- rbuffer->b.b.b.depth0 = 1;
- rbuffer->b.b.b.array_size = 1;
- rbuffer->b.b.b.flags = 0;
- rbuffer->b.b.b.user_ptr = ptr;
- rbuffer->b.user_ptr = ptr;
+ pipe_reference_init(&rbuffer->b.b.reference, 1);
+ rbuffer->b.vtbl = &r600_buffer_vtbl;
+ rbuffer->b.b.screen = screen;
+ rbuffer->b.b.target = PIPE_BUFFER;
+ rbuffer->b.b.format = PIPE_FORMAT_R8_UNORM;
+ rbuffer->b.b.usage = PIPE_USAGE_IMMUTABLE;
+ rbuffer->b.b.bind = bind;
+ rbuffer->b.b.width0 = bytes;
+ rbuffer->b.b.height0 = 1;
+ rbuffer->b.b.depth0 = 1;
+ rbuffer->b.b.array_size = 1;
+ rbuffer->b.b.flags = 0;
+ rbuffer->b.b.user_ptr = ptr;
rbuffer->buf = NULL;
- return &rbuffer->b.b.b;
+ return &rbuffer->b.b;
}
if (block->pm4_bo_index[id]) {
/* find relocation */
reloc_id = block->pm4_bo_index[id];
- pipe_resource_reference((struct pipe_resource**)&block->reloc[reloc_id].bo, ®->bo->b.b.b);
+ pipe_resource_reference((struct pipe_resource**)&block->reloc[reloc_id].bo, ®->bo->b.b);
block->reloc[reloc_id].bo_usage = reg->bo_usage;
/* always force dirty for relocs for now */
dirty |= R600_BLOCK_STATUS_DIRTY;
if (dirty) {
/* TEXTURE RESOURCE */
- pipe_resource_reference((struct pipe_resource**)&block->reloc[1].bo, &state->bo[0]->b.b.b);
+ pipe_resource_reference((struct pipe_resource**)&block->reloc[1].bo, &state->bo[0]->b.b);
block->reloc[1].bo_usage = state->bo_usage[0];
- pipe_resource_reference((struct pipe_resource**)&block->reloc[2].bo, &state->bo[1]->b.b.b);
+ pipe_resource_reference((struct pipe_resource**)&block->reloc[2].bo, &state->bo[1]->b.b);
block->reloc[2].bo_usage = state->bo_usage[1];
r600_context_dirty_resource_block(ctx, block, dirty, num_regs - 1);
r600_need_cs_space(ctx, query->num_cs_dw * 2, TRUE);
/* Get a new query buffer if needed. */
- if (query->buffer.results_end + query->result_size > query->buffer.buf->b.b.b.width0) {
+ if (query->buffer.results_end + query->result_size > query->buffer.buf->b.b.width0) {
struct r600_query_buffer *qbuf = MALLOC_STRUCT(r600_query_buffer);
*qbuf = query->buffer;
query->buffer.buf = r600_new_query_buffer(ctx, query->type);
/* emit predicate packets for all data blocks */
for (qbuf = &query->buffer; qbuf; qbuf = qbuf->previous) {
unsigned results_base = 0;
- uint64_t va = r600_resource_va(&ctx->screen->screen, &qbuf->buf->b.b.b);
+ uint64_t va = r600_resource_va(&ctx->screen->screen, &qbuf->buf->b.b);
while (results_base < qbuf->results_end) {
cs->buf[cs->cdw++] = PKT3(PKT3_SET_PREDICATION, 1, 0);
format = r600_translate_colorformat(surf->base.format);
swap = r600_translate_colorswap(surf->base.format);
- if(rtex->resource.b.b.b.usage == PIPE_USAGE_STAGING) {
+ if(rtex->resource.b.b.usage == PIPE_USAGE_STAGING) {
endian = ENDIAN_NONE;
} else {
endian = r600_colorformat_endian_swap(format);
cb = &state->cb[index];
cb->buffer_size = buffer->width0;
- ptr = u_vbuf_resource(buffer)->user_ptr;
+ ptr = buffer->user_ptr;
if (ptr) {
/* Upload the user buffer. */
/* Translate or upload, if needed. */
r600_translate_index_buffer(rctx, &ib, info.count);
- ptr = u_vbuf_resource(ib.buffer)->user_ptr;
+ ptr = ib.buffer->user_ptr;
if (ptr) {
u_upload_data(rctx->vbuf_mgr->uploader, 0, info.count * ib.index_size,
ptr, &ib.offset, &ib.buffer);
struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer;
struct pipe_resource *texture = transfer->resource;
- ctx->resource_copy_region(ctx, &rtransfer->staging->b.b.b,
+ ctx->resource_copy_region(ctx, &rtransfer->staging->b.b,
0, 0, 0, 0, texture, transfer->level,
&transfer->box);
}
sbox.depth = 1;
ctx->resource_copy_region(ctx, texture, transfer->level,
transfer->box.x, transfer->box.y, transfer->box.z,
- &rtransfer->staging->b.b.b,
+ &rtransfer->staging->b.b,
0, &sbox);
}
{
unsigned offset = rtex->offset[level];
- switch (rtex->resource.b.b.b.target) {
+ switch (rtex->resource.b.b.target) {
case PIPE_TEXTURE_3D:
case PIPE_TEXTURE_CUBE:
default:
struct r600_resource_texture *rtex,
unsigned level)
{
- struct pipe_resource *ptex = &rtex->resource.b.b.b;
+ struct pipe_resource *ptex = &rtex->resource.b.b;
unsigned nblocksx, block_align, width;
unsigned blocksize = util_format_get_blocksize(rtex->real_format);
struct r600_resource_texture *rtex,
unsigned level)
{
- struct pipe_resource *ptex = &rtex->resource.b.b.b;
+ struct pipe_resource *ptex = &rtex->resource.b.b;
unsigned height, tile_height;
height = mip_minify(ptex->height0, level);
struct r600_resource_texture *rtex,
unsigned level, unsigned array_mode)
{
- struct pipe_resource *ptex = &rtex->resource.b.b.b;
+ struct pipe_resource *ptex = &rtex->resource.b.b;
switch (array_mode) {
case V_0280A0_ARRAY_LINEAR_GENERAL:
unsigned array_mode,
unsigned pitch_in_bytes_override)
{
- struct pipe_resource *ptex = &rtex->resource.b.b.b;
+ struct pipe_resource *ptex = &rtex->resource.b.b;
struct r600_screen *rscreen = (struct r600_screen*)screen;
unsigned i;
int r;
struct r600_resource_texture *rtex,
unsigned array_mode)
{
- struct pipe_resource *ptex = &rtex->resource.b.b.b;
+ struct pipe_resource *ptex = &rtex->resource.b.b;
enum chip_class chipc = ((struct r600_screen*)screen)->chip_class;
unsigned size, layer_size, i, offset;
unsigned nblocksx, nblocksy;
return NULL;
resource = &rtex->resource;
- resource->b.b.b = *base;
- resource->b.b.vtbl = &r600_texture_vtbl;
- pipe_reference_init(&resource->b.b.b.reference, 1);
- resource->b.b.b.screen = screen;
+ resource->b.b = *base;
+ resource->b.vtbl = &r600_texture_vtbl;
+ pipe_reference_init(&resource->b.b.reference, 1);
+ resource->b.b.screen = screen;
rtex->pitch_override = pitch_in_bytes_override;
rtex->real_format = base->format;
stencil_align = r600_get_base_alignment(screen, rtex->stencil->real_format, array_mode);
stencil_offset = align(rtex->size, stencil_align);
- for (unsigned i = 0; i <= rtex->stencil->resource.b.b.b.last_level; i++)
+ for (unsigned i = 0; i <= rtex->stencil->resource.b.b.last_level; i++)
rtex->stencil->offset[i] += stencil_offset;
rtex->size = stencil_offset + rtex->stencil->size;
/* Now create the backing buffer. */
if (!buf && alloc_bo) {
- struct pipe_resource *ptex = &rtex->resource.b.b.b;
+ struct pipe_resource *ptex = &rtex->resource.b.b;
unsigned base_align = r600_get_base_alignment(screen, ptex->format, array_mode);
if (rscreen->use_surface_alloc) {