summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_format.csv20
-rw-r--r--src/gallium/auxiliary/util/u_format_access.py5
-rw-r--r--src/gallium/auxiliary/util/u_format_pack.py14
-rwxr-xr-xsrc/gallium/auxiliary/util/u_format_parse.py2
4 files changed, 29 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
index 2b2230f308..f55bc3d805 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -58,12 +58,12 @@
# Typical rendertarget formats
PIPE_FORMAT_B8G8R8A8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , zyxw, rgb
-PIPE_FORMAT_B8G8R8X8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , zyx1, rgb
+PIPE_FORMAT_B8G8R8X8_UNORM , plain, 1, 1, un8 , un8 , un8 , x8 , zyx1, rgb
PIPE_FORMAT_A8R8G8B8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , yzwx, rgb
-PIPE_FORMAT_X8R8G8B8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , yzw1, rgb
+PIPE_FORMAT_X8R8G8B8_UNORM , plain, 1, 1, x8 , un8 , un8 , un8 , yzw1, rgb
PIPE_FORMAT_A8B8G8R8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , wzyx, rgb
-PIPE_FORMAT_X8B8G8R8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , wzy1, rgb
-PIPE_FORMAT_B5G5R5X1_UNORM , plain, 1, 1, un5 , un5 , un5 , un1 , zyx1, rgb
+PIPE_FORMAT_X8B8G8R8_UNORM , plain, 1, 1, x8 , un8 , un8 , un8 , wzy1, rgb
+PIPE_FORMAT_B5G5R5X1_UNORM , plain, 1, 1, un5 , un5 , un5 , x1 , zyx1, rgb
PIPE_FORMAT_B5G5R5A1_UNORM , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb
PIPE_FORMAT_B4G4R4A4_UNORM , plain, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb
PIPE_FORMAT_B5G6R5_UNORM , plain, 1, 1, un5 , un6 , un5 , , zyx1, rgb
@@ -82,11 +82,11 @@ PIPE_FORMAT_L8A8_SRGB , plain, 1, 1, un8 , un8 , , , xxxy, s
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, un8 , un8 , un8 , un8 , wzy1, 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
-PIPE_FORMAT_B8G8R8X8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , zyx1, srgb
+PIPE_FORMAT_B8G8R8X8_SRGB , plain, 1, 1, un8 , un8 , un8 , x8 , zyx1, srgb
PIPE_FORMAT_A8R8G8B8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , yzwx, srgb
-PIPE_FORMAT_X8R8G8B8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , yzw1, srgb
+PIPE_FORMAT_X8R8G8B8_SRGB , plain, 1, 1, x8 , un8 , un8 , un8 , yzw1, srgb
# Mixed-sign formats (typically used for bump map textures)
PIPE_FORMAT_R8SG8SB8UX8U_NORM , plain, 1, 1, sn8 , sn8 , un8 , x8 , xyz1, rgb
@@ -99,9 +99,9 @@ PIPE_FORMAT_Z32_UNORM , plain, 1, 1, un32, , , , x___,
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, u8 , , , x___, zs
-PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, u8 , un24, , , y___, zs
-PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED , plain, 1, 1, f32, u8 , u24 , , xy__, 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
diff --git a/src/gallium/auxiliary/util/u_format_access.py b/src/gallium/auxiliary/util/u_format_access.py
index 00424779d2..42a37badca 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:
@@ -78,6 +81,8 @@ def native_type(format):
else:
# For array pixel formats return the integer type that matches the color channel
channel = format.channels[0]
+ if channel.type == VOID:
+ channel = format.channels[1]
if channel.type == UNSIGNED:
return 'uint%u_t' % channel.size
elif channel.type == SIGNED:
diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
index 409d024c63..47def90317 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:
@@ -125,6 +133,8 @@ def native_type(format):
else:
# For array pixel formats return the integer type that matches the color channel
type = format.channels[0]
+ if type.type == VOID:
+ type = format.channels[1]
if type.type == UNSIGNED:
return 'uint%u_t' % type.size
elif type.type == SIGNED:
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: