diff options
author | Michel Dänzer <daenzer@vmware.com> | 2009-04-04 16:04:59 +0200 |
---|---|---|
committer | Michel Dänzer <daenzer@vmware.com> | 2009-04-04 16:04:59 +0200 |
commit | ba14b043bc1ab87e8e5e46e6e909a8def9535028 (patch) | |
tree | 38d4c58fcee1af9f9c4857ff708826623c66c9e8 /src/gallium | |
parent | b0ce91518646b62169594da661dd92ac899cbd6f (diff) |
gallium: Add utility helper for packing combined depth/stencil values.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/util/u_pack_color.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index e0e8aa8e9f..e05d032253 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -440,6 +440,26 @@ util_pack_z(enum pipe_format format, double z) return 0; } } + + +/** + * Note: it's assumed that z is in [0,1] and s in [0,255] + */ +static INLINE uint +util_pack_z_stencil(enum pipe_format format, double z, uint s) +{ + switch (format) { + case PIPE_FORMAT_S8Z24_UNORM: + return util_pack_z(format, z) | s << 24; + case PIPE_FORMAT_Z24S8_UNORM: + return util_pack_z(format, z) | s; + default: + debug_print_format("gallium: unhandled format in util_pack_z_stencil()", + format); + assert(0); + return 0; + } +} /** |