[spirv] Ignore const-ness when comparing types. (#985)
This commit is contained in:
Родитель
e1dea871c5
Коммит
231619361a
|
@ -62,6 +62,10 @@ bool patchConstFuncTakesHullOutputPatch(FunctionDecl *pcf) {
|
|||
|
||||
/// Returns true if the two types are the same scalar or vector type.
|
||||
bool isSameScalarOrVecType(QualType type1, QualType type2) {
|
||||
// Consider cases such as 'const bool' and 'bool' to be the same type.
|
||||
type1.removeLocalConst();
|
||||
type2.removeLocalConst();
|
||||
|
||||
{
|
||||
QualType scalarType1 = {}, scalarType2 = {};
|
||||
if (TypeTranslator::isScalarType(type1, &scalarType1) &&
|
||||
|
|
|
@ -24,4 +24,12 @@ void main() {
|
|||
// CHECK-NEXT: OpStore %q [[and2]]
|
||||
k = i && j;
|
||||
q = o && p;
|
||||
|
||||
// The result of '&&' could be 'const bool'. In such cases, make sure
|
||||
// the result type is correct.
|
||||
// CHECK: [[a1:%\d+]] = OpLoad %bool %a
|
||||
// CHECK-NEXT: [[b1:%\d+]] = OpLoad %bool %b
|
||||
// CHECK-NEXT: [[and3:%\d+]] = OpLogicalAnd %bool [[a1]] [[b1]]
|
||||
// CHECK-NEXT: {{%\d+}} = OpCompositeConstruct %v2bool [[and3]] %true
|
||||
bool2 t = bool2(a&&b, true);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче