diff options
author | Marek Olšák <[email protected]> | 2012-01-01 12:36:44 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-01-05 18:29:11 +0100 |
commit | 1acef6a7465e8c54dc10a43c9e7278d4506c1d5e (patch) | |
tree | 390680f6845723b1002061eb3a3b79f327d987da /src/gallium/auxiliary/translate | |
parent | 501e2e3b6d64de9937d397b49ad3930d4bac3083 (diff) |
translate: implement translation of half floats in the generic codepath
Diffstat (limited to 'src/gallium/auxiliary/translate')
-rw-r--r-- | src/gallium/auxiliary/translate/translate_generic.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c index e4e1c868333..516a1efeab0 100644 --- a/src/gallium/auxiliary/translate/translate_generic.c +++ b/src/gallium/auxiliary/translate/translate_generic.c @@ -32,6 +32,7 @@ #include "util/u_memory.h" #include "util/u_format.h" +#include "util/u_half.h" #include "util/u_math.h" #include "pipe/p_state.h" #include "translate.h" @@ -105,6 +106,7 @@ emit_##NAME(const float *attrib, void *ptr) \ #define TO_64_FLOAT(x) ((double) x) #define TO_32_FLOAT(x) (x) +#define TO_16_FLOAT(x) util_float_to_half(x) #define TO_8_USCALED(x) ((unsigned char) x) #define TO_16_USCALED(x) ((unsigned short) x) @@ -135,6 +137,11 @@ ATTRIB( R32G32B32_FLOAT, 3, float, TO_32_FLOAT ) ATTRIB( R32G32_FLOAT, 2, float, TO_32_FLOAT ) ATTRIB( R32_FLOAT, 1, float, TO_32_FLOAT ) +ATTRIB( R16G16B16A16_FLOAT, 4, ushort, TO_16_FLOAT ) +ATTRIB( R16G16B16_FLOAT, 3, ushort, TO_16_FLOAT ) +ATTRIB( R16G16_FLOAT, 2, ushort, TO_16_FLOAT ) +ATTRIB( R16_FLOAT, 1, ushort, TO_16_FLOAT ) + ATTRIB( R32G32B32A32_USCALED, 4, unsigned, TO_32_USCALED ) ATTRIB( R32G32B32_USCALED, 3, unsigned, TO_32_USCALED ) ATTRIB( R32G32_USCALED, 2, unsigned, TO_32_USCALED ) @@ -242,6 +249,15 @@ static emit_func get_emit_func( enum pipe_format format ) case PIPE_FORMAT_R32G32B32A32_FLOAT: return &emit_R32G32B32A32_FLOAT; + case PIPE_FORMAT_R16_FLOAT: + return &emit_R16_FLOAT; + case PIPE_FORMAT_R16G16_FLOAT: + return &emit_R16G16_FLOAT; + case PIPE_FORMAT_R16G16B16_FLOAT: + return &emit_R16G16B16_FLOAT; + case PIPE_FORMAT_R16G16B16A16_FLOAT: + return &emit_R16G16B16A16_FLOAT; + case PIPE_FORMAT_R32_UNORM: return &emit_R32_UNORM; case PIPE_FORMAT_R32G32_UNORM: @@ -595,6 +611,11 @@ boolean translate_generic_is_output_format_supported(enum pipe_format format) case PIPE_FORMAT_R32G32_FLOAT: return TRUE; case PIPE_FORMAT_R32_FLOAT: return TRUE; + case PIPE_FORMAT_R16G16B16A16_FLOAT: return TRUE; + case PIPE_FORMAT_R16G16B16_FLOAT: return TRUE; + case PIPE_FORMAT_R16G16_FLOAT: return TRUE; + case PIPE_FORMAT_R16_FLOAT: return TRUE; + case PIPE_FORMAT_R32G32B32A32_USCALED: return TRUE; case PIPE_FORMAT_R32G32B32_USCALED: return TRUE; case PIPE_FORMAT_R32G32_USCALED: return TRUE; |