Skip to content

Commit

Permalink
d3dretrace: Add support for dual channel formats
Browse files Browse the repository at this point in the history
Add support for D3DFMT_G32R32F and D3DFMT_G16R16F.

v2: add channelType

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
  • Loading branch information
siro20 authored and jrfonseca committed Sep 21, 2016
1 parent 26be65c commit 3607bf9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions retrace/d3d9state_formats.cpp
Expand Up @@ -181,6 +181,11 @@ ConvertImage(D3DFORMAT SrcFormat,
numChannels = 3;
channelType = image::TYPE_UNORM8;
break;
case D3DFMT_G32R32F:
case D3DFMT_G16R16F:
numChannels = 2;
channelType = image::TYPE_FLOAT;
break;
case D3DFMT_R32F:
case D3DFMT_R16F:
case D3DFMT_D16:
Expand Down Expand Up @@ -234,6 +239,18 @@ ConvertImage(D3DFORMAT SrcFormat,
dst[3*x + 2] = src[4*x + 0];
}
break;
case D3DFMT_G32R32F:
for (unsigned x = 0; x < Width; ++x) {
((float *)dst)[2*x + 0] = ((const float *)src)[2*x + 0];
((float *)dst)[2*x + 1] = ((const float *)src)[2*x + 1];
}
break;
case D3DFMT_G16R16F:
for (unsigned x = 0; x < Width; ++x) {
((float *)dst)[2*x + 0] = util_half_to_float(((const uint16_t *)src)[2*x + 0]);
((float *)dst)[2*x + 1] = util_half_to_float(((const uint16_t *)src)[2*x + 1]);
}
break;
case D3DFMT_D16:
case D3DFMT_D16_LOCKABLE:
case D3DFMT_DF16:
Expand Down

0 comments on commit 3607bf9

Please sign in to comment.