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:
parent
89c548b5d3
commit
b67f28e00d
@ -689,6 +689,24 @@ namespace gl
|
|||||||
|
|
||||||
void apply_component_mapping_flags(GLenum target, u32 gcm_format, rsx::texture_create_flags flags)
|
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)
|
switch (flags)
|
||||||
{
|
{
|
||||||
case rsx::texture_create_flags::default_component_order:
|
case rsx::texture_create_flags::default_component_order:
|
||||||
|
@ -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)
|
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 = {};
|
VkComponentMapping mapping = {};
|
||||||
switch (flags)
|
switch (flags)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user