shader_recompiler: Increase push constants user data to full capacity. (#1032)

This commit is contained in:
squidbus 2024-09-23 03:40:33 -07:00 committed by GitHub
parent ee38eec7fe
commit a5001d11a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View file

@ -88,18 +88,19 @@ using SamplerResourceList = boost::container::small_vector<SamplerResource, 16>;
struct PushData {
static constexpr u32 BufOffsetIndex = 2;
static constexpr u32 UdRegsIndex = 4;
static constexpr u32 MaxUdRegs = 8;
u32 step0;
u32 step1;
std::array<u8, 32> buf_offsets;
std::array<u32, MaxUdRegs> ud_regs;
std::array<u32, NumUserDataRegs> ud_regs;
void AddOffset(u32 binding, u32 offset) {
ASSERT(offset < 256 && binding < buf_offsets.size());
buf_offsets[binding] = offset;
}
};
static_assert(sizeof(PushData) <= 128,
"PushData size is greater than minimum size guaranteed by Vulkan spec");
/**
* Contains general information generated by the shader recompiler for an input program.
@ -216,6 +217,7 @@ struct Info {
u32 mask = ud_mask.mask;
while (mask) {
const u32 index = std::countr_zero(mask);
ASSERT(bnd.user_data < NumUserDataRegs && index < NumUserDataRegs);
mask &= ~(1U << index);
push.ud_regs[bnd.user_data++] = user_data[index];
}