diff options
author | Roland Scheidegger <sroland@vmware.com> | 2010-03-31 16:57:05 +0200 |
---|---|---|
committer | Roland Scheidegger <sroland@vmware.com> | 2010-03-31 16:57:05 +0200 |
commit | d97f6963aee71d8fafa2a94a5fe1f3ca4b4ef16d (patch) | |
tree | 4b6fa4c2104dae852616908923d00b723cca082c /src/gallium/auxiliary | |
parent | 96bf4aff5bd674bba5d83ab32c46024a686c1a1d (diff) | |
parent | 56b34e54f29cdd0a479219695c6559c44a41a76c (diff) |
Merge branch 'gallium-new-formats'
Conflicts:
src/gallium/auxiliary/util/u_format.csv
src/gallium/auxiliary/util/u_format_access.py
src/gallium/auxiliary/util/u_format_pack.py
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_depth.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_format.csv | 36 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_format_access.py | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_format_pack.py | 12 | ||||
-rwxr-xr-x | src/gallium/auxiliary/util/u_format_parse.py | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_pack_color.h | 12 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_tile.c | 20 |
7 files changed, 61 insertions, 28 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.c b/src/gallium/auxiliary/gallivm/lp_bld_depth.c index 4ce1a27a06..c6d0e4bc04 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_depth.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.c @@ -495,8 +495,8 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, assert(format_desc->block.height == 1); if (stencil[0].enabled) { - assert(format_desc->format == PIPE_FORMAT_Z24S8_UNORM || - format_desc->format == PIPE_FORMAT_S8Z24_UNORM); + assert(format_desc->format == PIPE_FORMAT_Z24_UNORM_S8_USCALED || + format_desc->format == PIPE_FORMAT_S8_USCALED_Z24_UNORM); } assert(z_swizzle < 4); diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv index 25a661eb45..ee91788d71 100644 --- a/src/gallium/auxiliary/util/u_format.csv +++ b/src/gallium/auxiliary/util/u_format.csv @@ -80,6 +80,7 @@ PIPE_FORMAT_L16_UNORM , plain, 1, 1, un16, , , , xxx1, r PIPE_FORMAT_L8_SRGB , plain, 1, 1, un8 , , , , xxx1, srgb PIPE_FORMAT_L8A8_SRGB , plain, 1, 1, un8 , un8 , , , xxxy, srgb PIPE_FORMAT_R8G8B8_SRGB , plain, 1, 1, un8 , un8 , un8 , , xyz1, srgb +PIPE_FORMAT_R8G8B8A8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb PIPE_FORMAT_A8B8G8R8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , wzyx, srgb PIPE_FORMAT_X8B8G8R8_SRGB , plain, 1, 1, x8 , un8 , un8 , un8 , wzy1, srgb PIPE_FORMAT_B8G8R8A8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , zyxw, srgb @@ -92,14 +93,15 @@ PIPE_FORMAT_R8SG8SB8UX8U_NORM , plain, 1, 1, sn8 , sn8 , un8 , x8 , xyz1, r PIPE_FORMAT_R5SG5SB6U_NORM , plain, 1, 1, sn5 , sn5 , un6 , , xyz1, rgb # Depth-stencil formats -PIPE_FORMAT_S8_UNORM , plain, 1, 1, un8 , , , , _x__, zs -PIPE_FORMAT_Z16_UNORM , plain, 1, 1, un16, , , , x___, zs -PIPE_FORMAT_Z32_UNORM , plain, 1, 1, un32, , , , x___, zs -PIPE_FORMAT_Z32_FLOAT , plain, 1, 1, f32 , , , , x___, zs -PIPE_FORMAT_Z24S8_UNORM , plain, 1, 1, un24, un8 , , , xy__, zs -PIPE_FORMAT_S8Z24_UNORM , plain, 1, 1, un8 , un24, , , yx__, zs -PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs -PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs +PIPE_FORMAT_S8_USCALED , plain, 1, 1, u8 , , , , _x__, zs +PIPE_FORMAT_Z16_UNORM , plain, 1, 1, un16, , , , x___, zs +PIPE_FORMAT_Z32_UNORM , plain, 1, 1, un32, , , , x___, zs +PIPE_FORMAT_Z32_FLOAT , plain, 1, 1, f32 , , , , x___, zs +PIPE_FORMAT_Z24_UNORM_S8_USCALED , plain, 1, 1, un24, u8 , , , xy__, zs +PIPE_FORMAT_S8_USCALED_Z24_UNORM , plain, 1, 1, u8 , un24, , , yx__, zs +PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs +PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs +PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED , plain, 1, 1, f32, u8 , x24 , , xy__, zs # YUV formats # http://www.fourcc.org/yuv.php#UYVY @@ -108,6 +110,15 @@ PIPE_FORMAT_UYVY , subsampled, 2, 1, x32 , , , , xyz # XXX: u_tile.c's ycbcr_get_tile_rgba actually interprets it as VYUY but the # intent should be to match D3DFMT_YUY2 PIPE_FORMAT_YUYV , subsampled, 2, 1, x32 , , , , xyz1, yuv +# same subsampling but with rgb channels +PIPE_FORMAT_R8G8_B8G8_UNORM , subsampled, 2, 1, x32 , , , , xyz1, rgb +PIPE_FORMAT_G8R8_G8B8_UNORM , subsampled, 2, 1, x32 , , , , xyz1, rgb + +# some special formats not fitting anywhere else +PIPE_FORMAT_R10G10B10A2_USCALED , plain, 1, 1, u10 , u10 , u10 , u2 , xyzw, rgb +PIPE_FORMAT_R11G11B10_FLOAT , plain, 1, 1, f11 , f11 , f10 , , xyz1, rgb +PIPE_FORMAT_R9G9B9E5_FLOAT , other, 1, 1, x32 , , , , xyz1, rgb +PIPE_FORMAT_R1_UNORM , other, 8, 1, x8 , , , , x001, rgb # Compressed formats # - http://en.wikipedia.org/wiki/S3_Texture_Compression @@ -123,6 +134,11 @@ PIPE_FORMAT_DXT1_SRGBA , s3tc, 4, 4, x64 , , , , xyzw, sr PIPE_FORMAT_DXT3_SRGBA , s3tc, 4, 4, x128, , , , xyzw, srgb PIPE_FORMAT_DXT5_SRGBA , s3tc, 4, 4, x128, , , , xyzw, srgb +PIPE_FORMAT_RGTC1_UNORM , rgtc, 4, 4, x64, , , , x001, rgb +PIPE_FORMAT_RGTC1_SNORM , rgtc, 4, 4, x64, , , , x001, rgb +PIPE_FORMAT_RGTC2_UNORM , rgtc, 4, 4, x128, , , , xy01, rgb +PIPE_FORMAT_RGTC2_SNORM , rgtc, 4, 4, x128, , , , xy01, rgb + # Straightforward D3D10-like formats (also used for # vertex buffer element description) # @@ -157,6 +173,10 @@ PIPE_FORMAT_R32_FIXED , plain, 1, 1, h32 , , , , x001, r PIPE_FORMAT_R32G32_FIXED , plain, 1, 1, h32 , h32 , , , xy01, rgb PIPE_FORMAT_R32G32B32_FIXED , plain, 1, 1, h32 , h32 , h32 , , xyz1, rgb PIPE_FORMAT_R32G32B32A32_FIXED , plain, 1, 1, h32 , h32 , h32 , h32 , xyzw, rgb +PIPE_FORMAT_R16_FLOAT , plain, 1, 1, f16 , , , , x001, rgb +PIPE_FORMAT_R16G16_FLOAT , plain, 1, 1, f16 , f16 , , , xy01, rgb +PIPE_FORMAT_R16G16B16_FLOAT , plain, 1, 1, f16 , f16 , f16 , , xyz1, rgb +PIPE_FORMAT_R16G16B16A16_FLOAT , plain, 1, 1, f16 , f16 , f16 , f16 , xyzw, rgb PIPE_FORMAT_R16_UNORM , plain, 1, 1, un16, , , , x001, rgb PIPE_FORMAT_R16G16_UNORM , plain, 1, 1, un16, un16, , , xy01, rgb PIPE_FORMAT_R16G16B16_UNORM , plain, 1, 1, un16, un16, un16, , xyz1, rgb diff --git a/src/gallium/auxiliary/util/u_format_access.py b/src/gallium/auxiliary/util/u_format_access.py index c85f538626..1c76d9a79d 100644 --- a/src/gallium/auxiliary/util/u_format_access.py +++ b/src/gallium/auxiliary/util/u_format_access.py @@ -60,6 +60,9 @@ def is_format_supported(format): channel = format.channels[i] if channel.type not in (VOID, UNSIGNED, FLOAT): return False + if channel.type == FLOAT: + if channel.size not in (32, 64) or format.is_mixed(): + return False # We can only read a color from a depth/stencil format if the depth channel is present if format.colorspace == 'zs' and format.swizzles[0] == SWIZZLE_NONE: diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py index 28a9dad60e..f40b3bdf2e 100644 --- a/src/gallium/auxiliary/util/u_format_pack.py +++ b/src/gallium/auxiliary/util/u_format_pack.py @@ -46,11 +46,11 @@ def generate_format_type(format): '''Generate a structure that describes the format.''' print 'union util_format_%s {' % format.short_name() - if format.is_bitmask(): + if format.is_bitmask() or format.short_name() == "r11g11b10_float": print ' uint%u_t value;' % (format.block_size(),) print ' struct {' for channel in format.channels: - if format.is_bitmask() and not format.is_array(): + if (format.is_bitmask() or format.is_mixed()) and not format.is_array() or format.short_name() == "r11g11b10_float": if channel.type == VOID: if channel.size: print ' unsigned %s:%u;' % (channel.name, channel.size) @@ -58,6 +58,11 @@ def generate_format_type(format): print ' unsigned %s:%u;' % (channel.name, channel.size) elif channel.type == SIGNED: print ' int %s:%u;' % (channel.name, channel.size) + elif channel.type == FLOAT: + if channel.size == 32: + print ' float %s;' % (channel.name) + else: + print ' unsigned %s:%u;' % (channel.name, channel.size) else: assert 0 else: @@ -107,6 +112,9 @@ def is_format_supported(format): channel = format.channels[i] if channel.type not in (VOID, UNSIGNED, SIGNED, FLOAT): return False + if channel.type == FLOAT: + if channel.size not in (32, 64): + return False # We can only read a color from a depth/stencil format if the depth channel is present if format.colorspace == 'zs' and format.swizzles[0] == SWIZZLE_NONE: diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py index f74dc5e88a..03dc62d329 100755 --- a/src/gallium/auxiliary/util/u_format_parse.py +++ b/src/gallium/auxiliary/util/u_format_parse.py @@ -142,6 +142,8 @@ class Format: def is_mixed(self): ref_channel = self.channels[0] + if ref_channel.type == VOID: + ref_channel = self.channels[1] for channel in self.channels[1:]: if channel.type != VOID: if channel.type != ref_channel.type: diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index c5fd7a6783..ad4a06dc77 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -446,17 +446,17 @@ util_pack_z(enum pipe_format format, double z) return (uint) (z * 0xffffffff); case PIPE_FORMAT_Z32_FLOAT: return (uint)z; - case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_USCALED: case PIPE_FORMAT_Z24X8_UNORM: if (z == 1.0) return 0xffffff; return (uint) (z * 0xffffff); - case PIPE_FORMAT_S8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: if (z == 1.0) return 0xffffff00; return ((uint) (z * 0xffffff)) << 8; - case PIPE_FORMAT_S8_UNORM: + case PIPE_FORMAT_S8_USCALED: /* this case can get it via util_pack_z_stencil() */ return 0; default: @@ -477,13 +477,13 @@ util_pack_z_stencil(enum pipe_format format, double z, uint s) unsigned packed = util_pack_z(format, z); switch (format) { - case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_USCALED: packed |= s << 24; break; - case PIPE_FORMAT_S8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: packed |= s; break; - case PIPE_FORMAT_S8_UNORM: + case PIPE_FORMAT_S8_USCALED: packed |= s; break; default: diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 09b2382733..e03ee9b8bd 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -1036,7 +1036,7 @@ z32_get_tile_rgba(const unsigned *src, } -/*** PIPE_FORMAT_Z24S8_UNORM ***/ +/*** PIPE_FORMAT_Z24_UNORM_S8_USCALED ***/ /** * Return Z component as four float in [0,1]. Stencil part ignored. @@ -1063,7 +1063,7 @@ s8z24_get_tile_rgba(const unsigned *src, } -/*** PIPE_FORMAT_S8Z24_UNORM ***/ +/*** PIPE_FORMAT_S8_USCALED_Z24_UNORM ***/ /** * Return Z component as four float in [0,1]. Stencil part ignored. @@ -1271,11 +1271,11 @@ pipe_tile_raw_to_rgba(enum pipe_format format, case PIPE_FORMAT_Z32_UNORM: z32_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); break; - case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_USCALED: case PIPE_FORMAT_Z24X8_UNORM: s8z24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); break; - case PIPE_FORMAT_S8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: z24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); break; @@ -1468,11 +1468,11 @@ pipe_put_tile_rgba(struct pipe_context *pipe, case PIPE_FORMAT_Z32_UNORM: /*z32_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/ break; - case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_USCALED: case PIPE_FORMAT_Z24X8_UNORM: /*s8z24_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/ break; - case PIPE_FORMAT_S8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: /*z24s8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/ break; @@ -1525,7 +1525,7 @@ pipe_get_tile_z(struct pipe_context *pipe, } } break; - case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_USCALED: case PIPE_FORMAT_Z24X8_UNORM: { const uint *ptrc @@ -1540,7 +1540,7 @@ pipe_get_tile_z(struct pipe_context *pipe, } } break; - case PIPE_FORMAT_S8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: { const uint *ptrc @@ -1609,7 +1609,7 @@ pipe_put_tile_z(struct pipe_context *pipe, } } break; - case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_USCALED: { uint *pDest = (uint *) (map + y * pt->stride + x*4); assert((pt->usage & PIPE_TRANSFER_READ_WRITE) == PIPE_TRANSFER_READ_WRITE); @@ -1636,7 +1636,7 @@ pipe_put_tile_z(struct pipe_context *pipe, } } break; - case PIPE_FORMAT_S8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: { uint *pDest = (uint *) (map + y * pt->stride + x*4); assert((pt->usage & PIPE_TRANSFER_READ_WRITE) == PIPE_TRANSFER_READ_WRITE); |