diff options
author | Axel Davy <[email protected]> | 2016-03-07 22:30:05 +0100 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-05-18 23:37:14 +0200 |
commit | 10e548c0c954d50a594728b228f8d59b76579956 (patch) | |
tree | be75b668b45e824234c40d8f2e635603980c21f8 /src | |
parent | 258ca1823c322661122d2d033c8b7facd3eb7767 (diff) |
st/nine: Add support for X8L8V8U8
X8L8V8U8 support should be common. Some more recent cards
do support this format, but not L6V5U5.
Add fallback for this format to have it alwaus supported.
L6V5U5 conversion rule apparently differs a bit from the normal
spec, and thus the gallium equivalent format leads to slightly
wrong colors. Since some recent cards do not support it, do not
support it either.
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/nine/nine_pipe.c | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_pipe.h | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c index 27a10d64473..461b416d2a2 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.c +++ b/src/gallium/state_trackers/nine/nine_pipe.c @@ -289,8 +289,8 @@ const enum pipe_format nine_d3d9_to_pipe_format_map[120] = [D3DFMT_A8L8] = PIPE_FORMAT_L8A8_UNORM, [D3DFMT_A4L4] = PIPE_FORMAT_L4A4_UNORM, [D3DFMT_V8U8] = PIPE_FORMAT_R8G8_SNORM, - [D3DFMT_L6V5U5] = PIPE_FORMAT_NONE, - [D3DFMT_X8L8V8U8] = PIPE_FORMAT_NONE, + [D3DFMT_L6V5U5] = PIPE_FORMAT_NONE, /* Should be PIPE_FORMAT_R5SG5SB6U_NORM, but interpretation of the data differs a bit. */ + [D3DFMT_X8L8V8U8] = PIPE_FORMAT_R8SG8SB8UX8U_NORM, [D3DFMT_Q8W8V8U8] = PIPE_FORMAT_R8G8B8A8_SNORM, [D3DFMT_V16U16] = PIPE_FORMAT_R16G16_SNORM, [D3DFMT_A2W10V10U10] = PIPE_FORMAT_R10SG10SB10SA2U_NORM, diff --git a/src/gallium/state_trackers/nine/nine_pipe.h b/src/gallium/state_trackers/nine/nine_pipe.h index 1ffce7dc1d7..9c8e8e6a062 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.h +++ b/src/gallium/state_trackers/nine/nine_pipe.h @@ -338,7 +338,8 @@ d3d9_to_pipe_format_checked(struct pipe_screen *screen, /* bypass_check: Used for D3DPOOL_SCRATCH, which * isn't limited to the formats supported by the - * device. */ + * device, and to check we are not using a format + * fallback. */ if (bypass_check || format_check_internal(result)) return result; @@ -357,6 +358,15 @@ d3d9_to_pipe_format_checked(struct pipe_screen *screen, case D3DFMT_D24X8: if (format_check_internal(PIPE_FORMAT_Z24X8_UNORM)) return PIPE_FORMAT_Z24X8_UNORM; + /* Support for X8L8V8U8 bumpenvmap format with lighting bits. + * X8L8V8U8 is commonly supported among dx9 cards. + * To avoid precision loss, we use PIPE_FORMAT_R32G32B32X32_FLOAT, + * however using PIPE_FORMAT_R8G8B8A8_SNORM should be ok */ + case D3DFMT_X8L8V8U8: + if (bindings & PIPE_BIND_RENDER_TARGET) + return PIPE_FORMAT_NONE; + if (format_check_internal(PIPE_FORMAT_R32G32B32X32_FLOAT)) + return PIPE_FORMAT_R32G32B32X32_FLOAT; default: break; } |