[spirv] Ignore const-ness when comparing types. (#985)

This commit is contained in:
Ehsan 2018-01-10 10:15:45 -05:00 коммит произвёл GitHub
Родитель e1dea871c5
Коммит 231619361a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -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);
}