From: Axel Davy Date: Sat, 10 Jan 2015 11:38:02 +0000 (+0100) Subject: st/nine: Refactor nine_d3d9_to_pipe_format_map X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f8713b1bfd0099e262f1224bb5fb02ee42838d55;p=mesa.git st/nine: Refactor nine_d3d9_to_pipe_format_map The order of the format is changed to have an increasing ordering of the d3d9 format values. Some missing formats are added and matched to PIPE_FORMAT_NONE Reviewed-by: Tiziano Bacocco Signed-off-by: Axel Davy --- diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c index 3a7bb90d222..0bfb379129b 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.c +++ b/src/gallium/state_trackers/nine/nine_pipe.c @@ -248,95 +248,60 @@ nine_pipe_context_clear(struct NineDevice9 *This) const enum pipe_format nine_d3d9_to_pipe_format_map[120] = { - [D3DFMT_UNKNOWN] = PIPE_FORMAT_NONE, - - [D3DFMT_A8R8G8B8] = PIPE_FORMAT_B8G8R8A8_UNORM, - [D3DFMT_X8R8G8B8] = PIPE_FORMAT_B8G8R8X8_UNORM, - [D3DFMT_R5G6B5] = PIPE_FORMAT_B5G6R5_UNORM, - [D3DFMT_X1R5G5B5] = PIPE_FORMAT_B5G5R5X1_UNORM, - [D3DFMT_A1R5G5B5] = PIPE_FORMAT_B5G5R5A1_UNORM, - [D3DFMT_A4R4G4B4] = PIPE_FORMAT_B4G4R4A4_UNORM, - [D3DFMT_A8] = PIPE_FORMAT_A8_UNORM, - [D3DFMT_X4R4G4B4] = PIPE_FORMAT_B4G4R4X4_UNORM, - [D3DFMT_R3G3B2] = PIPE_FORMAT_B2G3R3_UNORM, - [D3DFMT_A2B10G10R10] = PIPE_FORMAT_R10G10B10A2_UNORM, - [D3DFMT_A8B8G8R8] = PIPE_FORMAT_R8G8B8A8_UNORM, - [D3DFMT_X8B8G8R8] = PIPE_FORMAT_R8G8B8X8_UNORM, - [D3DFMT_G16R16] = PIPE_FORMAT_R16G16_UNORM, - [D3DFMT_A2R10G10B10] = PIPE_FORMAT_B10G10R10A2_UNORM, - [D3DFMT_A16B16G16R16] = PIPE_FORMAT_R16G16B16A16_UNORM, - - /* palette texture formats not supported by gallium/hardware, TODO ? */ - [D3DFMT_P8] = PIPE_FORMAT_NONE, - [D3DFMT_A8P8] = PIPE_FORMAT_NONE, - - [D3DFMT_L8] = PIPE_FORMAT_L8_UNORM, - [D3DFMT_A8L8] = PIPE_FORMAT_L8A8_UNORM, - [D3DFMT_A4L4] = PIPE_FORMAT_L4A4_UNORM, - - [D3DFMT_V8U8] = PIPE_FORMAT_R8G8_SNORM, - [D3DFMT_Q8W8V8U8] = PIPE_FORMAT_R8G8B8A8_SNORM, - [D3DFMT_V16U16] = PIPE_FORMAT_R16G16_SNORM, - [D3DFMT_A2W10V10U10] = PIPE_FORMAT_R10SG10SB10SA2U_NORM, - - /* [D3DFMT_UYVY] = PIPE_FORMAT_YUYV, fourcc */ - /* [D3DFMT_YUY2] = PIPE_FORMAT_NONE, fourcc */ - - /* XXX: DXT2, DXT4 */ - /* fourcc - [D3DFMT_DXT1] = PIPE_FORMAT_DXT1_RGBA, - [D3DFMT_DXT2] = PIPE_FORMAT_DXT3_RGBA, - [D3DFMT_DXT3] = PIPE_FORMAT_DXT3_RGBA, - [D3DFMT_DXT4] = PIPE_FORMAT_DXT5_RGBA, - [D3DFMT_DXT5] = PIPE_FORMAT_DXT5_RGBA, - */ - - /* XXX: order ? */ - /* fourcc - [D3DFMT_G8R8_G8B8] = PIPE_FORMAT_G8R8_G8B8_UNORM, - [D3DFMT_R8G8_B8G8] = PIPE_FORMAT_R8G8_B8G8_UNORM, - */ - + [D3DFMT_UNKNOWN] = PIPE_FORMAT_NONE, + [D3DFMT_R8G8B8] = PIPE_FORMAT_NONE, + [D3DFMT_A8R8G8B8] = PIPE_FORMAT_B8G8R8A8_UNORM, + [D3DFMT_X8R8G8B8] = PIPE_FORMAT_B8G8R8X8_UNORM, + [D3DFMT_R5G6B5] = PIPE_FORMAT_B5G6R5_UNORM, + [D3DFMT_X1R5G5B5] = PIPE_FORMAT_B5G5R5X1_UNORM, + [D3DFMT_A1R5G5B5] = PIPE_FORMAT_B5G5R5A1_UNORM, + [D3DFMT_A4R4G4B4] = PIPE_FORMAT_B4G4R4A4_UNORM, + [D3DFMT_R3G3B2] = PIPE_FORMAT_B2G3R3_UNORM, + [D3DFMT_A8] = PIPE_FORMAT_A8_UNORM, + [D3DFMT_A8R3G3B2] = PIPE_FORMAT_NONE + [D3DFMT_X4R4G4B4] = PIPE_FORMAT_B4G4R4X4_UNORM, + [D3DFMT_A2B10G10R10] = PIPE_FORMAT_R10G10B10A2_UNORM, + [D3DFMT_A8B8G8R8] = PIPE_FORMAT_R8G8B8A8_UNORM, + [D3DFMT_X8B8G8R8] = PIPE_FORMAT_R8G8B8X8_UNORM, + [D3DFMT_G16R16] = PIPE_FORMAT_R16G16_UNORM, + [D3DFMT_A2R10G10B10] = PIPE_FORMAT_B10G10R10A2_UNORM, + [D3DFMT_A16B16G16R16] = PIPE_FORMAT_R16G16B16A16_UNORM, + [D3DFMT_A8P8] = PIPE_FORMAT_NONE, + [D3DFMT_P8] = PIPE_FORMAT_NONE, + [D3DFMT_L8] = PIPE_FORMAT_L8_UNORM, + [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_Q8W8V8U8] = PIPE_FORMAT_R8G8B8A8_SNORM, + [D3DFMT_V16U16] = PIPE_FORMAT_R16G16_SNORM, + [D3DFMT_A2W10V10U10] = PIPE_FORMAT_R10SG10SB10SA2U_NORM, [D3DFMT_D16_LOCKABLE] = PIPE_FORMAT_Z16_UNORM, [D3DFMT_D32] = PIPE_FORMAT_Z32_UNORM, + [D3DFMT_D15S1] = PIPE_FORMAT_Z24_UNORM_S8_UINT, [D3DFMT_D24S8] = PIPE_FORMAT_S8_UINT_Z24_UNORM, [D3DFMT_D24X8] = PIPE_FORMAT_X8Z24_UNORM, + [D3DFMT_D24X4S4] = PIPE_FORMAT_Z24_UNORM_S8_UINT, [D3DFMT_D16] = PIPE_FORMAT_Z16_UNORM, - [D3DFMT_L16] = PIPE_FORMAT_L16_UNORM, [D3DFMT_D32F_LOCKABLE] = PIPE_FORMAT_Z32_FLOAT, - - [D3DFMT_INDEX16] = PIPE_FORMAT_R16_UINT, - [D3DFMT_INDEX32] = PIPE_FORMAT_R32_UINT, - [D3DFMT_Q16W16V16U16] = PIPE_FORMAT_R16G16B16A16_SNORM, - + [D3DFMT_D24FS8] = PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, + [D3DFMT_D32_LOCKABLE] = PIPE_FORMAT_NONE, + [D3DFMT_S8_LOCKABLE] = PIPE_FORMAT_NONE, + [D3DFMT_L16] = PIPE_FORMAT_L16_UNORM, + [D3DFMT_VERTEXDATA] = PIPE_FORMAT_NONE, + [D3DFMT_INDEX16] = PIPE_FORMAT_R16_UINT, + [D3DFMT_INDEX32] = PIPE_FORMAT_R32_UINT, + [D3DFMT_Q16W16V16U16] = PIPE_FORMAT_R16G16B16A16_SNORM, [D3DFMT_R16F] = PIPE_FORMAT_R16_FLOAT, - [D3DFMT_R32F] = PIPE_FORMAT_R32_FLOAT, [D3DFMT_G16R16F] = PIPE_FORMAT_R16G16_FLOAT, - [D3DFMT_G32R32F] = PIPE_FORMAT_R32G32_FLOAT, [D3DFMT_A16B16G16R16F] = PIPE_FORMAT_R16G16B16A16_FLOAT, + [D3DFMT_R32F] = PIPE_FORMAT_R32_FLOAT, + [D3DFMT_G32R32F] = PIPE_FORMAT_R32G32_FLOAT, [D3DFMT_A32B32G32R32F] = PIPE_FORMAT_R32G32B32A32_FLOAT, - - /* non-1:1 formats (don't support because we'd have to convert) */ - [D3DFMT_R8G8B8] = PIPE_FORMAT_NONE, /* XXX order */ - [D3DFMT_A8R3G3B2] = PIPE_FORMAT_NONE, /* XXX alpha */ - /* This is ok because they're not lockable: */ - [D3DFMT_D15S1] = PIPE_FORMAT_Z24_UNORM_S8_UINT, - [D3DFMT_D24X4S4] = PIPE_FORMAT_Z24_UNORM_S8_UINT, - [D3DFMT_D24FS8] = PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, - - /* not really formats */ - [D3DFMT_VERTEXDATA] = PIPE_FORMAT_NONE, - /* [D3DFMT_BINARYBUFFER] = PIPE_FORMAT_NONE, too large */ - - /* unsupported formats */ - [D3DFMT_L6V5U5] = PIPE_FORMAT_NONE, - [D3DFMT_X8L8V8U8] = PIPE_FORMAT_NONE, - - /* [D3DFMT_MULTI2_ARGB8] = PIPE_FORMAT_NONE, fourcc, MET */ - - [D3DFMT_CxV8U8] = PIPE_FORMAT_NONE, - [D3DFMT_A1] = PIPE_FORMAT_NONE, /* XXX: add this ? */ - [D3DFMT_A2B10G10R10_XR_BIAS] = PIPE_FORMAT_NONE, /* XXX ? */ + [D3DFMT_CxV8U8] = PIPE_FORMAT_NONE, + [D3DFMT_A1] = PIPE_FORMAT_NONE, + [D3DFMT_A2B10G10R10_XR_BIAS] = PIPE_FORMAT_NONE, }; const D3DFORMAT nine_pipe_to_d3d9_format_map[PIPE_FORMAT_COUNT] =