summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_format.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/util/u_format.h')
-rw-r--r--src/gallium/auxiliary/util/u_format.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 98d4b98ebb..609d398ebf 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -189,6 +189,23 @@ struct util_format_description
* Colorspace transformation.
*/
enum util_format_colorspace colorspace;
+
+ /**
+ * Accessor functions.
+ */
+
+ void
+ (*unpack_8unorm)(uint8_t *dst, const uint8_t *src, unsigned nr_blocks);
+
+ void
+ (*pack_8unorm)(uint8_t *dst, const uint8_t *src, unsigned nr_blocks);
+
+ void
+ (*unpack_float)(float *dst, const uint8_t *src, unsigned nr_blocks);
+
+ void
+ (*pack_float)(uint8_t *dst, const float *src, unsigned nr_blocks);
+
};
@@ -261,6 +278,34 @@ util_format_is_depth_and_stencil(enum pipe_format format)
desc->swizzle[1] != UTIL_FORMAT_SWIZZLE_NONE) ? TRUE : FALSE;
}
+/**
+ * Whether this format is a rgab8 variant.
+ *
+ * That is, any format that matches the
+ *
+ * PIPE_FORMAT_?8?8?8?8_UNORM
+ */
+static INLINE boolean
+util_format_is_rgba8_variant(const struct util_format_description *desc)
+{
+ unsigned chan;
+
+ if(desc->block.width != 1 ||
+ desc->block.height != 1 ||
+ desc->block.bits != 32)
+ return FALSE;
+
+ for(chan = 0; chan < 4; ++chan) {
+ if(desc->channel[chan].type != UTIL_FORMAT_TYPE_UNSIGNED &&
+ desc->channel[chan].type != UTIL_FORMAT_TYPE_VOID)
+ return FALSE;
+ if(desc->channel[chan].size != 8)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/**
* Return total bits needed for the pixel format per block.