forked from microsoft/DirectXShaderCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspv.inline.decorate.member.hlsl
More file actions
48 lines (38 loc) · 1.45 KB
/
spv.inline.decorate.member.hlsl
File metadata and controls
48 lines (38 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// RUN: %dxc -T ps_6_0 -E main -Vd -spirv %s -spirv | FileCheck %s
template<class T, class U>
[[vk::ext_instruction(/*spv::OpBitcast*/124)]]
T Bitcast(U);
// CHECK-DAG: OpMemberDecorate %S 0 Offset 0
// CHECK-DAG: OpMemberDecorate %S 1 Offset 16
// CHECK-DAG: %S = OpTypeStruct %v4float %v4float
struct S
{
[[vk::ext_decorate(/*offset*/ 35, 0)]] float4 f1;
[[vk::ext_decorate(/*offset*/ 35, 16)]] float4 f2;
};
// CHECK-DAG: OpDecorateString %out_var_SV_TARGET UserSemantic "raster_order_group_0"
struct PixelOutput
{
[[vk::location(0), vk::ext_decorate_string(5635, "raster_order_group_0")]] float4 rt0 : SV_TARGET;
};
using PointerType = vk::SpirvOpaqueType<
/* OpTypePointer */ 32,
/* PhysicalStorageBuffer */ vk::Literal<vk::integral_constant<uint,5349> >,
S>;
[[vk::ext_capability(/*PhysicalStorageBufferAddresses */ 5347 )]]
[[vk::ext_instruction( /*OpLoad*/ 61 )]]
S Load(PointerType pointer,
[[vk::ext_literal]] uint32_t __aligned=/*Aligned*/0x00000002,
[[vk::ext_literal]] uint32_t __alignment=32);
uint64_t address;
PixelOutput main()
{
// CHECK: [[BC:%[0-9]+]] = OpBitcast %_ptr_PhysicalStorageBuffer_S {{%[0-9]+}}
PointerType ptr = Bitcast<PointerType>(address);
PixelOutput output;
// CHECK: [[AC:%[0-9]+]] = OpAccessChain %_ptr_PhysicalStorageBuffer_v4float [[BC]] %uint_0
// CHECK: [[LD:%[0-9]+]] = OpLoad %v4float [[AC]] Aligned 32
// CHECK: OpStore %out_var_SV_TARGET [[LD]]
output.rt0 = Load(ptr).f1;
return output;
}