@@ -819,22 +819,25 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
819
819
node->getBasicType () == EbtFloat ||
820
820
node->getBasicType () == EbtDouble);
821
821
822
- if (! getArithemeticInt8Enabled ()) {
823
- if (((convertTo == EbtInt8 || convertTo == EbtUint8) && ! convertFromIntTypes) ||
824
- ((node-> getBasicType () == EbtInt8 || node-> getBasicType () == EbtUint8) && ! convertToIntTypes))
822
+ if (((convertTo == EbtInt8 || convertTo == EbtUint8) && ! convertFromIntTypes) ||
823
+ ((node-> getBasicType () == EbtInt8 || node-> getBasicType () == EbtUint8) && ! convertToIntTypes)) {
824
+ if (! getArithemeticInt8Enabled ()) {
825
825
return nullptr ;
826
+ }
826
827
}
827
828
828
- if (! getArithemeticInt16Enabled ()) {
829
- if (((convertTo == EbtInt16 || convertTo == EbtUint16) && ! convertFromIntTypes) ||
830
- ((node-> getBasicType () == EbtInt16 || node-> getBasicType () == EbtUint16) && ! convertToIntTypes))
829
+ if (((convertTo == EbtInt16 || convertTo == EbtUint16) && ! convertFromIntTypes) ||
830
+ ((node-> getBasicType () == EbtInt16 || node-> getBasicType () == EbtUint16) && ! convertToIntTypes)) {
831
+ if (! getArithemeticInt16Enabled ()) {
831
832
return nullptr ;
833
+ }
832
834
}
833
835
834
- if (! getArithemeticFloat16Enabled ()) {
835
- if ((convertTo == EbtFloat16 && ! convertFromFloatTypes) ||
836
- (node-> getBasicType () == EbtFloat16 && ! convertToFloatTypes))
836
+ if ((convertTo == EbtFloat16 && ! convertFromFloatTypes) ||
837
+ (node-> getBasicType () == EbtFloat16 && ! convertToFloatTypes)) {
838
+ if (! getArithemeticFloat16Enabled ()) {
837
839
return nullptr ;
840
+ }
838
841
}
839
842
#endif
840
843
@@ -1650,64 +1653,45 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
1650
1653
}
1651
1654
}
1652
1655
1653
- bool explicitTypesEnabled = extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types) ||
1654
- extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_int8) ||
1655
- extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_int16) ||
1656
- extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_int32) ||
1657
- extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_int64) ||
1658
- extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_float16) ||
1659
- extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_float32) ||
1660
- extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_float64);
1661
-
1662
- if (explicitTypesEnabled) {
1663
- // integral promotions
1664
- if (isIntegralPromotion (from, to)) {
1665
- return true ;
1666
- }
1667
-
1668
- // floating-point promotions
1669
- if (isFPPromotion (from, to)) {
1670
- return true ;
1671
- }
1672
-
1673
- // integral conversions
1674
- if (isIntegralConversion (from, to)) {
1656
+ if (getSource () == EShSourceHlsl) {
1657
+ // HLSL
1658
+ if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat))
1675
1659
return true ;
1676
- }
1677
-
1678
- // floating-point conversions
1679
- if (isFPConversion (from, to)) {
1680
- return true ;
1681
- }
1682
-
1683
- // floating-integral conversions
1684
- if (isFPIntegralConversion (from, to)) {
1685
- return true ;
1686
- }
1687
-
1688
- // hlsl supported conversions
1689
- if (getSource () == EShSourceHlsl) {
1690
- if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat))
1660
+ } else {
1661
+ // GLSL
1662
+ if (isIntegralPromotion (from, to) ||
1663
+ isFPPromotion (from, to) ||
1664
+ isIntegralConversion (from, to) ||
1665
+ isFPConversion (from, to) ||
1666
+ isFPIntegralConversion (from, to)) {
1667
+
1668
+ if (extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types) ||
1669
+ extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_int8) ||
1670
+ extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_int16) ||
1671
+ extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_int32) ||
1672
+ extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_int64) ||
1673
+ extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_float16) ||
1674
+ extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_float32) ||
1675
+ extensionRequested (E_GL_EXT_shader_explicit_arithmetic_types_float64)) {
1691
1676
return true ;
1677
+ }
1692
1678
}
1693
- } else if (isEsProfile ()) {
1679
+ }
1680
+
1681
+ if (isEsProfile ()) {
1694
1682
switch (to) {
1695
1683
case EbtFloat:
1696
1684
switch (from) {
1697
1685
case EbtInt:
1698
1686
case EbtUint:
1699
1687
return extensionRequested (E_GL_EXT_shader_implicit_conversions);
1700
- case EbtFloat:
1701
- return true ;
1702
1688
default :
1703
1689
return false ;
1704
1690
}
1705
1691
case EbtUint:
1706
1692
switch (from) {
1707
1693
case EbtInt:
1708
1694
return extensionRequested (E_GL_EXT_shader_implicit_conversions);
1709
- case EbtUint:
1710
- return true ;
1711
1695
default :
1712
1696
return false ;
1713
1697
}
@@ -1723,7 +1707,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
1723
1707
case EbtInt64:
1724
1708
case EbtUint64:
1725
1709
case EbtFloat:
1726
- case EbtDouble:
1727
1710
return version >= 400 || extensionRequested (E_GL_ARB_gpu_shader_fp64);
1728
1711
case EbtInt16:
1729
1712
case EbtUint16:
@@ -1739,7 +1722,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
1739
1722
switch (from) {
1740
1723
case EbtInt:
1741
1724
case EbtUint:
1742
- case EbtFloat:
1743
1725
return true ;
1744
1726
case EbtBool:
1745
1727
return getSource () == EShSourceHlsl;
@@ -1756,8 +1738,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
1756
1738
switch (from) {
1757
1739
case EbtInt:
1758
1740
return version >= 400 || getSource () == EShSourceHlsl;
1759
- case EbtUint:
1760
- return true ;
1761
1741
case EbtBool:
1762
1742
return getSource () == EShSourceHlsl;
1763
1743
case EbtInt16:
@@ -1768,8 +1748,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
1768
1748
}
1769
1749
case EbtInt:
1770
1750
switch (from) {
1771
- case EbtInt:
1772
- return true ;
1773
1751
case EbtBool:
1774
1752
return getSource () == EShSourceHlsl;
1775
1753
case EbtInt16:
@@ -1782,7 +1760,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
1782
1760
case EbtInt:
1783
1761
case EbtUint:
1784
1762
case EbtInt64:
1785
- case EbtUint64:
1786
1763
return true ;
1787
1764
case EbtInt16:
1788
1765
case EbtUint16:
@@ -1793,7 +1770,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
1793
1770
case EbtInt64:
1794
1771
switch (from) {
1795
1772
case EbtInt:
1796
- case EbtInt64:
1797
1773
return true ;
1798
1774
case EbtInt16:
1799
1775
return extensionRequested (E_GL_AMD_gpu_shader_int16);
@@ -1805,16 +1781,13 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
1805
1781
case EbtInt16:
1806
1782
case EbtUint16:
1807
1783
return extensionRequested (E_GL_AMD_gpu_shader_int16);
1808
- case EbtFloat16:
1809
- return extensionRequested (E_GL_AMD_gpu_shader_half_float);
1810
1784
default :
1811
1785
break ;
1812
1786
}
1813
1787
return false ;
1814
1788
case EbtUint16:
1815
1789
switch (from) {
1816
1790
case EbtInt16:
1817
- case EbtUint16:
1818
1791
return extensionRequested (E_GL_AMD_gpu_shader_int16);
1819
1792
default :
1820
1793
break ;
0 commit comments