File tree 2 files changed +41
-0
lines changed 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -10932,6 +10932,12 @@ SpirvInstruction *SpirvEmitter::processIntrinsicGetBufferContents(
10932
10932
SpirvInstruction *bufferPointer = doExpr(obj);
10933
10933
if (!bufferPointer)
10934
10934
return nullptr;
10935
+ if (bufferPointer->isRValue()) {
10936
+ bufferPointer->setRValue(false);
10937
+ bufferPointer->setStorageClass(spv::StorageClass::PhysicalStorageBuffer);
10938
+ return bufferPointer;
10939
+ }
10940
+
10935
10941
unsigned align = hlsl::GetVKBufferPointerAlignment(obj->getType());
10936
10942
lowerTypeVisitor.visitInstruction(bufferPointer);
10937
10943
Original file line number Diff line number Diff line change
1
+ // RUN: %dxc -spirv -HV 202x -Od -T cs_6_9 %s | FileCheck %s
2
+
3
+ // Issue #7302: implicit object argument of Get() evaluates to rvalue
4
+
5
+ template<class T, class U>
6
+ [[vk::ext_instruction (/*spv::OpBitcast*/ 124 )]]
7
+ T bitcast (U);
8
+
9
+ struct Content
10
+ {
11
+ int a;
12
+ };
13
+
14
+ // CHECK: [[INT:%[_0-9A-Za-z]*]] = OpTypeInt 32 1
15
+ // CHECK-DAG: [[I1:%[_0-9A-Za-z]*]] = OpConstant [[INT]] 1
16
+ // CHECK-DAG: [[IO:%[_0-9A-Za-z]*]] = OpConstant [[INT]] 0
17
+ // CHECK: [[UINT:%[_0-9A-Za-z]*]] = OpTypeInt 32 0
18
+ // CHECK-DAG: [[UDEADBEEF:%[_0-9A-Za-z]*]] = OpConstant [[UINT]] 3735928559
19
+ // CHECK-DAG: [[U0:%[_0-9A-Za-z]*]] = OpConstant [[UINT]] 0
20
+ // CHECK: [[V2UINT:%[_0-9A-Za-z]*]] = OpTypeVector [[UINT]] 2
21
+ // CHECK: [[VECTOR:%[_0-9A-Za-z]*]] = OpConstantComposite [[V2UINT]] [[UDEADBEEF]] [[U0]]
22
+ // CHECK: [[CONTENT:%[_0-9A-Za-z]*]] = OpTypeStruct [[INT]]
23
+ // CHECK: [[PPCONTENT:%[_0-9A-Za-z]*]] = OpTypePointer PhysicalStorageBuffer [[CONTENT]]
24
+ // CHECK: [[PPINT:%[_0-9A-Za-z]*]] = OpTypePointer PhysicalStorageBuffer [[INT]]
25
+
26
+ [numthreads (1 , 1 , 1 )]
27
+ void main ()
28
+ {
29
+ bitcast<vk::BufferPointer<Content> >(uint32_t2 (0xdeadbeefu,0x0u)).Get ().a = 1 ;
30
+ }
31
+
32
+ // CHECK: [[BITCAST:%[0-9]*]] = OpBitcast [[PPCONTENT]] [[VECTOR]]
33
+ // CHECK: [[PTR:%[0-9]*]] = OpAccessChain [[PPINT]] [[BITCAST]] [[IO]]
34
+ // CHECK: OpStore [[PTR]] [[I1]] Aligned 4
35
+
You can’t perform that action at this time.
0 commit comments