Implement extension GL_AMD_gpu_shader_int16
- Add int16 types (int16_t, uint16_t, i16vec, u16vec). - Add int16 support to GLSL operators. - Add int16 type conversions (to int16, from int16). - Add int16 built-in functions.
This commit is contained in:
parent
4d5bcd3162
commit
cabbb788b4
28 changed files with 8560 additions and 5521 deletions
|
|
@ -193,7 +193,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
|||
|
||||
case EbtUint:
|
||||
if (rightUnionArray[i] == 0) {
|
||||
newConstArray[i].setUConst(0xFFFFFFFF);
|
||||
newConstArray[i].setUConst(0xFFFFFFFFu);
|
||||
} else
|
||||
newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst());
|
||||
break;
|
||||
|
|
@ -213,6 +213,23 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
|||
} else
|
||||
newConstArray[i].setU64Const(leftUnionArray[i].getU64Const() / rightUnionArray[i].getU64Const());
|
||||
break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
if (rightUnionArray[i] == 0)
|
||||
newConstArray[i].setIConst(0x7FFF);
|
||||
else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)0x8000)
|
||||
newConstArray[i].setIConst(0x8000);
|
||||
else
|
||||
newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst());
|
||||
break;
|
||||
|
||||
case EbtUint16:
|
||||
if (rightUnionArray[i] == 0) {
|
||||
newConstArray[i].setUConst(0xFFFFu);
|
||||
} else
|
||||
newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst());
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -457,10 +474,16 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
case EbtFloat16:
|
||||
#endif
|
||||
case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
#endif
|
||||
case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtUint16:
|
||||
#endif
|
||||
case EbtUint: newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
|
||||
case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break;
|
||||
case EbtUint64: newConstArray[i].setU64Const(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getU64Const()))); break;
|
||||
case EbtUint64: newConstArray[i].setU64Const(static_cast<unsigned long long>(-static_cast<long long>(unionArray[i].getU64Const()))); break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -610,6 +633,14 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
case EOpUintBitsToFloat:
|
||||
case EOpDoubleBitsToInt64:
|
||||
case EOpDoubleBitsToUint64:
|
||||
case EOpInt64BitsToDouble:
|
||||
case EOpUint64BitsToDouble:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpFloat16BitsToInt16:
|
||||
case EOpFloat16BitsToUint16:
|
||||
case EOpInt16BitsToFloat16:
|
||||
case EOpUint16BitsToFloat16:
|
||||
#endif
|
||||
|
||||
default:
|
||||
return 0;
|
||||
|
|
@ -702,6 +733,9 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
#endif
|
||||
children[0]->getAsTyped()->getBasicType() == EbtDouble;
|
||||
bool isSigned = children[0]->getAsTyped()->getBasicType() == EbtInt ||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
children[0]->getAsTyped()->getBasicType() == EbtInt16 ||
|
||||
#endif
|
||||
children[0]->getAsTyped()->getBasicType() == EbtInt64;
|
||||
bool isInt64 = children[0]->getAsTyped()->getBasicType() == EbtInt64 ||
|
||||
children[0]->getAsTyped()->getBasicType() == EbtUint64;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue