[D3D12] GPUTEXTUREFORMAT_6_5_5 as RBG

This commit is contained in:
Triang3l 2018-11-16 12:54:33 +03:00
parent e1d771ab9c
commit 38f421e89f
10 changed files with 156 additions and 74 deletions

View File

@ -1427,6 +1427,7 @@ bool RenderTargetCache::ResolveCopy(SharedMemory* shared_memory,
rt_srv_desc.Format = rt_srv_desc.Format =
GetColorDXGIFormat(ColorRenderTargetFormat(src_format)); GetColorDXGIFormat(ColorRenderTargetFormat(src_format));
rt_srv_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; rt_srv_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
UINT swizzle = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
if (dest_swap) { if (dest_swap) {
switch (ColorRenderTargetFormat(src_format)) { switch (ColorRenderTargetFormat(src_format)) {
case ColorRenderTargetFormat::k_8_8_8_8: case ColorRenderTargetFormat::k_8_8_8_8:
@ -1437,17 +1438,22 @@ bool RenderTargetCache::ResolveCopy(SharedMemory* shared_memory,
case ColorRenderTargetFormat::k_16_16_16_16_FLOAT: case ColorRenderTargetFormat::k_16_16_16_16_FLOAT:
case ColorRenderTargetFormat::k_2_10_10_10_AS_16_16_16_16: case ColorRenderTargetFormat::k_2_10_10_10_AS_16_16_16_16:
case ColorRenderTargetFormat::k_2_10_10_10_FLOAT_AS_16_16_16_16: case ColorRenderTargetFormat::k_2_10_10_10_FLOAT_AS_16_16_16_16:
rt_srv_desc.Shader4ComponentMapping = swizzle = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(2, 1, 0, 3);
D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(2, 1, 0, 3);
break; break;
default: default:
rt_srv_desc.Shader4ComponentMapping = break;
D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
} }
} else {
rt_srv_desc.Shader4ComponentMapping =
D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
} }
if (dest_format == TextureFormat::k_6_5_5) {
// Green bits of the resolve target used for blue, and blue bits used for
// green.
swizzle = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(0, swizzle),
D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(2, swizzle),
D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(1, swizzle),
D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(3, swizzle));
}
rt_srv_desc.Shader4ComponentMapping = swizzle;
rt_srv_desc.Texture2D.MostDetailedMip = 0; rt_srv_desc.Texture2D.MostDetailedMip = 0;
rt_srv_desc.Texture2D.MipLevels = 1; rt_srv_desc.Texture2D.MipLevels = 1;
rt_srv_desc.Texture2D.PlaneSlice = 0; rt_srv_desc.Texture2D.PlaneSlice = 0;

View File

@ -1,11 +1,11 @@
// generated from `xb buildhlsl` // generated from `xb buildhlsl`
// source: texture_load_16bpb.cs.hlsl // source: texture_load_16bpb.cs.hlsl
const uint8_t texture_load_16bpb_cs[] = { const uint8_t texture_load_16bpb_cs[] = {
0x44, 0x58, 0x42, 0x43, 0x5B, 0xB9, 0x1F, 0xC1, 0xE7, 0x66, 0xBD, 0x81, 0x44, 0x58, 0x42, 0x43, 0x89, 0x14, 0x9B, 0x73, 0x1F, 0x02, 0x38, 0xDE,
0xEE, 0x86, 0xEF, 0x4C, 0x98, 0x36, 0x0A, 0xD9, 0x01, 0x00, 0x00, 0x00, 0x96, 0x09, 0x47, 0xEA, 0xF6, 0xD9, 0xFD, 0xA2, 0x01, 0x00, 0x00, 0x00,
0xF0, 0x1B, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x28, 0x1D, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
0x14, 0x05, 0x00, 0x00, 0x24, 0x05, 0x00, 0x00, 0x34, 0x05, 0x00, 0x00, 0x14, 0x05, 0x00, 0x00, 0x24, 0x05, 0x00, 0x00, 0x34, 0x05, 0x00, 0x00,
0x54, 0x1B, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xD8, 0x04, 0x00, 0x00, 0x8C, 0x1C, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xD8, 0x04, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x43, 0x00, 0x05, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x43, 0x00, 0x05, 0x00, 0x00,
0xAE, 0x04, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, 0x3C, 0x00, 0x00, 0x00, 0xAE, 0x04, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, 0x3C, 0x00, 0x00, 0x00,
@ -112,8 +112,8 @@ const uint8_t texture_load_16bpb_cs[] = {
0x31, 0x00, 0xAB, 0xAB, 0x49, 0x53, 0x47, 0x4E, 0x08, 0x00, 0x00, 0x00, 0x31, 0x00, 0xAB, 0xAB, 0x49, 0x53, 0x47, 0x4E, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4F, 0x53, 0x47, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4F, 0x53, 0x47, 0x4E,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x53, 0x48, 0x45, 0x58, 0x18, 0x16, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x53, 0x48, 0x45, 0x58, 0x50, 0x17, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00,
0x86, 0x05, 0x00, 0x00, 0x6A, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x07, 0xD4, 0x05, 0x00, 0x00, 0x6A, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x07,
0x46, 0x8E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xA1, 0x00, 0x00, 0x06, 0x46, 0x7E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0x00, 0x00, 0x06, 0x46, 0x7E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -546,24 +546,50 @@ const uint8_t texture_load_16bpb_cs[] = {
0x03, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x09, 0x03, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x09,
0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x80, 0x30, 0x00, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x80, 0x30, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x04, 0x03, 0x01, 0x40, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x04, 0x03,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0A, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x14,
0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0xF0, 0xF0, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00,
0x8C, 0x00, 0x00, 0x11, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0x00, 0x00, 0x0F, 0xF2, 0x00, 0x10, 0x00,
0x08, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x8A, 0x00, 0x00, 0x0F, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0xF2, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x07, 0xF2, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00,
0x23, 0x00, 0x00, 0x0C, 0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x86, 0x0D, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x12, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x09, 0x22, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x0F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x04, 0x03, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00,
0xF0, 0xF0, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x11,
0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x07, 0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x8A, 0x00, 0x00, 0x0F, 0xF2, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x07, 0xF2, 0x00, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x86, 0x0D, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x01,
0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01,
0x29, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
@ -584,10 +610,10 @@ const uint8_t texture_load_16bpb_cs[] = {
0xA6, 0x00, 0x00, 0x08, 0x32, 0xE0, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA6, 0x00, 0x00, 0x08, 0x32, 0xE0, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x96, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x96, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01,
0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, 0x8A, 0x00, 0x00, 0x00, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -173,12 +173,21 @@ else
ushr r3.xyzw, r2.xzyw, l(11, 11, 11, 11) ushr r3.xyzw, r2.xzyw, l(11, 11, 11, 11)
iadd r2.xyzw, r1.xzyw, r3.xzyw iadd r2.xyzw, r1.xzyw, r3.xzyw
else else
ieq r0.y, CB0[0][3].z, l(15) ieq r0.y, CB0[0][3].z, l(5)
if_nz r0.y if_nz r0.y
and r1.xyzw, r2.xzyw, l(0x0000f0f0, 0x0000f0f0, 0x0000f0f0, 0x0000f0f0) bfi r1.xyzw, l(5, 5, 5, 5), l(11, 11, 11, 11), r2.xzyw, l(0, 0, 0, 0)
bfi r1.xyzw, l(4, 4, 4, 4), l(8, 8, 8, 8), r2.xzyw, r1.xyzw ubfe r3.xyzw, l(5, 5, 5, 5), l(5, 5, 5, 5), r2.xzyw
ubfe r3.xyzw, l(4, 4, 4, 4), l(8, 8, 8, 8), r2.xzyw iadd r1.xyzw, r1.xyzw, r3.xyzw
iadd r2.xyzw, r1.xzyw, r3.xzyw ushr r3.xyzw, r2.xzyw, l(10, 10, 10, 10)
imad r2.xyzw, r3.xzyw, l(32, 32, 32, 32), r1.xzyw
else
ieq r0.y, CB0[0][3].z, l(15)
if_nz r0.y
and r1.xyzw, r2.xzyw, l(0x0000f0f0, 0x0000f0f0, 0x0000f0f0, 0x0000f0f0)
bfi r1.xyzw, l(4, 4, 4, 4), l(8, 8, 8, 8), r2.xzyw, r1.xyzw
ubfe r3.xyzw, l(4, 4, 4, 4), l(8, 8, 8, 8), r2.xzyw
iadd r2.xyzw, r1.xzyw, r3.xzyw
endif
endif endif
endif endif
endif endif
@ -189,4 +198,4 @@ iadd r0.x, r0.x, CB0[0][0].z
imad r0.yz, r2.zzwz, l(0, 0x00010000, 0x00010000, 0), r2.xxyx imad r0.yz, r2.zzwz, l(0, 0x00010000, 0x00010000, 0), r2.xxyx
store_raw U0[0].xy, r0.x, r0.yzyy store_raw U0[0].xy, r0.x, r0.yzyy
ret ret
// Approximately 138 instruction slots used // Approximately 147 instruction slots used

View File

@ -1,11 +1,11 @@
// generated from `xb buildhlsl` // generated from `xb buildhlsl`
// source: texture_tile_16bpp.cs.hlsl // source: texture_tile_16bpp.cs.hlsl
const uint8_t texture_tile_16bpp_cs[] = { const uint8_t texture_tile_16bpp_cs[] = {
0x44, 0x58, 0x42, 0x43, 0xE7, 0x31, 0xF8, 0xD9, 0xD0, 0x57, 0x9E, 0xA0, 0x44, 0x58, 0x42, 0x43, 0x01, 0x47, 0x3A, 0xC8, 0x23, 0xFF, 0x19, 0x7B,
0xF8, 0x2E, 0x5F, 0x3E, 0xD0, 0x35, 0x77, 0x82, 0x01, 0x00, 0x00, 0x00, 0xC2, 0x80, 0xCB, 0x99, 0xA4, 0xB1, 0xF3, 0xD3, 0x01, 0x00, 0x00, 0x00,
0x78, 0x10, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x50, 0x11, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
0x38, 0x03, 0x00, 0x00, 0x48, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x48, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00,
0xDC, 0x0F, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xFC, 0x02, 0x00, 0x00, 0xB4, 0x10, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xFC, 0x02, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x43, 0x00, 0x05, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x43, 0x00, 0x05, 0x00, 0x00,
0xD3, 0x02, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, 0x3C, 0x00, 0x00, 0x00, 0xD3, 0x02, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, 0x3C, 0x00, 0x00, 0x00,
@ -72,8 +72,8 @@ const uint8_t texture_tile_16bpp_cs[] = {
0x72, 0x20, 0x31, 0x30, 0x2E, 0x31, 0x00, 0xAB, 0x49, 0x53, 0x47, 0x4E, 0x72, 0x20, 0x31, 0x30, 0x2E, 0x31, 0x00, 0xAB, 0x49, 0x53, 0x47, 0x4E,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x4F, 0x53, 0x47, 0x4E, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x53, 0x47, 0x4E, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x53, 0x48, 0x45, 0x58, 0x7C, 0x0C, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x53, 0x48, 0x45, 0x58, 0x54, 0x0D, 0x00, 0x00,
0x51, 0x00, 0x05, 0x00, 0x1F, 0x03, 0x00, 0x00, 0x6A, 0x08, 0x00, 0x01, 0x51, 0x00, 0x05, 0x00, 0x55, 0x03, 0x00, 0x00, 0x6A, 0x08, 0x00, 0x01,
0x59, 0x00, 0x00, 0x07, 0x46, 0x8E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x07, 0x46, 0x8E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xA1, 0x00, 0x00, 0x06, 0x46, 0x7E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0x00, 0x00, 0x06, 0x46, 0x7E, 0x30, 0x00,
@ -120,33 +120,51 @@ const uint8_t texture_tile_16bpp_cs[] = {
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, 0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x04, 0x03, 0x1A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x04, 0x03, 0x2A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00,
0x04, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00,
0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x14, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x14,
0xF2, 0x00, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xF2, 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00,
0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x07, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x07, 0xF2, 0x00, 0x10, 0x00,
0x04, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x8A, 0x00, 0x00, 0x0F, 0x46, 0x0E, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x8A, 0x00, 0x00, 0x0F,
0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xF2, 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00,
0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x07, 0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x07,
0xF2, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0xF2, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x04, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00,
0x12, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x12, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00,
0x03, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x04, 0x03,
0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x15, 0x00, 0x00, 0x01, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x14,
0xF2, 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x8A, 0x00, 0x00, 0x0F, 0xF2, 0x00, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x86, 0x0D, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x07, 0xF2, 0x00, 0x10, 0x00,
0x03, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x01,
0x01, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00,
0x86, 0x0D, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00,
0xFF, 0xFF, 0x00, 0x00, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01,
0x55, 0x00, 0x00, 0x0C, 0x72, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x0C, 0x72, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x96, 0x85, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x85, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
@ -340,9 +358,9 @@ const uint8_t texture_tile_16bpp_cs[] = {
0x01, 0x00, 0x00, 0x00, 0xF6, 0x0F, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xF6, 0x0F, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00,
0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01,
0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00,
0x54, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -62,15 +62,22 @@ iadd r0.y, r0.z, r0.y
ld_raw r2.xy, r0.y, T0[0].xyxx ld_raw r2.xy, r0.y, T0[0].xyxx
ushr r2.zw, r2.xxxy, l(0, 0, 16, 16) ushr r2.zw, r2.xxxy, l(0, 0, 16, 16)
ubfe r0.y, l(6), l(3), CB0[0][0].y ubfe r0.y, l(6), l(3), CB0[0][0].y
ieq r0.y, r0.y, l(4) ieq r0.z, r0.y, l(4)
if_nz r0.y if_nz r0.z
and r4.xyzw, r2.xzyw, l(2016, 2016, 2016, 2016) and r3.xyzw, r2.xzyw, l(2016, 2016, 2016, 2016)
bfi r5.xyzw, l(5, 5, 5, 5), l(11, 11, 11, 11), r2.xzyw, l(0, 0, 0, 0) bfi r4.xyzw, l(5, 5, 5, 5), l(11, 11, 11, 11), r2.xzyw, l(0, 0, 0, 0)
iadd r4.xyzw, r4.xyzw, r5.xyzw iadd r3.xyzw, r3.xyzw, r4.xyzw
ubfe r2.xyzw, l(5, 5, 5, 5), l(11, 11, 11, 11), r2.xzyw ubfe r4.xyzw, l(5, 5, 5, 5), l(11, 11, 11, 11), r2.xzyw
iadd r3.xyzw, r4.xyzw, r2.xyzw iadd r3.xyzw, r3.xyzw, r4.xyzw
else else
and r3.xyzw, r2.xzyw, l(0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff) ieq r0.y, r0.y, l(5)
if_nz r0.y
bfi r4.xyzw, l(11, 11, 11, 11), l(5, 5, 5, 5), r2.xzyw, l(0, 0, 0, 0)
ubfe r2.xyzw, l(5, 5, 5, 5), l(11, 11, 11, 11), r2.xzyw
iadd r3.xyzw, r4.xyzw, r2.xyzw
else
and r3.xyzw, r2.xzyw, l(0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff)
endif
endif endif
ushr r2.xyz, CB0[0][0].yzyy, l(1, 16, 9, 0) ushr r2.xyz, CB0[0][0].yzyy, l(1, 16, 9, 0)
xor r0.y, r2.x, CB0[0][0].y xor r0.y, r2.x, CB0[0][0].y
@ -130,4 +137,4 @@ if_nz r0.x
endif endif
endif endif
ret ret
// Approximately 84 instruction slots used // Approximately 91 instruction slots used

View File

@ -28,12 +28,16 @@ void main(uint3 xe_thread_id : SV_DispatchThreadID) {
// k_5_6_5. // k_5_6_5.
blocks = (blocks & (63u << 5u)) | ((blocks & 31u) << 11u) | blocks = (blocks & (63u << 5u)) | ((blocks & 31u) << 11u) |
((blocks >> 11u) & 31u); ((blocks >> 11u) & 31u);
} else if (xe_texture_load_guest_format == 5u) {
// k_6_5_5 - RRRRR GGGGG BBBBBB to GGGGG BBBBBB RRRRR (use RBGA swizzle when
// reading).
blocks = ((blocks & 31u) << 11u) | ((blocks >> 5u) & 31u) |
((blocks >> 10u) << 5u);
} else if (xe_texture_load_guest_format == 15u) { } else if (xe_texture_load_guest_format == 15u) {
// k_4_4_4_4. // k_4_4_4_4.
blocks = blocks =
(blocks & 0xF0F0u) | ((blocks & 15u) << 8u) | ((blocks >> 8u) & 15u); (blocks & 0xF0F0u) | ((blocks & 15u) << 8u) | ((blocks >> 8u) & 15u);
} }
// TODO(Triang3l): k_6_5_5.
uint block_offset_host = XeTextureHostLinearOffset( uint block_offset_host = XeTextureHostLinearOffset(
block_index, xe_texture_load_size_blocks.y, xe_texture_load_host_pitch, block_index, xe_texture_load_size_blocks.y, xe_texture_load_host_pitch,

View File

@ -20,10 +20,13 @@ void main(uint3 xe_thread_id : SV_DispatchThreadID) {
uint format = (xe_texture_tile_endian_format_guest_pitch >> 3u) & 63u; uint format = (xe_texture_tile_endian_format_guest_pitch >> 3u) & 63u;
if (format == 4u) { if (format == 4u) {
// k_5_6_5. // k_5_6_5.
texels = (texels & (63u << 5u)) | ((texels & 31u) << 11u) | texels = (texels & (63u << 5u)) | ((texels & 31u) << 11u) | (texels >> 11u);
((texels >> 11u) & 31u); } else if (format == 5u) {
// k_6_5_5 - GGGGG BBBBBB RRRRR to RRRRR GGGGG BBBBBB (use RBGA swizzle when
// resolving).
texels = ((texels & 31u) << 5u) | ((texels & (63u << 5u)) << (10u - 5u)) |
(texels >> 11u);
} }
// TODO(Triang3l): k_6_5_5.
texels = XeByteSwap16(texels, xe_texture_tile_endian_format_guest_pitch); texels = XeByteSwap16(texels, xe_texture_tile_endian_format_guest_pitch);
uint4 texel_addresses = (xe_texture_tile_guest_base + XeTextureTiledOffset2D( uint4 texel_addresses = (xe_texture_tile_guest_base + XeTextureTiledOffset2D(

View File

@ -80,9 +80,10 @@ const TextureCache::HostFormat TextureCache::host_formats_[64] = {
DXGI_FORMAT_UNKNOWN, LoadMode::kUnknown, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, LoadMode::kUnknown, DXGI_FORMAT_UNKNOWN,
LoadMode::kUnknown, DXGI_FORMAT_B5G6R5_UNORM, ResolveTileMode::k16bpp}, LoadMode::kUnknown, DXGI_FORMAT_B5G6R5_UNORM, ResolveTileMode::k16bpp},
// k_6_5_5 // k_6_5_5
{DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, LoadMode::kUnknown, // Green bits in blue, blue bits in green - RBGA swizzle must be used.
{DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G6R5_UNORM, LoadMode::k16bpb,
DXGI_FORMAT_UNKNOWN, LoadMode::kUnknown, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, LoadMode::kUnknown, DXGI_FORMAT_UNKNOWN,
LoadMode::kUnknown, DXGI_FORMAT_UNKNOWN, ResolveTileMode::kUnknown}, LoadMode::kUnknown, DXGI_FORMAT_B5G6R5_UNORM, ResolveTileMode::k16bpp},
// k_8_8_8_8 // k_8_8_8_8
{DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_UNORM, {DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_UNORM,
LoadMode::k32bpb, DXGI_FORMAT_R8G8B8A8_SNORM, LoadMode::kUnknown, LoadMode::k32bpb, DXGI_FORMAT_R8G8B8A8_SNORM, LoadMode::kUnknown,
@ -1181,7 +1182,15 @@ void TextureCache::BindingInfoFromFetchConstant(
// Remap the swizzle according to the texture format. k_1_5_5_5, k_5_6_5 and // Remap the swizzle according to the texture format. k_1_5_5_5, k_5_6_5 and
// k_4_4_4_4 already have red and blue swapped in the load shader for // k_4_4_4_4 already have red and blue swapped in the load shader for
// simplicity. // simplicity.
if (format == TextureFormat::k_DXT3A || format == TextureFormat::k_DXT5A) { if (format == TextureFormat::k_6_5_5) {
// Green bits of the texture used for blue, and blue bits used for green.
// Swap 001 and 010 (XOR 011 if either 001 or 010).
uint32_t swizzle_green_or_blue =
((swizzle & 0b001001001001) ^ ((swizzle >> 1) & 0b001001001001)) &
swizzle_not_constant;
swizzle ^= swizzle_green_or_blue | (swizzle_green_or_blue << 1);
} else if (format == TextureFormat::k_DXT3A ||
format == TextureFormat::k_DXT5A) {
// DXT3A is emulated as R8, DXT5A is emulated as BC4 or (for unaligned // DXT3A is emulated as R8, DXT5A is emulated as BC4 or (for unaligned
// size) R8, but DXT5 alpha (in the red component of R8 and BC4) should be // size) R8, but DXT5 alpha (in the red component of R8 and BC4) should be
// replicated. // replicated.