Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Skip identity conversions for 8-bit and 16-bit types #3622

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions glslang/MachineIndependent/ParseHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8540,7 +8540,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
basicOp = EOpConstructFloat16;
// 8/16-bit storage extensions don't support constructing composites of 8/16-bit types,
// so construct a 32-bit type and convert
if (!intermediate.getArithemeticFloat16Enabled()) {
// and do not generate any conversion if it is an identity conversion, i.e. float16_t(<float16_t> var)
if (!intermediate.getArithemeticFloat16Enabled() && (node->getBasicType() != EbtFloat16)) {
TType tempType(EbtFloat, EvqTemporary, type.getVectorSize());
newNode = node;
if (tempType != newNode->getType()) {
Expand All @@ -8563,7 +8564,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
basicOp = EOpConstructInt8;
// 8/16-bit storage extensions don't support constructing composites of 8/16-bit types,
// so construct a 32-bit type and convert
if (!intermediate.getArithemeticInt8Enabled()) {
// and do not generate any conversion if it is an identity conversion, i.e. int8_t(<int8_t> var)
if (!intermediate.getArithemeticInt8Enabled() && (node->getBasicType() != EbtInt8)) {
TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
newNode = node;
if (tempType != newNode->getType()) {
Expand All @@ -8586,7 +8588,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
basicOp = EOpConstructUint8;
// 8/16-bit storage extensions don't support constructing composites of 8/16-bit types,
// so construct a 32-bit type and convert
if (!intermediate.getArithemeticInt8Enabled()) {
// and do not generate any conversion if it is an identity conversion, i.e. uint8_t(<uint8_t> var)
if (!intermediate.getArithemeticInt8Enabled() && (node->getBasicType() != EbtUint8)) {
TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
newNode = node;
if (tempType != newNode->getType()) {
Expand All @@ -8609,7 +8612,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
basicOp = EOpConstructInt16;
// 8/16-bit storage extensions don't support constructing composites of 8/16-bit types,
// so construct a 32-bit type and convert
if (!intermediate.getArithemeticInt16Enabled()) {
// and do not generate any conversion if it is an identity conversion, i.e. int16_t(<int16_t> var)
if (!intermediate.getArithemeticInt16Enabled() && (node->getBasicType() != EbtInt16)) {
TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
newNode = node;
if (tempType != newNode->getType()) {
Expand All @@ -8632,7 +8636,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
basicOp = EOpConstructUint16;
// 8/16-bit storage extensions don't support constructing composites of 8/16-bit types,
// so construct a 32-bit type and convert
if (!intermediate.getArithemeticInt16Enabled()) {
// and do not generate any conversion if it is an identity conversion, i.e. uint16_t(<uint16_t> var)
if (!intermediate.getArithemeticInt16Enabled() && (node->getBasicType() != EbtUint16)) {
TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
newNode = node;
if (tempType != newNode->getType()) {
Expand Down