diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/compatible_formats.cpp | 9 | ||||
| -rw-r--r-- | src/video_core/compatible_formats.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_device.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_device.h | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 195 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.h | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.h | 5 | ||||
| -rw-r--r-- | src/video_core/texture_cache/image_base.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/texture_cache/image_view_base.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 15 | ||||
| -rw-r--r-- | src/video_core/texture_cache/util.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/texture_cache/util.h | 8 |
12 files changed, 148 insertions, 120 deletions
diff --git a/src/video_core/compatible_formats.cpp b/src/video_core/compatible_formats.cpp index 1619d8664..acf2668dc 100644 --- a/src/video_core/compatible_formats.cpp +++ b/src/video_core/compatible_formats.cpp | |||
| @@ -10,9 +10,7 @@ | |||
| 10 | #include "video_core/surface.h" | 10 | #include "video_core/surface.h" |
| 11 | 11 | ||
| 12 | namespace VideoCore::Surface { | 12 | namespace VideoCore::Surface { |
| 13 | |||
| 14 | namespace { | 13 | namespace { |
| 15 | |||
| 16 | using Table = std::array<std::array<u64, 2>, MaxPixelFormat>; | 14 | using Table = std::array<std::array<u64, 2>, MaxPixelFormat>; |
| 17 | 15 | ||
| 18 | // Compatibility table taken from Table 3.X.2 in: | 16 | // Compatibility table taken from Table 3.X.2 in: |
| @@ -233,10 +231,13 @@ constexpr Table MakeCopyTable() { | |||
| 233 | EnableRange(copy, COPY_CLASS_64_BITS); | 231 | EnableRange(copy, COPY_CLASS_64_BITS); |
| 234 | return copy; | 232 | return copy; |
| 235 | } | 233 | } |
| 236 | |||
| 237 | } // Anonymous namespace | 234 | } // Anonymous namespace |
| 238 | 235 | ||
| 239 | bool IsViewCompatible(PixelFormat format_a, PixelFormat format_b) { | 236 | bool IsViewCompatible(PixelFormat format_a, PixelFormat format_b, bool broken_views) { |
| 237 | if (broken_views) { | ||
| 238 | // If format views are broken, only accept formats that are identical. | ||
| 239 | return format_a == format_b; | ||
| 240 | } | ||
| 240 | static constexpr Table TABLE = MakeViewTable(); | 241 | static constexpr Table TABLE = MakeViewTable(); |
| 241 | return IsSupported(TABLE, format_a, format_b); | 242 | return IsSupported(TABLE, format_a, format_b); |
| 242 | } | 243 | } |
diff --git a/src/video_core/compatible_formats.h b/src/video_core/compatible_formats.h index b5eb03bea..9a0522988 100644 --- a/src/video_core/compatible_formats.h +++ b/src/video_core/compatible_formats.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | namespace VideoCore::Surface { | 9 | namespace VideoCore::Surface { |
| 10 | 10 | ||
| 11 | bool IsViewCompatible(PixelFormat format_a, PixelFormat format_b); | 11 | bool IsViewCompatible(PixelFormat format_a, PixelFormat format_b, bool broken_views); |
| 12 | 12 | ||
| 13 | bool IsCopyCompatible(PixelFormat format_a, PixelFormat format_b); | 13 | bool IsCopyCompatible(PixelFormat format_a, PixelFormat format_b); |
| 14 | 14 | ||
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index b24179d59..81b71edfb 100644 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp | |||
| @@ -208,6 +208,7 @@ Device::Device() | |||
| 208 | 208 | ||
| 209 | const bool is_nvidia = vendor == "NVIDIA Corporation"; | 209 | const bool is_nvidia = vendor == "NVIDIA Corporation"; |
| 210 | const bool is_amd = vendor == "ATI Technologies Inc."; | 210 | const bool is_amd = vendor == "ATI Technologies Inc."; |
| 211 | const bool is_intel = vendor == "Intel"; | ||
| 211 | 212 | ||
| 212 | bool disable_fast_buffer_sub_data = false; | 213 | bool disable_fast_buffer_sub_data = false; |
| 213 | if (is_nvidia && version == "4.6.0 NVIDIA 443.24") { | 214 | if (is_nvidia && version == "4.6.0 NVIDIA 443.24") { |
| @@ -231,6 +232,7 @@ Device::Device() | |||
| 231 | has_variable_aoffi = TestVariableAoffi(); | 232 | has_variable_aoffi = TestVariableAoffi(); |
| 232 | has_component_indexing_bug = is_amd; | 233 | has_component_indexing_bug = is_amd; |
| 233 | has_precise_bug = TestPreciseBug(); | 234 | has_precise_bug = TestPreciseBug(); |
| 235 | has_broken_texture_view_formats = is_amd || is_intel; | ||
| 234 | has_nv_viewport_array2 = GLAD_GL_NV_viewport_array2; | 236 | has_nv_viewport_array2 = GLAD_GL_NV_viewport_array2; |
| 235 | has_vertex_buffer_unified_memory = GLAD_GL_NV_vertex_buffer_unified_memory; | 237 | has_vertex_buffer_unified_memory = GLAD_GL_NV_vertex_buffer_unified_memory; |
| 236 | has_debugging_tool_attached = IsDebugToolAttached(extensions); | 238 | has_debugging_tool_attached = IsDebugToolAttached(extensions); |
| @@ -248,6 +250,8 @@ Device::Device() | |||
| 248 | LOG_INFO(Render_OpenGL, "Renderer_VariableAOFFI: {}", has_variable_aoffi); | 250 | LOG_INFO(Render_OpenGL, "Renderer_VariableAOFFI: {}", has_variable_aoffi); |
| 249 | LOG_INFO(Render_OpenGL, "Renderer_ComponentIndexingBug: {}", has_component_indexing_bug); | 251 | LOG_INFO(Render_OpenGL, "Renderer_ComponentIndexingBug: {}", has_component_indexing_bug); |
| 250 | LOG_INFO(Render_OpenGL, "Renderer_PreciseBug: {}", has_precise_bug); | 252 | LOG_INFO(Render_OpenGL, "Renderer_PreciseBug: {}", has_precise_bug); |
| 253 | LOG_INFO(Render_OpenGL, "Renderer_BrokenTextureViewFormats: {}", | ||
| 254 | has_broken_texture_view_formats); | ||
| 251 | 255 | ||
| 252 | if (Settings::values.use_assembly_shaders.GetValue() && !use_assembly_shaders) { | 256 | if (Settings::values.use_assembly_shaders.GetValue() && !use_assembly_shaders) { |
| 253 | LOG_ERROR(Render_OpenGL, "Assembly shaders enabled but not supported"); | 257 | LOG_ERROR(Render_OpenGL, "Assembly shaders enabled but not supported"); |
diff --git a/src/video_core/renderer_opengl/gl_device.h b/src/video_core/renderer_opengl/gl_device.h index 13e66846c..3e79d1e37 100644 --- a/src/video_core/renderer_opengl/gl_device.h +++ b/src/video_core/renderer_opengl/gl_device.h | |||
| @@ -96,6 +96,10 @@ public: | |||
| 96 | return has_precise_bug; | 96 | return has_precise_bug; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | bool HasBrokenTextureViewFormats() const { | ||
| 100 | return has_broken_texture_view_formats; | ||
| 101 | } | ||
| 102 | |||
| 99 | bool HasFastBufferSubData() const { | 103 | bool HasFastBufferSubData() const { |
| 100 | return has_fast_buffer_sub_data; | 104 | return has_fast_buffer_sub_data; |
| 101 | } | 105 | } |
| @@ -137,6 +141,7 @@ private: | |||
| 137 | bool has_variable_aoffi{}; | 141 | bool has_variable_aoffi{}; |
| 138 | bool has_component_indexing_bug{}; | 142 | bool has_component_indexing_bug{}; |
| 139 | bool has_precise_bug{}; | 143 | bool has_precise_bug{}; |
| 144 | bool has_broken_texture_view_formats{}; | ||
| 140 | bool has_fast_buffer_sub_data{}; | 145 | bool has_fast_buffer_sub_data{}; |
| 141 | bool has_nv_viewport_array2{}; | 146 | bool has_nv_viewport_array2{}; |
| 142 | bool has_debugging_tool_attached{}; | 147 | bool has_debugging_tool_attached{}; |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 4c690418c..546cb6d00 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -61,100 +61,99 @@ struct FormatTuple { | |||
| 61 | GLenum internal_format; | 61 | GLenum internal_format; |
| 62 | GLenum format = GL_NONE; | 62 | GLenum format = GL_NONE; |
| 63 | GLenum type = GL_NONE; | 63 | GLenum type = GL_NONE; |
| 64 | GLenum store_format = internal_format; | ||
| 65 | }; | 64 | }; |
| 66 | 65 | ||
| 67 | constexpr std::array<FormatTuple, MaxPixelFormat> FORMAT_TABLE = {{ | 66 | constexpr std::array<FormatTuple, MaxPixelFormat> FORMAT_TABLE = {{ |
| 68 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // A8B8G8R8_UNORM | 67 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // A8B8G8R8_UNORM |
| 69 | {GL_RGBA8_SNORM, GL_RGBA, GL_BYTE}, // A8B8G8R8_SNORM | 68 | {GL_RGBA8_SNORM, GL_RGBA, GL_BYTE}, // A8B8G8R8_SNORM |
| 70 | {GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE}, // A8B8G8R8_SINT | 69 | {GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE}, // A8B8G8R8_SINT |
| 71 | {GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, // A8B8G8R8_UINT | 70 | {GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, // A8B8G8R8_UINT |
| 72 | {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // R5G6B5_UNORM | 71 | {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // R5G6B5_UNORM |
| 73 | {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV}, // B5G6R5_UNORM | 72 | {GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV}, // B5G6R5_UNORM |
| 74 | {GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1R5G5B5_UNORM | 73 | {GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1R5G5B5_UNORM |
| 75 | {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10_UNORM | 74 | {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10_UNORM |
| 76 | {GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10_UINT | 75 | {GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10_UINT |
| 77 | {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5_UNORM | 76 | {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5_UNORM |
| 78 | {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8_UNORM | 77 | {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8_UNORM |
| 79 | {GL_R8_SNORM, GL_RED, GL_BYTE}, // R8_SNORM | 78 | {GL_R8_SNORM, GL_RED, GL_BYTE}, // R8_SNORM |
| 80 | {GL_R8I, GL_RED_INTEGER, GL_BYTE}, // R8_SINT | 79 | {GL_R8I, GL_RED_INTEGER, GL_BYTE}, // R8_SINT |
| 81 | {GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE}, // R8_UINT | 80 | {GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE}, // R8_UINT |
| 82 | {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, // R16G16B16A16_FLOAT | 81 | {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, // R16G16B16A16_FLOAT |
| 83 | {GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // R16G16B16A16_UNORM | 82 | {GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // R16G16B16A16_UNORM |
| 84 | {GL_RGBA16_SNORM, GL_RGBA, GL_SHORT}, // R16G16B16A16_SNORM | 83 | {GL_RGBA16_SNORM, GL_RGBA, GL_SHORT}, // R16G16B16A16_SNORM |
| 85 | {GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT}, // R16G16B16A16_SINT | 84 | {GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT}, // R16G16B16A16_SINT |
| 86 | {GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT}, // R16G16B16A16_UINT | 85 | {GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT}, // R16G16B16A16_UINT |
| 87 | {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV}, // B10G11R11_FLOAT | 86 | {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV}, // B10G11R11_FLOAT |
| 88 | {GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT}, // R32G32B32A32_UINT | 87 | {GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT}, // R32G32B32A32_UINT |
| 89 | {GL_COMPRESSED_RGBA_S3TC_DXT1_EXT}, // BC1_RGBA_UNORM | 88 | {GL_COMPRESSED_RGBA_S3TC_DXT1_EXT}, // BC1_RGBA_UNORM |
| 90 | {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT}, // BC2_UNORM | 89 | {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT}, // BC2_UNORM |
| 91 | {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT}, // BC3_UNORM | 90 | {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT}, // BC3_UNORM |
| 92 | {GL_COMPRESSED_RED_RGTC1}, // BC4_UNORM | 91 | {GL_COMPRESSED_RED_RGTC1}, // BC4_UNORM |
| 93 | {GL_COMPRESSED_SIGNED_RED_RGTC1}, // BC4_SNORM | 92 | {GL_COMPRESSED_SIGNED_RED_RGTC1}, // BC4_SNORM |
| 94 | {GL_COMPRESSED_RG_RGTC2}, // BC5_UNORM | 93 | {GL_COMPRESSED_RG_RGTC2}, // BC5_UNORM |
| 95 | {GL_COMPRESSED_SIGNED_RG_RGTC2}, // BC5_SNORM | 94 | {GL_COMPRESSED_SIGNED_RG_RGTC2}, // BC5_SNORM |
| 96 | {GL_COMPRESSED_RGBA_BPTC_UNORM}, // BC7_UNORM | 95 | {GL_COMPRESSED_RGBA_BPTC_UNORM}, // BC7_UNORM |
| 97 | {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UFLOAT | 96 | {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UFLOAT |
| 98 | {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SFLOAT | 97 | {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SFLOAT |
| 99 | {GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4_UNORM | 98 | {GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4_UNORM |
| 100 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // B8G8R8A8_UNORM | 99 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // B8G8R8A8_UNORM |
| 101 | {GL_RGBA32F, GL_RGBA, GL_FLOAT}, // R32G32B32A32_FLOAT | 100 | {GL_RGBA32F, GL_RGBA, GL_FLOAT}, // R32G32B32A32_FLOAT |
| 102 | {GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // R32G32B32A32_SINT | 101 | {GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // R32G32B32A32_SINT |
| 103 | {GL_RG32F, GL_RG, GL_FLOAT}, // R32G32_FLOAT | 102 | {GL_RG32F, GL_RG, GL_FLOAT}, // R32G32_FLOAT |
| 104 | {GL_RG32I, GL_RG_INTEGER, GL_INT}, // R32G32_SINT | 103 | {GL_RG32I, GL_RG_INTEGER, GL_INT}, // R32G32_SINT |
| 105 | {GL_R32F, GL_RED, GL_FLOAT}, // R32_FLOAT | 104 | {GL_R32F, GL_RED, GL_FLOAT}, // R32_FLOAT |
| 106 | {GL_R16F, GL_RED, GL_HALF_FLOAT}, // R16_FLOAT | 105 | {GL_R16F, GL_RED, GL_HALF_FLOAT}, // R16_FLOAT |
| 107 | {GL_R16, GL_RED, GL_UNSIGNED_SHORT}, // R16_UNORM | 106 | {GL_R16, GL_RED, GL_UNSIGNED_SHORT}, // R16_UNORM |
| 108 | {GL_R16_SNORM, GL_RED, GL_SHORT}, // R16_SNORM | 107 | {GL_R16_SNORM, GL_RED, GL_SHORT}, // R16_SNORM |
| 109 | {GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16_UINT | 108 | {GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16_UINT |
| 110 | {GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16_SINT | 109 | {GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16_SINT |
| 111 | {GL_RG16, GL_RG, GL_UNSIGNED_SHORT}, // R16G16_UNORM | 110 | {GL_RG16, GL_RG, GL_UNSIGNED_SHORT}, // R16G16_UNORM |
| 112 | {GL_RG16F, GL_RG, GL_HALF_FLOAT}, // R16G16_FLOAT | 111 | {GL_RG16F, GL_RG, GL_HALF_FLOAT}, // R16G16_FLOAT |
| 113 | {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT}, // R16G16_UINT | 112 | {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT}, // R16G16_UINT |
| 114 | {GL_RG16I, GL_RG_INTEGER, GL_SHORT}, // R16G16_SINT | 113 | {GL_RG16I, GL_RG_INTEGER, GL_SHORT}, // R16G16_SINT |
| 115 | {GL_RG16_SNORM, GL_RG, GL_SHORT}, // R16G16_SNORM | 114 | {GL_RG16_SNORM, GL_RG, GL_SHORT}, // R16G16_SNORM |
| 116 | {GL_RGB32F, GL_RGB, GL_FLOAT}, // R32G32B32_FLOAT | 115 | {GL_RGB32F, GL_RGB, GL_FLOAT}, // R32G32B32_FLOAT |
| 117 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, GL_RGBA8}, // A8B8G8R8_SRGB | 116 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // A8B8G8R8_SRGB |
| 118 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // R8G8_UNORM | 117 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // R8G8_UNORM |
| 119 | {GL_RG8_SNORM, GL_RG, GL_BYTE}, // R8G8_SNORM | 118 | {GL_RG8_SNORM, GL_RG, GL_BYTE}, // R8G8_SNORM |
| 120 | {GL_RG8I, GL_RG_INTEGER, GL_BYTE}, // R8G8_SINT | 119 | {GL_RG8I, GL_RG_INTEGER, GL_BYTE}, // R8G8_SINT |
| 121 | {GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE}, // R8G8_UINT | 120 | {GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE}, // R8G8_UINT |
| 122 | {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // R32G32_UINT | 121 | {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // R32G32_UINT |
| 123 | {GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // R16G16B16X16_FLOAT | 122 | {GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // R16G16B16X16_FLOAT |
| 124 | {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32_UINT | 123 | {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32_UINT |
| 125 | {GL_R32I, GL_RED_INTEGER, GL_INT}, // R32_SINT | 124 | {GL_R32I, GL_RED_INTEGER, GL_INT}, // R32_SINT |
| 126 | {GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8_UNORM | 125 | {GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8_UNORM |
| 127 | {GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5_UNORM | 126 | {GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5_UNORM |
| 128 | {GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4_UNORM | 127 | {GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4_UNORM |
| 129 | {GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE, GL_RGBA8}, // B8G8R8A8_UNORM | 128 | {GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE}, // B8G8R8A8_UNORM |
| 130 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // BC1_RGBA_SRGB | 129 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // BC1_RGBA_SRGB |
| 131 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // BC2_SRGB | 130 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // BC2_SRGB |
| 132 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB | 131 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB |
| 133 | {GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM}, // BC7_SRGB | 132 | {GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM}, // BC7_SRGB |
| 134 | {GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, // A4B4G4R4_UNORM | 133 | {GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, // A4B4G4R4_UNORM |
| 135 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR}, // ASTC_2D_4X4_SRGB | 134 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR}, // ASTC_2D_4X4_SRGB |
| 136 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR}, // ASTC_2D_8X8_SRGB | 135 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR}, // ASTC_2D_8X8_SRGB |
| 137 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR}, // ASTC_2D_8X5_SRGB | 136 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR}, // ASTC_2D_8X5_SRGB |
| 138 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR}, // ASTC_2D_5X4_SRGB | 137 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR}, // ASTC_2D_5X4_SRGB |
| 139 | {GL_COMPRESSED_RGBA_ASTC_5x5_KHR}, // ASTC_2D_5X5_UNORM | 138 | {GL_COMPRESSED_RGBA_ASTC_5x5_KHR}, // ASTC_2D_5X5_UNORM |
| 140 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR}, // ASTC_2D_5X5_SRGB | 139 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR}, // ASTC_2D_5X5_SRGB |
| 141 | {GL_COMPRESSED_RGBA_ASTC_10x8_KHR}, // ASTC_2D_10X8_UNORM | 140 | {GL_COMPRESSED_RGBA_ASTC_10x8_KHR}, // ASTC_2D_10X8_UNORM |
| 142 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR}, // ASTC_2D_10X8_SRGB | 141 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR}, // ASTC_2D_10X8_SRGB |
| 143 | {GL_COMPRESSED_RGBA_ASTC_6x6_KHR}, // ASTC_2D_6X6_UNORM | 142 | {GL_COMPRESSED_RGBA_ASTC_6x6_KHR}, // ASTC_2D_6X6_UNORM |
| 144 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR}, // ASTC_2D_6X6_SRGB | 143 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR}, // ASTC_2D_6X6_SRGB |
| 145 | {GL_COMPRESSED_RGBA_ASTC_10x10_KHR}, // ASTC_2D_10X10_UNORM | 144 | {GL_COMPRESSED_RGBA_ASTC_10x10_KHR}, // ASTC_2D_10X10_UNORM |
| 146 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR}, // ASTC_2D_10X10_SRGB | 145 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR}, // ASTC_2D_10X10_SRGB |
| 147 | {GL_COMPRESSED_RGBA_ASTC_12x12_KHR}, // ASTC_2D_12X12_UNORM | 146 | {GL_COMPRESSED_RGBA_ASTC_12x12_KHR}, // ASTC_2D_12X12_UNORM |
| 148 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}, // ASTC_2D_12X12_SRGB | 147 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}, // ASTC_2D_12X12_SRGB |
| 149 | {GL_COMPRESSED_RGBA_ASTC_8x6_KHR}, // ASTC_2D_8X6_UNORM | 148 | {GL_COMPRESSED_RGBA_ASTC_8x6_KHR}, // ASTC_2D_8X6_UNORM |
| 150 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR}, // ASTC_2D_8X6_SRGB | 149 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR}, // ASTC_2D_8X6_SRGB |
| 151 | {GL_COMPRESSED_RGBA_ASTC_6x5_KHR}, // ASTC_2D_6X5_UNORM | 150 | {GL_COMPRESSED_RGBA_ASTC_6x5_KHR}, // ASTC_2D_6X5_UNORM |
| 152 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR}, // ASTC_2D_6X5_SRGB | 151 | {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR}, // ASTC_2D_6X5_SRGB |
| 153 | {GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9_FLOAT | 152 | {GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9_FLOAT |
| 154 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32_FLOAT | 153 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32_FLOAT |
| 155 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // D16_UNORM | 154 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // D16_UNORM |
| 156 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // D24_UNORM_S8_UINT | 155 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // D24_UNORM_S8_UINT |
| 157 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8_UINT_D24_UNORM | 156 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8_UINT_D24_UNORM |
| 158 | {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, | 157 | {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, |
| 159 | GL_FLOAT_32_UNSIGNED_INT_24_8_REV}, // D32_FLOAT_S8_UINT | 158 | GL_FLOAT_32_UNSIGNED_INT_24_8_REV}, // D32_FLOAT_S8_UINT |
| 160 | }}; | 159 | }}; |
| @@ -431,6 +430,8 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, ProgramManager& | |||
| 431 | format_properties[i].emplace(format, properties); | 430 | format_properties[i].emplace(format, properties); |
| 432 | } | 431 | } |
| 433 | } | 432 | } |
| 433 | has_broken_texture_view_formats = device.HasBrokenTextureViewFormats(); | ||
| 434 | |||
| 434 | null_image_1d_array.Create(GL_TEXTURE_1D_ARRAY); | 435 | null_image_1d_array.Create(GL_TEXTURE_1D_ARRAY); |
| 435 | null_image_cube_array.Create(GL_TEXTURE_CUBE_MAP_ARRAY); | 436 | null_image_cube_array.Create(GL_TEXTURE_CUBE_MAP_ARRAY); |
| 436 | null_image_3d.Create(GL_TEXTURE_3D); | 437 | null_image_3d.Create(GL_TEXTURE_3D); |
| @@ -651,13 +652,11 @@ Image::Image(TextureCacheRuntime& runtime, const VideoCommon::ImageInfo& info_, | |||
| 651 | if (IsConverted(runtime.device, info.format, info.type)) { | 652 | if (IsConverted(runtime.device, info.format, info.type)) { |
| 652 | flags |= ImageFlagBits::Converted; | 653 | flags |= ImageFlagBits::Converted; |
| 653 | gl_internal_format = IsPixelFormatSRGB(info.format) ? GL_SRGB8_ALPHA8 : GL_RGBA8; | 654 | gl_internal_format = IsPixelFormatSRGB(info.format) ? GL_SRGB8_ALPHA8 : GL_RGBA8; |
| 654 | gl_store_format = GL_RGBA8; | ||
| 655 | gl_format = GL_RGBA; | 655 | gl_format = GL_RGBA; |
| 656 | gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; | 656 | gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; |
| 657 | } else { | 657 | } else { |
| 658 | const auto& tuple = GetFormatTuple(info.format); | 658 | const auto& tuple = GetFormatTuple(info.format); |
| 659 | gl_internal_format = tuple.internal_format; | 659 | gl_internal_format = tuple.internal_format; |
| 660 | gl_store_format = tuple.store_format; | ||
| 661 | gl_format = tuple.format; | 660 | gl_format = tuple.format; |
| 662 | gl_type = tuple.type; | 661 | gl_type = tuple.type; |
| 663 | } | 662 | } |
| @@ -677,23 +676,23 @@ Image::Image(TextureCacheRuntime& runtime, const VideoCommon::ImageInfo& info_, | |||
| 677 | } | 676 | } |
| 678 | switch (target) { | 677 | switch (target) { |
| 679 | case GL_TEXTURE_1D_ARRAY: | 678 | case GL_TEXTURE_1D_ARRAY: |
| 680 | glTextureStorage2D(handle, num_levels, gl_store_format, width, num_layers); | 679 | glTextureStorage2D(handle, num_levels, gl_internal_format, width, num_layers); |
| 681 | break; | 680 | break; |
| 682 | case GL_TEXTURE_2D_ARRAY: | 681 | case GL_TEXTURE_2D_ARRAY: |
| 683 | glTextureStorage3D(handle, num_levels, gl_store_format, width, height, num_layers); | 682 | glTextureStorage3D(handle, num_levels, gl_internal_format, width, height, num_layers); |
| 684 | break; | 683 | break; |
| 685 | case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: { | 684 | case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: { |
| 686 | // TODO: Where should 'fixedsamplelocations' come from? | 685 | // TODO: Where should 'fixedsamplelocations' come from? |
| 687 | const auto [samples_x, samples_y] = SamplesLog2(info.num_samples); | 686 | const auto [samples_x, samples_y] = SamplesLog2(info.num_samples); |
| 688 | glTextureStorage3DMultisample(handle, num_samples, gl_store_format, width >> samples_x, | 687 | glTextureStorage3DMultisample(handle, num_samples, gl_internal_format, width >> samples_x, |
| 689 | height >> samples_y, num_layers, GL_FALSE); | 688 | height >> samples_y, num_layers, GL_FALSE); |
| 690 | break; | 689 | break; |
| 691 | } | 690 | } |
| 692 | case GL_TEXTURE_RECTANGLE: | 691 | case GL_TEXTURE_RECTANGLE: |
| 693 | glTextureStorage2D(handle, num_levels, gl_store_format, width, height); | 692 | glTextureStorage2D(handle, num_levels, gl_internal_format, width, height); |
| 694 | break; | 693 | break; |
| 695 | case GL_TEXTURE_3D: | 694 | case GL_TEXTURE_3D: |
| 696 | glTextureStorage3D(handle, num_levels, gl_store_format, width, height, depth); | 695 | glTextureStorage3D(handle, num_levels, gl_internal_format, width, height, depth); |
| 697 | break; | 696 | break; |
| 698 | case GL_TEXTURE_BUFFER: | 697 | case GL_TEXTURE_BUFFER: |
| 699 | buffer.Create(); | 698 | buffer.Create(); |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index 04193e31e..15b7c3676 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h | |||
| @@ -96,6 +96,10 @@ public: | |||
| 96 | 96 | ||
| 97 | FormatProperties FormatInfo(VideoCommon::ImageType type, GLenum internal_format) const; | 97 | FormatProperties FormatInfo(VideoCommon::ImageType type, GLenum internal_format) const; |
| 98 | 98 | ||
| 99 | bool HasBrokenTextureViewFormats() const noexcept { | ||
| 100 | return has_broken_texture_view_formats; | ||
| 101 | } | ||
| 102 | |||
| 99 | private: | 103 | private: |
| 100 | struct StagingBuffers { | 104 | struct StagingBuffers { |
| 101 | explicit StagingBuffers(GLenum storage_flags_, GLenum map_flags_); | 105 | explicit StagingBuffers(GLenum storage_flags_, GLenum map_flags_); |
| @@ -120,6 +124,7 @@ private: | |||
| 120 | UtilShaders util_shaders; | 124 | UtilShaders util_shaders; |
| 121 | 125 | ||
| 122 | std::array<std::unordered_map<GLenum, FormatProperties>, 3> format_properties; | 126 | std::array<std::unordered_map<GLenum, FormatProperties>, 3> format_properties; |
| 127 | bool has_broken_texture_view_formats = false; | ||
| 123 | 128 | ||
| 124 | StagingBuffers upload_buffers{GL_MAP_WRITE_BIT, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT}; | 129 | StagingBuffers upload_buffers{GL_MAP_WRITE_BIT, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT}; |
| 125 | StagingBuffers download_buffers{GL_MAP_READ_BIT, GL_MAP_READ_BIT}; | 130 | StagingBuffers download_buffers{GL_MAP_READ_BIT, GL_MAP_READ_BIT}; |
| @@ -165,7 +170,6 @@ private: | |||
| 165 | OGLTextureView store_view; | 170 | OGLTextureView store_view; |
| 166 | OGLBuffer buffer; | 171 | OGLBuffer buffer; |
| 167 | GLenum gl_internal_format = GL_NONE; | 172 | GLenum gl_internal_format = GL_NONE; |
| 168 | GLenum gl_store_format = GL_NONE; | ||
| 169 | GLenum gl_format = GL_NONE; | 173 | GLenum gl_format = GL_NONE; |
| 170 | GLenum gl_type = GL_NONE; | 174 | GLenum gl_type = GL_NONE; |
| 171 | }; | 175 | }; |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index e68a3db43..92a7aad8b 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h | |||
| @@ -104,6 +104,11 @@ struct TextureCacheRuntime { | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | void InsertUploadMemoryBarrier() {} | 106 | void InsertUploadMemoryBarrier() {} |
| 107 | |||
| 108 | bool HasBrokenTextureViewFormats() const noexcept { | ||
| 109 | // No known Vulkan driver has broken image views | ||
| 110 | return false; | ||
| 111 | } | ||
| 107 | }; | 112 | }; |
| 108 | 113 | ||
| 109 | class Image : public VideoCommon::ImageBase { | 114 | class Image : public VideoCommon::ImageBase { |
diff --git a/src/video_core/texture_cache/image_base.cpp b/src/video_core/texture_cache/image_base.cpp index 448a05fcc..959b3f115 100644 --- a/src/video_core/texture_cache/image_base.cpp +++ b/src/video_core/texture_cache/image_base.cpp | |||
| @@ -120,7 +120,9 @@ void AddImageAlias(ImageBase& lhs, ImageBase& rhs, ImageId lhs_id, ImageId rhs_i | |||
| 120 | if (lhs.info.type == ImageType::Linear) { | 120 | if (lhs.info.type == ImageType::Linear) { |
| 121 | base = SubresourceBase{.level = 0, .layer = 0}; | 121 | base = SubresourceBase{.level = 0, .layer = 0}; |
| 122 | } else { | 122 | } else { |
| 123 | base = FindSubresource(rhs.info, lhs, rhs.gpu_addr, OPTIONS); | 123 | // We are passing relaxed formats as an option, having broken views or not won't matter |
| 124 | static constexpr bool broken_views = false; | ||
| 125 | base = FindSubresource(rhs.info, lhs, rhs.gpu_addr, OPTIONS, broken_views); | ||
| 124 | } | 126 | } |
| 125 | if (!base) { | 127 | if (!base) { |
| 126 | LOG_ERROR(HW_GPU, "Image alias should have been flipped"); | 128 | LOG_ERROR(HW_GPU, "Image alias should have been flipped"); |
diff --git a/src/video_core/texture_cache/image_view_base.cpp b/src/video_core/texture_cache/image_view_base.cpp index 076a4bcfd..18f72e508 100644 --- a/src/video_core/texture_cache/image_view_base.cpp +++ b/src/video_core/texture_cache/image_view_base.cpp | |||
| @@ -24,7 +24,7 @@ ImageViewBase::ImageViewBase(const ImageViewInfo& info, const ImageInfo& image_i | |||
| 24 | .height = std::max(image_info.size.height >> range.base.level, 1u), | 24 | .height = std::max(image_info.size.height >> range.base.level, 1u), |
| 25 | .depth = std::max(image_info.size.depth >> range.base.level, 1u), | 25 | .depth = std::max(image_info.size.depth >> range.base.level, 1u), |
| 26 | } { | 26 | } { |
| 27 | ASSERT_MSG(VideoCore::Surface::IsViewCompatible(image_info.format, info.format), | 27 | ASSERT_MSG(VideoCore::Surface::IsViewCompatible(image_info.format, info.format, false), |
| 28 | "Image view format {} is incompatible with image format {}", info.format, | 28 | "Image view format {} is incompatible with image format {}", info.format, |
| 29 | image_info.format); | 29 | image_info.format); |
| 30 | const bool is_async = Settings::values.use_asynchronous_gpu_emulation.GetValue(); | 30 | const bool is_async = Settings::values.use_asynchronous_gpu_emulation.GetValue(); |
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 968059842..ad86c50b4 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -883,6 +883,7 @@ ImageId TextureCache<P>::FindImage(const ImageInfo& info, GPUVAddr gpu_addr, | |||
| 883 | if (!cpu_addr) { | 883 | if (!cpu_addr) { |
| 884 | return ImageId{}; | 884 | return ImageId{}; |
| 885 | } | 885 | } |
| 886 | const bool broken_views = runtime.HasBrokenTextureViewFormats(); | ||
| 886 | ImageId image_id; | 887 | ImageId image_id; |
| 887 | const auto lambda = [&](ImageId existing_image_id, ImageBase& existing_image) { | 888 | const auto lambda = [&](ImageId existing_image_id, ImageBase& existing_image) { |
| 888 | if (info.type == ImageType::Linear || existing_image.info.type == ImageType::Linear) { | 889 | if (info.type == ImageType::Linear || existing_image.info.type == ImageType::Linear) { |
| @@ -892,11 +893,11 @@ ImageId TextureCache<P>::FindImage(const ImageInfo& info, GPUVAddr gpu_addr, | |||
| 892 | if (existing_image.gpu_addr == gpu_addr && existing.type == info.type && | 893 | if (existing_image.gpu_addr == gpu_addr && existing.type == info.type && |
| 893 | existing.pitch == info.pitch && | 894 | existing.pitch == info.pitch && |
| 894 | IsPitchLinearSameSize(existing, info, strict_size) && | 895 | IsPitchLinearSameSize(existing, info, strict_size) && |
| 895 | IsViewCompatible(existing.format, info.format)) { | 896 | IsViewCompatible(existing.format, info.format, broken_views)) { |
| 896 | image_id = existing_image_id; | 897 | image_id = existing_image_id; |
| 897 | return true; | 898 | return true; |
| 898 | } | 899 | } |
| 899 | } else if (IsSubresource(info, existing_image, gpu_addr, options)) { | 900 | } else if (IsSubresource(info, existing_image, gpu_addr, options, broken_views)) { |
| 900 | image_id = existing_image_id; | 901 | image_id = existing_image_id; |
| 901 | return true; | 902 | return true; |
| 902 | } | 903 | } |
| @@ -926,6 +927,7 @@ template <class P> | |||
| 926 | ImageId TextureCache<P>::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VAddr cpu_addr) { | 927 | ImageId TextureCache<P>::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VAddr cpu_addr) { |
| 927 | ImageInfo new_info = info; | 928 | ImageInfo new_info = info; |
| 928 | const size_t size_bytes = CalculateGuestSizeInBytes(new_info); | 929 | const size_t size_bytes = CalculateGuestSizeInBytes(new_info); |
| 930 | const bool broken_views = runtime.HasBrokenTextureViewFormats(); | ||
| 929 | std::vector<ImageId> overlap_ids; | 931 | std::vector<ImageId> overlap_ids; |
| 930 | std::vector<ImageId> left_aliased_ids; | 932 | std::vector<ImageId> left_aliased_ids; |
| 931 | std::vector<ImageId> right_aliased_ids; | 933 | std::vector<ImageId> right_aliased_ids; |
| @@ -940,7 +942,9 @@ ImageId TextureCache<P>::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VA | |||
| 940 | } | 942 | } |
| 941 | return; | 943 | return; |
| 942 | } | 944 | } |
| 943 | const auto solution = ResolveOverlap(new_info, gpu_addr, cpu_addr, overlap, true); | 945 | static constexpr bool strict_size = true; |
| 946 | const std::optional<OverlapResult> solution = | ||
| 947 | ResolveOverlap(new_info, gpu_addr, cpu_addr, overlap, strict_size, broken_views); | ||
| 944 | if (solution) { | 948 | if (solution) { |
| 945 | gpu_addr = solution->gpu_addr; | 949 | gpu_addr = solution->gpu_addr; |
| 946 | cpu_addr = solution->cpu_addr; | 950 | cpu_addr = solution->cpu_addr; |
| @@ -950,9 +954,10 @@ ImageId TextureCache<P>::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VA | |||
| 950 | } | 954 | } |
| 951 | static constexpr auto options = RelaxedOptions::Size | RelaxedOptions::Format; | 955 | static constexpr auto options = RelaxedOptions::Size | RelaxedOptions::Format; |
| 952 | const ImageBase new_image_base(new_info, gpu_addr, cpu_addr); | 956 | const ImageBase new_image_base(new_info, gpu_addr, cpu_addr); |
| 953 | if (IsSubresource(new_info, overlap, gpu_addr, options)) { | 957 | if (IsSubresource(new_info, overlap, gpu_addr, options, broken_views)) { |
| 954 | left_aliased_ids.push_back(overlap_id); | 958 | left_aliased_ids.push_back(overlap_id); |
| 955 | } else if (IsSubresource(overlap.info, new_image_base, overlap.gpu_addr, options)) { | 959 | } else if (IsSubresource(overlap.info, new_image_base, overlap.gpu_addr, options, |
| 960 | broken_views)) { | ||
| 956 | right_aliased_ids.push_back(overlap_id); | 961 | right_aliased_ids.push_back(overlap_id); |
| 957 | } | 962 | } |
| 958 | }); | 963 | }); |
diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp index 9ed1fc007..279932778 100644 --- a/src/video_core/texture_cache/util.cpp +++ b/src/video_core/texture_cache/util.cpp | |||
| @@ -1069,13 +1069,13 @@ bool IsPitchLinearSameSize(const ImageInfo& lhs, const ImageInfo& rhs, bool stri | |||
| 1069 | 1069 | ||
| 1070 | std::optional<OverlapResult> ResolveOverlap(const ImageInfo& new_info, GPUVAddr gpu_addr, | 1070 | std::optional<OverlapResult> ResolveOverlap(const ImageInfo& new_info, GPUVAddr gpu_addr, |
| 1071 | VAddr cpu_addr, const ImageBase& overlap, | 1071 | VAddr cpu_addr, const ImageBase& overlap, |
| 1072 | bool strict_size) { | 1072 | bool strict_size, bool broken_views) { |
| 1073 | ASSERT(new_info.type != ImageType::Linear); | 1073 | ASSERT(new_info.type != ImageType::Linear); |
| 1074 | ASSERT(overlap.info.type != ImageType::Linear); | 1074 | ASSERT(overlap.info.type != ImageType::Linear); |
| 1075 | if (!IsLayerStrideCompatible(new_info, overlap.info)) { | 1075 | if (!IsLayerStrideCompatible(new_info, overlap.info)) { |
| 1076 | return std::nullopt; | 1076 | return std::nullopt; |
| 1077 | } | 1077 | } |
| 1078 | if (!IsViewCompatible(overlap.info.format, new_info.format)) { | 1078 | if (!IsViewCompatible(overlap.info.format, new_info.format, broken_views)) { |
| 1079 | return std::nullopt; | 1079 | return std::nullopt; |
| 1080 | } | 1080 | } |
| 1081 | if (gpu_addr == overlap.gpu_addr) { | 1081 | if (gpu_addr == overlap.gpu_addr) { |
| @@ -1118,14 +1118,15 @@ bool IsLayerStrideCompatible(const ImageInfo& lhs, const ImageInfo& rhs) { | |||
| 1118 | } | 1118 | } |
| 1119 | 1119 | ||
| 1120 | std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const ImageBase& image, | 1120 | std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const ImageBase& image, |
| 1121 | GPUVAddr candidate_addr, RelaxedOptions options) { | 1121 | GPUVAddr candidate_addr, RelaxedOptions options, |
| 1122 | bool broken_views) { | ||
| 1122 | const std::optional<SubresourceBase> base = image.TryFindBase(candidate_addr); | 1123 | const std::optional<SubresourceBase> base = image.TryFindBase(candidate_addr); |
| 1123 | if (!base) { | 1124 | if (!base) { |
| 1124 | return std::nullopt; | 1125 | return std::nullopt; |
| 1125 | } | 1126 | } |
| 1126 | const ImageInfo& existing = image.info; | 1127 | const ImageInfo& existing = image.info; |
| 1127 | if (False(options & RelaxedOptions::Format)) { | 1128 | if (False(options & RelaxedOptions::Format)) { |
| 1128 | if (!IsViewCompatible(existing.format, candidate.format)) { | 1129 | if (!IsViewCompatible(existing.format, candidate.format, broken_views)) { |
| 1129 | return std::nullopt; | 1130 | return std::nullopt; |
| 1130 | } | 1131 | } |
| 1131 | } | 1132 | } |
| @@ -1162,8 +1163,8 @@ std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const | |||
| 1162 | } | 1163 | } |
| 1163 | 1164 | ||
| 1164 | bool IsSubresource(const ImageInfo& candidate, const ImageBase& image, GPUVAddr candidate_addr, | 1165 | bool IsSubresource(const ImageInfo& candidate, const ImageBase& image, GPUVAddr candidate_addr, |
| 1165 | RelaxedOptions options) { | 1166 | RelaxedOptions options, bool broken_views) { |
| 1166 | return FindSubresource(candidate, image, candidate_addr, options).has_value(); | 1167 | return FindSubresource(candidate, image, candidate_addr, options, broken_views).has_value(); |
| 1167 | } | 1168 | } |
| 1168 | 1169 | ||
| 1169 | void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* dst, | 1170 | void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* dst, |
diff --git a/src/video_core/texture_cache/util.h b/src/video_core/texture_cache/util.h index dbbbd33cd..52a9207d6 100644 --- a/src/video_core/texture_cache/util.h +++ b/src/video_core/texture_cache/util.h | |||
| @@ -87,17 +87,19 @@ void SwizzleImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr, const Ima | |||
| 87 | [[nodiscard]] std::optional<OverlapResult> ResolveOverlap(const ImageInfo& new_info, | 87 | [[nodiscard]] std::optional<OverlapResult> ResolveOverlap(const ImageInfo& new_info, |
| 88 | GPUVAddr gpu_addr, VAddr cpu_addr, | 88 | GPUVAddr gpu_addr, VAddr cpu_addr, |
| 89 | const ImageBase& overlap, | 89 | const ImageBase& overlap, |
| 90 | bool strict_size); | 90 | bool strict_size, bool broken_views); |
| 91 | 91 | ||
| 92 | [[nodiscard]] bool IsLayerStrideCompatible(const ImageInfo& lhs, const ImageInfo& rhs); | 92 | [[nodiscard]] bool IsLayerStrideCompatible(const ImageInfo& lhs, const ImageInfo& rhs); |
| 93 | 93 | ||
| 94 | [[nodiscard]] std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, | 94 | [[nodiscard]] std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, |
| 95 | const ImageBase& image, | 95 | const ImageBase& image, |
| 96 | GPUVAddr candidate_addr, | 96 | GPUVAddr candidate_addr, |
| 97 | RelaxedOptions options); | 97 | RelaxedOptions options, |
| 98 | bool broken_views); | ||
| 98 | 99 | ||
| 99 | [[nodiscard]] bool IsSubresource(const ImageInfo& candidate, const ImageBase& image, | 100 | [[nodiscard]] bool IsSubresource(const ImageInfo& candidate, const ImageBase& image, |
| 100 | GPUVAddr candidate_addr, RelaxedOptions options); | 101 | GPUVAddr candidate_addr, RelaxedOptions options, |
| 102 | bool broken_views); | ||
| 101 | 103 | ||
| 102 | void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* dst, | 104 | void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* dst, |
| 103 | const ImageBase* src); | 105 | const ImageBase* src); |