shader: Add NVN storage buffer fallbacks

When we can't track the SSBO origin of a global memory instruction,
leave it as a global memory operation and assume these pointers are in
the NVN storage buffer slots, then apply a linear search in the shader's
runtime.
This commit is contained in:
ReinUsesLisp
2021-04-19 16:33:23 -03:00
committed by ameerj
parent 6325601947
commit 7018e524f5
9 changed files with 214 additions and 62 deletions

View File

@ -64,16 +64,16 @@ void EmitLoadGlobalS16(EmitContext&) {
throw NotImplementedException("SPIR-V Instruction");
}
void EmitLoadGlobal32(EmitContext&) {
throw NotImplementedException("SPIR-V Instruction");
Id EmitLoadGlobal32(EmitContext& ctx, Id address) {
return ctx.OpFunctionCall(ctx.U32[1], ctx.load_global_func_u32, address);
}
void EmitLoadGlobal64(EmitContext&) {
throw NotImplementedException("SPIR-V Instruction");
Id EmitLoadGlobal64(EmitContext& ctx, Id address) {
return ctx.OpFunctionCall(ctx.U32[2], ctx.load_global_func_u32x2, address);
}
void EmitLoadGlobal128(EmitContext&) {
throw NotImplementedException("SPIR-V Instruction");
Id EmitLoadGlobal128(EmitContext& ctx, Id address) {
return ctx.OpFunctionCall(ctx.U32[4], ctx.load_global_func_u32x4, address);
}
void EmitWriteGlobalU8(EmitContext&) {
@ -92,16 +92,16 @@ void EmitWriteGlobalS16(EmitContext&) {
throw NotImplementedException("SPIR-V Instruction");
}
void EmitWriteGlobal32(EmitContext&) {
throw NotImplementedException("SPIR-V Instruction");
void EmitWriteGlobal32(EmitContext& ctx, Id address, Id value) {
ctx.OpFunctionCall(ctx.void_id, ctx.write_global_func_u32, address, value);
}
void EmitWriteGlobal64(EmitContext&) {
throw NotImplementedException("SPIR-V Instruction");
void EmitWriteGlobal64(EmitContext& ctx, Id address, Id value) {
ctx.OpFunctionCall(ctx.void_id, ctx.write_global_func_u32x2, address, value);
}
void EmitWriteGlobal128(EmitContext&) {
throw NotImplementedException("SPIR-V Instruction");
void EmitWriteGlobal128(EmitContext& ctx, Id address, Id value) {
ctx.OpFunctionCall(ctx.void_id, ctx.write_global_func_u32x4, address, value);
}
Id EmitLoadStorageU8(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset) {