private static string StoreLocalOrShared(CodeGenContext context, AstOperation operation, string arrayName) { IAstNode src1 = operation.GetSource(0); IAstNode src2 = operation.GetSource(1); string offsetExpr = GetSoureExpr(context, src1, GetSrcVarType(operation.Inst, 0)); VariableType srcType = OperandManager.GetNodeDestType(src2); string src = TypeConversion.ReinterpretCast(context, src2, srcType, VariableType.U32); return($"{arrayName}[{offsetExpr}] = {src}"); }
public static string StoreStorage(CodeGenContext context, AstOperation operation) { IAstNode src1 = operation.GetSource(0); IAstNode src2 = operation.GetSource(1); IAstNode src3 = operation.GetSource(2); string indexExpr = GetSoureExpr(context, src1, GetSrcVarType(operation.Inst, 0)); string offsetExpr = GetSoureExpr(context, src2, GetSrcVarType(operation.Inst, 1)); VariableType srcType = OperandManager.GetNodeDestType(src3); string src = TypeConversion.ReinterpretCast(context, src3, srcType, VariableType.U32); string sb = GetStorageBufferAccessor(indexExpr, offsetExpr, context.Config.Stage); return($"{sb} = {src}"); }
public static string GetSoureExpr(CodeGenContext context, IAstNode node, VariableType dstType) { return(ReinterpretCast(context, node, OperandManager.GetNodeDestType(node), dstType)); }