[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,
/* 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;
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;
}