Skip to content

Commit ac82f19

Browse files
author
devsh
committed
1 parent a297411 commit ac82f19

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

include/nbl/builtin/hlsl/bda/__ref.hlsl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,12 @@ struct __base_ref
3535
{
3636
ptr.value = _ptr;
3737
}
38-
38+
3939
spirv::bda_pointer_t<T> __get_spv_ptr()
4040
{
41-
// BUG: if I don't launder the pointer through this I get "IsNonPtrAccessChain(ptrInst->opcode())"
42-
//return ptr.value;
43-
// What to do!? OpCopyObject? trick the compiler into giving me an immediate value some other way!?
44-
// If I add `[[vk::ext_reference]]` to my OpLoad and OpStore, then compiler doesn't emit anything!?
45-
return spirv::bitcast<spirv::bda_pointer_t<T> >(spirv::bitcast<uint32_t2>(ptr.value));
41+
// BUG: https://github.com/microsoft/DirectXShaderCompiler/issues/7184
42+
// if I don't launder the pointer through this I get "IsNonPtrAccessChain(ptrInst->opcode())"
43+
return spirv::copyObject<spirv::bda_pointer_t<T> >(ptr.value);
4644
}
4745

4846
T load()

include/nbl/builtin/hlsl/spirv_intrinsics/core.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ template<typename M, uint32_t StorageClass, typename T>
106106
pointer_t<StorageClass,M> accessChain(pointer_t<StorageClass,T> v, int32_t index);
107107

108108
// The holy operation that makes addrof possible
109-
template<uint32_t StorageClass, typename T>
109+
template<typename T, typename U>
110110
[[vk::ext_instruction(spv::OpCopyObject)]]
111-
pointer_t<StorageClass,T> copyObject([[vk::ext_reference]] T v);
111+
T copyObject(U v);
112112

113113
// unfortunately without reflection we can't validate that objects "logically match" in a concept
114114
template<typename T, typename U>

0 commit comments

Comments
 (0)