diff options
author | Kenneth Graunke <[email protected]> | 2018-07-30 15:20:47 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2018-10-14 23:36:28 -0700 |
commit | 5849e0612cc4c21d213bdb4bd8d0a3f9531cc2b3 (patch) | |
tree | 8f6a9bd56313a9af9050387ed1b2796f954dabc1 | |
parent | 1c0f92d8a8c480a5803c3ce45b2a6d46bfcd280f (diff) |
gallium/auxiliary: Add util_format_get_depth_only() helper.
This will be used by u_transfer_helper.c shortly, in order to split
packed depth-stencil into separate resources.
Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r-- | src/gallium/auxiliary/util/u_format.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index f421222f854..e66849c16b1 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -557,6 +557,27 @@ util_format_is_depth_and_stencil(enum pipe_format format) util_format_has_stencil(desc); } +/** + * For depth-stencil formats, return the equivalent depth-only format. + */ +static inline boolean +util_format_get_depth_only(enum pipe_format format) +{ + switch (format) { + case PIPE_FORMAT_Z24_UNORM_S8_UINT: + return PIPE_FORMAT_Z24X8_UNORM; + + case PIPE_FORMAT_S8_UINT_Z24_UNORM: + return PIPE_FORMAT_X8Z24_UNORM; + + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: + return PIPE_FORMAT_Z32_FLOAT; + + default: + return format; + } +} + static inline boolean util_format_is_yuv(enum pipe_format format) { |