From 65daba61793ab13c2a5c6d0674426ac0a76dbc22 Mon Sep 17 00:00:00 2001 From: Zephyron Date: Wed, 31 Dec 2025 16:10:48 +1000 Subject: [PATCH] feat(shader): integrate component type into texture pass optimization - Update texture descriptor comparison to include component_type - Add ReadTextureComponentType helper in texture_pass.cpp - Use component type when creating texture descriptors This ensures texture descriptors are properly differentiated by component type. Co-Authored-By: ForrestMarkX Signed-off-by: Zephyron --- src/shader_recompiler/ir_opt/texture_pass.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp index 92612b28c..50f3fc368 100644 --- a/src/shader_recompiler/ir_opt/texture_pass.cpp +++ b/src/shader_recompiler/ir_opt/texture_pass.cpp @@ -393,6 +393,10 @@ bool IsTexturePixelFormatInteger(Environment& env, const ConstBufferAddr& cbuf) return env.IsTexturePixelFormatInteger(GetTextureHandle(env, cbuf)); } +SamplerComponentType ReadTextureComponentType(Environment& env, const ConstBufferAddr& cbuf) { + return env.ReadTextureComponentType(GetTextureHandle(env, cbuf)); +} + class Descriptors { public: explicit Descriptors(TextureBufferDescriptors& texture_buffer_descriptors_, @@ -430,7 +434,9 @@ public: u32 Add(const TextureDescriptor& desc) { const u32 index{Add(texture_descriptors, desc, [&desc](const auto& existing) { - return desc.type == existing.type && desc.is_depth == existing.is_depth && + return desc.type == existing.type && + desc.component_type == existing.component_type && + desc.is_depth == existing.is_depth && desc.has_secondary == existing.has_secondary && desc.cbuf_index == existing.cbuf_index && desc.cbuf_offset == existing.cbuf_offset && @@ -669,6 +675,7 @@ void TexturePass(Environment& env, IR::Program& program, const HostTranslateInfo const bool is_integer{IsTexturePixelFormatInteger(env, cbuf)}; index = descriptors.Add(TextureDescriptor{ .type = flags.type, + .component_type = ReadTextureComponentType(env, cbuf), .is_depth = flags.is_depth != 0, .is_multisample = is_multisample, .is_integer = is_integer,