mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 07:21:25 +12:00
d3d12: Implement A4R4G4B4 texture format with byte swapped
Make the guided fate paradox works
This commit is contained in:
parent
593b9a494d
commit
76d52b4bb3
1 changed files with 35 additions and 18 deletions
|
@ -100,7 +100,6 @@ size_t D3D12GSRender::UploadTextures()
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
case CELL_GCM_TEXTURE_A1R5G5B5:
|
case CELL_GCM_TEXTURE_A1R5G5B5:
|
||||||
case CELL_GCM_TEXTURE_A4R4G4B4:
|
|
||||||
case CELL_GCM_TEXTURE_G8B8:
|
case CELL_GCM_TEXTURE_G8B8:
|
||||||
case CELL_GCM_TEXTURE_R6G5B5:
|
case CELL_GCM_TEXTURE_R6G5B5:
|
||||||
case CELL_GCM_TEXTURE_DEPTH24_D8:
|
case CELL_GCM_TEXTURE_DEPTH24_D8:
|
||||||
|
@ -122,6 +121,11 @@ size_t D3D12GSRender::UploadTextures()
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(RSX, "Unimplemented Texture format : %x", format);
|
LOG_ERROR(RSX, "Unimplemented Texture format : %x", format);
|
||||||
break;
|
break;
|
||||||
|
case CELL_GCM_TEXTURE_A4R4G4B4:
|
||||||
|
dxgiFormat = DXGI_FORMAT_B4G4R4A4_UNORM;
|
||||||
|
blockSizeInByte = 2;
|
||||||
|
blockWidthInPixel = 1, blockHeightInPixel = 1;
|
||||||
|
break;
|
||||||
case CELL_GCM_TEXTURE_R5G6B5:
|
case CELL_GCM_TEXTURE_R5G6B5:
|
||||||
dxgiFormat = DXGI_FORMAT_B5G6R5_UNORM;
|
dxgiFormat = DXGI_FORMAT_B5G6R5_UNORM;
|
||||||
blockSizeInByte = 2;
|
blockSizeInByte = 2;
|
||||||
|
@ -218,7 +222,11 @@ size_t D3D12GSRender::UploadTextures()
|
||||||
{
|
{
|
||||||
size_t m_texture_pitch = m_textures[i].m_pitch;
|
size_t m_texture_pitch = m_textures[i].m_pitch;
|
||||||
if (!m_texture_pitch) m_texture_pitch = rowPitch;
|
if (!m_texture_pitch) m_texture_pitch = rowPitch;
|
||||||
if (format == CELL_GCM_TEXTURE_A8R8G8B8 && is_swizzled)
|
switch (format)
|
||||||
|
{
|
||||||
|
case CELL_GCM_TEXTURE_A8R8G8B8:
|
||||||
|
{
|
||||||
|
if (is_swizzled)
|
||||||
{
|
{
|
||||||
u32 *src, *dst;
|
u32 *src, *dst;
|
||||||
u32 log2width, log2height;
|
u32 log2width, log2height;
|
||||||
|
@ -234,19 +242,28 @@ size_t D3D12GSRender::UploadTextures()
|
||||||
dst[(row * rowPitch / 4) + j] = src[LinearToSwizzleAddress(j, i, 0, log2width, log2height, 0)];
|
dst[(row * rowPitch / 4) + j] = src[LinearToSwizzleAddress(j, i, 0, log2width, log2height, 0)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (format == CELL_GCM_TEXTURE_R5G6B5)
|
else
|
||||||
|
streamBuffer((char*)textureData + row * rowPitch, (char*)pixels + row * m_texture_pitch, m_texture_pitch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CELL_GCM_TEXTURE_A4R4G4B4:
|
||||||
|
case CELL_GCM_TEXTURE_R5G6B5:
|
||||||
{
|
{
|
||||||
unsigned short *dst = (unsigned short *)textureData,
|
unsigned short *dst = (unsigned short *)textureData, *src = (unsigned short *)pixels;
|
||||||
*src = (unsigned short *)pixels;
|
|
||||||
|
|
||||||
for (int j = 0; j < m_textures[i].GetWidth(); j++)
|
for (int j = 0; j < m_textures[i].GetWidth(); j++)
|
||||||
{
|
{
|
||||||
u16 tmp = src[row * m_texture_pitch / 2 + j];
|
u16 tmp = src[row * m_texture_pitch / 2 + j];
|
||||||
dst[row * rowPitch / 2 + j] = (tmp >> 8) | (tmp << 8);
|
dst[row * rowPitch / 2 + j] = (tmp >> 8) | (tmp << 8);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
default:
|
||||||
|
{
|
||||||
streamBuffer((char*)textureData + row * rowPitch, (char*)pixels + row * m_texture_pitch, m_texture_pitch);
|
streamBuffer((char*)textureData + row * rowPitch, (char*)pixels + row * m_texture_pitch, m_texture_pitch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Texture->Unmap(0, nullptr);
|
Texture->Unmap(0, nullptr);
|
||||||
|
|
||||||
|
@ -300,7 +317,6 @@ size_t D3D12GSRender::UploadTextures()
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
case CELL_GCM_TEXTURE_A1R5G5B5:
|
case CELL_GCM_TEXTURE_A1R5G5B5:
|
||||||
case CELL_GCM_TEXTURE_A4R4G4B4:
|
|
||||||
case CELL_GCM_TEXTURE_G8B8:
|
case CELL_GCM_TEXTURE_G8B8:
|
||||||
case CELL_GCM_TEXTURE_R6G5B5:
|
case CELL_GCM_TEXTURE_R6G5B5:
|
||||||
case CELL_GCM_TEXTURE_DEPTH24_D8:
|
case CELL_GCM_TEXTURE_DEPTH24_D8:
|
||||||
|
@ -322,6 +338,7 @@ size_t D3D12GSRender::UploadTextures()
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(RSX, "Unimplemented Texture format : %x", format);
|
LOG_ERROR(RSX, "Unimplemented Texture format : %x", format);
|
||||||
break;
|
break;
|
||||||
|
case CELL_GCM_TEXTURE_A4R4G4B4:
|
||||||
case CELL_GCM_TEXTURE_R5G6B5:
|
case CELL_GCM_TEXTURE_R5G6B5:
|
||||||
srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue