-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[HLSL] Add Load overload with status #166449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
99c9788
06ad11a
ec4e3a9
2a49c36
0d0b79f
8cc846b
673c1a5
3f124ba
5bbfc7f
cc885d0
84d5ca1
1e10b23
48957a3
5852461
4fdb463
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -353,6 +353,56 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, | |||||||
| RetTy, CGM.getHLSLRuntime().getCreateResourceGetPointerIntrinsic(), | ||||||||
| ArrayRef<Value *>{HandleOp, IndexOp}); | ||||||||
| } | ||||||||
| case Builtin::BI__builtin_hlsl_resource_load_with_status: { | ||||||||
| Value *HandleOp = EmitScalarExpr(E->getArg(0)); | ||||||||
| Value *IndexOp = EmitScalarExpr(E->getArg(1)); | ||||||||
|
|
||||||||
| // Get the *address* of the status argument (since it's a reference) | ||||||||
| LValue StatusLVal = EmitLValue(E->getArg(2)); | ||||||||
| Address StatusAddr = StatusLVal.getAddress(); | ||||||||
|
|
||||||||
| QualType HandleTy = E->getArg(0)->getType(); | ||||||||
| const HLSLAttributedResourceType *RT = | ||||||||
| HandleTy->getAs<HLSLAttributedResourceType>(); | ||||||||
| assert(RT && "Expected a resource type as first parameter"); | ||||||||
|
|
||||||||
| Intrinsic::ID IntrID = RT->getAttrs().RawBuffer | ||||||||
| ? llvm::Intrinsic::dx_resource_load_rawbuffer | ||||||||
| : llvm::Intrinsic::dx_resource_load_typedbuffer; | ||||||||
bogner marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| QualType BuiltinRetTy = E->getType(); | ||||||||
| llvm::Type *DataTy = ConvertType(BuiltinRetTy->getPointeeType()); | ||||||||
|
|
||||||||
| llvm::Type *IntrinsicRetTy = llvm::StructType::get( | ||||||||
| Builder.getContext(), {DataTy, Builder.getInt1Ty()}); | ||||||||
|
|
||||||||
| SmallVector<Value *, 3> Args; | ||||||||
| Args.push_back(HandleOp); | ||||||||
| Args.push_back(IndexOp); | ||||||||
|
|
||||||||
| if (RT->getAttrs().RawBuffer) { | ||||||||
| Args.push_back(Builder.getInt32(0)); // dummy offset | ||||||||
|
||||||||
| Args.push_back(Builder.getInt32(0)); // dummy offset | |
| Value *Offset = Builder.getInt32(0); | |
| Args.push_back(Offset); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,10 @@ def int_dx_resource_getpointer | |
| : DefaultAttrsIntrinsic<[llvm_anyptr_ty], [llvm_any_ty, llvm_i32_ty], | ||
| [IntrNoMem]>; | ||
|
|
||
| def int_dx_resource_load_with_status | ||
| : DefaultAttrsIntrinsic<[llvm_anyptr_ty], [llvm_any_ty, llvm_i32_ty, llvm_i32_ty], | ||
| [IntrNoMem]>; | ||
|
||
|
|
||
| def int_dx_resource_nonuniformindex | ||
| : DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrNoMem]>; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,6 +175,9 @@ def int_spv_rsqrt : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty] | |
| def int_spv_resource_getpointer | ||
| : DefaultAttrsIntrinsic<[llvm_anyptr_ty], [llvm_any_ty, llvm_i32_ty], | ||
| [IntrNoMem]>; | ||
| def int_spv_resource_load_with_status | ||
| : DefaultAttrsIntrinsic<[llvm_anyptr_ty], [llvm_any_ty, llvm_i32_ty, llvm_i32_ty], | ||
| [IntrNoMem]>; | ||
|
||
|
|
||
| def int_spv_resource_nonuniformindex | ||
| : DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrNoMem]>; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.