summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c1
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c1
-rw-r--r--src/gallium/auxiliary/util/u_blit.c1
-rw-r--r--src/gallium/auxiliary/util/u_debug.c8
-rw-r--r--src/gallium/auxiliary/util/u_format.h2
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c12
-rw-r--r--src/gallium/auxiliary/util/u_linear.c2
-rw-r--r--src/gallium/auxiliary/util/u_linear.h19
-rw-r--r--src/gallium/auxiliary/util/u_rect.c71
-rw-r--r--src/gallium/auxiliary/util/u_rect.h4
-rw-r--r--src/gallium/auxiliary/util/u_surface.c1
-rw-r--r--src/gallium/auxiliary/util/u_tile.c29
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c33
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c10
-rw-r--r--src/gallium/include/pipe/p_format.h123
-rw-r--r--src/gallium/include/pipe/p_state.h8
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c8
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c7
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c14
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c33
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c4
-rw-r--r--src/mesa/state_tracker/st_texture.c4
23 files changed, 191 insertions, 205 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 31de84b272..8c631a01af 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -401,7 +401,6 @@ aaline_create_texture(struct aaline_stage *aaline)
texTemp.width0 = 1 << MAX_TEXTURE_LEVEL;
texTemp.height0 = 1 << MAX_TEXTURE_LEVEL;
texTemp.depth0 = 1;
- pf_get_block(texTemp.format, &texTemp.block);
aaline->texture = screen->texture_create(screen, &texTemp);
if (!aaline->texture)
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index 27d89721b1..7803946baa 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -430,7 +430,6 @@ pstip_create_texture(struct pstip_stage *pstip)
texTemp.width0 = 32;
texTemp.height0 = 32;
texTemp.depth0 = 1;
- pf_get_block(texTemp.format, &texTemp.block);
pstip->texture = screen->texture_create(screen, &texTemp);
if (pstip->texture == NULL)
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 5372df5735..abe1de3302 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -357,7 +357,6 @@ util_blit_pixels_writemask(struct blit_state *ctx,
texTemp.width0 = srcW;
texTemp.height0 = srcH;
texTemp.depth0 = 1;
- pf_get_block(src->format, &texTemp.block);
tex = screen->texture_create(screen, &texTemp);
if (!tex)
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index 96d400c839..40633574b0 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -669,10 +669,10 @@ void debug_dump_surface(const char *prefix,
goto error;
debug_dump_image(prefix,
- transfer->format,
- transfer->block.size,
- transfer->nblocksx,
- transfer->nblocksy,
+ texture->format,
+ pf_get_blocksize(texture->format),
+ pf_get_nblocksx(texture->format, transfer->width),
+ pf_get_nblocksy(texture->format, transfer->height),
transfer->stride,
data);
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 7b5b7fcda5..6740683a61 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -50,7 +50,7 @@ struct util_format_block
/** Block height in pixels */
unsigned height;
- /** Block size in bytes */
+ /** Block size in bits */
unsigned bits;
};
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index f67f1e458d..83263d9fe6 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -996,7 +996,7 @@ reduce_2d(enum pipe_format pformat,
{
enum dtype datatype;
uint comps;
- const int bpt = pf_get_size(pformat);
+ const int bpt = pf_get_blocksize(pformat);
const ubyte *srcA, *srcB;
ubyte *dst;
int row;
@@ -1035,7 +1035,7 @@ reduce_3d(enum pipe_format pformat,
int dstWidth, int dstHeight, int dstDepth,
int dstRowStride, ubyte *dstPtr)
{
- const int bpt = pf_get_size(pformat);
+ const int bpt = pf_get_blocksize(pformat);
const int border = 0;
int img, row;
int bytesPerSrcImage, bytesPerDstImage;
@@ -1159,8 +1159,8 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
const uint zslice = 0;
uint dstLevel;
- assert(pt->block.width == 1);
- assert(pt->block.height == 1);
+ assert(pf_get_blockwidth(pt->format) == 1);
+ assert(pf_get_blockheight(pt->format) == 1);
for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
const uint srcLevel = dstLevel - 1;
@@ -1204,8 +1204,8 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
struct pipe_screen *screen = pipe->screen;
uint dstLevel, zslice = 0;
- assert(pt->block.width == 1);
- assert(pt->block.height == 1);
+ assert(pf_get_blockwidth(pt->format) == 1);
+ assert(pf_get_blockheight(pt->format) == 1);
for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
const uint srcLevel = dstLevel - 1;
diff --git a/src/gallium/auxiliary/util/u_linear.c b/src/gallium/auxiliary/util/u_linear.c
index a1dce3f5cf..f1aef21677 100644
--- a/src/gallium/auxiliary/util/u_linear.c
+++ b/src/gallium/auxiliary/util/u_linear.c
@@ -82,7 +82,7 @@ void pipe_linear_from_tile(struct pipe_tile_info *t, const void *src_ptr,
void
pipe_linear_fill_info(struct pipe_tile_info *t,
- const struct pipe_format_block *block,
+ const struct u_linear_format_block *block,
unsigned tile_width, unsigned tile_height,
unsigned tiles_x, unsigned tiles_y)
{
diff --git a/src/gallium/auxiliary/util/u_linear.h b/src/gallium/auxiliary/util/u_linear.h
index b74308ffa3..42c40b2aa7 100644
--- a/src/gallium/auxiliary/util/u_linear.h
+++ b/src/gallium/auxiliary/util/u_linear.h
@@ -35,6 +35,19 @@
#include "pipe/p_format.h"
+struct u_linear_format_block
+{
+ /** Block size in bytes */
+ unsigned size;
+
+ /** Block width in pixels */
+ unsigned width;
+
+ /** Block height in pixels */
+ unsigned height;
+};
+
+
struct pipe_tile_info
{
unsigned size;
@@ -49,10 +62,10 @@ struct pipe_tile_info
unsigned rows;
/* Describe the tile in pixels */
- struct pipe_format_block tile;
+ struct u_linear_format_block tile;
/* Describe each block within the tile */
- struct pipe_format_block block;
+ struct u_linear_format_block block;
};
void pipe_linear_to_tile(size_t src_stride, const void *src_ptr,
@@ -71,7 +84,7 @@ void pipe_linear_from_tile(struct pipe_tile_info *t, const void *src_ptr,
* @tiles_y number of tiles in y axis
*/
void pipe_linear_fill_info(struct pipe_tile_info *t,
- const struct pipe_format_block *block,
+ const struct u_linear_format_block *block,
unsigned tile_width, unsigned tile_height,
unsigned tiles_x, unsigned tiles_y);
diff --git a/src/gallium/auxiliary/util/u_rect.c b/src/gallium/auxiliary/util/u_rect.c
index 9866b6fc8a..72725b59d2 100644
--- a/src/gallium/auxiliary/util/u_rect.c
+++ b/src/gallium/auxiliary/util/u_rect.c
@@ -44,7 +44,7 @@
*/
void
util_copy_rect(ubyte * dst,
- const struct pipe_format_block *block,
+ enum pipe_format format,
unsigned dst_stride,
unsigned dst_x,
unsigned dst_y,
@@ -57,27 +57,30 @@ util_copy_rect(ubyte * dst,
{
unsigned i;
int src_stride_pos = src_stride < 0 ? -src_stride : src_stride;
+ int blocksize = pf_get_blocksize(format);
+ int blockwidth = pf_get_blockwidth(format);
+ int blockheight = pf_get_blockheight(format);
- assert(block->size > 0);
- assert(block->width > 0);
- assert(block->height > 0);
+ assert(blocksize > 0);
+ assert(blockwidth > 0);
+ assert(blockheight > 0);
assert(src_x >= 0);
assert(src_y >= 0);
assert(dst_x >= 0);
assert(dst_y >= 0);
- dst_x /= block->width;
- dst_y /= block->height;
- width = (width + block->width - 1)/block->width;
- height = (height + block->height - 1)/block->height;
- src_x /= block->width;
- src_y /= block->height;
+ dst_x /= blockwidth;
+ dst_y /= blockheight;
+ width = (width + blockwidth - 1)/blockwidth;
+ height = (height + blockheight - 1)/blockheight;
+ src_x /= blockwidth;
+ src_y /= blockheight;
- dst += dst_x * block->size;
- src += src_x * block->size;
+ dst += dst_x * blocksize;
+ src += src_x * blocksize;
dst += dst_y * dst_stride;
src += src_y * src_stride_pos;
- width *= block->size;
+ width *= blocksize;
if (width == dst_stride && width == src_stride)
memcpy(dst, src, height * width);
@@ -92,7 +95,7 @@ util_copy_rect(ubyte * dst,
void
util_fill_rect(ubyte * dst,
- const struct pipe_format_block *block,
+ enum pipe_format format,
unsigned dst_stride,
unsigned dst_x,
unsigned dst_y,
@@ -102,23 +105,26 @@ util_fill_rect(ubyte * dst,
{
unsigned i, j;
unsigned width_size;
+ int blocksize = pf_get_blocksize(format);
+ int blockwidth = pf_get_blockwidth(format);
+ int blockheight = pf_get_blockheight(format);
- assert(block->size > 0);
- assert(block->width > 0);
- assert(block->height > 0);
+ assert(blocksize > 0);
+ assert(blockwidth > 0);
+ assert(blockheight > 0);
assert(dst_x >= 0);
assert(dst_y >= 0);
- dst_x /= block->width;
- dst_y /= block->height;
- width = (width + block->width - 1)/block->width;
- height = (height + block->height - 1)/block->height;
+ dst_x /= blockwidth;
+ dst_y /= blockheight;
+ width = (width + blockwidth - 1)/blockwidth;
+ height = (height + blockheight - 1)/blockheight;
- dst += dst_x * block->size;
+ dst += dst_x * blocksize;
dst += dst_y * dst_stride;
- width_size = width * block->size;
+ width_size = width * blocksize;
- switch (block->size) {
+ switch (blocksize) {
case 1:
if(dst_stride == width_size)
memset(dst, (ubyte) value, height * width_size);
@@ -172,10 +178,15 @@ util_surface_copy(struct pipe_context *pipe,
struct pipe_transfer *src_trans, *dst_trans;
void *dst_map;
const void *src_map;
+ enum pipe_format src_format, dst_format;
assert(src->texture && dst->texture);
if (!src->texture || !dst->texture)
return;
+
+ src_format = src->texture->format;
+ dst_format = dst->texture->format;
+
src_trans = screen->get_tex_transfer(screen,
src->texture,
src->face,
@@ -192,9 +203,9 @@ util_surface_copy(struct pipe_context *pipe,
PIPE_TRANSFER_WRITE,
dst_x, dst_y, w, h);
- assert(dst_trans->block.size == src_trans->block.size);
- assert(dst_trans->block.width == src_trans->block.width);
- assert(dst_trans->block.height == src_trans->block.height);
+ assert(pf_get_blocksize(dst_format) == pf_get_blocksize(src_format));
+ assert(pf_get_blockwidth(dst_format) == pf_get_blockwidth(src_format));
+ assert(pf_get_blockheight(dst_format) == pf_get_blockheight(src_format));
src_map = pipe->screen->transfer_map(screen, src_trans);
dst_map = pipe->screen->transfer_map(screen, dst_trans);
@@ -205,7 +216,7 @@ util_surface_copy(struct pipe_context *pipe,
if (src_map && dst_map) {
/* If do_flip, invert src_y position and pass negative src stride */
util_copy_rect(dst_map,
- &dst_trans->block,
+ dst_format,
dst_trans->stride,
0, 0,
w, h,
@@ -259,11 +270,11 @@ util_surface_fill(struct pipe_context *pipe,
if (dst_map) {
assert(dst_trans->stride > 0);
- switch (dst_trans->block.size) {
+ switch (pf_get_blocksize(dst_trans->texture->format)) {
case 1:
case 2:
case 4:
- util_fill_rect(dst_map, &dst_trans->block, dst_trans->stride,
+ util_fill_rect(dst_map, dst_trans->texture->format, dst_trans->stride,
0, 0, width, height, value);
break;
case 8:
diff --git a/src/gallium/auxiliary/util/u_rect.h b/src/gallium/auxiliary/util/u_rect.h
index daa50834d3..5e444ffae2 100644
--- a/src/gallium/auxiliary/util/u_rect.h
+++ b/src/gallium/auxiliary/util/u_rect.h
@@ -42,13 +42,13 @@ struct pipe_surface;
extern void
-util_copy_rect(ubyte * dst, const struct pipe_format_block *block,
+util_copy_rect(ubyte * dst, enum pipe_format format,
unsigned dst_stride, unsigned dst_x, unsigned dst_y,
unsigned width, unsigned height, const ubyte * src,
int src_stride, unsigned src_x, int src_y);
extern void
-util_fill_rect(ubyte * dst, const struct pipe_format_block *block,
+util_fill_rect(ubyte * dst, enum pipe_format format,
unsigned dst_stride, unsigned dst_x, unsigned dst_y,
unsigned width, unsigned height, uint32_t value);
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index de8c266db8..f828908f0b 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -82,7 +82,6 @@ util_create_rgba_surface(struct pipe_screen *screen,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
- pf_get_block(format, &templ.block);
templ.tex_usage = usage;
*textureOut = screen->texture_create(screen, &templ);
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index 8a22f584be..4f34f8a1a6 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -52,7 +52,7 @@ pipe_get_tile_raw(struct pipe_transfer *pt,
const void *src;
if (dst_stride == 0)
- dst_stride = pf_get_nblocksx(&pt->block, w) * pt->block.size;
+ dst_stride = pf_get_stride(pt->texture->format, w);
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
@@ -62,7 +62,7 @@ pipe_get_tile_raw(struct pipe_transfer *pt,
if(!src)
return;
- util_copy_rect(dst, &pt->block, dst_stride, 0, 0, w, h, src, pt->stride, x, y);
+ util_copy_rect(dst, pt->texture->format, dst_stride, 0, 0, w, h, src, pt->stride, x, y);
screen->transfer_unmap(screen, pt);
}
@@ -78,9 +78,10 @@ pipe_put_tile_raw(struct pipe_transfer *pt,
{
struct pipe_screen *screen = pt->texture->screen;
void *dst;
+ enum pipe_format format = pt->texture->format;
if (src_stride == 0)
- src_stride = pf_get_nblocksx(&pt->block, w) * pt->block.size;
+ src_stride = pf_get_stride(format, w);
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
@@ -90,7 +91,7 @@ pipe_put_tile_raw(struct pipe_transfer *pt,
if(!dst)
return;
- util_copy_rect(dst, &pt->block, pt->stride, x, y, w, h, src, src_stride, 0, 0);
+ util_copy_rect(dst, format, pt->stride, x, y, w, h, src, src_stride, 0, 0);
screen->transfer_unmap(screen, pt);
}
@@ -1219,21 +1220,22 @@ pipe_get_tile_rgba(struct pipe_transfer *pt,
{
unsigned dst_stride = w * 4;
void *packed;
+ enum pipe_format format = pt->texture->format;
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- packed = MALLOC(pf_get_nblocks(&pt->block, w, h) * pt->block.size);
+ packed = MALLOC(pf_get_nblocks(format, w, h) * pf_get_blocksize(format));
if (!packed)
return;
- if(pt->format == PIPE_FORMAT_YCBCR || pt->format == PIPE_FORMAT_YCBCR_REV)
+ if(format == PIPE_FORMAT_YCBCR || format == PIPE_FORMAT_YCBCR_REV)
assert((x & 1) == 0);
pipe_get_tile_raw(pt, x, y, w, h, packed, 0);
- pipe_tile_raw_to_rgba(pt->format, packed, w, h, p, dst_stride);
+ pipe_tile_raw_to_rgba(format, packed, w, h, p, dst_stride);
FREE(packed);
}
@@ -1246,16 +1248,17 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
{
unsigned src_stride = w * 4;
void *packed;
+ enum pipe_format format = pt->texture->format;
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- packed = MALLOC(pf_get_nblocks(&pt->block, w, h) * pt->block.size);
+ packed = MALLOC(pf_get_nblocks(format, w, h) * pf_get_blocksize(format));
if (!packed)
return;
- switch (pt->format) {
+ switch (format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
a8r8g8b8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
break;
@@ -1322,7 +1325,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
/*z24s8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
break;
default:
- debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(pt->format));
+ debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(format));
}
pipe_put_tile_raw(pt, x, y, w, h, packed, 0);
@@ -1344,6 +1347,7 @@ pipe_get_tile_z(struct pipe_transfer *pt,
ubyte *map;
uint *pDest = z;
uint i, j;
+ enum pipe_format format = pt->texture->format;
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
@@ -1354,7 +1358,7 @@ pipe_get_tile_z(struct pipe_transfer *pt,
return;
}
- switch (pt->format) {
+ switch (format) {
case PIPE_FORMAT_Z32_UNORM:
{
const uint *ptrc
@@ -1428,6 +1432,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
const uint *ptrc = zSrc;
ubyte *map;
uint i, j;
+ enum pipe_format format = pt->texture->format;
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
@@ -1438,7 +1443,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
return;
}
- switch (pt->format) {
+ switch (format) {
case PIPE_FORMAT_Z32_UNORM:
{
uint *pDest = (uint *) (map + y * pt->stride + x*4);
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
index 1934965995..8b4c0dc3a2 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
@@ -840,7 +840,6 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
template.height0 = r->pot_buffers ?
util_next_power_of_two(r->picture_height) : r->picture_height;
template.depth0 = 1;
- pf_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_DYNAMIC;
r->textures.individual.y = r->pipe->screen->texture_create(r->pipe->screen, &template);
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index ac5f61e46f..bd653216c0 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -63,13 +63,11 @@ softpipe_texture_layout(struct pipe_screen *screen,
pt->depth0 = depth;
for (level = 0; level <= pt->last_level; level++) {
- pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height);
- spt->stride[level] = pt->nblocksx[level]*pt->block.size;
+ spt->stride[level] = pf_get_stride(pt->format, width);
spt->level_offset[level] = buffer_size;
- buffer_size += (pt->nblocksy[level] *
+ buffer_size += (pf_get_nblocksy(pt->format, u_minify(height, level)) *
((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) *
spt->stride[level]);
@@ -97,9 +95,6 @@ softpipe_displaytarget_layout(struct pipe_screen *screen,
PIPE_BUFFER_USAGE_GPU_READ_WRITE);
unsigned tex_usage = spt->base.tex_usage;
- spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0);
- spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0);
-
spt->buffer = screen->surface_buffer_create( screen,
spt->base.width0,
spt->base.height0,
@@ -175,8 +170,6 @@ softpipe_texture_blanket(struct pipe_screen * screen,
spt->base = *base;
pipe_reference_init(&spt->base.reference, 1);
spt->base.screen = screen;
- spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0);
- spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0);
spt->stride[0] = stride[0];
pipe_buffer_reference(&spt->buffer, buffer);
@@ -244,10 +237,12 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
ps->zslice = zslice;
if (pt->target == PIPE_TEXTURE_CUBE) {
- ps->offset += face * pt->nblocksy[level] * spt->stride[level];
+ ps->offset += face * pf_get_nblocksy(pt->format, u_minify(pt->height0, level)) *
+ spt->stride[level];
}
else if (pt->target == PIPE_TEXTURE_3D) {
- ps->offset += zslice * pt->nblocksy[level] * spt->stride[level];
+ ps->offset += zslice * pf_get_nblocksy(pt->format, u_minify(pt->height0, level)) *
+ spt->stride[level];
}
else {
assert(face == 0);
@@ -302,15 +297,12 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
spt = CALLOC_STRUCT(softpipe_transfer);
if (spt) {
struct pipe_transfer *pt = &spt->base;
+ int nblocksy = pf_get_nblocksy(texture->format, u_minify(texture->height0, level));
pipe_texture_reference(&pt->texture, texture);
- pt->format = texture->format;
- pt->block = texture->block;
pt->x = x;
pt->y = y;
pt->width = w;
pt->height = h;
- pt->nblocksx = texture->nblocksx[level];
- pt->nblocksy = texture->nblocksy[level];
pt->stride = sptex->stride[level];
pt->usage = usage;
pt->face = face;
@@ -320,10 +312,10 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
spt->offset = sptex->level_offset[level];
if (texture->target == PIPE_TEXTURE_CUBE) {
- spt->offset += face * pt->nblocksy * pt->stride;
+ spt->offset += face * nblocksy * pt->stride;
}
else if (texture->target == PIPE_TEXTURE_3D) {
- spt->offset += zslice * pt->nblocksy * pt->stride;
+ spt->offset += zslice * nblocksy * pt->stride;
}
else {
assert(face == 0);
@@ -361,9 +353,11 @@ softpipe_transfer_map( struct pipe_screen *screen,
{
ubyte *map, *xfer_map;
struct softpipe_texture *spt;
+ enum pipe_format format;
assert(transfer->texture);
spt = softpipe_texture(transfer->texture);
+ format = transfer->texture->format;
map = pipe_buffer_map(screen, spt->buffer, pipe_transfer_buffer_flags(transfer));
if (map == NULL)
@@ -380,8 +374,8 @@ softpipe_transfer_map( struct pipe_screen *screen,
}
xfer_map = map + softpipe_transfer(transfer)->offset +
- transfer->y / transfer->block.height * transfer->stride +
- transfer->x / transfer->block.width * transfer->block.size;
+ transfer->y / pf_get_blockheight(format) * transfer->stride +
+ transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format);
/*printf("map = %p xfer map = %p\n", map, xfer_map);*/
return xfer_map;
}
@@ -438,7 +432,6 @@ softpipe_video_surface_create(struct pipe_screen *screen,
template.width0 = util_next_power_of_two(width);
template.height0 = util_next_power_of_two(height);
template.depth0 = 1;
- pf_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET;
sp_vsfc->tex = screen->texture_create(screen, &template);
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index 65872cecc4..04f61d16c4 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -238,7 +238,7 @@ clear_tile(struct softpipe_cached_tile *tile,
{
uint i, j;
- switch (pf_get_size(format)) {
+ switch (pf_get_blocksize(format)) {
case 1:
memset(tile->data.any, clear_value, TILE_SIZE * TILE_SIZE);
break;
@@ -284,8 +284,9 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc)
uint x, y;
uint numCleared = 0;
+ assert(pt->texture);
/* clear the scratch tile to the clear value */
- clear_tile(&tc->tile, pt->format, tc->clear_val);
+ clear_tile(&tc->tile, pt->texture->format, tc->clear_val);
/* push the tile to all positions marked as clear */
for (y = 0; y < h; y += TILE_SIZE) {
@@ -372,6 +373,7 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc,
if (addr.value != tile->addr.value) {
+ assert(pt->texture);
if (tile->addr.bits.invalid == 0) {
/* put dirty tile back in framebuffer */
if (tc->depth_stencil) {
@@ -395,10 +397,10 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc,
if (is_clear_flag_set(tc->clear_flags, addr)) {
/* don't get tile from framebuffer, just clear it */
if (tc->depth_stencil) {
- clear_tile(tile, pt->format, tc->clear_val);
+ clear_tile(tile, pt->texture->format, tc->clear_val);
}
else {
- clear_tile_rgba(tile, pt->format, tc->clear_color);
+ clear_tile_rgba(tile, pt->texture->format, tc->clear_color);
}
clear_clear_flag(tc->clear_flags, addr);
}
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index af23080920..e6bba777d3 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -422,10 +422,11 @@ static INLINE uint pf_get_component_bits( enum pipe_format format, uint comp )
return size << (pf_mixed_scale8( format ) * 3);
}
+
/**
- * Return total bits needed for the pixel format.
+ * Return total bits needed for the pixel format per block.
*/
-static INLINE uint pf_get_bits( enum pipe_format format )
+static INLINE uint pf_get_blocksizebits( enum pipe_format format )
{
switch (pf_layout(format)) {
case PIPE_FORMAT_LAYOUT_RGBAZS:
@@ -441,8 +442,24 @@ static INLINE uint pf_get_bits( enum pipe_format format )
pf_get_component_bits( format, PIPE_FORMAT_COMP_S );
case PIPE_FORMAT_LAYOUT_YCBCR:
assert( format == PIPE_FORMAT_YCBCR || format == PIPE_FORMAT_YCBCR_REV );
- /* return effective bits per pixel */
- return 16;
+ return 32;
+ case PIPE_FORMAT_LAYOUT_DXT:
+ switch(format) {
+ case PIPE_FORMAT_DXT1_RGBA:
+ case PIPE_FORMAT_DXT1_RGB:
+ case PIPE_FORMAT_DXT1_SRGBA:
+ case PIPE_FORMAT_DXT1_SRGB:
+ return 64;
+ case PIPE_FORMAT_DXT3_RGBA:
+ case PIPE_FORMAT_DXT5_RGBA:
+ case PIPE_FORMAT_DXT3_SRGBA:
+ case PIPE_FORMAT_DXT5_SRGBA:
+ return 128;
+ default:
+ assert( 0 );
+ return 0;
+ }
+
default:
assert( 0 );
return 0;
@@ -450,102 +467,66 @@ static INLINE uint pf_get_bits( enum pipe_format format )
}
/**
- * Return bytes per pixel for the given format.
+ * Return bytes per element for the given format.
*/
-static INLINE uint pf_get_size( enum pipe_format format )
+static INLINE uint pf_get_blocksize( enum pipe_format format )
{
- assert(pf_get_bits(format) % 8 == 0);
- return pf_get_bits(format) / 8;
+ assert(pf_get_blocksizebits(format) % 8 == 0);
+ return pf_get_blocksizebits(format) / 8;
}
-/**
- * Describe accurately the pixel format.
- *
- * The chars-per-pixel concept falls apart with compressed and yuv images, where
- * more than one pixel are coded in a single data block. This structure
- * describes that block.
- *
- * Simple pixel formats are effectively a 1x1xcpp block.
- */
-struct pipe_format_block
+static INLINE uint pf_get_blockwidth( enum pipe_format format )
{
- /** Block size in bytes */
- unsigned size;
-
- /** Block width in pixels */
- unsigned width;
-
- /** Block height in pixels */
- unsigned height;
-};
+ switch (pf_layout(format)) {
+ case PIPE_FORMAT_LAYOUT_YCBCR:
+ return 2;
+ case PIPE_FORMAT_LAYOUT_DXT:
+ return 4;
+ default:
+ return 1;
+ }
+}
-/**
- * Describe pixel format's block.
- *
- * @sa http://msdn2.microsoft.com/en-us/library/ms796147.aspx
- */
-static INLINE void
-pf_get_block(enum pipe_format format, struct pipe_format_block *block)
+static INLINE uint pf_get_blockheight( enum pipe_format format )
{
- switch(format) {
- case PIPE_FORMAT_DXT1_RGBA:
- case PIPE_FORMAT_DXT1_RGB:
- case PIPE_FORMAT_DXT1_SRGBA:
- case PIPE_FORMAT_DXT1_SRGB:
- block->size = 8;
- block->width = 4;
- block->height = 4;
- break;
- case PIPE_FORMAT_DXT3_RGBA:
- case PIPE_FORMAT_DXT5_RGBA:
- case PIPE_FORMAT_DXT3_SRGBA:
- case PIPE_FORMAT_DXT5_SRGBA:
- block->size = 16;
- block->width = 4;
- block->height = 4;
- break;
- case PIPE_FORMAT_YCBCR:
- case PIPE_FORMAT_YCBCR_REV:
- block->size = 4; /* 2*cpp */
- block->width = 2;
- block->height = 1;
- break;
+ switch (pf_layout(format)) {
+ case PIPE_FORMAT_LAYOUT_DXT:
+ return 4;
default:
- block->size = pf_get_size(format);
- block->width = 1;
- block->height = 1;
- break;
+ return 1;
}
}
static INLINE unsigned
-pf_get_nblocksx(const struct pipe_format_block *block, unsigned x)
+pf_get_nblocksx(enum pipe_format format, unsigned x)
{
- return (x + block->width - 1)/block->width;
+ unsigned blockwidth = pf_get_blockwidth(format);
+ return (x + blockwidth - 1) / blockwidth;
}
static INLINE unsigned
-pf_get_nblocksy(const struct pipe_format_block *block, unsigned y)
+pf_get_nblocksy(enum pipe_format format, unsigned y)
{
- return (y + block->height - 1)/block->height;
+ unsigned blockheight = pf_get_blockheight(format);
+ return (y + blockheight - 1) / blockheight;
}
static INLINE unsigned
-pf_get_nblocks(const struct pipe_format_block *block, unsigned width, unsigned height)
+pf_get_nblocks(enum pipe_format format, unsigned width, unsigned height)
{
- return pf_get_nblocksx(block, width)*pf_get_nblocksy(block, height);
+ return pf_get_nblocksx(format, width) * pf_get_nblocksy(format, height);
}
static INLINE size_t
-pf_get_stride(const struct pipe_format_block *block, unsigned width)
+pf_get_stride(enum pipe_format format, unsigned width)
{
- return pf_get_nblocksx(block, width)*block->size;
+ return pf_get_nblocksx(format, width) * pf_get_blocksize(format);
}
static INLINE size_t
-pf_get_2d_size(const struct pipe_format_block *block, size_t stride, unsigned height)
+pf_get_2d_size(enum pipe_format format, size_t stride, unsigned height)
{
- return pf_get_nblocksy(block, height)*stride;
+ return pf_get_nblocksy(format, height) * stride;
}
static INLINE boolean
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 9766e86620..db83c8e157 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -315,14 +315,10 @@ struct pipe_surface
*/
struct pipe_transfer
{
- enum pipe_format format; /**< PIPE_FORMAT_x */
unsigned x; /**< x offset from start of texture image */
unsigned y; /**< y offset from start of texture image */
unsigned width; /**< logical width in pixels */
unsigned height; /**< logical height in pixels */
- struct pipe_format_block block;
- unsigned nblocksx; /**< allocated width in blocks */
- unsigned nblocksy; /**< allocated height in blocks */
unsigned stride; /**< stride in bytes between rows of blocks */
enum pipe_transfer_usage usage; /**< PIPE_TRANSFER_* */
@@ -347,10 +343,6 @@ struct pipe_texture
unsigned height0;
unsigned depth0;
- struct pipe_format_block block;
- unsigned nblocksx[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated width in blocks */
- unsigned nblocksy[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated height in blocks */
-
unsigned last_level:8; /**< Index of last mipmap level present/defined */
unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index a68a29e126..a15043da78 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -701,7 +701,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
}
/* now pack the stencil (and Z) values in the dest format */
- switch (pt->format) {
+ switch (pt->texture->format) {
case PIPE_FORMAT_S8_UNORM:
{
ubyte *dest = stmap + spanY * pt->stride + spanX;
@@ -856,8 +856,8 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
usage, dstx, dsty,
width, height);
- assert(ptDraw->block.width == 1);
- assert(ptDraw->block.height == 1);
+ assert(pf_get_blockwidth(ptDraw->texture->format) == 1);
+ assert(pf_get_blockheight(ptDraw->texture->format) == 1);
/* map the stencil buffer */
drawMap = screen->transfer_map(screen, ptDraw);
@@ -878,7 +878,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
dst = drawMap + y * ptDraw->stride;
src = buffer + i * width;
- switch (ptDraw->format) {
+ switch (ptDraw->texture->format) {
case PIPE_FORMAT_S8Z24_UNORM:
{
uint *dst4 = (uint *) dst;
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 659a6c9193..ead8e22888 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -98,16 +98,14 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
strb->defined = GL_FALSE; /* undefined contents now */
if(strb->software) {
- struct pipe_format_block block;
size_t size;
_mesa_free(strb->data);
assert(strb->format != PIPE_FORMAT_NONE);
- pf_get_block(strb->format, &block);
- strb->stride = pf_get_stride(&block, width);
- size = pf_get_2d_size(&block, strb->stride, height);
+ strb->stride = pf_get_stride(strb->format, width);
+ size = pf_get_2d_size(strb->format, strb->stride, height);
strb->data = _mesa_malloc(size);
@@ -127,7 +125,6 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
memset(&template, 0, sizeof(template));
template.target = PIPE_TEXTURE_2D;
template.format = format;
- pf_get_block(format, &template.block);
template.width0 = width;
template.height0 = height;
template.depth0 = 1;
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 103861d6f9..6fa7bb64f2 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -103,7 +103,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
}
/* get stencil (and Z) values */
- switch (pt->format) {
+ switch (pt->texture->format) {
case PIPE_FORMAT_S8_UNORM:
{
const ubyte *src = stmap + srcY * pt->stride;
@@ -431,8 +431,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
const GLint dstStride = _mesa_image_row_stride(&clippedPacking, width,
format, type);
- if (trans->format == PIPE_FORMAT_S8Z24_UNORM ||
- trans->format == PIPE_FORMAT_X8Z24_UNORM) {
+ if (trans->texture->format == PIPE_FORMAT_S8Z24_UNORM ||
+ trans->texture->format == PIPE_FORMAT_X8Z24_UNORM) {
if (format == GL_DEPTH_COMPONENT) {
for (i = 0; i < height; i++) {
GLuint ztemp[MAX_WIDTH];
@@ -463,8 +463,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
}
}
- else if (trans->format == PIPE_FORMAT_Z24S8_UNORM ||
- trans->format == PIPE_FORMAT_Z24X8_UNORM) {
+ else if (trans->texture->format == PIPE_FORMAT_Z24S8_UNORM ||
+ trans->texture->format == PIPE_FORMAT_Z24X8_UNORM) {
if (format == GL_DEPTH_COMPONENT) {
for (i = 0; i < height; i++) {
GLuint ztemp[MAX_WIDTH];
@@ -490,7 +490,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
}
}
- else if (trans->format == PIPE_FORMAT_Z16_UNORM) {
+ else if (trans->texture->format == PIPE_FORMAT_Z16_UNORM) {
for (i = 0; i < height; i++) {
GLushort ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
@@ -505,7 +505,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
dst += dstStride;
}
}
- else if (trans->format == PIPE_FORMAT_Z32_UNORM) {
+ else if (trans->texture->format == PIPE_FORMAT_Z32_UNORM) {
for (i = 0; i < height; i++) {
GLuint ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 3a2337802f..6d136f5abf 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -405,7 +405,6 @@ compress_with_blit(GLcontext * ctx,
memset(&templ, 0, sizeof(templ));
templ.target = PIPE_TEXTURE_2D;
templ.format = st_mesa_format_to_pipe_format(mesa_format);
- pf_get_block(templ.format, &templ.block);
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
@@ -833,7 +832,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
/* copy/pack data into user buffer */
if (st_equal_formats(stImage->pt->format, format, type)) {
/* memcpy */
- const uint bytesPerRow = width * pf_get_size(stImage->pt->format);
+ const uint bytesPerRow = width * pf_get_blocksize(stImage->pt->format);
ubyte *map = screen->transfer_map(screen, tex_xfer);
GLuint row;
for (row = 0; row < height; row++) {
@@ -915,7 +914,7 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
PIPE_TRANSFER_READ, 0, 0,
stImage->base.Width,
stImage->base.Height);
- texImage->RowStride = stImage->transfer->stride / stImage->pt->block.size;
+ texImage->RowStride = stImage->transfer->stride / pf_get_blocksize(stImage->pt->format);
}
else {
/* Otherwise, the image should actually be stored in
@@ -1163,10 +1162,10 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_image *texImage)
{
struct st_texture_image *stImage = st_texture_image(texImage);
- struct pipe_format_block block;
int srcBlockStride;
int dstBlockStride;
int y;
+ enum pipe_format pformat= stImage->pt->format;
if (stImage->pt) {
unsigned face = _mesa_tex_target_to_face(target);
@@ -1178,8 +1177,7 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
xoffset, yoffset,
width, height);
- block = stImage->pt->block;
- srcBlockStride = pf_get_stride(&block, width);
+ srcBlockStride = pf_get_stride(pformat, width);
dstBlockStride = stImage->transfer->stride;
} else {
assert(stImage->pt);
@@ -1193,16 +1191,16 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
return;
}
- assert(xoffset % block.width == 0);
- assert(yoffset % block.height == 0);
- assert(width % block.width == 0);
- assert(height % block.height == 0);
+ assert(xoffset % pf_get_blockwidth(pformat) == 0);
+ assert(yoffset % pf_get_blockheight(pformat) == 0);
+ assert(width % pf_get_blockwidth(pformat) == 0);
+ assert(height % pf_get_blockheight(pformat) == 0);
- for (y = 0; y < height; y += block.height) {
+ for (y = 0; y < height; y += pf_get_blockheight(pformat)) {
/* don't need to adjust for xoffset and yoffset as st_texture_image_map does that */
- const char *src = (const char*)data + srcBlockStride * pf_get_nblocksy(&block, y);
- char *dst = (char*)texImage->Data + dstBlockStride * pf_get_nblocksy(&block, y);
- memcpy(dst, src, pf_get_stride(&block, width));
+ const char *src = (const char*)data + srcBlockStride * pf_get_nblocksy(pformat, y);
+ char *dst = (char*)texImage->Data + dstBlockStride * pf_get_nblocksy(pformat, y);
+ memcpy(dst, src, pf_get_stride(pformat, width));
}
if (stImage->pt) {
@@ -1692,10 +1690,10 @@ copy_image_data_to_texture(struct st_context *st,
dstLevel,
stImage->base.Data,
stImage->base.RowStride *
- stObj->pt->block.size,
+ pf_get_blocksize(stObj->pt->format),
stImage->base.RowStride *
stImage->base.Height *
- stObj->pt->block.size);
+ pf_get_blocksize(stObj->pt->format));
_mesa_align_free(stImage->base.Data);
stImage->base.Data = NULL;
}
@@ -1763,8 +1761,7 @@ st_finalize_texture(GLcontext *ctx,
stObj->pt->last_level < stObj->lastLevel ||
stObj->pt->width0 != firstImage->base.Width2 ||
stObj->pt->height0 != firstImage->base.Height2 ||
- stObj->pt->depth0 != firstImage->base.Depth2 ||
- stObj->pt->block.size != blockSize)
+ stObj->pt->depth0 != firstImage->base.Depth2)
{
pipe_texture_reference(&stObj->pt, NULL);
ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER;
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index f8068fa12b..7700551830 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -146,8 +146,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
srcData = (ubyte *) screen->transfer_map(screen, srcTrans);
dstData = (ubyte *) screen->transfer_map(screen, dstTrans);
- srcStride = srcTrans->stride / srcTrans->block.size;
- dstStride = dstTrans->stride / dstTrans->block.size;
+ srcStride = srcTrans->stride / pf_get_blocksize(srcTrans->texture->format);
+ dstStride = dstTrans->stride / pf_get_blocksize(dstTrans->texture->format);
_mesa_generate_mipmap_level(target, datatype, comps,
0 /*border*/,
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index dbccee86c1..3035d78b61 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -104,7 +104,6 @@ st_texture_create(struct st_context *st,
pt.width0 = width0;
pt.height0 = height0;
pt.depth0 = depth0;
- pf_get_block(format, &pt.block);
pt.tex_usage = usage;
newtex = screen->texture_create(screen, &pt);
@@ -242,8 +241,9 @@ st_surface_data(struct pipe_context *pipe,
struct pipe_screen *screen = pipe->screen;
void *map = screen->transfer_map(screen, dst);
+ assert(dst->texture);
util_copy_rect(map,
- &dst->block,
+ dst->texture->format,
dst->stride,
dstx, dsty,
width, height,