diff options
author | Marek Olšák <[email protected]> | 2019-01-15 12:33:53 -0500 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-01-22 12:21:43 -0500 |
commit | b443465fb966218fd81c119d4d6e449ab7ffc0a5 (patch) | |
tree | fed3356cd23d1a74eed159c42a1697cbd7ec429c /src/gallium/auxiliary | |
parent | 3ee240890ce2d474ce96712972d2e06e363341f4 (diff) |
gallium/util: add util_format_snorm8_to_sint8 (from radeonsi)
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/util/u_format.c | 40 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_format.h | 3 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index 231e89017b4..862061a8ec2 100644 --- a/src/gallium/auxiliary/util/u_format.c +++ b/src/gallium/auxiliary/util/u_format.c @@ -886,3 +886,43 @@ void util_format_unswizzle_4f(float *dst, const float *src, } } } + +enum pipe_format +util_format_snorm8_to_sint8(enum pipe_format format) +{ + switch (format) { + case PIPE_FORMAT_R8_SNORM: + return PIPE_FORMAT_R8_SINT; + case PIPE_FORMAT_R8G8_SNORM: + return PIPE_FORMAT_R8G8_SINT; + case PIPE_FORMAT_R8G8B8_SNORM: + return PIPE_FORMAT_R8G8B8_SINT; + case PIPE_FORMAT_R8G8B8A8_SNORM: + return PIPE_FORMAT_R8G8B8A8_SINT; + + case PIPE_FORMAT_A8_SNORM: + return PIPE_FORMAT_A8_SINT; + case PIPE_FORMAT_L8_SNORM: + return PIPE_FORMAT_L8_SINT; + case PIPE_FORMAT_L8A8_SNORM: + return PIPE_FORMAT_L8A8_SINT; + case PIPE_FORMAT_I8_SNORM: + return PIPE_FORMAT_I8_SINT; + + case PIPE_FORMAT_R8G8B8X8_SNORM: + return PIPE_FORMAT_R8G8B8X8_SINT; + case PIPE_FORMAT_R8A8_SNORM: + return PIPE_FORMAT_R8A8_SINT; + case PIPE_FORMAT_A8L8_SNORM: + return PIPE_FORMAT_A8L8_SINT; + case PIPE_FORMAT_G8R8_SNORM: + return PIPE_FORMAT_G8R8_SINT; + case PIPE_FORMAT_A8B8G8R8_SNORM: + return PIPE_FORMAT_A8B8G8R8_SINT; + case PIPE_FORMAT_X8B8G8R8_SNORM: + return PIPE_FORMAT_X8B8G8R8_SINT; + + default: + return format; + } +} diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index 8dcc438a4a1..0c0c505e391 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -1358,6 +1358,9 @@ void pipe_swizzle_4f(float *dst, const float *src, void util_format_unswizzle_4f(float *dst, const float *src, const unsigned char swz[4]); +enum pipe_format +util_format_snorm8_to_sint8(enum pipe_format format); + #ifdef __cplusplus } // extern "C" { #endif |