File: cbuffer_align.hlsl

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (119 lines) | stat: -rw-r--r-- 2,134 bytes parent folder | download | duplicates (3)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -fsyntax-only -verify -verify-ignore-unexpected=warning

struct S0 {
  half a;
  half b;
  half c;
  half d;
  half e;
  half f;
  half g;
  half h;
};

cbuffer CB0Pass {
  S0 s0p : packoffset(c0.x);
  float f0p : packoffset(c1.x);
}

cbuffer CB0Fail {
  S0 s0f : packoffset(c0.x);
  float f0f : packoffset(c0.w);
  // expected-error@-1 {{packoffset overlap between 'f0f', 's0f'}}
}

struct S1 {
  float a;
  double b;
  float c;
};

cbuffer CB1Pass {
  S1 s1p : packoffset(c0.x);
  float f1p : packoffset(c1.y);
}

cbuffer CB1Fail {
  S1 s1f : packoffset(c0.x);
  float f1f : packoffset(c1.x);
  // expected-error@-1 {{packoffset overlap between 'f1f', 's1f'}}
}

struct S2 {
  float3 a;
  float2 b;
};

cbuffer CB2Pass {
  S2 s2p : packoffset(c0.x);
  float f2p : packoffset(c1.z);
}

cbuffer CB2Fail {
  S2 s2f : packoffset(c0.x);
  float f2f : packoffset(c1.y);
  // expected-error@-1 {{packoffset overlap between 'f2f', 's2f'}}
}

struct S3 {
  float3 a;
  float b;
};

cbuffer CB3Pass {
  S3 s3p : packoffset(c0.x);
  float f3p : packoffset(c1.x);
}

cbuffer CB3Fail {
  S3 s3f : packoffset(c0.x);
  float f3f : packoffset(c0.w);
  // expected-error@-1 {{packoffset overlap between 'f3f', 's3f'}}
}

struct S4 {
  float2 a;
  float2 b;
};

cbuffer CB4Pass {
  S4 s4p : packoffset(c0.x);
  float f4p : packoffset(c1.x);
}

cbuffer CB4Fail {
  S4 s4f : packoffset(c0.x);
  float f4f : packoffset(c0.w);
  // expected-error@-1 {{packoffset overlap between 'f4f', 's4f'}}
}

struct S5 {
  float a[3];
};

cbuffer CB5Pass {
  S5 s5p : packoffset(c0.x);
  float f5p : packoffset(c2.y);
}

cbuffer CB5Fail {
  S5 s5f : packoffset(c0.x);
  float f5f : packoffset(c2.x);
  // expected-error@-1 {{packoffset overlap between 'f5f', 's5f'}}
}

struct S6 {
  float a;
  float2 b;
};

cbuffer CB6Pass {
  S6 s6p : packoffset(c0.x);
  float f6p : packoffset(c0.w);
}

cbuffer CB6Fail {
  S6 s6f : packoffset(c0.x);
  float f6f : packoffset(c0.y);
  // expected-error@-1 {{packoffset overlap between 'f6f', 's6f'}}
}