summaryrefslogtreecommitdiffstats
path: root/src/gallium/include/pipe
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2009-12-17 23:41:57 +0100
committerMichal Krol <[email protected]>2009-12-17 23:41:57 +0100
commitb1ed72ebe2599ec178f51d86fd42f26486b9a19b (patch)
treeb49428bb48d81bf1396ef14ee8a0a462f89d2d8e /src/gallium/include/pipe
parentec5577a83da18890a4f334af2241aca41b6ed31b (diff)
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.
Diffstat (limited to 'src/gallium/include/pipe')
-rw-r--r--src/gallium/include/pipe/p_format.h134
1 files changed, 0 insertions, 134 deletions
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index d334114d62a..6bfff1cc59c 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -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
{