1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

rsx/texture_cache: Do not access non-existent components

This commit is contained in:
kd-11 2018-02-07 16:25:49 +03:00
parent 89c548b5d3
commit b67f28e00d
2 changed files with 32 additions and 0 deletions

View File

@ -689,6 +689,24 @@ namespace gl
void apply_component_mapping_flags(GLenum target, u32 gcm_format, rsx::texture_create_flags flags)
{
//NOTE: Depth textures should always read RRRR
switch (gcm_format)
{
case CELL_GCM_TEXTURE_DEPTH24_D8:
case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT:
case CELL_GCM_TEXTURE_DEPTH16:
case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
{
glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_RED);
glTexParameteri(target, GL_TEXTURE_SWIZZLE_G, GL_RED);
glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_RED);
glTexParameteri(target, GL_TEXTURE_SWIZZLE_A, GL_RED);
return;
}
default:
break;
}
switch (flags)
{
case rsx::texture_create_flags::default_component_order:

View File

@ -489,6 +489,20 @@ namespace vk
VkComponentMapping apply_component_mapping_flags(u32 gcm_format, rsx::texture_create_flags flags, const std::pair<std::array<u8, 4>, std::array<u8, 4>>& remap_vector)
{
//NOTE: Depth textures should always read RRRR
switch (gcm_format)
{
case CELL_GCM_TEXTURE_DEPTH24_D8:
case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT:
case CELL_GCM_TEXTURE_DEPTH16:
case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
{
return{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R };
}
default:
break;
}
VkComponentMapping mapping = {};
switch (flags)
{