Files
AnyPS5/core/shader/recompiler/CompiledVariant.hpp
T
Celegans12 068f2b3ecf fix(shader): reuse bound specialization fields for null buffer slots
Null buffer descriptors still split modules on unused specialization
fields after buffer presence moved to run time. Learn the first valid
bound fields per slot and use them for absent descriptors, retaining
actual runtime presence and independent bound formats.
Snapshot the learned fields once for result memo keys and materialization
so identical null captures cannot retain a module made before learning.
Cover direct, captured and prepared calls, null stores, and changed formats.
Keep the process-local table and an off switch for main's module selection.

AI-assisted: yes
2026-10-31 23:22:39 +01:00

48 lines
1.2 KiB
C++

#ifndef CORE_SHADER_RECOMPILER_COMPILEDVARIANT_HPP
#define CORE_SHADER_RECOMPILER_COMPILEDVARIANT_HPP
#include "Recompiler.hpp"
#include "IntermediateRepresentation/IrMetadata/CompiledShaderInfo.hpp"
#include "Optimization/include/Optimization/BindingAllocator.hpp"
#include "Optimization/include/Optimization/DescriptorBindingBuilder.hpp"
#include <cstddef>
#include <memory>
#include <mutex>
#include <utility>
#include <vector>
namespace ShaderRecompiler {
class BufferSubstituteTable {
public:
explicit BufferSubstituteTable(std::vector<BufferSubstitute> slots) : slots(std::move(slots)) {}
[[nodiscard]] std::vector<BufferSubstitute> Slots() const {
std::lock_guard lock(mutex);
return slots;
}
void Learn(std::size_t slot, const BufferSubstitute& value) {
std::lock_guard lock(mutex);
if (slot >= slots.size() || slots[slot].known) return;
slots[slot] = value;
slots[slot].known = true;
}
private:
mutable std::mutex mutex;
std::vector<BufferSubstitute> slots;
};
struct CompiledVariant {
BindingLayout layout;
CompiledShaderInfo info;
CompiledBindingLayout bindings;
CompiledShaderArtifact artifact;
std::shared_ptr<BufferSubstituteTable> substitutes;
};
}
#endif