Skip to content

Commit bc392f9

Browse files
author
Tim Foley
authored
Update signatures for Shader Model 6 functions (shader-slang#1029)
* Update signatures for Shader Model 6 functions We originally culled out list of Shader Model 6 function prototypes from some combination of MSDN and the dxc wiki, but this was when things were in a pre-release state and the names of many functions changed (as well as some functions being added/removed). For this change, I initially tried to look at MSDN, but the documentation there was internally inconsistent and included things like misspellings in function names (which I *hoped* weren't accurate to the real implementation). Instead, I looked at the meta-program input that dxc uses to generate its intrinsic definitions and used that to discover the updated function names along with what was added/removed, a few signature differences, and some extra functions that don't even seem to be documented at all on MSDN> These have *not* been tested in any meaningful way, so this is really a best-effort thing. Given that most of the old functions had the wrong names there was no way for them to be used in working code anyway, so this is unlikely to cause breakage. * fixup: quadLaneID is a uint
1 parent 7258ef4 commit bc392f9

File tree

2 files changed

+153
-93
lines changed

2 files changed

+153
-93
lines changed

source/slang/hlsl.meta.slang

+76-46
Original file line numberDiff line numberDiff line change
@@ -1307,61 +1307,67 @@ __generic<T : __BuiltinFloatingPointType, let N : int, let M : int> matrix<T,N,M
13071307

13081308
// Shader model 6.0 stuff
13091309

1310-
uint GlobalOrderedCountIncrement(uint countToAppendForThisLane);
1310+
__generic<T : __BuiltinType> T QuadReadLaneAt(T sourceValue, uint quadLaneID);
1311+
__generic<T : __BuiltinType, let N : int> vector<T,N> QuadReadLaneAt(vector<T,N> sourceValue, uint quadLaneID);
1312+
__generic<T : __BuiltinType, let N : int, let M : int> matrix<T,N,M> QuadReadLaneAt(matrix<T,N,M> sourceValue, uint quadLaneID);
13111313

1312-
__generic<T : __BuiltinType> T QuadReadLaneAt(T sourceValue, int quadLaneID);
1313-
__generic<T : __BuiltinType, let N : int> vector<T,N> QuadReadLaneAt(vector<T,N> sourceValue, int quadLaneID);
1314-
__generic<T : __BuiltinType, let N : int, let M : int> matrix<T,N,M> QuadReadLaneAt(matrix<T,N,M> sourceValue, int quadLaneID);
1314+
__generic<T : __BuiltinType> T QuadReadAcrossX(T localValue);
1315+
__generic<T : __BuiltinType, let N : int> vector<T,N> QuadReadAcrossX(vector<T,N> localValue);
1316+
__generic<T : __BuiltinType, let N : int, let M : int> matrix<T,N,M> QuadReadAcrossX(matrix<T,N,M> localValue);
13151317

1316-
__generic<T : __BuiltinType> T QuadSwapX(T localValue);
1317-
__generic<T : __BuiltinType, let N : int> vector<T,N> QuadSwapX(vector<T,N> localValue);
1318-
__generic<T : __BuiltinType, let N : int, let M : int> matrix<T,N,M> QuadSwapX(matrix<T,N,M> localValue);
1318+
__generic<T : __BuiltinType> T QuadReadAcrossY(T localValue);
1319+
__generic<T : __BuiltinType, let N : int> vector<T,N> QuadReadAcrossY(vector<T,N> localValue);
1320+
__generic<T : __BuiltinType, let N : int, let M : int> matrix<T,N,M> QuadReadAcrossY(matrix<T,N,M> localValue);
13191321

1320-
__generic<T : __BuiltinType> T QuadSwapY(T localValue);
1321-
__generic<T : __BuiltinType, let N : int> vector<T,N> QuadSwapY(vector<T,N> localValue);
1322-
__generic<T : __BuiltinType, let N : int, let M : int> matrix<T,N,M> QuadSwapY(matrix<T,N,M> localValue);
1322+
__generic<T : __BuiltinType> T QuadReadAcrossDiagonal(T localValue);
1323+
__generic<T : __BuiltinType, let N : int> vector<T,N> QuadReadAcrossDiagonal(vector<T,N> localValue);
1324+
__generic<T : __BuiltinType, let N : int, let M : int> matrix<T,N,M> QuadReadAcrossDiagonal(matrix<T,N,M> localValue);
13231325

1324-
__generic<T : __BuiltinIntegerType> T WaveAllBitAnd(T expr);
1325-
__generic<T : __BuiltinIntegerType, let N : int> vector<T,N> WaveAllBitAnd(vector<T,N> expr);
1326-
__generic<T : __BuiltinIntegerType, let N : int, let M : int> matrix<T,N,M> WaveAllBitAnd(matrix<T,N,M> expr);
1326+
__generic<T : __BuiltinIntegerType> T WaveActiveBitAnd(T expr);
1327+
__generic<T : __BuiltinIntegerType, let N : int> vector<T,N> WaveActiveBitAnd(vector<T,N> expr);
1328+
__generic<T : __BuiltinIntegerType, let N : int, let M : int> matrix<T,N,M> WaveActiveBitAnd(matrix<T,N,M> expr);
13271329

1328-
__generic<T : __BuiltinIntegerType> T WaveAllBitOr(T expr);
1329-
__generic<T : __BuiltinIntegerType, let N : int> vector<T,N> WaveAllBitOr(vector<T,N> expr);
1330-
__generic<T : __BuiltinIntegerType, let N : int, let M : int> matrix<T,N,M> WaveAllBitOr(matrix<T,N,M> expr);
1330+
__generic<T : __BuiltinIntegerType> T WaveActiveBitOr(T expr);
1331+
__generic<T : __BuiltinIntegerType, let N : int> vector<T,N> WaveActiveBitOr(vector<T,N> expr);
1332+
__generic<T : __BuiltinIntegerType, let N : int, let M : int> matrix<T,N,M> WaveActiveBitOr(matrix<T,N,M> expr);
13311333

1332-
__generic<T : __BuiltinIntegerType> T WaveAllBitXor(T expr);
1333-
__generic<T : __BuiltinIntegerType, let N : int> vector<T,N> WaveAllBitXor(vector<T,N> expr);
1334-
__generic<T : __BuiltinIntegerType, let N : int, let M : int> matrix<T,N,M> WaveAllBitXor(matrix<T,N,M> expr);
1334+
__generic<T : __BuiltinIntegerType> T WaveActiveBitXor(T expr);
1335+
__generic<T : __BuiltinIntegerType, let N : int> vector<T,N> WaveActiveBitXor(vector<T,N> expr);
1336+
__generic<T : __BuiltinIntegerType, let N : int, let M : int> matrix<T,N,M> WaveActiveBitXor(matrix<T,N,M> expr);
13351337

1336-
__generic<T : __BuiltinArithmeticType> T WaveAllMax(T expr);
1337-
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveAllMax(vector<T,N> expr);
1338-
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveAllMax(matrix<T,N,M> expr);
1338+
__generic<T : __BuiltinArithmeticType> T WaveActiveMax(T expr);
1339+
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveActiveMax(vector<T,N> expr);
1340+
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveActiveMax(matrix<T,N,M> expr);
13391341

1340-
__generic<T : __BuiltinArithmeticType> T WaveAllMin(T expr);
1341-
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveAllMin(vector<T,N> expr);
1342-
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveAllMin(matrix<T,N,M> expr);
1342+
__generic<T : __BuiltinArithmeticType> T WaveActiveMin(T expr);
1343+
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveActiveMin(vector<T,N> expr);
1344+
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveActiveMin(matrix<T,N,M> expr);
13431345

1344-
__generic<T : __BuiltinArithmeticType> T WaveAllProduct(T expr);
1345-
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveAllProduct(vector<T,N> expr);
1346-
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveAllProduct(matrix<T,N,M> expr);
1346+
__generic<T : __BuiltinArithmeticType> T WaveActiveProduct(T expr);
1347+
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveActiveProduct(vector<T,N> expr);
1348+
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveActiveProduct(matrix<T,N,M> expr);
13471349

1348-
__generic<T : __BuiltinArithmeticType> T WaveAllSum(T expr);
1349-
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveAllSum(vector<T,N> expr);
1350-
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveAllSum(matrix<T,N,M> expr);
1350+
__generic<T : __BuiltinArithmeticType> T WaveActiveSum(T expr);
1351+
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveActiveSum(vector<T,N> expr);
1352+
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveActiveSum(matrix<T,N,M> expr);
13511353

1352-
bool WaveAllEqual(bool expr);
1353-
bool WaveAllTrue(bool expr);
1354-
bool WaveAnyTrue(bool expr);
1354+
__generic<T : __BuiltinType> bool WaveActiveAllEqual(T value);
1355+
__generic<T : __BuiltinType, let N : int> vector<bool,N> WaveActiveAllEqual(vector<T,N> value);
1356+
__generic<T : __BuiltinType, let N : int, let M : int> matrix<bool,N,M> WaveActiveAllEqual(matrix<T,N,M> value);
13551357

1356-
uint64_t WaveBallot(bool expr);
1358+
__generic<T : __BuiltinType> uint4 WaveMatch(T value);
1359+
__generic<T : __BuiltinType, let N : int> uint4 WaveMatch(vector<T,N> value);
1360+
__generic<T : __BuiltinType, let N : int, let M : int> uint4 WaveMatch(matrix<T,N,M> value);
13571361

1358-
uint WaveGetLaneCount();
1359-
uint WaveGetLaneIndex();
1360-
uint WaveGetOrderedIndex();
1362+
bool WaveActiveAllTrue(bool condition);
1363+
bool WaveActiveAnyTrue(bool condition);
13611364

1362-
bool WaveIsHelperLane();
1365+
uint4 WaveActiveBallot(bool condition);
1366+
uint WaveActiveCountBits(bool value);
13631367

1364-
bool WaveOnce();
1368+
uint WaveGetLaneCount();
1369+
uint WaveGetLaneIndex();
1370+
bool WaveIsFirstLane();
13651371

13661372
__generic<T : __BuiltinArithmeticType> T WavePrefixProduct(T expr);
13671373
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WavePrefixProduct(vector<T,N> expr);
@@ -1371,13 +1377,37 @@ __generic<T : __BuiltinArithmeticType> T WavePrefixSum(T expr);
13711377
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WavePrefixSum(vector<T,N> expr);
13721378
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WavePrefixSum(matrix<T,N,M> expr);
13731379

1374-
__generic<T : __BuiltinType> T WaveReadFirstLane(T expr);
1375-
__generic<T : __BuiltinType, let N : int> vector<T,N> WaveReadFirstLane(vector<T,N> expr);
1376-
__generic<T : __BuiltinType, let N : int, let M : int> matrix<T,N,M> WaveReadFirstLane(matrix<T,N,M> expr);
1380+
__generic<T : __BuiltinArithmeticType> T WaveMultiPrefixBitAnd(T expr);
1381+
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveMultiPrefixBitAnd(vector<T,N> expr);
1382+
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveMultiPrefixBitAnd(matrix<T,N,M> expr);
1383+
1384+
__generic<T : __BuiltinArithmeticType> T WaveMultiPrefixBitOr(T expr);
1385+
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveMultiPrefixBitOr(vector<T,N> expr);
1386+
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveMultiPrefixBitOr(matrix<T,N,M> expr);
1387+
1388+
__generic<T : __BuiltinArithmeticType> T WaveMultiPrefixBitXor(T expr);
1389+
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveMultiPrefixBitXor(vector<T,N> expr);
1390+
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveMultiPrefixBitXor(matrix<T,N,M> expr);
1391+
1392+
uint WavePrefixCountBits(bool value);
1393+
uint WaveMultiPrefixCountBits(bool value, uint4 mask);
1394+
1395+
__generic<T : __BuiltinArithmeticType> T WaveMultiPrefixProduct(T value, uint4 mask);
1396+
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveMultiPrefixProduct(vector<T,N> value, uint4 mask);
1397+
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveMultiPrefixProduct(matrix<T,N,M> value, uint4 mask);
1398+
1399+
__generic<T : __BuiltinArithmeticType> T WaveMultiPrefixSum(T value, uint4 mask);
1400+
__generic<T : __BuiltinArithmeticType, let N : int> vector<T,N> WaveMultiPrefixSum(vector<T,N> value, uint4 mask);
1401+
__generic<T : __BuiltinArithmeticType, let N : int, let M : int> matrix<T,N,M> WaveMultiPrefixSum(matrix<T,N,M> value, uint4 mask);
1402+
1403+
__generic<T : __BuiltinType> T WaveReadLaneFirst(T expr);
1404+
__generic<T : __BuiltinType, let N : int> vector<T,N> WaveReadLaneFirst(vector<T,N> expr);
1405+
__generic<T : __BuiltinType, let N : int, let M : int> matrix<T,N,M> WaveReadLaneFirst(matrix<T,N,M> expr);
1406+
1407+
__generic<T : __BuiltinType> T WaveReadLaneAt(T value, int lane);
1408+
__generic<T : __BuiltinType, let N : int> vector<T,N> WaveReadLaneAt(vector<T,N> value, int lane);
1409+
__generic<T : __BuiltinType, let N : int, let M : int> matrix<T,N,M> WaveReadLaneAt(matrix<T,N,M> value, int lane);
13771410

1378-
__generic<T : __BuiltinType> T WaveReadLaneAt(T expr, int laneIndex);
1379-
__generic<T : __BuiltinType, let N : int> vector<T,N> WaveReadLaneAt(vector<T,N> expr, int laneIndex);
1380-
__generic<T : __BuiltinType, let N : int, let M : int> matrix<T,N,M> WaveReadLaneAt(matrix<T,N,M> expr, int laneIndex);
13811411

13821412
// `typedef`s to help with the fact that HLSL has been sorta-kinda case insensitive at various points
13831413
typedef Texture2D texture2D;

0 commit comments

Comments
 (0)