mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
Remove remaining pipe format utility functions.
Depricate pf_type(), pf_size_*(), pf_layout() and pf_exp2(). Map depricated PIPE_FORMAT_TYPE to new UTIL_FORMAT_ values: UNKNOWN = TYPE_VOID UNORM = TYPE_UNSIGNED + LAYOUT_ARITH SNORM = TYPE_SIGNED + LAYOUT_ARITH FIXED = TYPE_FIXED FLOAT = TYPE_FLOAT USCALED = TYPE_UNSIGNED + LAYOUT_ARRAY SSCALED = TYPE_SIGNED + LAYOUT_ARRAY SRGB = TYPE_COLORSPACE_SRGB
This commit is contained in:
parent
72befaaae5
commit
6fd8b9b550
8 changed files with 123 additions and 109 deletions
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_format.h"
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
|
||||
|
|
@ -307,7 +308,7 @@ util_pack_color(const float rgba[4], enum pipe_format format, void *dest)
|
|||
ubyte b = 0;
|
||||
ubyte a = 0;
|
||||
|
||||
if (pf_size_x(format) <= 8) {
|
||||
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0) <= 8) {
|
||||
/* format uses 8-bit components or less */
|
||||
r = float_to_ubyte(rgba[0]);
|
||||
g = float_to_ubyte(rgba[1]);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "nouveau/nouveau_stateobj.h"
|
||||
|
||||
#include "util/u_format.h"
|
||||
|
||||
#define _MIXED(pf, t0, t1, t2, t3, cr, cg, cb, ca, f) \
|
||||
{ \
|
||||
PIPE_FORMAT_##pf, \
|
||||
|
|
@ -89,6 +91,7 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so,
|
|||
{
|
||||
unsigned i;
|
||||
uint32_t mode;
|
||||
const struct util_format_description *desc;
|
||||
|
||||
for (i = 0; i < NV50_TEX_FORMAT_LIST_SIZE; i++)
|
||||
if (nv50_tex_format_list[i].pf == mt->base.base.format)
|
||||
|
|
@ -106,7 +109,10 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so,
|
|||
mode |= ((mt->base.bo->tile_mode & 0x0f) << 22) |
|
||||
((mt->base.bo->tile_mode & 0xf0) << 21);
|
||||
|
||||
if (pf_type(mt->base.base.format) == PIPE_FORMAT_TYPE_SRGB)
|
||||
desc = util_format_description(mt->base.base.format);
|
||||
assert(desc);
|
||||
|
||||
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
|
||||
mode |= 0x0400;
|
||||
|
||||
switch (mt->base.base.target) {
|
||||
|
|
|
|||
|
|
@ -64,19 +64,36 @@ nv50_prim(unsigned mode)
|
|||
}
|
||||
|
||||
static INLINE uint32_t
|
||||
nv50_vbo_type_to_hw(unsigned type)
|
||||
nv50_vbo_type_to_hw(enum pipe_format format)
|
||||
{
|
||||
switch (type) {
|
||||
case PIPE_FORMAT_TYPE_FLOAT:
|
||||
const struct util_format_description *desc;
|
||||
|
||||
desc = util_format_description(format);
|
||||
assert(desc);
|
||||
|
||||
switch (desc->type) {
|
||||
case UTIL_FORMAT_TYPE_FLOAT:
|
||||
return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_FLOAT;
|
||||
case PIPE_FORMAT_TYPE_UNORM:
|
||||
return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_UNORM;
|
||||
case PIPE_FORMAT_TYPE_SNORM:
|
||||
return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SNORM;
|
||||
case PIPE_FORMAT_TYPE_USCALED:
|
||||
return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_USCALED;
|
||||
case PIPE_FORMAT_TYPE_SSCALED:
|
||||
return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SSCALED;
|
||||
case UTIL_FORMAT_TYPE_UNSIGNED:
|
||||
switch (desc->layout) {
|
||||
case UTIL_FORMAT_LAYOUT_ARITH:
|
||||
return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_UNORM;
|
||||
case UTIL_FORMAT_LAYOUT_ARRAY:
|
||||
return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_USCALED;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case UTIL_FORMAT_TYPE_SIGNED:
|
||||
switch (desc->layout) {
|
||||
case UTIL_FORMAT_LAYOUT_ARITH:
|
||||
return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SNORM;
|
||||
case UTIL_FORMAT_LAYOUT_ARRAY:
|
||||
return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SSCALED;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case PIPE_FORMAT_TYPE_UINT:
|
||||
return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_UINT;
|
||||
|
|
@ -122,9 +139,15 @@ nv50_vbo_vtxelt_to_hw(struct pipe_vertex_element *ve)
|
|||
{
|
||||
uint32_t hw_type, hw_size;
|
||||
enum pipe_format pf = ve->src_format;
|
||||
unsigned size = pf_size_x(pf) << pf_exp2(pf);
|
||||
const struct util_format_description *desc;
|
||||
unsigned size;
|
||||
|
||||
hw_type = nv50_vbo_type_to_hw(pf_type(pf));
|
||||
desc = util_format_description(pf);
|
||||
assert(desc);
|
||||
|
||||
size = util_format_get_component_bits(pf, UTIL_FORMAT_COLORSPACE_RGB, 0);
|
||||
|
||||
hw_type = nv50_vbo_type_to_hw(pf);
|
||||
hw_size = nv50_vbo_size_to_hw(size, ve->nr_components);
|
||||
|
||||
if (!hw_type || !hw_size) {
|
||||
|
|
@ -133,7 +156,7 @@ nv50_vbo_vtxelt_to_hw(struct pipe_vertex_element *ve)
|
|||
return 0x24e80000;
|
||||
}
|
||||
|
||||
if (util_format_description(pf)->swizzle[0] == UTIL_FORMAT_SWIZZLE_Z) /* BGRA */
|
||||
if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_Z) /* BGRA */
|
||||
hw_size |= (1 << 31); /* no real swizzle bits :-( */
|
||||
|
||||
return (hw_type | hw_size);
|
||||
|
|
@ -321,9 +344,13 @@ nv50_vbo_static_attrib(struct nv50_context *nv50, unsigned attrib,
|
|||
float *v;
|
||||
int ret;
|
||||
enum pipe_format pf = ve->src_format;
|
||||
const struct util_format_description *desc;
|
||||
|
||||
if ((pf_type(pf) != PIPE_FORMAT_TYPE_FLOAT) ||
|
||||
(pf_size_x(pf) << pf_exp2(pf)) != 32)
|
||||
desc = util_format_description(pf);
|
||||
assert(desc);
|
||||
|
||||
if ((desc->type != UTIL_FORMAT_TYPE_FLOAT) ||
|
||||
util_format_get_component_bits(pf, UTIL_FORMAT_COLORSPACE_RGB, 0) != 32)
|
||||
return FALSE;
|
||||
|
||||
ret = nouveau_bo_map(bo, NOUVEAU_BO_RD);
|
||||
|
|
@ -611,7 +638,8 @@ emit_prepare(struct nv50_context *nv50, struct nv50_vbo_emitctx *emit,
|
|||
for (i = 0; i < nv50->vtxelt_nr; ++i) {
|
||||
struct pipe_vertex_element *ve;
|
||||
struct pipe_vertex_buffer *vb;
|
||||
unsigned n, type, size;
|
||||
unsigned n, size;
|
||||
const struct util_format_description *desc;
|
||||
|
||||
ve = &nv50->vtxelt[i];
|
||||
vb = &nv50->vtxbuf[ve->vertex_buffer_index];
|
||||
|
|
@ -623,8 +651,10 @@ emit_prepare(struct nv50_context *nv50, struct nv50_vbo_emitctx *emit,
|
|||
emit->map[n] = nouveau_bo(vb->buffer)->map +
|
||||
(start * vb->stride + ve->src_offset);
|
||||
|
||||
type = pf_type(ve->src_format);
|
||||
size = pf_size_x(ve->src_format) << pf_exp2(ve->src_format);
|
||||
desc = util_format_description(ve->src_format);
|
||||
assert(desc);
|
||||
|
||||
size = util_format_get_component_bits(ve->src_format, UTIL_FORMAT_COLORSPACE_RGB, 0);
|
||||
|
||||
assert(ve->nr_components > 0 && ve->nr_components <= 4);
|
||||
|
||||
|
|
|
|||
|
|
@ -445,20 +445,22 @@ static INLINE uint32_t r300_translate_gb_pipes(int pipe_count)
|
|||
static INLINE unsigned pf_component_count(enum pipe_format format) {
|
||||
unsigned count = 0;
|
||||
|
||||
if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) {
|
||||
return count;
|
||||
}
|
||||
|
||||
if (pf_size_x(format)) {
|
||||
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0)) {
|
||||
count++;
|
||||
}
|
||||
if (pf_size_y(format)) {
|
||||
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 1)) {
|
||||
count++;
|
||||
}
|
||||
if (pf_size_z(format)) {
|
||||
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 2)) {
|
||||
count++;
|
||||
}
|
||||
if (pf_size_w(format)) {
|
||||
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3)) {
|
||||
count++;
|
||||
}
|
||||
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0)) {
|
||||
count++;
|
||||
}
|
||||
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1)) {
|
||||
count++;
|
||||
}
|
||||
|
||||
|
|
@ -469,19 +471,23 @@ static INLINE unsigned pf_component_count(enum pipe_format format) {
|
|||
static INLINE uint16_t
|
||||
r300_translate_vertex_data_type(enum pipe_format format) {
|
||||
uint32_t result = 0;
|
||||
const struct util_format_description *desc;
|
||||
unsigned components = pf_component_count(format);
|
||||
|
||||
if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) {
|
||||
desc = util_format_description(format);
|
||||
|
||||
if (desc->layout != UTIL_FORMAT_LAYOUT_ARITH &&
|
||||
desc->layout != UTIL_FORMAT_LAYOUT_ARRAY) {
|
||||
debug_printf("r300: Bad format %s in %s:%d\n", pf_name(format),
|
||||
__FUNCTION__, __LINE__);
|
||||
assert(0);
|
||||
}
|
||||
|
||||
switch (pf_type(format)) {
|
||||
switch (desc->type) {
|
||||
/* Half-floats, floats, doubles */
|
||||
case PIPE_FORMAT_TYPE_FLOAT:
|
||||
switch (pf_size_x(format)) {
|
||||
case 4:
|
||||
case UTIL_FORMAT_TYPE_FLOAT:
|
||||
switch (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0)) {
|
||||
case 32:
|
||||
result = R300_DATA_TYPE_FLOAT_1 + (components - 1);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -490,19 +496,15 @@ r300_translate_vertex_data_type(enum pipe_format format) {
|
|||
assert(0);
|
||||
}
|
||||
break;
|
||||
/* Normalized unsigned ints */
|
||||
case PIPE_FORMAT_TYPE_UNORM:
|
||||
/* Normalized signed ints */
|
||||
case PIPE_FORMAT_TYPE_SNORM:
|
||||
/* Non-normalized unsigned ints */
|
||||
case PIPE_FORMAT_TYPE_USCALED:
|
||||
/* Non-normalized signed ints */
|
||||
case PIPE_FORMAT_TYPE_SSCALED:
|
||||
switch (pf_size_x(format)) {
|
||||
case 1:
|
||||
/* Unsigned ints */
|
||||
case UTIL_FORMAT_TYPE_UNSIGNED:
|
||||
/* Signed ints */
|
||||
case UTIL_FORMAT_TYPE_SIGNED:
|
||||
switch (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0)) {
|
||||
case 8:
|
||||
result = R300_DATA_TYPE_BYTE;
|
||||
break;
|
||||
case 2:
|
||||
case 16:
|
||||
if (components > 2) {
|
||||
result = R300_DATA_TYPE_SHORT_4;
|
||||
} else {
|
||||
|
|
@ -512,8 +514,8 @@ r300_translate_vertex_data_type(enum pipe_format format) {
|
|||
default:
|
||||
debug_printf("r300: Bad format %s in %s:%d\n",
|
||||
pf_name(format), __FUNCTION__, __LINE__);
|
||||
debug_printf("r300: pf_size_x(format) == %d\n",
|
||||
pf_size_x(format));
|
||||
debug_printf("r300: util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0) == %d\n",
|
||||
util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0));
|
||||
assert(0);
|
||||
}
|
||||
break;
|
||||
|
|
@ -523,12 +525,11 @@ r300_translate_vertex_data_type(enum pipe_format format) {
|
|||
assert(0);
|
||||
}
|
||||
|
||||
if (pf_type(format) == PIPE_FORMAT_TYPE_SSCALED) {
|
||||
if (desc->type == UTIL_FORMAT_TYPE_SIGNED) {
|
||||
result |= R300_SIGNED;
|
||||
} else if (pf_type(format) == PIPE_FORMAT_TYPE_UNORM) {
|
||||
}
|
||||
if (desc->layout == UTIL_FORMAT_LAYOUT_ARITH) {
|
||||
result |= R300_NORMALIZE;
|
||||
} else if (pf_type(format) == PIPE_FORMAT_TYPE_SNORM) {
|
||||
result |= (R300_SIGNED | R300_NORMALIZE);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -540,7 +541,8 @@ r300_translate_vertex_data_swizzle(enum pipe_format format) {
|
|||
|
||||
assert(format);
|
||||
|
||||
if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) {
|
||||
if (desc->layout != UTIL_FORMAT_LAYOUT_ARITH &&
|
||||
desc->layout != UTIL_FORMAT_LAYOUT_ARRAY) {
|
||||
debug_printf("r300: Bad format %s in %s:%d\n",
|
||||
pf_name(format), __FUNCTION__, __LINE__);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -54,11 +54,6 @@ extern "C" {
|
|||
#define PIPE_FORMAT_LAYOUT_DXT 2 /**< XXX temporary? */
|
||||
#define PIPE_FORMAT_LAYOUT_MIXED 3
|
||||
|
||||
static INLINE uint pf_layout(uint f) /**< PIPE_FORMAT_LAYOUT_ */
|
||||
{
|
||||
return f & 0x3;
|
||||
}
|
||||
|
||||
/**
|
||||
* RGBAZS Format Layout.
|
||||
*/
|
||||
|
|
@ -107,19 +102,6 @@ static INLINE uint pf_layout(uint f) /**< PIPE_FORMAT_LAYOUT_ */
|
|||
*/
|
||||
typedef uint pipe_format_rgbazs_t;
|
||||
|
||||
static INLINE uint pf_get(pipe_format_rgbazs_t f, uint shift, uint mask)
|
||||
{
|
||||
return (f >> shift) & mask;
|
||||
}
|
||||
|
||||
#define pf_size_x(f) pf_get(f, 14, 0x7) /**< Size of X */
|
||||
#define pf_size_y(f) pf_get(f, 17, 0x7) /**< Size of Y */
|
||||
#define pf_size_z(f) pf_get(f, 20, 0x7) /**< Size of Z */
|
||||
#define pf_size_w(f) pf_get(f, 23, 0x7) /**< Size of W */
|
||||
#define pf_size_xyzw(f,i) pf_get(f, 14+((i)*3), 0x7)
|
||||
#define pf_exp2(f) pf_get(f, 26, 0x7) /**< Scale size by 2 ^ exp2 */
|
||||
#define pf_type(f) pf_get(f, 29, 0x7) /**< PIPE_FORMAT_TYPE_ */
|
||||
|
||||
/**
|
||||
* Helper macro to encode the above structure into a 32-bit value.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -268,9 +268,7 @@ stw_framebuffer_allocate(
|
|||
enum pipe_format colorFormat, depthFormat, stencilFormat;
|
||||
|
||||
colorFormat = pfi->color_format;
|
||||
|
||||
assert(pf_layout( pfi->depth_stencil_format ) == PIPE_FORMAT_LAYOUT_RGBAZS );
|
||||
|
||||
|
||||
if(util_format_get_component_bits(pfi->depth_stencil_format, UTIL_FORMAT_COLORSPACE_ZS, 0))
|
||||
depthFormat = pfi->depth_stencil_format;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -133,12 +133,10 @@ stw_pixelformat_add(
|
|||
if(stw_dev->pixelformat_extended_count >= STW_MAX_PIXELFORMATS)
|
||||
return;
|
||||
|
||||
assert(pf_layout( color->format ) == PIPE_FORMAT_LAYOUT_RGBAZS );
|
||||
assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 0) == color->bits.red);
|
||||
assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 1) == color->bits.green);
|
||||
assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 2) == color->bits.blue);
|
||||
assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 3) == color->bits.alpha);
|
||||
assert(pf_layout( depth->format ) == PIPE_FORMAT_LAYOUT_RGBAZS );
|
||||
assert(util_format_get_component_bits(depth->format, UTIL_FORMAT_COLORSPACE_ZS, 0) == depth->bits.depth);
|
||||
assert(util_format_get_component_bits(depth->format, UTIL_FORMAT_COLORSPACE_ZS, 1) == depth->bits.stencil);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,30 +48,28 @@
|
|||
|
||||
|
||||
static GLuint
|
||||
format_max_bits(
|
||||
pipe_format_rgbazs_t info )
|
||||
format_max_bits(enum pipe_format format)
|
||||
{
|
||||
GLuint size = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 0);
|
||||
GLuint size = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0);
|
||||
|
||||
size = MAX2(size, util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 1));
|
||||
size = MAX2(size, util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 2));
|
||||
size = MAX2(size, util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 3));
|
||||
size = MAX2(size, util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 0));
|
||||
size = MAX2(size, util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 1));
|
||||
size = MAX2(size, util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 1));
|
||||
size = MAX2(size, util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 2));
|
||||
size = MAX2(size, util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3));
|
||||
size = MAX2(size, util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0));
|
||||
size = MAX2(size, util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1));
|
||||
return size;
|
||||
}
|
||||
|
||||
static GLuint
|
||||
format_size(
|
||||
pipe_format_rgbazs_t info )
|
||||
format_size(enum pipe_format format)
|
||||
{
|
||||
return
|
||||
util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 0) +
|
||||
util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 1) +
|
||||
util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 2) +
|
||||
util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 3) +
|
||||
util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 0) +
|
||||
util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 1);
|
||||
util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0) +
|
||||
util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 1) +
|
||||
util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 2) +
|
||||
util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3) +
|
||||
util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0) +
|
||||
util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -80,14 +78,13 @@ format_size(
|
|||
GLboolean
|
||||
st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
|
||||
{
|
||||
if (pf_layout(format) == PIPE_FORMAT_LAYOUT_RGBAZS) {
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
pipe_format_rgbazs_t info;
|
||||
const struct util_format_description *desc;
|
||||
|
||||
assert(desc);
|
||||
|
||||
info = format;
|
||||
desc = util_format_description(format);
|
||||
assert(desc);
|
||||
|
||||
if (desc->layout == UTIL_FORMAT_LAYOUT_ARITH ||
|
||||
desc->layout == UTIL_FORMAT_LAYOUT_ARRAY) {
|
||||
#if 0
|
||||
printf("%s\n", pf_name( format ) );
|
||||
#endif
|
||||
|
|
@ -100,22 +97,22 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
|
|||
pinfo->datatype = GL_UNSIGNED_INT_24_8;
|
||||
}
|
||||
else {
|
||||
const GLuint size = format_max_bits( info );
|
||||
const GLuint size = format_max_bits(format);
|
||||
if (size == 8) {
|
||||
if (pf_type(info) == PIPE_FORMAT_TYPE_UNORM)
|
||||
if (desc->type == UTIL_FORMAT_TYPE_UNSIGNED)
|
||||
pinfo->datatype = GL_UNSIGNED_BYTE;
|
||||
else
|
||||
pinfo->datatype = GL_BYTE;
|
||||
}
|
||||
else if (size == 16) {
|
||||
if (pf_type(info) == PIPE_FORMAT_TYPE_UNORM)
|
||||
if (desc->type == UTIL_FORMAT_TYPE_UNSIGNED)
|
||||
pinfo->datatype = GL_UNSIGNED_SHORT;
|
||||
else
|
||||
pinfo->datatype = GL_SHORT;
|
||||
}
|
||||
else {
|
||||
assert( size <= 32 );
|
||||
if (pf_type(info) == PIPE_FORMAT_TYPE_UNORM)
|
||||
if (desc->type == UTIL_FORMAT_TYPE_UNSIGNED)
|
||||
pinfo->datatype = GL_UNSIGNED_INT;
|
||||
else
|
||||
pinfo->datatype = GL_INT;
|
||||
|
|
@ -123,17 +120,17 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
|
|||
}
|
||||
|
||||
/* Component bits */
|
||||
pinfo->red_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 0);
|
||||
pinfo->green_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 1);
|
||||
pinfo->blue_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 2);
|
||||
pinfo->alpha_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 3);
|
||||
pinfo->depth_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 0);
|
||||
pinfo->stencil_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 1);
|
||||
pinfo->red_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0);
|
||||
pinfo->green_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 1);
|
||||
pinfo->blue_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 2);
|
||||
pinfo->alpha_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3);
|
||||
pinfo->depth_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0);
|
||||
pinfo->stencil_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1);
|
||||
pinfo->luminance_bits = 0;
|
||||
pinfo->intensity_bits = 0;
|
||||
|
||||
/* Format size */
|
||||
pinfo->size = format_size( info ) / 8;
|
||||
pinfo->size = format_size(format) / 8;
|
||||
|
||||
/* Luminance & Intensity bits */
|
||||
if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
|
||||
|
|
@ -150,7 +147,7 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
|
|||
|
||||
pinfo->mesa_format = st_pipe_format_to_mesa_format(format);
|
||||
}
|
||||
else if (pf_layout(format) == PIPE_FORMAT_LAYOUT_YCBCR) {
|
||||
else if (desc->layout == UTIL_FORMAT_LAYOUT_YUV) {
|
||||
pinfo->mesa_format = MESA_FORMAT_YCBCR;
|
||||
pinfo->datatype = GL_UNSIGNED_SHORT;
|
||||
pinfo->size = 2; /* two bytes per "texel" */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue