Return a null handle when reading from an unbound cbuf

This commit is contained in:
Billy Laws 2023-03-11 23:12:02 +00:00
parent 8d9b0041b4
commit 0b551e04db

View File

@ -77,6 +77,9 @@ namespace skyline::gpu::interconnect {
static BindlessHandle ReadBindlessHandle(InterconnectContext &ctx, auto &constantBuffers, const auto &desc, size_t arrayIdx) { static BindlessHandle ReadBindlessHandle(InterconnectContext &ctx, auto &constantBuffers, const auto &desc, size_t arrayIdx) {
ConstantBuffer &primaryCbuf{constantBuffers[desc.cbuf_index]}; ConstantBuffer &primaryCbuf{constantBuffers[desc.cbuf_index]};
if (!primaryCbuf.view)
return { .raw = 0 };
size_t elemOffset{arrayIdx << desc.size_shift}; size_t elemOffset{arrayIdx << desc.size_shift};
size_t primaryCbufOffset{desc.cbuf_offset + elemOffset}; size_t primaryCbufOffset{desc.cbuf_offset + elemOffset};
u32 primaryVal{primaryCbuf.Read<u32>(ctx.executor, primaryCbufOffset)}; u32 primaryVal{primaryCbuf.Read<u32>(ctx.executor, primaryCbufOffset)};