diff options
author | Patrick Rudolph <siro@das-labor.org> | 2016-09-02 15:27:58 +0200 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-09-21 11:48:49 +0100 |
commit | 209c426e7d83cd6021b84590e84be282dd305e2a (patch) | |
tree | 8bf6713e895660c6a9e38e2493d446d5bd3eae9c | |
parent | 3607bf902e1026d3cb707b7d211dcff40cfcce79 (diff) |
d3dretrace: Add support for quad float channel formats
Add format D3DFMT_A32B32G32R32F and D3DFMT_A16B16G16R16F.
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
-rw-r--r-- | retrace/d3d9state_formats.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/retrace/d3d9state_formats.cpp b/retrace/d3d9state_formats.cpp index 6a7def57..9651e16d 100644 --- a/retrace/d3d9state_formats.cpp +++ b/retrace/d3d9state_formats.cpp @@ -175,6 +175,11 @@ ConvertImage(D3DFORMAT SrcFormat, unsigned numChannels; image::ChannelType channelType; switch (SrcFormat) { + case D3DFMT_A32B32G32R32F: + case D3DFMT_A16B16G16R16F: + numChannels = 4; + channelType = image::TYPE_FLOAT; + break; case D3DFMT_X8R8G8B8: case D3DFMT_A8R8G8B8: case D3DFMT_R5G6B5: @@ -239,6 +244,22 @@ ConvertImage(D3DFORMAT SrcFormat, dst[3*x + 2] = src[4*x + 0]; } break; + case D3DFMT_A32B32G32R32F: + for (unsigned x = 0; x < Width; ++x) { + ((float *)dst)[4*x + 0] = ((const float *)src)[4*x + 0]; + ((float *)dst)[4*x + 1] = ((const float *)src)[4*x + 1]; + ((float *)dst)[4*x + 2] = ((const float *)src)[4*x + 2]; + ((float *)dst)[4*x + 3] = ((const float *)src)[4*x + 3]; + } + break; + case D3DFMT_A16B16G16R16F: + for (unsigned x = 0; x < Width; ++x) { + ((float *)dst)[4*x + 0] = util_half_to_float(((const uint16_t *)src)[4*x + 0]); + ((float *)dst)[4*x + 1] = util_half_to_float(((const uint16_t *)src)[4*x + 1]); + ((float *)dst)[4*x + 2] = util_half_to_float(((const uint16_t *)src)[4*x + 2]); + ((float *)dst)[4*x + 3] = util_half_to_float(((const uint16_t *)src)[4*x + 3]); + } + break; case D3DFMT_G32R32F: for (unsigned x = 0; x < Width; ++x) { ((float *)dst)[2*x + 0] = ((const float *)src)[2*x + 0]; |