[PATCH 2/4] wined3d: Fix pixel format alpha/red masks.
Matteo Bruni
mbruni at codeweavers.com
Mon Aug 13 13:20:46 CDT 2012
Just to make the post-pixelshader blending test actually test stuff. We
will probably want to use GL_ARB_internalformat_query2 for that in the
future, but in the meantime let's improve the current code.
---
dlls/wined3d/utils.c | 42 +++++++++++++++++++++---------------------
1 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index dd300d1..1ddbe60 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -42,12 +42,12 @@ struct StaticPixelFormatDesc
/*****************************************************************************
* Pixel format array
*
- * For the formats WINED3DFMT_A32B32G32R32F, WINED3DFMT_A16B16G16R16F,
- * and WINED3DFMT_A16B16G16R16 do not have correct alpha masks, because the
- * high masks do not fit into the 32 bit values needed for ddraw. It is only
- * used for ddraw mostly, and to figure out if the format has alpha at all, so
- * setting a mask like 0x1 for those surfaces is correct. The 64 and 128 bit
- * formats are not usable in 2D rendering because ddraw doesn't support them.
+ * Pixel formats with more than 4 bpp do not have correct masks, because the
+ * high masks do not fit into the 32 bit values needed for ddraw. The masks
+ * are only used for ddraw mostly, and to figure out if the format has an alpha
+ * component (the POSTPIXELSHADER_BLENDING test also uses those masks to know
+ * if there is more than 1 alpha bit and a red component), so that doesn't
+ * matter. The 64 and 128 bit formats are not supported by ddraw anyway.
*/
static const struct StaticPixelFormatDesc formats[] =
{
@@ -66,18 +66,18 @@ static const struct StaticPixelFormatDesc formats[] =
{WINED3DFMT_G8R8_G8B8, 0x0, 0x0, 0x0, 0x0, 1/*?*/, 0, 0},
{WINED3DFMT_R8G8_B8G8, 0x0, 0x0, 0x0, 0x0, 1/*?*/, 0, 0},
/* IEEE formats */
- {WINED3DFMT_R32_FLOAT, 0x0, 0x0, 0x0, 0x0, 4, 0, 0},
- {WINED3DFMT_R32G32_FLOAT, 0x0, 0x0, 0x0, 0x0, 8, 0, 0},
- {WINED3DFMT_R32G32B32_FLOAT, 0x0, 0x0, 0x0, 0x0, 12, 0, 0},
- {WINED3DFMT_R32G32B32A32_FLOAT, 0x1, 0x0, 0x0, 0x0, 16, 0, 0},
+ {WINED3DFMT_R32_FLOAT, 0x0, 0xffffffff, 0x0, 0x0, 4, 0, 0},
+ {WINED3DFMT_R32G32_FLOAT, 0x0, 0xffffffff, 0x0, 0x0, 8, 0, 0},
+ {WINED3DFMT_R32G32B32_FLOAT, 0x0, 0xffffffff, 0x0, 0x0, 12, 0, 0},
+ {WINED3DFMT_R32G32B32A32_FLOAT, 0xffffffff, 0xffffffff, 0x0, 0x0, 16, 0, 0},
/* Hmm? */
{WINED3DFMT_R8G8_SNORM_Cx, 0x0, 0x0, 0x0, 0x0, 2, 0, 0},
/* Float */
- {WINED3DFMT_R16_FLOAT, 0x0, 0x0, 0x0, 0x0, 2, 0, 0},
- {WINED3DFMT_R16G16_FLOAT, 0x0, 0x0, 0x0, 0x0, 4, 0, 0},
- {WINED3DFMT_R16G16_SINT, 0x0, 0x0, 0x0, 0x0, 4, 0, 0},
- {WINED3DFMT_R16G16B16A16_FLOAT, 0x1, 0x0, 0x0, 0x0, 8, 0, 0},
- {WINED3DFMT_R16G16B16A16_SINT, 0x1, 0x0, 0x0, 0x0, 8, 0, 0},
+ {WINED3DFMT_R16_FLOAT, 0x0, 0x0000ffff, 0x0, 0x0, 2, 0, 0},
+ {WINED3DFMT_R16G16_FLOAT, 0x0, 0x0000ffff, 0x0, 0x0, 4, 0, 0},
+ {WINED3DFMT_R16G16_SINT, 0x0, 0x0000ffff, 0x0, 0x0, 4, 0, 0},
+ {WINED3DFMT_R16G16B16A16_FLOAT, 0x0000ffff, 0x0000ffff, 0x0, 0x0, 8, 0, 0},
+ {WINED3DFMT_R16G16B16A16_SINT, 0x0000ffff, 0x0000ffff, 0x0, 0x0, 8, 0, 0},
/* Palettized formats */
{WINED3DFMT_P8_UINT_A8_UNORM, 0x0000ff00, 0x0, 0x0, 0x0, 2, 0, 0},
{WINED3DFMT_P8_UINT, 0x0, 0x0, 0x0, 0x0, 1, 0, 0},
@@ -101,20 +101,20 @@ static const struct StaticPixelFormatDesc formats[] =
{WINED3DFMT_R8G8B8X8_UNORM, 0x0, 0x000000ff, 0x0000ff00, 0x00ff0000, 4, 0, 0},
{WINED3DFMT_R16G16_UNORM, 0x0, 0x0000ffff, 0xffff0000, 0x0, 4, 0, 0},
{WINED3DFMT_B10G10R10A2_UNORM, 0xc0000000, 0x3ff00000, 0x000ffc00, 0x000003ff, 4, 0, 0},
- {WINED3DFMT_R16G16B16A16_UNORM, 0x1, 0x0000ffff, 0xffff0000, 0x0, 8, 0, 0},
+ {WINED3DFMT_R16G16B16A16_UNORM, 0x0000ffff, 0x0000ffff, 0xffff0000, 0x0, 8, 0, 0},
/* Luminance */
{WINED3DFMT_L8_UNORM, 0x0, 0x0, 0x0, 0x0, 1, 0, 0},
{WINED3DFMT_L8A8_UNORM, 0x0000ff00, 0x0, 0x0, 0x0, 2, 0, 0},
{WINED3DFMT_L4A4_UNORM, 0x000000f0, 0x0, 0x0, 0x0, 1, 0, 0},
{WINED3DFMT_L16_UNORM, 0x0, 0x0, 0x0, 0x0, 2, 16, 0},
/* Bump mapping stuff */
- {WINED3DFMT_R8G8_SNORM, 0x0, 0x0, 0x0, 0x0, 2, 0, 0},
+ {WINED3DFMT_R8G8_SNORM, 0x0, 0x000000ff, 0x0, 0x0, 2, 0, 0},
{WINED3DFMT_R5G5_SNORM_L6_UNORM, 0x0, 0x0, 0x0, 0x0, 2, 0, 0},
{WINED3DFMT_R8G8_SNORM_L8X8_UNORM, 0x0, 0x0, 0x0, 0x0, 4, 0, 0},
- {WINED3DFMT_R8G8B8A8_SNORM, 0x0, 0x0, 0x0, 0x0, 4, 0, 0},
- {WINED3DFMT_R16G16_SNORM, 0x0, 0x0, 0x0, 0x0, 4, 0, 0},
- {WINED3DFMT_R10G11B11_SNORM, 0x0, 0x0, 0x0, 0x0, 4, 0, 0},
- {WINED3DFMT_R10G10B10_SNORM_A2_UNORM, 0xb0000000, 0x0, 0x0, 0x0, 4, 0, 0},
+ {WINED3DFMT_R8G8B8A8_SNORM, 0xff000000, 0x000000ff, 0x0, 0x0, 4, 0, 0},
+ {WINED3DFMT_R16G16_SNORM, 0x0, 0x0000ffff, 0x0, 0x0, 4, 0, 0},
+ {WINED3DFMT_R10G11B11_SNORM, 0x0, 0x000003ff, 0x0, 0x0, 4, 0, 0},
+ {WINED3DFMT_R10G10B10_SNORM_A2_UNORM, 0xc0000000, 0x000003ff, 0x0, 0x0, 4, 0, 0},
/* Depth stencil formats */
{WINED3DFMT_D16_LOCKABLE, 0x0, 0x0, 0x0, 0x0, 2, 16, 0},
{WINED3DFMT_D32_UNORM, 0x0, 0x0, 0x0, 0x0, 4, 32, 0},
--
1.7.8.6
More information about the wine-patches
mailing list