Skip to content

Commit 619a257

Browse files
authored
HLSL: regression test for module-scope arrays in library mode (#2627)
This removes the need for a special case for default_entry_point and correctly handles exports that call other exports.
1 parent 252c44e commit 619a257

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
static const uint _15[4] = { 10u, 20u, 30u, 40u };
2+
3+
uint lookup(uint i)
4+
{
5+
return _15[i];
6+
}
7+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
; SPIR-V
2+
; Version: 1.5
3+
; Generator: Khronos SPIR-V Tools Assembler; 0
4+
; Bound: 30
5+
; Schema: 0
6+
OpCapability Linkage
7+
OpCapability Shader
8+
OpMemoryModel Logical GLSL450
9+
OpSource HLSL 630
10+
OpName %lookup "lookup"
11+
OpName %i "i"
12+
OpName %table "table"
13+
OpDecorate %lookup LinkageAttributes "lookup" Export
14+
%uint = OpTypeInt 32 0
15+
%uint_10 = OpConstant %uint 10
16+
%uint_20 = OpConstant %uint 20
17+
%uint_30 = OpConstant %uint 30
18+
%uint_40 = OpConstant %uint 40
19+
%uint_4 = OpConstant %uint 4
20+
%_arr_uint_uint_4 = OpTypeArray %uint %uint_4
21+
%_ptr_Private__arr_uint_uint_4 = OpTypePointer Private %_arr_uint_uint_4
22+
%_ptr_Private_uint = OpTypePointer Private %uint
23+
%_ptr_Function_uint = OpTypePointer Function %uint
24+
%fn1 = OpTypeFunction %uint %_ptr_Function_uint
25+
%table_init = OpConstantComposite %_arr_uint_uint_4 %uint_10 %uint_20 %uint_30 %uint_40
26+
%table = OpVariable %_ptr_Private__arr_uint_uint_4 Private %table_init
27+
28+
%lookup = OpFunction %uint None %fn1
29+
%i = OpFunctionParameter %_ptr_Function_uint
30+
%l_bb = OpLabel
31+
%l_iv = OpLoad %uint %i
32+
%l_ac = OpAccessChain %_ptr_Private_uint %table %l_iv
33+
%l_v = OpLoad %uint %l_ac
34+
OpReturnValue %l_v
35+
OpFunctionEnd

0 commit comments

Comments
 (0)