summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-03-18 11:27:29 +0000
committerJosé Fonseca <[email protected]>2010-03-31 20:19:14 +0100
commit329814c6ee8a87d67a55ecf197af9d6e6fb7ade0 (patch)
treec0dacdd8c1e4bdcf05d2df02b33ebe38822a4af7 /src
parent9fcf2b87b35240efe8dd8ebe7d2f40268e647902 (diff)
util: Describe PIPE_FORMAT_NONE as PIPE_FORMAT_R8_USCALED.
Avoids the need to special case PIPE_FORMAT_NONE so often. Conflicts: src/gallium/auxiliary/util/u_format_table.py
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_format.csv4
-rw-r--r--src/gallium/auxiliary/util/u_format.h28
-rwxr-xr-xsrc/gallium/auxiliary/util/u_format_table.py51
3 files changed, 19 insertions, 64 deletions
diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
index ee91788d71f..0cf539247e7 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -56,6 +56,10 @@
# internal formats to base in- ternal formats, and desired component
# resolutions for each sized internal format."
+# None
+# Described as regular uint_8 bytes, i.e. PIPE_FORMAT_R8_USCALED
+PIPE_FORMAT_NONE , plain, 1, 1, u8 , , , , x001, rgb
+
# 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 , x8 , zyx1, rgb
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 8e76e13b664..0fad81fe403 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -239,8 +239,8 @@ util_format_name(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return "???";
}
@@ -252,8 +252,8 @@ util_format_is_s3tc(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return FALSE;
}
@@ -265,8 +265,8 @@ util_format_is_depth_or_stencil(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return FALSE;
}
@@ -278,8 +278,8 @@ util_format_is_depth_and_stencil(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return FALSE;
}
@@ -328,8 +328,8 @@ util_format_get_blocksizebits(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return 0;
}
@@ -354,8 +354,8 @@ util_format_get_blockwidth(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return 1;
}
@@ -367,8 +367,8 @@ util_format_get_blockheight(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return 1;
}
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
index 6877bd6844c..1309044097f 100755
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -3,7 +3,7 @@
'''
/**************************************************************************
*
- * Copyright 2009 VMware, Inc.
+ * Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -87,53 +87,6 @@ def write_format_table(formats):
print
print '#include "u_format.h"'
print
- print '''
-static void
-util_format_none_unpack_8unorm(uint8_t *dst, const uint8_t *src, unsigned length)
-{
-}
-
-static void
-util_format_none_pack_8unorm(uint8_t *dst, const uint8_t *src, unsigned length)
-{
-}
-
-static void
-util_format_none_unpack_float(float *dst, const uint8_t *src, unsigned length)
-{
-}
-
-static void
-util_format_none_pack_float(uint8_t *dst, const float *src, unsigned length)
-{
-}
-
-static void
-util_format_none_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-}
- '''
- print 'const struct util_format_description'
- print 'util_format_none_description = {'
- print " PIPE_FORMAT_NONE,"
- print " \"PIPE_FORMAT_NONE\","
- print " \"none\","
- print " {0, 0, 0},"
- print " 0,"
- print " 0,"
- print " 0,"
- print " 0,"
- print " 0,"
- print " {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},"
- print " {0, 0, 0, 0},"
- print " 0,"
- print " &util_format_none_unpack_8unorm,"
- print " &util_format_none_pack_8unorm,"
- print " &util_format_none_unpack_float,"
- print " &util_format_none_pack_float,"
- print " &util_format_none_fetch_float"
- print "};"
- print
u_format_pack.generate(formats)
@@ -191,8 +144,6 @@ util_format_none_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigne
print " }"
print
print " switch (format) {"
- print " case PIPE_FORMAT_NONE:"
- print " return &util_format_none_description;"
for format in formats:
print " case %s:" % format.name
print " return &util_format_%s_description;" % (format.short_name(),)