From 7ca15c60bbb8b941679d5d7f6aa7b61848643520 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Tue, 7 Dec 2021 20:46:31 +0300 Subject: [PATCH] rsx: Improve image aspect tests - Replace old format-based detection with proper aspect test. Explicit image aspect has been available for a long time, but older code was not updated. --- rpcs3/Emu/RSX/GL/GLRenderTargets.h | 10 +--------- rpcs3/Emu/RSX/GL/GLTextureCache.h | 10 +--------- rpcs3/Emu/RSX/VK/VKTextureCache.h | 11 +---------- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/rpcs3/Emu/RSX/GL/GLRenderTargets.h b/rpcs3/Emu/RSX/GL/GLRenderTargets.h index 9130475b95..2c58785463 100644 --- a/rpcs3/Emu/RSX/GL/GLRenderTargets.h +++ b/rpcs3/Emu/RSX/GL/GLRenderTargets.h @@ -76,15 +76,7 @@ namespace gl bool is_depth_surface() const override { - switch (get_internal_format()) - { - case gl::texture::internal_format::depth16: - case gl::texture::internal_format::depth24_stencil8: - case gl::texture::internal_format::depth32f_stencil8: - return true; - default: - return false; - } + return !!(aspect() & gl::image_aspect::depth); } void release_ref(texture* t) const override diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/Emu/RSX/GL/GLTextureCache.h index c098a15d23..c6aa1dd92a 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -413,15 +413,7 @@ namespace gl bool is_depth_texture() const { - switch (vram_texture->get_internal_format()) - { - case gl::texture::internal_format::depth16: - case gl::texture::internal_format::depth24_stencil8: - case gl::texture::internal_format::depth32f_stencil8: - return true; - default: - return false; - } + return !!(vram_texture->aspect() & gl::image_aspect::depth); } bool has_compatible_format(gl::texture* tex) const diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.h b/rpcs3/Emu/RSX/VK/VKTextureCache.h index b9fa905272..639a25a094 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.h +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.h @@ -346,16 +346,7 @@ namespace vk bool is_depth_texture() const { - switch (vram_texture->info.format) - { - case VK_FORMAT_D16_UNORM: - case VK_FORMAT_D32_SFLOAT: - case VK_FORMAT_D32_SFLOAT_S8_UINT: - case VK_FORMAT_D24_UNORM_S8_UINT: - return true; - default: - return false; - } + return !!(vram_texture->aspect() & VK_IMAGE_ASPECT_DEPTH_BIT); } };