[D3D12] Resolve 16-bit RTs to unorm textures, not snorm
This commit is contained in:
parent
7049d52dbb
commit
5582e63ef1
|
@ -1128,24 +1128,22 @@ bool RenderTargetCache::ResolveCopy(SharedMemory* shared_memory,
|
||||||
DepthRenderTargetToTextureFormat(DepthRenderTargetFormat(src_format));
|
DepthRenderTargetToTextureFormat(DepthRenderTargetFormat(src_format));
|
||||||
src_64bpp = false;
|
src_64bpp = false;
|
||||||
} else {
|
} else {
|
||||||
// Texture formats k_16_16_EDRAM and k_16_16_16_16_EDRAM are not the same as
|
// Force k_16_16 and k_16_16_16_16 RTs to be always resolved via drawing,
|
||||||
// k_16_16 and k_16_16_16_16, but they are emulated with the same DXGI
|
// because resolving to a k_16_16 or a k_16_16_16_16 texture should result
|
||||||
// formats as k_16_16 and k_16_16_16_16 on the host, so they are treated as
|
// in unsigned texture data, unlike the render target which is signed.
|
||||||
// a special case of such formats.
|
|
||||||
if (ColorRenderTargetFormat(src_format) ==
|
if (ColorRenderTargetFormat(src_format) ==
|
||||||
ColorRenderTargetFormat::k_16_16) {
|
ColorRenderTargetFormat::k_16_16) {
|
||||||
src_texture_format = TextureFormat::k_16_16;
|
src_texture_format = TextureFormat::k_16_16_EDRAM;
|
||||||
} else if (ColorRenderTargetFormat(src_format) ==
|
} else if (ColorRenderTargetFormat(src_format) ==
|
||||||
ColorRenderTargetFormat::k_16_16_16_16) {
|
ColorRenderTargetFormat::k_16_16_16_16) {
|
||||||
src_texture_format = TextureFormat::k_16_16_16_16;
|
src_texture_format = TextureFormat::k_16_16_16_16_EDRAM;
|
||||||
} else {
|
} else {
|
||||||
src_texture_format =
|
src_texture_format = GetBaseFormat(ColorRenderTargetToTextureFormat(
|
||||||
ColorRenderTargetToTextureFormat(ColorRenderTargetFormat(src_format));
|
ColorRenderTargetFormat(src_format)));
|
||||||
}
|
}
|
||||||
src_64bpp = IsColorFormat64bpp(ColorRenderTargetFormat(src_format));
|
src_64bpp = IsColorFormat64bpp(ColorRenderTargetFormat(src_format));
|
||||||
}
|
}
|
||||||
assert_true(src_texture_format != TextureFormat::kUnknown);
|
assert_true(src_texture_format != TextureFormat::kUnknown);
|
||||||
src_texture_format = GetBaseFormat(src_texture_format);
|
|
||||||
// The destination format is specified as k_8_8_8_8 when resolving depth,
|
// The destination format is specified as k_8_8_8_8 when resolving depth,
|
||||||
// apparently there's no format conversion.
|
// apparently there's no format conversion.
|
||||||
TextureFormat dest_format =
|
TextureFormat dest_format =
|
||||||
|
|
|
@ -199,18 +199,18 @@ const TextureCache::HostFormat TextureCache::host_formats_[64] = {
|
||||||
DXGI_FORMAT_R16_SNORM, LoadMode::kUnknown, DXGI_FORMAT_UNKNOWN,
|
DXGI_FORMAT_R16_SNORM, LoadMode::kUnknown, DXGI_FORMAT_UNKNOWN,
|
||||||
LoadMode::kUnknown, DXGI_FORMAT_R16_UNORM, ResolveTileMode::k16bpp, true},
|
LoadMode::kUnknown, DXGI_FORMAT_R16_UNORM, ResolveTileMode::k16bpp, true},
|
||||||
// k_16_16
|
// k_16_16
|
||||||
// TODO(Triang3l): Check if this is the correct way of specifying a signed
|
// The resolve format being unorm is correct (with snorm distortion effects
|
||||||
// resolve destination format.
|
// in Halo 3 cause stretching of one corner of the screen).
|
||||||
{DXGI_FORMAT_R16G16_TYPELESS, DXGI_FORMAT_R16G16_UNORM, LoadMode::k32bpb,
|
{DXGI_FORMAT_R16G16_TYPELESS, DXGI_FORMAT_R16G16_UNORM, LoadMode::k32bpb,
|
||||||
DXGI_FORMAT_R16G16_SNORM, LoadMode::kUnknown, DXGI_FORMAT_UNKNOWN,
|
DXGI_FORMAT_R16G16_SNORM, LoadMode::kUnknown, DXGI_FORMAT_UNKNOWN,
|
||||||
LoadMode::kUnknown, DXGI_FORMAT_R16G16_SNORM, ResolveTileMode::k32bpp,
|
LoadMode::kUnknown, DXGI_FORMAT_R16G16_UNORM, ResolveTileMode::k32bpp,
|
||||||
false},
|
false},
|
||||||
// k_16_16_16_16
|
// k_16_16_16_16
|
||||||
// TODO(Triang3l): Check if this is the correct way of specifying a signed
|
// The resolve format being unorm is correct (with snorm distortion effects
|
||||||
// resolve destination format.
|
// in Halo 3 cause stretching of one corner of the screen).
|
||||||
{DXGI_FORMAT_R16G16B16A16_TYPELESS, DXGI_FORMAT_R16G16B16A16_UNORM,
|
{DXGI_FORMAT_R16G16B16A16_TYPELESS, DXGI_FORMAT_R16G16B16A16_UNORM,
|
||||||
LoadMode::k64bpb, DXGI_FORMAT_R16G16B16A16_SNORM, LoadMode::kUnknown,
|
LoadMode::k64bpb, DXGI_FORMAT_R16G16B16A16_SNORM, LoadMode::kUnknown,
|
||||||
DXGI_FORMAT_UNKNOWN, LoadMode::kUnknown, DXGI_FORMAT_R16G16B16A16_SNORM,
|
DXGI_FORMAT_UNKNOWN, LoadMode::kUnknown, DXGI_FORMAT_R16G16B16A16_UNORM,
|
||||||
ResolveTileMode::k64bpp, false},
|
ResolveTileMode::k64bpp, false},
|
||||||
// k_16_EXPAND
|
// k_16_EXPAND
|
||||||
{DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, LoadMode::k16bpb,
|
{DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, LoadMode::k16bpb,
|
||||||
|
|
Loading…
Reference in New Issue