Move the remaining format pf_get_* functions to u_format.h.
Previously they depended on format blocks, but after removing those they started depending on format encoding.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_format.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_network.h"
|
||||
@@ -54,10 +55,7 @@ static void dump(unsigned width, unsigned height,
|
||||
unsigned src_stride, enum pipe_format src_format,
|
||||
uint8_t *data, unsigned src_size)
|
||||
{
|
||||
struct pipe_format_block src_block;
|
||||
|
||||
enum pipe_format dst_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
|
||||
struct pipe_format_block dst_block;
|
||||
unsigned dst_stride;
|
||||
unsigned dst_size;
|
||||
float *rgba;
|
||||
@@ -65,14 +63,11 @@ static void dump(unsigned width, unsigned height,
|
||||
char filename[512];
|
||||
|
||||
{
|
||||
pf_get_block(src_format, &src_block);
|
||||
assert(src_stride >= pf_get_stride(&src_block, width));
|
||||
assert(src_size >= pf_get_2d_size(&src_block, src_stride, width));
|
||||
assert(src_stride >= util_format_get_stride(src_format, width));
|
||||
}
|
||||
{
|
||||
pf_get_block(dst_format, &dst_block);
|
||||
dst_stride = pf_get_stride(&dst_block, width);
|
||||
dst_size = pf_get_2d_size(&dst_block, dst_stride, width);
|
||||
dst_stride = util_format_get_stride(dst_format, width);
|
||||
dst_size = util_format_get_2d_size(dst_format, dst_stride, width);
|
||||
rgba = MALLOC(dst_size);
|
||||
}
|
||||
|
||||
|
@@ -579,8 +579,8 @@ void util_blitter_copy(struct blitter_context *blitter,
|
||||
if (!dst->texture || !src->texture)
|
||||
return;
|
||||
|
||||
is_depth = pf_get_component_bits(src->format, PIPE_FORMAT_COMP_Z) != 0;
|
||||
is_stencil = pf_get_component_bits(src->format, PIPE_FORMAT_COMP_S) != 0;
|
||||
is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0;
|
||||
is_stencil = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 1) != 0;
|
||||
dst_tex_usage = is_depth || is_stencil ? PIPE_TEXTURE_USAGE_DEPTH_STENCIL :
|
||||
PIPE_TEXTURE_USAGE_RENDER_TARGET;
|
||||
|
||||
|
@@ -64,6 +64,7 @@
|
||||
#include "pipe/p_format.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_string.h"
|
||||
#include "util/u_stream.h"
|
||||
@@ -670,9 +671,9 @@ void debug_dump_surface(const char *prefix,
|
||||
|
||||
debug_dump_image(prefix,
|
||||
texture->format,
|
||||
pf_get_blocksize(texture->format),
|
||||
pf_get_nblocksx(texture->format, transfer->width),
|
||||
pf_get_nblocksy(texture->format, transfer->height),
|
||||
util_format_get_blocksize(texture->format),
|
||||
util_format_get_nblocksx(texture->format, transfer->width),
|
||||
util_format_get_nblocksy(texture->format, transfer->height),
|
||||
transfer->stride,
|
||||
data);
|
||||
|
||||
|
@@ -200,7 +200,7 @@ util_format_is_depth_and_stencil(enum pipe_format format)
|
||||
* Return total bits needed for the pixel format.
|
||||
*/
|
||||
static INLINE uint
|
||||
util_format_get_bits(enum pipe_format format)
|
||||
util_format_get_blocksizebits(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
|
||||
@@ -216,15 +216,92 @@ util_format_get_bits(enum pipe_format format)
|
||||
* Return bytes per pixel for the given format.
|
||||
*/
|
||||
static INLINE uint
|
||||
util_format_get_size(enum pipe_format format)
|
||||
util_format_get_blocksize(enum pipe_format format)
|
||||
{
|
||||
uint bits = util_format_get_bits(format);
|
||||
uint bits = util_format_get_blocksizebits(format);
|
||||
|
||||
assert(bits % 8 == 0);
|
||||
|
||||
return bits / 8;
|
||||
}
|
||||
|
||||
static INLINE uint
|
||||
util_format_get_blockwidth(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
|
||||
assert(format);
|
||||
if (!format) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (desc->layout) {
|
||||
case UTIL_FORMAT_LAYOUT_YUV:
|
||||
return 2;
|
||||
case UTIL_FORMAT_LAYOUT_DXT:
|
||||
return 4;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE uint
|
||||
util_format_get_blockheight(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
|
||||
assert(format);
|
||||
if (!format) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (desc->layout) {
|
||||
case UTIL_FORMAT_LAYOUT_DXT:
|
||||
return 4;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE unsigned
|
||||
util_format_get_nblocksx(enum pipe_format format,
|
||||
unsigned x)
|
||||
{
|
||||
unsigned blockwidth = util_format_get_blockwidth(format);
|
||||
return (x + blockwidth - 1) / blockwidth;
|
||||
}
|
||||
|
||||
static INLINE unsigned
|
||||
util_format_get_nblocksy(enum pipe_format format,
|
||||
unsigned y)
|
||||
{
|
||||
unsigned blockheight = util_format_get_blockheight(format);
|
||||
return (y + blockheight - 1) / blockheight;
|
||||
}
|
||||
|
||||
static INLINE unsigned
|
||||
util_format_get_nblocks(enum pipe_format format,
|
||||
unsigned width,
|
||||
unsigned height)
|
||||
{
|
||||
return util_format_get_nblocksx(format, width) * util_format_get_nblocksy(format, height);
|
||||
}
|
||||
|
||||
static INLINE size_t
|
||||
util_format_get_stride(enum pipe_format format,
|
||||
unsigned width)
|
||||
{
|
||||
return util_format_get_nblocksx(format, width) * util_format_get_blocksize(format);
|
||||
}
|
||||
|
||||
static INLINE size_t
|
||||
util_format_get_2d_size(enum pipe_format format,
|
||||
size_t stride,
|
||||
unsigned height)
|
||||
{
|
||||
return util_format_get_nblocksy(format, height) * stride;
|
||||
}
|
||||
|
||||
static INLINE uint
|
||||
util_format_get_component_bits(enum pipe_format format,
|
||||
enum util_format_colorspace colorspace,
|
||||
|
@@ -998,7 +998,7 @@ reduce_2d(enum pipe_format pformat,
|
||||
{
|
||||
enum dtype datatype;
|
||||
uint comps;
|
||||
const int bpt = util_format_get_size(pformat);
|
||||
const int bpt = util_format_get_blocksize(pformat);
|
||||
const ubyte *srcA, *srcB;
|
||||
ubyte *dst;
|
||||
int row;
|
||||
@@ -1037,7 +1037,7 @@ reduce_3d(enum pipe_format pformat,
|
||||
int dstWidth, int dstHeight, int dstDepth,
|
||||
int dstRowStride, ubyte *dstPtr)
|
||||
{
|
||||
const int bpt = util_format_get_size(pformat);
|
||||
const int bpt = util_format_get_blocksize(pformat);
|
||||
const int border = 0;
|
||||
int img, row;
|
||||
int bytesPerSrcImage, bytesPerDstImage;
|
||||
@@ -1161,8 +1161,8 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
|
||||
const uint zslice = 0;
|
||||
uint dstLevel;
|
||||
|
||||
assert(pf_get_blockwidth(pt->format) == 1);
|
||||
assert(pf_get_blockheight(pt->format) == 1);
|
||||
assert(util_format_get_blockwidth(pt->format) == 1);
|
||||
assert(util_format_get_blockheight(pt->format) == 1);
|
||||
|
||||
for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
|
||||
const uint srcLevel = dstLevel - 1;
|
||||
@@ -1206,8 +1206,8 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
|
||||
struct pipe_screen *screen = pipe->screen;
|
||||
uint dstLevel, zslice = 0;
|
||||
|
||||
assert(pf_get_blockwidth(pt->format) == 1);
|
||||
assert(pf_get_blockheight(pt->format) == 1);
|
||||
assert(util_format_get_blockwidth(pt->format) == 1);
|
||||
assert(util_format_get_blockheight(pt->format) == 1);
|
||||
|
||||
for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
|
||||
const uint srcLevel = dstLevel - 1;
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "pipe/p_format.h"
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_screen.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_rect.h"
|
||||
|
||||
|
||||
@@ -57,9 +58,9 @@ 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);
|
||||
int blocksize = util_format_get_blocksize(format);
|
||||
int blockwidth = util_format_get_blockwidth(format);
|
||||
int blockheight = util_format_get_blockheight(format);
|
||||
|
||||
assert(blocksize > 0);
|
||||
assert(blockwidth > 0);
|
||||
@@ -105,9 +106,9 @@ 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);
|
||||
int blocksize = util_format_get_blocksize(format);
|
||||
int blockwidth = util_format_get_blockwidth(format);
|
||||
int blockheight = util_format_get_blockheight(format);
|
||||
|
||||
assert(blocksize > 0);
|
||||
assert(blockwidth > 0);
|
||||
@@ -203,9 +204,9 @@ util_surface_copy(struct pipe_context *pipe,
|
||||
PIPE_TRANSFER_WRITE,
|
||||
dst_x, dst_y, w, h);
|
||||
|
||||
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));
|
||||
assert(util_format_get_blocksize(dst_format) == util_format_get_blocksize(src_format));
|
||||
assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format));
|
||||
assert(util_format_get_blockheight(dst_format) == util_format_get_blockheight(src_format));
|
||||
|
||||
src_map = pipe->screen->transfer_map(screen, src_trans);
|
||||
dst_map = pipe->screen->transfer_map(screen, dst_trans);
|
||||
@@ -270,7 +271,7 @@ util_surface_fill(struct pipe_context *pipe,
|
||||
if (dst_map) {
|
||||
assert(dst_trans->stride > 0);
|
||||
|
||||
switch (pf_get_blocksize(dst_trans->texture->format)) {
|
||||
switch (util_format_get_blocksize(dst_trans->texture->format)) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_rect.h"
|
||||
@@ -52,7 +53,7 @@ pipe_get_tile_raw(struct pipe_transfer *pt,
|
||||
const void *src;
|
||||
|
||||
if (dst_stride == 0)
|
||||
dst_stride = pf_get_stride(pt->texture->format, w);
|
||||
dst_stride = util_format_get_stride(pt->texture->format, w);
|
||||
|
||||
if (pipe_clip_tile(x, y, &w, &h, pt))
|
||||
return;
|
||||
@@ -81,7 +82,7 @@ pipe_put_tile_raw(struct pipe_transfer *pt,
|
||||
enum pipe_format format = pt->texture->format;
|
||||
|
||||
if (src_stride == 0)
|
||||
src_stride = pf_get_stride(format, w);
|
||||
src_stride = util_format_get_stride(format, w);
|
||||
|
||||
if (pipe_clip_tile(x, y, &w, &h, pt))
|
||||
return;
|
||||
@@ -1275,7 +1276,7 @@ pipe_get_tile_rgba(struct pipe_transfer *pt,
|
||||
if (pipe_clip_tile(x, y, &w, &h, pt))
|
||||
return;
|
||||
|
||||
packed = MALLOC(pf_get_nblocks(format, w, h) * pf_get_blocksize(format));
|
||||
packed = MALLOC(util_format_get_nblocks(format, w, h) * util_format_get_blocksize(format));
|
||||
|
||||
if (!packed)
|
||||
return;
|
||||
@@ -1303,7 +1304,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
|
||||
if (pipe_clip_tile(x, y, &w, &h, pt))
|
||||
return;
|
||||
|
||||
packed = MALLOC(pf_get_nblocks(format, w, h) * pf_get_blocksize(format));
|
||||
packed = MALLOC(util_format_get_nblocks(format, w, h) * util_format_get_blocksize(format));
|
||||
|
||||
if (!packed)
|
||||
return;
|
||||
|
@@ -1444,7 +1444,7 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby,
|
||||
assert(r);
|
||||
assert(blocks);
|
||||
|
||||
tex_pitch = r->tex_transfer[0]->stride / pf_get_blocksize(r->tex_transfer[0]->texture->format);
|
||||
tex_pitch = r->tex_transfer[0]->stride / util_format_get_blocksize(r->tex_transfer[0]->texture->format);
|
||||
texels = r->texels[0] + mbpy * tex_pitch + mbpx;
|
||||
|
||||
for (y = 0; y < 2; ++y) {
|
||||
@@ -1483,7 +1483,7 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby,
|
||||
mbpy /= 2;
|
||||
|
||||
for (tb = 0; tb < 2; ++tb) {
|
||||
tex_pitch = r->tex_transfer[tb + 1]->stride / pf_get_blocksize(r->tex_transfer[tb + 1]->texture->format);
|
||||
tex_pitch = r->tex_transfer[tb + 1]->stride / util_format_get_blocksize(r->tex_transfer[tb + 1]->texture->format);
|
||||
texels = r->texels[tb + 1] + mbpy * tex_pitch + mbpx;
|
||||
|
||||
if ((cbp >> (1 - tb)) & 1) {
|
||||
|
@@ -67,11 +67,11 @@ cell_texture_layout(struct cell_texture *ct)
|
||||
w_tile = align(width, TILE_SIZE);
|
||||
h_tile = align(height, TILE_SIZE);
|
||||
|
||||
ct->stride[level] = pf_get_stride(pt->format, w_tile);
|
||||
ct->stride[level] = util_format_get_stride(pt->format, w_tile);
|
||||
|
||||
ct->level_offset[level] = ct->buffer_size;
|
||||
|
||||
size = ct->stride[level] * pf_get_nblocksy(pt->format, h_tile);
|
||||
size = ct->stride[level] * util_format_get_nblocksy(pt->format, h_tile);
|
||||
if (pt->target == PIPE_TEXTURE_CUBE)
|
||||
size *= 6;
|
||||
else
|
||||
@@ -283,11 +283,11 @@ cell_get_tex_surface(struct pipe_screen *screen,
|
||||
|
||||
if (pt->target == PIPE_TEXTURE_CUBE) {
|
||||
unsigned h_tile = align(ps->height, TILE_SIZE);
|
||||
ps->offset += face * pf_get_nblocksy(ps->format, h_tile) * ct->stride[level];
|
||||
ps->offset += face * util_format_get_nblocksy(ps->format, h_tile) * ct->stride[level];
|
||||
}
|
||||
else if (pt->target == PIPE_TEXTURE_3D) {
|
||||
unsigned h_tile = align(ps->height, TILE_SIZE);
|
||||
ps->offset += zslice * pf_get_nblocksy(ps->format, h_tile) * ct->stride[level];
|
||||
ps->offset += zslice * util_format_get_nblocksy(ps->format, h_tile) * ct->stride[level];
|
||||
}
|
||||
else {
|
||||
assert(face == 0);
|
||||
@@ -342,11 +342,11 @@ cell_get_tex_transfer(struct pipe_screen *screen,
|
||||
|
||||
if (texture->target == PIPE_TEXTURE_CUBE) {
|
||||
unsigned h_tile = align(u_minify(texture->height0, level), TILE_SIZE);
|
||||
ctrans->offset += face * pf_get_nblocksy(texture->format, h_tile) * pt->stride;
|
||||
ctrans->offset += face * util_format_get_nblocksy(texture->format, h_tile) * pt->stride;
|
||||
}
|
||||
else if (texture->target == PIPE_TEXTURE_3D) {
|
||||
unsigned h_tile = align(u_minify(texture->height0, level), TILE_SIZE);
|
||||
ctrans->offset += zslice * pf_get_nblocksy(texture->format, h_tile) * pt->stride;
|
||||
ctrans->offset += zslice * util_format_get_nblocksy(texture->format, h_tile) * pt->stride;
|
||||
}
|
||||
else {
|
||||
assert(face == 0);
|
||||
@@ -399,8 +399,8 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer)
|
||||
* Create a buffer of ordinary memory for the linear texture.
|
||||
* This is the memory that the user will read/write.
|
||||
*/
|
||||
size = pf_get_stride(pt->format, align(texWidth, TILE_SIZE)) *
|
||||
pf_get_nblocksy(pt->format, align(texHeight, TILE_SIZE));
|
||||
size = util_format_get_stride(pt->format, align(texWidth, TILE_SIZE)) *
|
||||
util_format_get_nblocksy(pt->format, align(texHeight, TILE_SIZE));
|
||||
|
||||
ctrans->map = align_malloc(size, 16);
|
||||
if (!ctrans->map)
|
||||
@@ -408,7 +408,7 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer)
|
||||
|
||||
if (transfer->usage & PIPE_TRANSFER_READ) {
|
||||
/* need to untwiddle the texture to make a linear version */
|
||||
const uint bpp = util_format_get_size(ct->base.format);
|
||||
const uint bpp = util_format_get_blocksize(ct->base.format);
|
||||
if (bpp == 4) {
|
||||
const uint *src = (uint *) (ct->mapped + ctrans->offset);
|
||||
uint *dst = ctrans->map;
|
||||
@@ -451,7 +451,7 @@ cell_transfer_unmap(struct pipe_screen *screen,
|
||||
/* The user wrote new texture data into the mapped buffer.
|
||||
* We need to convert the new linear data into the twiddled/tiled format.
|
||||
*/
|
||||
const uint bpp = util_format_get_size(ct->base.format);
|
||||
const uint bpp = util_format_get_blocksize(ct->base.format);
|
||||
if (bpp == 4) {
|
||||
const uint *src = ctrans->map;
|
||||
uint *dst = (uint *) (ct->mapped + ctrans->offset);
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "pipe/internal/p_winsys_screen.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_tile.h"
|
||||
#include "util/u_rect.h"
|
||||
|
||||
@@ -52,15 +53,15 @@ i915_surface_copy(struct pipe_context *pipe,
|
||||
struct pipe_texture *spt = &src_tex->base;
|
||||
|
||||
assert( dst != src );
|
||||
assert( pf_get_blocksize(dpt->format) == pf_get_blocksize(spt->format) );
|
||||
assert( pf_get_blockwidth(dpt->format) == pf_get_blockwidth(spt->format) );
|
||||
assert( pf_get_blockheight(dpt->format) == pf_get_blockheight(spt->format) );
|
||||
assert( pf_get_blockwidth(dpt->format) == 1 );
|
||||
assert( pf_get_blockheight(dpt->format) == 1 );
|
||||
assert( util_format_get_blocksize(dpt->format) == util_format_get_blocksize(spt->format) );
|
||||
assert( util_format_get_blockwidth(dpt->format) == util_format_get_blockwidth(spt->format) );
|
||||
assert( util_format_get_blockheight(dpt->format) == util_format_get_blockheight(spt->format) );
|
||||
assert( util_format_get_blockwidth(dpt->format) == 1 );
|
||||
assert( util_format_get_blockheight(dpt->format) == 1 );
|
||||
|
||||
i915_copy_blit( i915_context(pipe),
|
||||
FALSE,
|
||||
pf_get_blocksize(dpt->format),
|
||||
util_format_get_blocksize(dpt->format),
|
||||
(unsigned short) src_tex->stride, src_tex->buffer, src->offset,
|
||||
(unsigned short) dst_tex->stride, dst_tex->buffer, dst->offset,
|
||||
(short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height );
|
||||
@@ -76,11 +77,11 @@ i915_surface_fill(struct pipe_context *pipe,
|
||||
struct i915_texture *tex = (struct i915_texture *)dst->texture;
|
||||
struct pipe_texture *pt = &tex->base;
|
||||
|
||||
assert(pf_get_blockwidth(pt->format) == 1);
|
||||
assert(pf_get_blockheight(pt->format) == 1);
|
||||
assert(util_format_get_blockwidth(pt->format) == 1);
|
||||
assert(util_format_get_blockheight(pt->format) == 1);
|
||||
|
||||
i915_fill_blit( i915_context(pipe),
|
||||
pf_get_blocksize(pt->format),
|
||||
util_format_get_blocksize(pt->format),
|
||||
(unsigned short) tex->stride,
|
||||
tex->buffer, dst->offset,
|
||||
(short) dstx, (short) dsty,
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "pipe/internal/p_winsys_screen.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
@@ -129,7 +130,7 @@ i915_miptree_set_image_offset(struct i915_texture *tex,
|
||||
|
||||
assert(img < tex->nr_images[level]);
|
||||
|
||||
tex->image_offset[level][img] = y * tex->stride + x * pf_get_blocksize(tex->base.format);
|
||||
tex->image_offset[level][img] = y * tex->stride + x * util_format_get_blocksize(tex->base.format);
|
||||
|
||||
/*
|
||||
printf("%s level %d img %d pos %d,%d image_offset %x\n",
|
||||
@@ -151,7 +152,7 @@ i915_scanout_layout(struct i915_texture *tex)
|
||||
{
|
||||
struct pipe_texture *pt = &tex->base;
|
||||
|
||||
if (pt->last_level > 0 || pf_get_blocksize(pt->format) != 4)
|
||||
if (pt->last_level > 0 || util_format_get_blocksize(pt->format) != 4)
|
||||
return FALSE;
|
||||
|
||||
i915_miptree_set_level_info(tex, 0, 1,
|
||||
@@ -161,18 +162,18 @@ i915_scanout_layout(struct i915_texture *tex)
|
||||
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
|
||||
|
||||
if (pt->width0 >= 240) {
|
||||
tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0));
|
||||
tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8);
|
||||
tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
|
||||
tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8);
|
||||
tex->hw_tiled = INTEL_TILE_X;
|
||||
} else if (pt->width0 == 64 && pt->height0 == 64) {
|
||||
tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0));
|
||||
tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8);
|
||||
tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
|
||||
tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
|
||||
pt->width0, pt->height0, pf_get_blocksize(pt->format),
|
||||
pt->width0, pt->height0, util_format_get_blocksize(pt->format),
|
||||
tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
|
||||
|
||||
return TRUE;
|
||||
@@ -186,7 +187,7 @@ i915_display_target_layout(struct i915_texture *tex)
|
||||
{
|
||||
struct pipe_texture *pt = &tex->base;
|
||||
|
||||
if (pt->last_level > 0 || pf_get_blocksize(pt->format) != 4)
|
||||
if (pt->last_level > 0 || util_format_get_blocksize(pt->format) != 4)
|
||||
return FALSE;
|
||||
|
||||
/* fallback to normal textures for small textures */
|
||||
@@ -199,12 +200,12 @@ i915_display_target_layout(struct i915_texture *tex)
|
||||
1);
|
||||
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
|
||||
|
||||
tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0));
|
||||
tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8);
|
||||
tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
|
||||
tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8);
|
||||
tex->hw_tiled = INTEL_TILE_X;
|
||||
|
||||
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
|
||||
pt->width0, pt->height0, pf_get_blocksize(pt->format),
|
||||
pt->width0, pt->height0, util_format_get_blocksize(pt->format),
|
||||
tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
|
||||
|
||||
return TRUE;
|
||||
@@ -217,7 +218,7 @@ i915_miptree_layout_2d(struct i915_texture *tex)
|
||||
unsigned level;
|
||||
unsigned width = pt->width0;
|
||||
unsigned height = pt->height0;
|
||||
unsigned nblocksy = pf_get_nblocksy(pt->format, pt->width0);
|
||||
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->width0);
|
||||
|
||||
/* used for scanouts that need special layouts */
|
||||
if (pt->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
|
||||
@@ -229,7 +230,7 @@ i915_miptree_layout_2d(struct i915_texture *tex)
|
||||
if (i915_display_target_layout(tex))
|
||||
return;
|
||||
|
||||
tex->stride = align(pf_get_stride(pt->format, pt->width0), 4);
|
||||
tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4);
|
||||
tex->total_nblocksy = 0;
|
||||
|
||||
for (level = 0; level <= pt->last_level; level++) {
|
||||
@@ -242,7 +243,7 @@ i915_miptree_layout_2d(struct i915_texture *tex)
|
||||
|
||||
width = u_minify(width, 1);
|
||||
height = u_minify(height, 1);
|
||||
nblocksy = pf_get_nblocksy(pt->format, height);
|
||||
nblocksy = util_format_get_nblocksy(pt->format, height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,12 +256,12 @@ i915_miptree_layout_3d(struct i915_texture *tex)
|
||||
unsigned width = pt->width0;
|
||||
unsigned height = pt->height0;
|
||||
unsigned depth = pt->depth0;
|
||||
unsigned nblocksy = pf_get_nblocksy(pt->format, pt->height0);
|
||||
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->height0);
|
||||
unsigned stack_nblocksy = 0;
|
||||
|
||||
/* Calculate the size of a single slice.
|
||||
*/
|
||||
tex->stride = align(pf_get_stride(pt->format, pt->width0), 4);
|
||||
tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4);
|
||||
|
||||
/* XXX: hardware expects/requires 9 levels at minimum.
|
||||
*/
|
||||
@@ -271,7 +272,7 @@ i915_miptree_layout_3d(struct i915_texture *tex)
|
||||
|
||||
width = u_minify(width, 1);
|
||||
height = u_minify(height, 1);
|
||||
nblocksy = pf_get_nblocksy(pt->format, height);
|
||||
nblocksy = util_format_get_nblocksy(pt->format, height);
|
||||
}
|
||||
|
||||
/* Fixup depth image_offsets:
|
||||
@@ -296,14 +297,14 @@ i915_miptree_layout_cube(struct i915_texture *tex)
|
||||
{
|
||||
struct pipe_texture *pt = &tex->base;
|
||||
unsigned width = pt->width0, height = pt->height0;
|
||||
const unsigned nblocks = pf_get_nblocksx(pt->format, pt->width0);
|
||||
const unsigned nblocks = util_format_get_nblocksx(pt->format, pt->width0);
|
||||
unsigned level;
|
||||
unsigned face;
|
||||
|
||||
assert(width == height); /* cubemap images are square */
|
||||
|
||||
/* double pitch for cube layouts */
|
||||
tex->stride = align(nblocks * pf_get_blocksize(pt->format) * 2, 4);
|
||||
tex->stride = align(nblocks * util_format_get_blocksize(pt->format) * 2, 4);
|
||||
tex->total_nblocksy = nblocks * 4;
|
||||
|
||||
for (level = 0; level <= pt->last_level; level++) {
|
||||
@@ -366,8 +367,8 @@ i945_miptree_layout_2d(struct i915_texture *tex)
|
||||
unsigned y = 0;
|
||||
unsigned width = pt->width0;
|
||||
unsigned height = pt->height0;
|
||||
unsigned nblocksx = pf_get_nblocksx(pt->format, pt->width0);
|
||||
unsigned nblocksy = pf_get_nblocksy(pt->format, pt->height0);
|
||||
unsigned nblocksx = util_format_get_nblocksx(pt->format, pt->width0);
|
||||
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->height0);
|
||||
|
||||
/* used for scanouts that need special layouts */
|
||||
if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
|
||||
@@ -379,7 +380,7 @@ i945_miptree_layout_2d(struct i915_texture *tex)
|
||||
if (i915_display_target_layout(tex))
|
||||
return;
|
||||
|
||||
tex->stride = align(pf_get_stride(pt->format, pt->width0), 4);
|
||||
tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4);
|
||||
|
||||
/* May need to adjust pitch to accomodate the placement of
|
||||
* the 2nd mipmap level. This occurs when the alignment
|
||||
@@ -388,11 +389,11 @@ i945_miptree_layout_2d(struct i915_texture *tex)
|
||||
*/
|
||||
if (pt->last_level > 0) {
|
||||
unsigned mip1_nblocksx
|
||||
= align(pf_get_nblocksx(pt->format, u_minify(width, 1)), align_x)
|
||||
+ pf_get_nblocksx(pt->format, u_minify(width, 2));
|
||||
= align(util_format_get_nblocksx(pt->format, u_minify(width, 1)), align_x)
|
||||
+ util_format_get_nblocksx(pt->format, u_minify(width, 2));
|
||||
|
||||
if (mip1_nblocksx > nblocksx)
|
||||
tex->stride = mip1_nblocksx * pf_get_blocksize(pt->format);
|
||||
tex->stride = mip1_nblocksx * util_format_get_blocksize(pt->format);
|
||||
}
|
||||
|
||||
/* Pitch must be a whole number of dwords
|
||||
@@ -422,8 +423,8 @@ i945_miptree_layout_2d(struct i915_texture *tex)
|
||||
|
||||
width = u_minify(width, 1);
|
||||
height = u_minify(height, 1);
|
||||
nblocksx = pf_get_nblocksx(pt->format, width);
|
||||
nblocksy = pf_get_nblocksy(pt->format, height);
|
||||
nblocksx = util_format_get_nblocksx(pt->format, width);
|
||||
nblocksy = util_format_get_nblocksy(pt->format, height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,16 +435,16 @@ i945_miptree_layout_3d(struct i915_texture *tex)
|
||||
unsigned width = pt->width0;
|
||||
unsigned height = pt->height0;
|
||||
unsigned depth = pt->depth0;
|
||||
unsigned nblocksy = pf_get_nblocksy(pt->format, pt->width0);
|
||||
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->width0);
|
||||
unsigned pack_x_pitch, pack_x_nr;
|
||||
unsigned pack_y_pitch;
|
||||
unsigned level;
|
||||
|
||||
tex->stride = align(pf_get_stride(pt->format, pt->width0), 4);
|
||||
tex->stride = align(util_format_get_stride(pt->format, pt->width0), 4);
|
||||
tex->total_nblocksy = 0;
|
||||
|
||||
pack_y_pitch = MAX2(nblocksy, 2);
|
||||
pack_x_pitch = tex->stride / pf_get_blocksize(pt->format);
|
||||
pack_x_pitch = tex->stride / util_format_get_blocksize(pt->format);
|
||||
pack_x_nr = 1;
|
||||
|
||||
for (level = 0; level <= pt->last_level; level++) {
|
||||
@@ -468,7 +469,7 @@ i945_miptree_layout_3d(struct i915_texture *tex)
|
||||
if (pack_x_pitch > 4) {
|
||||
pack_x_pitch >>= 1;
|
||||
pack_x_nr <<= 1;
|
||||
assert(pack_x_pitch * pack_x_nr * pf_get_blocksize(pt->format) <= tex->stride);
|
||||
assert(pack_x_pitch * pack_x_nr * util_format_get_blocksize(pt->format) <= tex->stride);
|
||||
}
|
||||
|
||||
if (pack_y_pitch > 2) {
|
||||
@@ -478,7 +479,7 @@ i945_miptree_layout_3d(struct i915_texture *tex)
|
||||
width = u_minify(width, 1);
|
||||
height = u_minify(height, 1);
|
||||
depth = u_minify(depth, 1);
|
||||
nblocksy = pf_get_nblocksy(pt->format, height);
|
||||
nblocksy = util_format_get_nblocksy(pt->format, height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,7 +489,7 @@ i945_miptree_layout_cube(struct i915_texture *tex)
|
||||
struct pipe_texture *pt = &tex->base;
|
||||
unsigned level;
|
||||
|
||||
const unsigned nblocks = pf_get_nblocksx(pt->format, pt->width0);
|
||||
const unsigned nblocks = util_format_get_nblocksx(pt->format, pt->width0);
|
||||
unsigned face;
|
||||
unsigned width = pt->width0;
|
||||
unsigned height = pt->height0;
|
||||
@@ -508,9 +509,9 @@ i945_miptree_layout_cube(struct i915_texture *tex)
|
||||
* or the final row of 4x4, 2x2 and 1x1 faces below this.
|
||||
*/
|
||||
if (nblocks > 32)
|
||||
tex->stride = align(nblocks * pf_get_blocksize(pt->format) * 2, 4);
|
||||
tex->stride = align(nblocks * util_format_get_blocksize(pt->format) * 2, 4);
|
||||
else
|
||||
tex->stride = 14 * 8 * pf_get_blocksize(pt->format);
|
||||
tex->stride = 14 * 8 * util_format_get_blocksize(pt->format);
|
||||
|
||||
tex->total_nblocksy = nblocks * 4;
|
||||
|
||||
@@ -840,8 +841,8 @@ i915_transfer_map(struct pipe_screen *screen,
|
||||
return NULL;
|
||||
|
||||
return map + i915_transfer(transfer)->offset +
|
||||
transfer->y / pf_get_blockheight(format) * transfer->stride +
|
||||
transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format);
|
||||
transfer->y / util_format_get_blockheight(format) * transfer->stride +
|
||||
transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -41,6 +41,7 @@
|
||||
#include "draw/draw_vertex.h"
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "pipe/p_thread.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "lp_bld_debug.h"
|
||||
@@ -166,7 +167,7 @@ shade_quads(struct llvmpipe_context *llvmpipe,
|
||||
assert((y % 2) == 0);
|
||||
depth = llvmpipe->zsbuf_map +
|
||||
y*llvmpipe->zsbuf_transfer->stride +
|
||||
2*x*pf_get_blocksize(llvmpipe->zsbuf_transfer->texture->format);
|
||||
2*x*util_format_get_blocksize(llvmpipe->zsbuf_transfer->texture->format);
|
||||
}
|
||||
else
|
||||
depth = NULL;
|
||||
|
@@ -69,10 +69,10 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
|
||||
|
||||
/* Allocate storage for whole quads. This is particularly important
|
||||
* for depth surfaces, which are currently stored in a swizzled format. */
|
||||
nblocksx = pf_get_nblocksx(pt->format, align(width, 2));
|
||||
nblocksy = pf_get_nblocksy(pt->format, align(height, 2));
|
||||
nblocksx = util_format_get_nblocksx(pt->format, align(width, 2));
|
||||
nblocksy = util_format_get_nblocksy(pt->format, align(height, 2));
|
||||
|
||||
lpt->stride[level] = align(nblocksx * pf_get_blocksize(pt->format), 16);
|
||||
lpt->stride[level] = align(nblocksx * util_format_get_blocksize(pt->format), 16);
|
||||
|
||||
lpt->level_offset[level] = buffer_size;
|
||||
|
||||
@@ -251,11 +251,11 @@ llvmpipe_get_tex_surface(struct pipe_screen *screen,
|
||||
*/
|
||||
if (pt->target == PIPE_TEXTURE_CUBE) {
|
||||
unsigned tex_height = ps->height;
|
||||
ps->offset += face * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
|
||||
ps->offset += face * util_format_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
|
||||
}
|
||||
else if (pt->target == PIPE_TEXTURE_3D) {
|
||||
unsigned tex_height = ps->height;
|
||||
ps->offset += zslice * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
|
||||
ps->offset += zslice * util_format_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
|
||||
}
|
||||
else {
|
||||
assert(face == 0);
|
||||
@@ -314,11 +314,11 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen,
|
||||
*/
|
||||
if (texture->target == PIPE_TEXTURE_CUBE) {
|
||||
unsigned tex_height = u_minify(texture->height0, level);
|
||||
lpt->offset += face * pf_get_nblocksy(texture->format, tex_height) * pt->stride;
|
||||
lpt->offset += face * util_format_get_nblocksy(texture->format, tex_height) * pt->stride;
|
||||
}
|
||||
else if (texture->target == PIPE_TEXTURE_3D) {
|
||||
unsigned tex_height = u_minify(texture->height0, level);
|
||||
lpt->offset += zslice * pf_get_nblocksy(texture->format, tex_height) * pt->stride;
|
||||
lpt->offset += zslice * util_format_get_nblocksy(texture->format, tex_height) * pt->stride;
|
||||
}
|
||||
else {
|
||||
assert(face == 0);
|
||||
@@ -379,8 +379,8 @@ llvmpipe_transfer_map( struct pipe_screen *_screen,
|
||||
}
|
||||
|
||||
xfer_map = map + llvmpipe_transfer(transfer)->offset +
|
||||
transfer->y / pf_get_blockheight(format) * transfer->stride +
|
||||
transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format);
|
||||
transfer->y / util_format_get_blockheight(format) * transfer->stride +
|
||||
transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
|
||||
/*printf("map = %p xfer map = %p\n", map, xfer_map);*/
|
||||
return xfer_map;
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_format.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
@@ -158,10 +159,10 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
|
||||
sub_w = MIN2(sub_w, w - x);
|
||||
|
||||
/* Must be 64-byte aligned */
|
||||
assert(!((dst->offset + nv04_swizzle_bits(dx+x, dy+y) * pf_get_blocksize(dst->texture->format)) & 63));
|
||||
assert(!((dst->offset + nv04_swizzle_bits(dx+x, dy+y) * util_format_get_blocksize(dst->texture->format)) & 63));
|
||||
|
||||
BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1);
|
||||
OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(dx+x, dy+y) * pf_get_blocksize(dst->texture->format),
|
||||
OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(dx+x, dy+y) * util_format_get_blocksize(dst->texture->format),
|
||||
NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
|
||||
|
||||
BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9);
|
||||
@@ -180,7 +181,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
|
||||
OUT_RING (chan, src_pitch |
|
||||
NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER |
|
||||
NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE);
|
||||
OUT_RELOCl(chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) * pf_get_blocksize(src->texture->format),
|
||||
OUT_RELOCl(chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) * util_format_get_blocksize(src->texture->format),
|
||||
NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
OUT_RING (chan, 0);
|
||||
}
|
||||
@@ -201,9 +202,9 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx,
|
||||
unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
|
||||
unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
|
||||
unsigned dst_offset = dst->offset + dy * dst_pitch +
|
||||
dx * pf_get_blocksize(dst->texture->format);
|
||||
dx * util_format_get_blocksize(dst->texture->format);
|
||||
unsigned src_offset = src->offset + sy * src_pitch +
|
||||
sx * pf_get_blocksize(src->texture->format);
|
||||
sx * util_format_get_blocksize(src->texture->format);
|
||||
|
||||
MARK_RING (chan, 3 + ((h / 2047) + 1) * 9, 2 + ((h / 2047) + 1) * 2);
|
||||
BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN, 2);
|
||||
@@ -222,7 +223,7 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx,
|
||||
NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_WR);
|
||||
OUT_RING (chan, src_pitch);
|
||||
OUT_RING (chan, dst_pitch);
|
||||
OUT_RING (chan, w * pf_get_blocksize(src->texture->format));
|
||||
OUT_RING (chan, w * util_format_get_blocksize(src->texture->format));
|
||||
OUT_RING (chan, count);
|
||||
OUT_RING (chan, 0x0101);
|
||||
OUT_RING (chan, 0);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include <pipe/p_state.h>
|
||||
#include <pipe/p_defines.h>
|
||||
#include <pipe/p_inlines.h>
|
||||
#include <util/u_format.h>
|
||||
#include <util/u_memory.h>
|
||||
#include <util/u_math.h>
|
||||
#include <nouveau/nouveau_winsys.h>
|
||||
@@ -151,7 +152,7 @@ nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
|
||||
pipe_transfer_buffer_flags(ptx));
|
||||
|
||||
return map + ns->base.offset +
|
||||
ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format);
|
||||
ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include "nv10_context.h"
|
||||
@@ -23,9 +24,9 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt)
|
||||
|
||||
for (l = 0; l <= pt->last_level; l++) {
|
||||
if (swizzled)
|
||||
nv10mt->level[l].pitch = pf_get_stride(pt->format, width);
|
||||
nv10mt->level[l].pitch = util_format_get_stride(pt->format, width);
|
||||
else
|
||||
nv10mt->level[l].pitch = pf_get_stride(pt->format, pt->width0);
|
||||
nv10mt->level[l].pitch = util_format_get_stride(pt->format, pt->width0);
|
||||
nv10mt->level[l].pitch = (nv10mt->level[l].pitch + 63) & ~63;
|
||||
|
||||
nv10mt->level[l].image_offset =
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include <pipe/p_state.h>
|
||||
#include <pipe/p_defines.h>
|
||||
#include <pipe/p_inlines.h>
|
||||
#include <util/u_format.h>
|
||||
#include <util/u_memory.h>
|
||||
#include <util/u_math.h>
|
||||
#include <nouveau/nouveau_winsys.h>
|
||||
@@ -151,7 +152,7 @@ nv10_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
|
||||
pipe_transfer_buffer_flags(ptx));
|
||||
|
||||
return map + ns->base.offset +
|
||||
ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format);
|
||||
ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include "nv20_context.h"
|
||||
@@ -27,9 +28,9 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt)
|
||||
|
||||
for (l = 0; l <= pt->last_level; l++) {
|
||||
if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
|
||||
nv20mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64);
|
||||
nv20mt->level[l].pitch = align(util_format_get_stride(pt->format, pt->width0), 64);
|
||||
else
|
||||
nv20mt->level[l].pitch = pf_get_stride(pt->format, width);
|
||||
nv20mt->level[l].pitch = util_format_get_stride(pt->format, width);
|
||||
|
||||
nv20mt->level[l].image_offset =
|
||||
CALLOC(nr_faces, sizeof(unsigned));
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include <pipe/p_state.h>
|
||||
#include <pipe/p_defines.h>
|
||||
#include <pipe/p_inlines.h>
|
||||
#include <util/u_format.h>
|
||||
#include <util/u_memory.h>
|
||||
#include <util/u_math.h>
|
||||
#include <nouveau/nouveau_winsys.h>
|
||||
@@ -151,7 +152,7 @@ nv20_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
|
||||
pipe_transfer_buffer_flags(ptx));
|
||||
|
||||
return map + ns->base.offset +
|
||||
ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format);
|
||||
ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include "nv30_context.h"
|
||||
@@ -29,9 +30,9 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt)
|
||||
|
||||
for (l = 0; l <= pt->last_level; l++) {
|
||||
if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
|
||||
nv30mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64);
|
||||
nv30mt->level[l].pitch = align(util_format_get_stride(pt->format, pt->width0), 64);
|
||||
else
|
||||
nv30mt->level[l].pitch = pf_get_stride(pt->format, width);
|
||||
nv30mt->level[l].pitch = util_format_get_stride(pt->format, width);
|
||||
|
||||
nv30mt->level[l].image_offset =
|
||||
CALLOC(nr_faces, sizeof(unsigned));
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include <pipe/p_state.h>
|
||||
#include <pipe/p_defines.h>
|
||||
#include <pipe/p_inlines.h>
|
||||
#include <util/u_format.h>
|
||||
#include <util/u_memory.h>
|
||||
#include <util/u_math.h>
|
||||
#include <nouveau/nouveau_winsys.h>
|
||||
@@ -151,7 +152,7 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
|
||||
pipe_transfer_buffer_flags(ptx));
|
||||
|
||||
return map + ns->base.offset +
|
||||
ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format);
|
||||
ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include "nv40_context.h"
|
||||
@@ -31,9 +32,9 @@ nv40_miptree_layout(struct nv40_miptree *mt)
|
||||
|
||||
for (l = 0; l <= pt->last_level; l++) {
|
||||
if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
|
||||
mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64);
|
||||
mt->level[l].pitch = align(util_format_get_stride(pt->format, pt->width0), 64);
|
||||
else
|
||||
mt->level[l].pitch = pf_get_stride(pt->format, width);
|
||||
mt->level[l].pitch = util_format_get_stride(pt->format, width);
|
||||
|
||||
mt->level[l].image_offset =
|
||||
CALLOC(nr_faces, sizeof(unsigned));
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include <pipe/p_state.h>
|
||||
#include <pipe/p_defines.h>
|
||||
#include <pipe/p_inlines.h>
|
||||
#include <util/u_format.h>
|
||||
#include <util/u_memory.h>
|
||||
#include <util/u_math.h>
|
||||
#include <nouveau/nouveau_winsys.h>
|
||||
@@ -151,7 +152,7 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
|
||||
pipe_transfer_buffer_flags(ptx));
|
||||
|
||||
return map + ns->base.offset +
|
||||
ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format);
|
||||
ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "util/u_format.h"
|
||||
|
||||
#include "nv50_context.h"
|
||||
|
||||
@@ -105,10 +106,10 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
|
||||
|
||||
for (l = 0; l <= pt->last_level; l++) {
|
||||
struct nv50_miptree_level *lvl = &mt->level[l];
|
||||
unsigned nblocksy = pf_get_nblocksy(pt->format, height);
|
||||
unsigned nblocksy = util_format_get_nblocksy(pt->format, height);
|
||||
|
||||
lvl->image_offset = CALLOC(mt->image_nr, sizeof(int));
|
||||
lvl->pitch = align(pf_get_stride(pt->format, width), 64);
|
||||
lvl->pitch = align(util_format_get_stride(pt->format, width), 64);
|
||||
lvl->tile_mode = get_tile_mode(nblocksy, depth);
|
||||
|
||||
width = u_minify(width, 1);
|
||||
@@ -130,7 +131,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
|
||||
unsigned tile_d = get_tile_depth(lvl->tile_mode);
|
||||
|
||||
size = lvl->pitch;
|
||||
size *= align(pf_get_nblocksy(pt->format, u_minify(pt->height0, l)), tile_h);
|
||||
size *= align(util_format_get_nblocksy(pt->format, u_minify(pt->height0, l)), tile_h);
|
||||
size *= align(u_minify(pt->depth0, l), tile_d);
|
||||
|
||||
lvl->image_offset[i] = mt->total_size;
|
||||
@@ -222,7 +223,7 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
|
||||
ps->offset = lvl->image_offset[img];
|
||||
|
||||
if (pt->target == PIPE_TEXTURE_3D) {
|
||||
unsigned nb_h = pf_get_nblocksy(pt->format, ps->height);
|
||||
unsigned nb_h = util_format_get_nblocksy(pt->format, ps->height);
|
||||
ps->offset += get_zslice_offset(lvl->tile_mode, zslice,
|
||||
lvl->pitch, nb_h);
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include "nv50_context.h"
|
||||
@@ -140,11 +141,11 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
|
||||
return NULL;
|
||||
|
||||
pipe_texture_reference(&tx->base.texture, pt);
|
||||
tx->nblocksx = pf_get_nblocksx(pt->format, u_minify(pt->width0, level));
|
||||
tx->nblocksy = pf_get_nblocksy(pt->format, u_minify(pt->height0, level));
|
||||
tx->nblocksx = util_format_get_nblocksx(pt->format, u_minify(pt->width0, level));
|
||||
tx->nblocksy = util_format_get_nblocksy(pt->format, u_minify(pt->height0, level));
|
||||
tx->base.width = w;
|
||||
tx->base.height = h;
|
||||
tx->base.stride = tx->nblocksx * pf_get_blocksize(pt->format);
|
||||
tx->base.stride = tx->nblocksx * util_format_get_blocksize(pt->format);
|
||||
tx->base.usage = usage;
|
||||
|
||||
tx->level_pitch = lvl->pitch;
|
||||
@@ -154,8 +155,8 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
|
||||
tx->level_offset = lvl->image_offset[image];
|
||||
tx->level_tiling = lvl->tile_mode;
|
||||
tx->level_z = zslice;
|
||||
tx->level_x = pf_get_nblocksx(pt->format, x);
|
||||
tx->level_y = pf_get_nblocksy(pt->format, y);
|
||||
tx->level_x = util_format_get_nblocksx(pt->format, x);
|
||||
tx->level_y = util_format_get_nblocksy(pt->format, y);
|
||||
ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0,
|
||||
tx->nblocksy * tx->base.stride, &tx->bo);
|
||||
if (ret) {
|
||||
@@ -164,8 +165,8 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
|
||||
}
|
||||
|
||||
if (usage & PIPE_TRANSFER_READ) {
|
||||
nx = pf_get_nblocksx(pt->format, tx->base.width);
|
||||
ny = pf_get_nblocksy(pt->format, tx->base.height);
|
||||
nx = util_format_get_nblocksx(pt->format, tx->base.width);
|
||||
ny = util_format_get_nblocksy(pt->format, tx->base.height);
|
||||
|
||||
nv50_transfer_rect_m2mf(pscreen, mt->base.bo, tx->level_offset,
|
||||
tx->level_pitch, tx->level_tiling,
|
||||
@@ -176,7 +177,7 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
|
||||
tx->base.stride, tx->bo->tile_mode,
|
||||
0, 0, 0,
|
||||
tx->nblocksx, tx->nblocksy, 1,
|
||||
pf_get_blocksize(pt->format), nx, ny,
|
||||
util_format_get_blocksize(pt->format), nx, ny,
|
||||
NOUVEAU_BO_VRAM | NOUVEAU_BO_GART,
|
||||
NOUVEAU_BO_GART);
|
||||
}
|
||||
@@ -191,8 +192,8 @@ nv50_transfer_del(struct pipe_transfer *ptx)
|
||||
struct nv50_miptree *mt = nv50_miptree(ptx->texture);
|
||||
struct pipe_texture *pt = ptx->texture;
|
||||
|
||||
unsigned nx = pf_get_nblocksx(pt->format, tx->base.width);
|
||||
unsigned ny = pf_get_nblocksy(pt->format, tx->base.height);
|
||||
unsigned nx = util_format_get_nblocksx(pt->format, tx->base.width);
|
||||
unsigned ny = util_format_get_nblocksy(pt->format, tx->base.height);
|
||||
|
||||
if (ptx->usage & PIPE_TRANSFER_WRITE) {
|
||||
struct pipe_screen *pscreen = pt->screen;
|
||||
@@ -206,7 +207,7 @@ nv50_transfer_del(struct pipe_transfer *ptx)
|
||||
tx->level_x, tx->level_y, tx->level_z,
|
||||
tx->nblocksx, tx->nblocksy,
|
||||
tx->level_depth,
|
||||
pf_get_blocksize(pt->format), nx, ny,
|
||||
util_format_get_blocksize(pt->format), nx, ny,
|
||||
NOUVEAU_BO_GART, NOUVEAU_BO_VRAM |
|
||||
NOUVEAU_BO_GART);
|
||||
}
|
||||
|
@@ -657,7 +657,7 @@ static boolean r300_validate_aos(struct r300_context *r300)
|
||||
/* Check if formats and strides are aligned to the size of DWORD. */
|
||||
for (i = 0; i < r300->vertex_element_count; i++) {
|
||||
if (vbuf[velem[i].vertex_buffer_index].stride % 4 != 0 ||
|
||||
pf_get_blocksize(velem[i].src_format) % 4 != 0) {
|
||||
util_format_get_blocksize(velem[i].src_format) % 4 != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -686,8 +686,8 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset)
|
||||
for (i = 0; i < aos_count - 1; i += 2) {
|
||||
vb1 = &vbuf[velem[i].vertex_buffer_index];
|
||||
vb2 = &vbuf[velem[i+1].vertex_buffer_index];
|
||||
size1 = util_format_get_size(velem[i].src_format);
|
||||
size2 = util_format_get_size(velem[i+1].src_format);
|
||||
size1 = util_format_get_blocksize(velem[i].src_format);
|
||||
size2 = util_format_get_blocksize(velem[i+1].src_format);
|
||||
|
||||
OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride) |
|
||||
R300_VBPNTR_SIZE1(size2) | R300_VBPNTR_STRIDE1(vb2->stride));
|
||||
@@ -697,7 +697,7 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset)
|
||||
|
||||
if (aos_count & 1) {
|
||||
vb1 = &vbuf[velem[i].vertex_buffer_index];
|
||||
size1 = util_format_get_size(velem[i].src_format);
|
||||
size1 = util_format_get_blocksize(velem[i].src_format);
|
||||
|
||||
OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride));
|
||||
OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride);
|
||||
|
@@ -21,6 +21,7 @@
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_simple_screen.h"
|
||||
|
||||
@@ -357,8 +358,8 @@ static void* r300_transfer_map(struct pipe_screen* screen,
|
||||
}
|
||||
|
||||
return map + r300_transfer(transfer)->offset +
|
||||
transfer->y / pf_get_blockheight(format) * transfer->stride +
|
||||
transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format);
|
||||
transfer->y / util_format_get_blockheight(format) * transfer->stride +
|
||||
transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
|
||||
}
|
||||
|
||||
static void r300_transfer_unmap(struct pipe_screen* screen,
|
||||
|
@@ -106,7 +106,7 @@ unsigned r300_texture_get_stride(struct r300_texture* tex, unsigned level)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return align(pf_get_stride(tex->tex.format, u_minify(tex->tex.width0, level)), 32);
|
||||
return align(util_format_get_stride(tex->tex.format, u_minify(tex->tex.width0, level)), 32);
|
||||
}
|
||||
|
||||
static void r300_setup_miptree(struct r300_texture* tex)
|
||||
@@ -116,7 +116,7 @@ static void r300_setup_miptree(struct r300_texture* tex)
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= base->last_level; i++) {
|
||||
unsigned nblocksy = pf_get_nblocksy(base->format, u_minify(base->height0, i));
|
||||
unsigned nblocksy = util_format_get_nblocksy(base->format, u_minify(base->height0, i));
|
||||
|
||||
stride = r300_texture_get_stride(tex, i);
|
||||
layer_size = stride * nblocksy;
|
||||
@@ -129,7 +129,7 @@ static void r300_setup_miptree(struct r300_texture* tex)
|
||||
tex->offset[i] = align(tex->size, 32);
|
||||
tex->size = tex->offset[i] + size;
|
||||
tex->layer_size[i] = layer_size;
|
||||
tex->pitch[i] = stride / pf_get_blocksize(base->format);
|
||||
tex->pitch[i] = stride / util_format_get_blocksize(base->format);
|
||||
|
||||
debug_printf("r300: Texture miptree: Level %d "
|
||||
"(%dx%dx%d px, pitch %d bytes)\n",
|
||||
@@ -245,7 +245,7 @@ static struct pipe_texture*
|
||||
tex->tex.screen = screen;
|
||||
|
||||
tex->stride_override = *stride;
|
||||
tex->pitch[0] = *stride / pf_get_blocksize(base->format);
|
||||
tex->pitch[0] = *stride / util_format_get_blocksize(base->format);
|
||||
|
||||
r300_setup_flags(tex);
|
||||
r300_setup_texture_state(tex, r300_screen(screen)->caps->is_r500);
|
||||
|
@@ -65,11 +65,11 @@ softpipe_texture_layout(struct pipe_screen *screen,
|
||||
pt->depth0 = depth;
|
||||
|
||||
for (level = 0; level <= pt->last_level; level++) {
|
||||
spt->stride[level] = pf_get_stride(pt->format, width);
|
||||
spt->stride[level] = util_format_get_stride(pt->format, width);
|
||||
|
||||
spt->level_offset[level] = buffer_size;
|
||||
|
||||
buffer_size += (pf_get_nblocksy(pt->format, height) *
|
||||
buffer_size += (util_format_get_nblocksy(pt->format, height) *
|
||||
((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) *
|
||||
spt->stride[level]);
|
||||
|
||||
@@ -239,11 +239,11 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
|
||||
ps->zslice = zslice;
|
||||
|
||||
if (pt->target == PIPE_TEXTURE_CUBE) {
|
||||
ps->offset += face * pf_get_nblocksy(pt->format, u_minify(pt->height0, level)) *
|
||||
ps->offset += face * util_format_get_nblocksy(pt->format, u_minify(pt->height0, level)) *
|
||||
spt->stride[level];
|
||||
}
|
||||
else if (pt->target == PIPE_TEXTURE_3D) {
|
||||
ps->offset += zslice * pf_get_nblocksy(pt->format, u_minify(pt->height0, level)) *
|
||||
ps->offset += zslice * util_format_get_nblocksy(pt->format, u_minify(pt->height0, level)) *
|
||||
spt->stride[level];
|
||||
}
|
||||
else {
|
||||
@@ -299,7 +299,7 @@ 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));
|
||||
int nblocksy = util_format_get_nblocksy(texture->format, u_minify(texture->height0, level));
|
||||
pipe_texture_reference(&pt->texture, texture);
|
||||
pt->x = x;
|
||||
pt->y = y;
|
||||
@@ -376,8 +376,8 @@ softpipe_transfer_map( struct pipe_screen *screen,
|
||||
}
|
||||
|
||||
xfer_map = map + softpipe_transfer(transfer)->offset +
|
||||
transfer->y / pf_get_blockheight(format) * transfer->stride +
|
||||
transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format);
|
||||
transfer->y / util_format_get_blockheight(format) * transfer->stride +
|
||||
transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
|
||||
/*printf("map = %p xfer map = %p\n", map, xfer_map);*/
|
||||
return xfer_map;
|
||||
}
|
||||
|
@@ -239,7 +239,7 @@ clear_tile(struct softpipe_cached_tile *tile,
|
||||
{
|
||||
uint i, j;
|
||||
|
||||
switch (util_format_get_size(format)) {
|
||||
switch (util_format_get_blocksize(format)) {
|
||||
case 1:
|
||||
memset(tile->data.any, clear_value, TILE_SIZE * TILE_SIZE);
|
||||
break;
|
||||
|
@@ -159,8 +159,8 @@ svga_transfer_dma_band(struct svga_transfer *st,
|
||||
st->base.x + st->base.width,
|
||||
y + h,
|
||||
st->base.zslice + 1,
|
||||
pf_get_blocksize(texture->base.format)*8/
|
||||
(pf_get_blockwidth(texture->base.format)*pf_get_blockheight(texture->base.format)));
|
||||
util_format_get_blocksize(texture->base.format)*8/
|
||||
(util_format_get_blockwidth(texture->base.format)*util_format_get_blockheight(texture->base.format)));
|
||||
|
||||
box.x = st->base.x;
|
||||
box.y = y;
|
||||
@@ -210,7 +210,7 @@ svga_transfer_dma(struct svga_transfer *st,
|
||||
}
|
||||
else {
|
||||
unsigned y, h, srcy;
|
||||
unsigned blockheight = pf_get_blockheight(st->base.texture->format);
|
||||
unsigned blockheight = util_format_get_blockheight(st->base.texture->format);
|
||||
h = st->hw_nblocksy * blockheight;
|
||||
srcy = 0;
|
||||
for(y = 0; y < st->base.height; y += h) {
|
||||
@@ -772,8 +772,8 @@ svga_get_tex_transfer(struct pipe_screen *screen,
|
||||
struct svga_screen *ss = svga_screen(screen);
|
||||
struct svga_winsys_screen *sws = ss->sws;
|
||||
struct svga_transfer *st;
|
||||
unsigned nblocksx = pf_get_nblocksx(texture->format, w);
|
||||
unsigned nblocksy = pf_get_nblocksy(texture->format, h);
|
||||
unsigned nblocksx = util_format_get_nblocksx(texture->format, w);
|
||||
unsigned nblocksy = util_format_get_nblocksy(texture->format, h);
|
||||
|
||||
/* We can't map texture storage directly */
|
||||
if (usage & PIPE_TRANSFER_MAP_DIRECTLY)
|
||||
@@ -787,7 +787,7 @@ svga_get_tex_transfer(struct pipe_screen *screen,
|
||||
st->base.y = y;
|
||||
st->base.width = w;
|
||||
st->base.height = h;
|
||||
st->base.stride = nblocksx*pf_get_blocksize(texture->format);
|
||||
st->base.stride = nblocksx*util_format_get_blocksize(texture->format);
|
||||
st->base.usage = usage;
|
||||
st->base.face = face;
|
||||
st->base.level = level;
|
||||
@@ -1071,7 +1071,7 @@ svga_screen_buffer_from_texture(struct pipe_texture *texture,
|
||||
svga_translate_format(texture->format),
|
||||
stex->handle);
|
||||
|
||||
*stride = pf_get_stride(texture->format, texture->width0);
|
||||
*stride = util_format_get_stride(texture->format, texture->width0);
|
||||
|
||||
return *buffer != NULL;
|
||||
}
|
||||
|
@@ -211,7 +211,7 @@ static int update_zero_stride( struct svga_context *svga,
|
||||
mapped_buffer = pipe_buffer_map_range(svga->pipe.screen,
|
||||
vbuffer->buffer,
|
||||
vel->src_offset,
|
||||
util_format_get_size(vel->src_format),
|
||||
util_format_get_blocksize(vel->src_format),
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
translate->set_buffer(translate, vel->vertex_buffer_index,
|
||||
mapped_buffer,
|
||||
|
@@ -26,6 +26,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_string.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_simple_list.h"
|
||||
@@ -203,9 +204,9 @@ trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header,
|
||||
&t->width0, 1,
|
||||
&t->height0, 1,
|
||||
&t->depth0, 1,
|
||||
pf_get_blockwidth(t->format),
|
||||
pf_get_blockheight(t->format),
|
||||
pf_get_blocksize(t->format),
|
||||
util_format_get_blockwidth(t->format),
|
||||
util_format_get_blockheight(t->format),
|
||||
util_format_get_blocksize(t->format),
|
||||
t->last_level,
|
||||
t->nr_samples,
|
||||
t->tex_usage,
|
||||
@@ -254,11 +255,11 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
|
||||
|
||||
rbug_send_texture_read_reply(tr_rbug->con, serial,
|
||||
t->texture->format,
|
||||
pf_get_blockwidth(t->texture->format),
|
||||
pf_get_blockheight(t->texture->format),
|
||||
pf_get_blocksize(t->texture->format),
|
||||
util_format_get_blockwidth(t->texture->format),
|
||||
util_format_get_blockheight(t->texture->format),
|
||||
util_format_get_blocksize(t->texture->format),
|
||||
(uint8_t*)map,
|
||||
t->stride * pf_get_nblocksy(t->texture->format, t->height),
|
||||
t->stride * util_format_get_nblocksy(t->texture->format, t->height),
|
||||
t->stride,
|
||||
NULL);
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_simple_list.h"
|
||||
|
||||
@@ -425,7 +426,7 @@ trace_screen_transfer_unmap(struct pipe_screen *_screen,
|
||||
struct pipe_transfer *transfer = tr_trans->transfer;
|
||||
|
||||
if(tr_trans->map) {
|
||||
size_t size = pf_get_nblocksy(transfer->texture->format, transfer->width) * transfer->stride;
|
||||
size_t size = util_format_get_nblocksy(transfer->texture->format, transfer->width) * transfer->stride;
|
||||
|
||||
trace_dump_call_begin("pipe_screen", "transfer_write");
|
||||
|
||||
|
@@ -174,140 +174,6 @@ enum pipe_format {
|
||||
*/
|
||||
extern const char *pf_name( enum pipe_format format );
|
||||
|
||||
/**
|
||||
* Return bits for a particular component.
|
||||
* \param comp component index, starting at 0
|
||||
*/
|
||||
static INLINE uint pf_get_component_bits( enum pipe_format format, uint comp )
|
||||
{
|
||||
uint size;
|
||||
|
||||
if (pf_swizzle_x(format) == comp) {
|
||||
size = pf_size_x(format);
|
||||
}
|
||||
else if (pf_swizzle_y(format) == comp) {
|
||||
size = pf_size_y(format);
|
||||
}
|
||||
else if (pf_swizzle_z(format) == comp) {
|
||||
size = pf_size_z(format);
|
||||
}
|
||||
else if (pf_swizzle_w(format) == comp) {
|
||||
size = pf_size_w(format);
|
||||
}
|
||||
else {
|
||||
size = 0;
|
||||
}
|
||||
if (pf_layout( format ) == PIPE_FORMAT_LAYOUT_RGBAZS)
|
||||
return size << pf_exp2( format );
|
||||
return size << (pf_mixed_scale8( format ) * 3);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return total bits needed for the pixel format per block.
|
||||
*/
|
||||
static INLINE uint pf_get_blocksizebits( enum pipe_format format )
|
||||
{
|
||||
switch (pf_layout(format)) {
|
||||
case PIPE_FORMAT_LAYOUT_RGBAZS:
|
||||
case PIPE_FORMAT_LAYOUT_MIXED:
|
||||
return
|
||||
pf_get_component_bits( format, PIPE_FORMAT_COMP_0 ) +
|
||||
pf_get_component_bits( format, PIPE_FORMAT_COMP_1 ) +
|
||||
pf_get_component_bits( format, PIPE_FORMAT_COMP_R ) +
|
||||
pf_get_component_bits( format, PIPE_FORMAT_COMP_G ) +
|
||||
pf_get_component_bits( format, PIPE_FORMAT_COMP_B ) +
|
||||
pf_get_component_bits( format, PIPE_FORMAT_COMP_A ) +
|
||||
pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) +
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return bytes per element for the given format.
|
||||
*/
|
||||
static INLINE uint pf_get_blocksize( enum pipe_format format )
|
||||
{
|
||||
assert(pf_get_blocksizebits(format) % 8 == 0);
|
||||
return pf_get_blocksizebits(format) / 8;
|
||||
}
|
||||
|
||||
static INLINE uint pf_get_blockwidth( enum pipe_format format )
|
||||
{
|
||||
switch (pf_layout(format)) {
|
||||
case PIPE_FORMAT_LAYOUT_YCBCR:
|
||||
return 2;
|
||||
case PIPE_FORMAT_LAYOUT_DXT:
|
||||
return 4;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE uint pf_get_blockheight( enum pipe_format format )
|
||||
{
|
||||
switch (pf_layout(format)) {
|
||||
case PIPE_FORMAT_LAYOUT_DXT:
|
||||
return 4;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE unsigned
|
||||
pf_get_nblocksx(enum pipe_format format, unsigned x)
|
||||
{
|
||||
unsigned blockwidth = pf_get_blockwidth(format);
|
||||
return (x + blockwidth - 1) / blockwidth;
|
||||
}
|
||||
|
||||
static INLINE unsigned
|
||||
pf_get_nblocksy(enum pipe_format format, unsigned y)
|
||||
{
|
||||
unsigned blockheight = pf_get_blockheight(format);
|
||||
return (y + blockheight - 1) / blockheight;
|
||||
}
|
||||
|
||||
static INLINE unsigned
|
||||
pf_get_nblocks(enum pipe_format format, unsigned width, unsigned height)
|
||||
{
|
||||
return pf_get_nblocksx(format, width) * pf_get_nblocksy(format, height);
|
||||
}
|
||||
|
||||
static INLINE size_t
|
||||
pf_get_stride(enum pipe_format format, unsigned width)
|
||||
{
|
||||
return pf_get_nblocksx(format, width) * pf_get_blocksize(format);
|
||||
}
|
||||
|
||||
static INLINE size_t
|
||||
pf_get_2d_size(enum pipe_format format, size_t stride, unsigned height)
|
||||
{
|
||||
return pf_get_nblocksy(format, height) * stride;
|
||||
}
|
||||
|
||||
enum pipe_video_chroma_format
|
||||
{
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "pipe/p_format.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_tile.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_memory.h"
|
||||
@@ -461,7 +462,7 @@ st_sample_dxt_pixel_block(enum pipe_format format,
|
||||
for(ch = 0; ch < 4; ++ch)
|
||||
rgba[y*rgba_stride + x*4 + ch] = (float)(data[i].rgba[y*4*4 + x*4 + ch])/255.0f;
|
||||
|
||||
memcpy(raw, data[i].raw, pf_get_blocksize(format));
|
||||
memcpy(raw, data[i].raw, util_format_get_blocksize(format));
|
||||
}
|
||||
|
||||
|
||||
@@ -473,7 +474,7 @@ st_sample_generic_pixel_block(enum pipe_format format,
|
||||
{
|
||||
unsigned i;
|
||||
unsigned x, y, ch;
|
||||
int blocksize = pf_get_blocksize(format);
|
||||
int blocksize = util_format_get_blocksize(format);
|
||||
|
||||
for(i = 0; i < blocksize; ++i)
|
||||
raw[i] = (uint8_t)st_random();
|
||||
@@ -548,11 +549,11 @@ st_sample_surface(struct st_surface *surface, float *rgba)
|
||||
if (raw) {
|
||||
enum pipe_format format = texture->format;
|
||||
uint x, y;
|
||||
int nblocksx = pf_get_nblocksx(format, width);
|
||||
int nblocksy = pf_get_nblocksy(format, height);
|
||||
int blockwidth = pf_get_blockwidth(format);
|
||||
int blockheight = pf_get_blockheight(format);
|
||||
int blocksize = pf_get_blocksize(format);
|
||||
int nblocksx = util_format_get_nblocksx(format, width);
|
||||
int nblocksy = util_format_get_nblocksy(format, height);
|
||||
int blockwidth = util_format_get_blockwidth(format);
|
||||
int blockheight = util_format_get_blockheight(format);
|
||||
int blocksize = util_format_get_blocksize(format);
|
||||
|
||||
|
||||
for (y = 0; y < nblocksy; ++y) {
|
||||
|
@@ -169,8 +169,8 @@ st_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
|
||||
const unsigned alignment = 64;
|
||||
unsigned nblocksy;
|
||||
|
||||
nblocksy = pf_get_nblocksy(format, height);
|
||||
*stride = align(pf_get_stride(format, width), alignment);
|
||||
nblocksy = util_format_get_nblocksy(format, height);
|
||||
*stride = align(util_format_get_stride(format, width), alignment);
|
||||
|
||||
return winsys->buffer_create(winsys, alignment,
|
||||
usage,
|
||||
|
@@ -247,7 +247,7 @@ nouveau_drm_handle_from_pt(struct drm_api *api, struct pipe_screen *pscreen,
|
||||
return false;
|
||||
|
||||
*handle = mt->bo->handle;
|
||||
*stride = pf_get_stride(mt->base.format, mt->base.width0);
|
||||
*stride = util_format_get_stride(mt->base.format, mt->base.width0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include "radeon_bo_gem.h"
|
||||
#include "softpipe/sp_texture.h"
|
||||
#include "r300_context.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
@@ -121,8 +122,8 @@ static struct pipe_buffer *radeon_surface_buffer_create(struct pipe_winsys *ws,
|
||||
const unsigned alignment = 64;
|
||||
unsigned nblocksy, size;
|
||||
|
||||
nblocksy = pf_get_nblocksy(format, height);
|
||||
*stride = align(pf_get_stride(format, width), alignment);
|
||||
nblocksy = util_format_get_nblocksy(format, height);
|
||||
*stride = align(util_format_get_stride(format, width), alignment);
|
||||
size = *stride * nblocksy;
|
||||
|
||||
return radeon_buffer_create(ws, 64, usage, size);
|
||||
|
@@ -163,8 +163,8 @@ surface_buffer_create(struct pipe_winsys *winsys,
|
||||
const unsigned alignment = 64;
|
||||
unsigned nblocksy;
|
||||
|
||||
nblocksy = pf_get_nblocksy(format, height);
|
||||
*stride = align(pf_get_stride(format, width), alignment);
|
||||
nblocksy = util_format_get_nblocksy(format, height);
|
||||
*stride = align(util_format_get_stride(format, width), alignment);
|
||||
|
||||
return winsys->buffer_create(winsys, alignment,
|
||||
usage,
|
||||
|
@@ -141,8 +141,8 @@ static struct pipe_buffer* xsp_surface_buffer_create
|
||||
const unsigned int ALIGNMENT = 1;
|
||||
unsigned nblocksy;
|
||||
|
||||
nblocksy = pf_get_nblocksy(format, height);
|
||||
*stride = align(pf_get_stride(format, width), ALIGNMENT);
|
||||
nblocksy = util_format_get_nblocksy(format, height);
|
||||
*stride = align(util_format_get_stride(format, width), ALIGNMENT);
|
||||
|
||||
return pws->buffer_create(pws, ALIGNMENT, usage,
|
||||
*stride * nblocksy);
|
||||
|
@@ -137,8 +137,8 @@ gdi_llvmpipe_displaytarget_create(struct llvmpipe_winsys *winsys,
|
||||
gdt->width = width;
|
||||
gdt->height = height;
|
||||
|
||||
bpp = util_format_get_bits(format);
|
||||
cpp = util_format_get_size(format);
|
||||
bpp = util_format_get_blocksizebits(format);
|
||||
cpp = util_format_get_blocksize(format);
|
||||
|
||||
gdt->stride = align(width * cpp, alignment);
|
||||
gdt->size = gdt->stride * height;
|
||||
|
@@ -163,8 +163,8 @@ gdi_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
|
||||
const unsigned alignment = 64;
|
||||
unsigned nblocksy;
|
||||
|
||||
nblocksy = pf_get_nblocksy(format, height);
|
||||
*stride = align(pf_get_stride(format, width), alignment);
|
||||
nblocksy = util_format_get_nblocksy(format, height);
|
||||
*stride = align(util_format_get_stride(format, width), alignment);
|
||||
|
||||
return winsys->buffer_create(winsys, alignment,
|
||||
usage,
|
||||
@@ -271,10 +271,10 @@ gdi_softpipe_present(struct pipe_screen *screen,
|
||||
|
||||
memset(&bmi, 0, sizeof(BITMAPINFO));
|
||||
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bmi.bmiHeader.biWidth = texture->stride[surface->level] / util_format_get_size(surface->format);
|
||||
bmi.bmiHeader.biWidth = texture->stride[surface->level] / util_format_get_blocksize(surface->format);
|
||||
bmi.bmiHeader.biHeight= -(long)surface->height;
|
||||
bmi.bmiHeader.biPlanes = 1;
|
||||
bmi.bmiHeader.biBitCount = util_format_get_bits(surface->format);
|
||||
bmi.bmiHeader.biBitCount = util_format_get_blocksizebits(surface->format);
|
||||
bmi.bmiHeader.biCompression = BI_RGB;
|
||||
bmi.bmiHeader.biSizeImage = 0;
|
||||
bmi.bmiHeader.biXPelsPerMeter = 0;
|
||||
|
@@ -289,8 +289,8 @@ xm_surface_buffer_create(struct pipe_winsys *winsys,
|
||||
const unsigned alignment = 64;
|
||||
unsigned nblocksy;
|
||||
|
||||
nblocksy = pf_get_nblocksy(format, height);
|
||||
*stride = align(pf_get_stride(format, width), alignment);
|
||||
nblocksy = util_format_get_nblocksy(format, height);
|
||||
*stride = align(util_format_get_stride(format, width), alignment);
|
||||
|
||||
return winsys->buffer_create(winsys, alignment,
|
||||
usage,
|
||||
|
@@ -262,10 +262,10 @@ xm_llvmpipe_display(struct xmesa_buffer *xm_buffer,
|
||||
{
|
||||
if (xm_dt->tempImage == NULL)
|
||||
{
|
||||
assert(pf_get_blockwidth(xm_dt->format) == 1);
|
||||
assert(pf_get_blockheight(xm_dt->format) == 1);
|
||||
assert(util_format_get_blockwidth(xm_dt->format) == 1);
|
||||
assert(util_format_get_blockheight(xm_dt->format) == 1);
|
||||
alloc_shm_ximage(xm_dt, xm_buffer,
|
||||
xm_dt->stride / pf_get_blocksize(xm_dt->format),
|
||||
xm_dt->stride / util_format_get_blocksize(xm_dt->format),
|
||||
xm_dt->height);
|
||||
}
|
||||
|
||||
@@ -331,8 +331,8 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys,
|
||||
xm_dt->width = width;
|
||||
xm_dt->height = height;
|
||||
|
||||
nblocksy = pf_get_nblocksy(format, height);
|
||||
xm_dt->stride = align(pf_get_stride(format, width), alignment);
|
||||
nblocksy = util_format_get_nblocksy(format, height);
|
||||
xm_dt->stride = align(util_format_get_stride(format, width), alignment);
|
||||
size = xm_dt->stride * nblocksy;
|
||||
|
||||
#ifdef USE_XSHM
|
||||
|
@@ -255,10 +255,10 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b,
|
||||
{
|
||||
if (xm_buf->tempImage == NULL)
|
||||
{
|
||||
assert(pf_get_blockwidth(surf->texture->format) == 1);
|
||||
assert(pf_get_blockheight(surf->texture->format) == 1);
|
||||
assert(util_format_get_blockwidth(surf->texture->format) == 1);
|
||||
assert(util_format_get_blockheight(surf->texture->format) == 1);
|
||||
alloc_shm_ximage(xm_buf, b, spt->stride[surf->level] /
|
||||
pf_get_blocksize(surf->texture->format), surf->height);
|
||||
util_format_get_blocksize(surf->texture->format), surf->height);
|
||||
}
|
||||
|
||||
ximage = xm_buf->tempImage;
|
||||
@@ -363,8 +363,8 @@ xm_surface_buffer_create(struct pipe_winsys *winsys,
|
||||
const unsigned alignment = 64;
|
||||
unsigned nblocksy, size;
|
||||
|
||||
nblocksy = pf_get_nblocksy(format, height);
|
||||
*stride = align(pf_get_stride(format, width), alignment);
|
||||
nblocksy = util_format_get_nblocksy(format, height);
|
||||
*stride = align(util_format_get_stride(format, width), alignment);
|
||||
size = *stride * nblocksy;
|
||||
|
||||
#ifdef USE_XSHM
|
||||
|
@@ -857,8 +857,8 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
||||
usage, dstx, dsty,
|
||||
width, height);
|
||||
|
||||
assert(pf_get_blockwidth(ptDraw->texture->format) == 1);
|
||||
assert(pf_get_blockheight(ptDraw->texture->format) == 1);
|
||||
assert(util_format_get_blockwidth(ptDraw->texture->format) == 1);
|
||||
assert(util_format_get_blockheight(ptDraw->texture->format) == 1);
|
||||
|
||||
/* map the stencil buffer */
|
||||
drawMap = screen->transfer_map(screen, ptDraw);
|
||||
|
@@ -105,8 +105,8 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||
|
||||
assert(strb->format != PIPE_FORMAT_NONE);
|
||||
|
||||
strb->stride = pf_get_stride(strb->format, width);
|
||||
size = pf_get_2d_size(strb->format, strb->stride, height);
|
||||
strb->stride = util_format_get_stride(strb->format, width);
|
||||
size = util_format_get_2d_size(strb->format, strb->stride, height);
|
||||
|
||||
strb->data = _mesa_malloc(size);
|
||||
|
||||
|
@@ -833,7 +833,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 * util_format_get_size(stImage->pt->format);
|
||||
const uint bytesPerRow = width * util_format_get_blocksize(stImage->pt->format);
|
||||
ubyte *map = screen->transfer_map(screen, tex_xfer);
|
||||
GLuint row;
|
||||
for (row = 0; row < height; row++) {
|
||||
@@ -915,7 +915,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 / pf_get_blocksize(stImage->pt->format);
|
||||
texImage->RowStride = stImage->transfer->stride / util_format_get_blocksize(stImage->pt->format);
|
||||
}
|
||||
else {
|
||||
/* Otherwise, the image should actually be stored in
|
||||
@@ -1178,7 +1178,7 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
|
||||
xoffset, yoffset,
|
||||
width, height);
|
||||
|
||||
srcBlockStride = pf_get_stride(pformat, width);
|
||||
srcBlockStride = util_format_get_stride(pformat, width);
|
||||
dstBlockStride = stImage->transfer->stride;
|
||||
} else {
|
||||
assert(stImage->pt);
|
||||
@@ -1192,16 +1192,16 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
assert(xoffset % util_format_get_blockwidth(pformat) == 0);
|
||||
assert(yoffset % util_format_get_blockheight(pformat) == 0);
|
||||
assert(width % util_format_get_blockwidth(pformat) == 0);
|
||||
assert(height % util_format_get_blockheight(pformat) == 0);
|
||||
|
||||
for (y = 0; y < height; y += pf_get_blockheight(pformat)) {
|
||||
for (y = 0; y < height; y += util_format_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(pformat, y);
|
||||
char *dst = (char*)texImage->Data + dstBlockStride * pf_get_nblocksy(pformat, y);
|
||||
memcpy(dst, src, pf_get_stride(pformat, width));
|
||||
const char *src = (const char*)data + srcBlockStride * util_format_get_nblocksy(pformat, y);
|
||||
char *dst = (char*)texImage->Data + dstBlockStride * util_format_get_nblocksy(pformat, y);
|
||||
memcpy(dst, src, util_format_get_stride(pformat, width));
|
||||
}
|
||||
|
||||
if (stImage->pt) {
|
||||
@@ -1691,10 +1691,10 @@ copy_image_data_to_texture(struct st_context *st,
|
||||
dstLevel,
|
||||
stImage->base.Data,
|
||||
stImage->base.RowStride *
|
||||
pf_get_blocksize(stObj->pt->format),
|
||||
util_format_get_blocksize(stObj->pt->format),
|
||||
stImage->base.RowStride *
|
||||
stImage->base.Height *
|
||||
pf_get_blocksize(stObj->pt->format));
|
||||
util_format_get_blocksize(stObj->pt->format));
|
||||
_mesa_align_free(stImage->base.Data);
|
||||
stImage->base.Data = NULL;
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_gen_mipmap.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
@@ -146,8 +147,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 / pf_get_blocksize(srcTrans->texture->format);
|
||||
dstStride = dstTrans->stride / pf_get_blocksize(dstTrans->texture->format);
|
||||
srcStride = srcTrans->stride / util_format_get_blocksize(srcTrans->texture->format);
|
||||
dstStride = dstTrans->stride / util_format_get_blocksize(dstTrans->texture->format);
|
||||
|
||||
_mesa_generate_mipmap_level(target, datatype, comps,
|
||||
0 /*border*/,
|
||||
|
Reference in New Issue
Block a user