renderer_vulkan: Fix shadow-texture usage determination

The shadow-texture should only actually be binded if shadows are enabled and if the shadow-texture slot is actually enabled. Otherwise the null-surface should be binded. This ensures that we are are not binding whatever texture slot the register happens to be set to as a shadow-texture. This avoids an RGBA4 texture from being binded into the shadow-texture slot in Monster Hunter 4 Ultimate when opening the equipment set screen.

Addresses https://github.com/azahar-emu/azahar/issues/2531
This commit is contained in:
Wunkolo authored and PabloMK7 committed 2026-09-11 18:12:00 +02:00
1 parent bb989a7b7f
commit 16370809db
1 file changed
+8 -1
@@ -700,7 +700,14 @@ void RasterizerVulkan::SyncTextureUnits(const Framebuffer* framebuffer) {
void RasterizerVulkan::SyncUtilityTextures(const Framebuffer* framebuffer) {
const bool shadow_writing = regs.framebuffer.IsShadowRendering();
const bool shadow_reading = regs.lighting.config0.enable_shadow;
bool shadow_reading = regs.lighting.config0.enable_shadow;
// Ensure the shadow-texture slot is actually enabled
if (shadow_reading) {
const u32 shadow_texture_unit = regs.lighting.config0.shadow_selector.Value();
const auto shadow_texture = regs.texturing.GetTextures()[shadow_texture_unit];
shadow_reading &= shadow_texture.enabled;
}
const auto utility_set = pipeline_cache.Acquire(DescriptorHeapType::Utility);
// Reading and writing are mutually exclusive