feat(shader): integrate component type into texture pass optimization

Update texture descriptor comparison to include component_type, ensuring
textures with different component types are properly differentiated.

- Add ReadTextureComponentType helper function
- Include component_type in texture descriptor comparison
- Use component type when creating texture descriptors

Co-Authored-By: ForrestMarkX <forrestmarkx@outlook.com>
Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron
2026-01-02 17:52:07 +10:00
parent 56edbff4d7
commit afc67e2e39

View File

@@ -393,6 +393,11 @@ bool IsTexturePixelFormatInteger(Environment& env, const ConstBufferAddr& cbuf)
return env.IsTexturePixelFormatInteger(GetTextureHandle(env, cbuf));
}
[[nodiscard]] SamplerComponentType ReadTextureComponentType(Environment& env,
const ConstBufferAddr& cbuf) {
return env.ReadTextureComponentType(GetTextureHandle(env, cbuf));
}
class Descriptors {
public:
explicit Descriptors(TextureBufferDescriptors& texture_buffer_descriptors_,
@@ -430,7 +435,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 +676,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,