@@ -16,6 +16,10 @@ struct VsAttribSpecialization {
16
16
AmdGpu::NumberClass num_class{};
17
17
18
18
auto operator <=>(const VsAttribSpecialization&) const = default ;
19
+
20
+ [[nodiscard]] bool IsCompatible (const VsAttribSpecialization& other) const {
21
+ return *this == other;
22
+ }
19
23
};
20
24
21
25
struct BufferSpecialization {
@@ -26,7 +30,7 @@ struct BufferSpecialization {
26
30
u8 element_size : 2 = 0 ;
27
31
u32 size = 0 ;
28
32
29
- bool operator == (const BufferSpecialization& other) const {
33
+ [[nodiscard]] bool IsCompatible (const BufferSpecialization& other) const {
30
34
return stride == other.stride && is_storage == other.is_storage &&
31
35
swizzle_enable == other.swizzle_enable &&
32
36
(!swizzle_enable ||
@@ -41,6 +45,10 @@ struct TextureBufferSpecialization {
41
45
AmdGpu::NumberConversion num_conversion{};
42
46
43
47
auto operator <=>(const TextureBufferSpecialization&) const = default ;
48
+
49
+ [[nodiscard]] bool IsCompatible (const TextureBufferSpecialization& other) const {
50
+ return *this == other;
51
+ }
44
52
};
45
53
46
54
struct ImageSpecialization {
@@ -51,19 +59,31 @@ struct ImageSpecialization {
51
59
AmdGpu::NumberConversion num_conversion{};
52
60
53
61
auto operator <=>(const ImageSpecialization&) const = default ;
62
+
63
+ [[nodiscard]] bool IsCompatible (const ImageSpecialization& other) const {
64
+ return *this == other;
65
+ }
54
66
};
55
67
56
68
struct FMaskSpecialization {
57
69
u32 width;
58
70
u32 height;
59
71
60
72
auto operator <=>(const FMaskSpecialization&) const = default ;
73
+
74
+ [[nodiscard]] bool IsCompatible (const FMaskSpecialization& other) const {
75
+ return *this == other;
76
+ }
61
77
};
62
78
63
79
struct SamplerSpecialization {
64
80
bool force_unnormalized = false ;
65
81
66
82
auto operator <=>(const SamplerSpecialization&) const = default ;
83
+
84
+ [[nodiscard]] bool IsCompatible (const SamplerSpecialization& other) const {
85
+ return *this == other;
86
+ }
67
87
};
68
88
69
89
/* *
@@ -179,7 +199,9 @@ struct StageSpecialization {
179
199
}
180
200
}
181
201
182
- bool operator ==(const StageSpecialization& other) const {
202
+ // / Checks if the permutation this specialization is for can be used in place of 'other'.
203
+ // / Note that this operation is not bidirectional.
204
+ [[nodiscard]] bool IsCompatible (const StageSpecialization& other) const {
183
205
if (start != other.start ) {
184
206
return false ;
185
207
}
@@ -190,7 +212,7 @@ struct StageSpecialization {
190
212
return false ;
191
213
}
192
214
for (u32 i = 0 ; i < vs_attribs.size (); i++) {
193
- if (vs_attribs[i] != other.vs_attribs [i]) {
215
+ if (! vs_attribs[i]. IsCompatible ( other.vs_attribs [i]) ) {
194
216
return false ;
195
217
}
196
218
}
@@ -202,27 +224,27 @@ struct StageSpecialization {
202
224
binding++;
203
225
}
204
226
for (u32 i = 0 ; i < buffers.size (); i++) {
205
- if (other.bitset [binding++] && buffers[i] != other.buffers [i]) {
227
+ if (other.bitset [binding++] && ! buffers[i]. IsCompatible ( other.buffers [i]) ) {
206
228
return false ;
207
229
}
208
230
}
209
231
for (u32 i = 0 ; i < tex_buffers.size (); i++) {
210
- if (other.bitset [binding++] && tex_buffers[i] != other.tex_buffers [i]) {
232
+ if (other.bitset [binding++] && ! tex_buffers[i]. IsCompatible ( other.tex_buffers [i]) ) {
211
233
return false ;
212
234
}
213
235
}
214
236
for (u32 i = 0 ; i < images.size (); i++) {
215
- if (other.bitset [binding++] && images[i] != other.images [i]) {
237
+ if (other.bitset [binding++] && ! images[i]. IsCompatible ( other.images [i]) ) {
216
238
return false ;
217
239
}
218
240
}
219
241
for (u32 i = 0 ; i < fmasks.size (); i++) {
220
- if (other.bitset [binding++] && fmasks[i] != other.fmasks [i]) {
242
+ if (other.bitset [binding++] && ! fmasks[i]. IsCompatible ( other.fmasks [i]) ) {
221
243
return false ;
222
244
}
223
245
}
224
246
for (u32 i = 0 ; i < samplers.size (); i++) {
225
- if (samplers[i] != other.samplers [i]) {
247
+ if (! samplers[i]. IsCompatible ( other.samplers [i]) ) {
226
248
return false ;
227
249
}
228
250
}
0 commit comments