[dxso] Fix for illegal OpCompositeConstruct while translating Crs opcode

During the translation of the Crs opcode to SPIR-V there is an assumption that the result type is a composite type. This is not always true. If the result is a scalar type the translation adds an OpCompositeConstruct with a scalar result type. This is a spec violation.

This change checks if the result type is a composite type and does not add the OpCompositeConstruct in case of scalar types.
This commit is contained in:
Michał Pyrzowski 2022-09-21 12:47:16 +02:00 committed by GitHub
parent 5c22e2fbda
commit 82ebc29e18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -2024,7 +2024,10 @@ namespace dxvk {
indices[index++] = m_module.opCompositeExtract(m_module.defFloatType(32), crossValue.id, 1, &i);
}
result.id = m_module.opCompositeConstruct(getVectorTypeId(result.type), result.type.ccount, indices.data());
if (result.type.ccount == 1)
result.id = indices[0];
else
result.id = m_module.opCompositeConstruct(typeId, result.type.ccount, indices.data());
break;
}