glsl: Fix program linking and cbuf
This commit is contained in:
parent
64337f004d
commit
faf4cd72c5
2 changed files with 5 additions and 3 deletions
|
@ -29,8 +29,8 @@ void EmitContext::DefineConstantBuffers() {
|
||||||
}
|
}
|
||||||
u32 binding{};
|
u32 binding{};
|
||||||
for (const auto& desc : info.constant_buffer_descriptors) {
|
for (const auto& desc : info.constant_buffer_descriptors) {
|
||||||
Add("layout(std140,binding={}) uniform cbuf_{}{{uint cbuf{}[];}};", binding, binding,
|
Add("layout(std140,binding={}) uniform cbuf_{}{{vec4 cbuf{}[{}];}};", binding, binding,
|
||||||
desc.index, desc.count);
|
desc.index, 4 * 1024);
|
||||||
++binding;
|
++binding;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,9 @@ void EmitGetCbufS16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] const IR
|
||||||
|
|
||||||
void EmitGetCbufU32(EmitContext& ctx, IR::Inst* inst, const IR::Value& binding,
|
void EmitGetCbufU32(EmitContext& ctx, IR::Inst* inst, const IR::Value& binding,
|
||||||
const IR::Value& offset) {
|
const IR::Value& offset) {
|
||||||
ctx.Add("uint {}=cbuf{}[{}];", *inst, binding.U32(), offset.U32());
|
const auto u32_offset{offset.U32()};
|
||||||
|
ctx.Add("uint {}=floatBitsToUint(cbuf{}[{}][{}]);", *inst, binding.U32(), u32_offset / 16,
|
||||||
|
(u32_offset / 4) % 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitGetCbufF32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] const IR::Value& binding,
|
void EmitGetCbufF32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] const IR::Value& binding,
|
||||||
|
|
Loading…
Reference in a new issue