d3d12: Support RGBX formats mapped to RGBA

Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13054>
This commit is contained in:
Jesse Natalie 2021-08-11 14:43:52 -07:00 committed by Marge Bot
parent ab9948997a
commit 2188607014
3 changed files with 18 additions and 1 deletions

View File

@ -69,7 +69,8 @@ resolve_supported(const struct pipe_blit_info *info)
return false;
} else {
if (util_format_get_mask(info->dst.format) != info->mask ||
util_format_get_mask(info->src.format) != info->mask)
util_format_get_mask(info->src.format) != info->mask ||
util_format_has_alpha1(info->src.format))
return false;
}

View File

@ -1697,6 +1697,10 @@ d3d12_clear_render_target(struct pipe_context *pctx,
clear_color[c] = color->f[c];
}
if (!(util_format_colormask(util_format_description(psurf->texture->format)) &
PIPE_MASK_A))
clear_color[3] = 1.0f;
D3D12_RECT rect = { (int)dstx, (int)dsty,
(int)dstx + (int)width,
(int)dsty + (int)height };

View File

@ -63,6 +63,16 @@ static const DXGI_FORMAT formats[PIPE_FORMAT_COUNT] = {
MAP_FORMAT_INT(R8G8B8A8)
MAP_FORMAT_SRGB(R8G8B8A8)
/* Since we report PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND and other caps,
* we can rely on st/mesa to force the alpha to 1 for these, so we can
* just use RGBA. This is needed to support RGB configs, since some apps
* will only choose RGB (not RGBA) configs.
*/
[PIPE_FORMAT_R8G8B8X8_UNORM] = DXGI_FORMAT_R8G8B8A8_UNORM,
[PIPE_FORMAT_R8G8B8X8_SNORM] = DXGI_FORMAT_R8G8B8A8_SNORM,
[PIPE_FORMAT_R8G8B8X8_UINT] = DXGI_FORMAT_R8G8B8A8_UINT,
[PIPE_FORMAT_R8G8B8X8_SINT] = DXGI_FORMAT_R8G8B8A8_SINT,
[PIPE_FORMAT_B8G8R8X8_UNORM] = DXGI_FORMAT_B8G8R8X8_UNORM,
[PIPE_FORMAT_B8G8R8A8_UNORM] = DXGI_FORMAT_B8G8R8A8_UNORM,
@ -238,6 +248,8 @@ d3d12_get_format_info(enum pipe_format pformat, enum pipe_texture_target target)
* but the shader will read the x component so we need to adjust the swizzle. */
plane_slice = 1;
swizzle = STENCIL_SWIZZLE;
} else if (util_format_has_alpha1(pformat)) {
swizzle = RGB1_SWIZZLE;
}
}