Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f2ea51d
Morton code tests
Fletterio Mar 23, 2025
8f4e452
Morton codes creating properly
Fletterio Mar 25, 2025
0aedfd9
All tests passing, HLSL compiles fine!
Fletterio Mar 28, 2025
ea42d5b
Rename example
Fletterio Apr 1, 2025
2ba08a4
Add tests for AddCarry and SUbBorrow intrinsics
Fletterio Apr 1, 2025
f00bbf6
Disable intrinsic tests for uSUbBorrow for the time being, start copy…
Fletterio Apr 7, 2025
b2d87c3
Added extensive tests for Morton codes
Fletterio Apr 24, 2025
c68c336
Done with tests
Fletterio Apr 28, 2025
d906bb2
Merged master
Fletterio Apr 28, 2025
f05dec4
Clarifying comment for blocker issue
Fletterio Apr 28, 2025
b13fdc7
Merge branch 'master' into mortons
Nov 19, 2025
08c898d
Reindex mortons example from 12 to 73
Nov 27, 2025
7f8dd73
Global variable of hlsl to use NBL_CONSTEXPR_INLINE_NSPC_SCOPE_VAR
Nov 28, 2025
43b8634
Add test for operator-
Dec 1, 2025
ba6641f
Use 1, 1, 1 workgroup dimension
Dec 1, 2025
e830c34
Enable previously failed test because of bug in glm
Dec 1, 2025
e35e61d
Example 73 to 15 and fix compile error
Dec 5, 2025
2e5642a
Remove example 73 mortons
Dec 8, 2025
197b46a
Enable second test set
Dec 9, 2025
6692311
Delete fillSecondTestValues
Dec 9, 2025
4287ed1
Fix morton test
Dec 10, 2025
6a7b003
Remove unnecessary code
Dec 10, 2025
f012a1a
Add some comment for the reason we have to CTester
Dec 10, 2025
f415e8c
Remove dummy code
Dec 10, 2025
8f72b9e
Fix compiler warning for shader compilation
Dec 11, 2025
3042409
Add back second test to first in commented form
Dec 12, 2025
7011ea0
Fix example 28 to use select instead of ternary_op
Dec 12, 2025
02eed2e
Fix example 28
Dec 12, 2025
30b4f52
prefix select with hlsl::
Dec 12, 2025
3e443b1
Add nbl prefix to hlsl::select
Dec 12, 2025
84eb1f7
Merge branch 'master' into mortons
Dec 12, 2025
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
25 changes: 25 additions & 0 deletions 22_CppCompat/CIntrinsicsTester.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ class CIntrinsicsTester final : public ITester
testInput.smoothStepEdge0 = realDistributionNeg(mt);
testInput.smoothStepEdge1 = realDistributionPos(mt);
testInput.smoothStepX = realDistribution(mt);
testInput.addCarryA = std::numeric_limits<uint32_t>::max() - uintDistribution(mt);
testInput.addCarryB = uintDistribution(mt);
testInput.subBorrowA = uintDistribution(mt);
testInput.subBorrowB = uintDistribution(mt);

testInput.bitCountVec = int32_t3(intDistribution(mt), intDistribution(mt), intDistribution(mt));
testInput.clampValVec = float32_t3(realDistribution(mt), realDistribution(mt), realDistribution(mt));
Expand Down Expand Up @@ -120,6 +124,10 @@ class CIntrinsicsTester final : public ITester
testInput.refractI = float32_t3(realDistribution(mt), realDistribution(mt), realDistribution(mt));
testInput.refractN = glm::normalize(float32_t3(realDistribution(mt), realDistribution(mt), realDistribution(mt)));
testInput.refractEta = realDistribution(mt);
testInput.addCarryAVec = uint32_t3(std::numeric_limits<uint32_t>::max() - uintDistribution(mt), std::numeric_limits<uint32_t>::max() - uintDistribution(mt), std::numeric_limits<uint32_t>::max() - uintDistribution(mt));
testInput.addCarryBVec = uint32_t3(uintDistribution(mt), uintDistribution(mt), uintDistribution(mt));
testInput.subBorrowAVec = uint32_t3(uintDistribution(mt), uintDistribution(mt), uintDistribution(mt));
testInput.subBorrowBVec = uint32_t3(uintDistribution(mt), uintDistribution(mt), uintDistribution(mt));

// use std library or glm functions to determine expected test values, the output of functions from intrinsics.hlsl will be verified against these values
IntrinsicsTestValues expected;
Expand All @@ -140,6 +148,9 @@ class CIntrinsicsTester final : public ITester
expected.step = glm::step(testInput.stepEdge, testInput.stepX);
expected.smoothStep = glm::smoothstep(testInput.smoothStepEdge0, testInput.smoothStepEdge1, testInput.smoothStepX);

expected.addCarry.result = glm::uaddCarry(testInput.addCarryA, testInput.addCarryB, expected.addCarry.carry);
expected.subBorrow.result = glm::usubBorrow(testInput.subBorrowA, testInput.subBorrowB, expected.subBorrow.borrow);

expected.frac = testInput.frac - std::floor(testInput.frac);
expected.bitReverse = glm::bitfieldReverse(testInput.bitReverse);

Expand Down Expand Up @@ -182,6 +193,9 @@ class CIntrinsicsTester final : public ITester
expected.reflect = glm::reflect(testInput.reflectI, testInput.reflectN);
expected.refract = glm::refract(testInput.refractI, testInput.refractN, testInput.refractEta);

expected.addCarryVec.result = glm::uaddCarry(testInput.addCarryAVec, testInput.addCarryBVec, expected.addCarryVec.carry);
expected.subBorrowVec.result = glm::usubBorrow(testInput.subBorrowAVec, testInput.subBorrowBVec, expected.subBorrowVec.borrow);

auto mulGlm = nbl::hlsl::mul(testInput.mulLhs, testInput.mulRhs);
expected.mul = reinterpret_cast<float32_t3x3&>(mulGlm);
auto transposeGlm = glm::transpose(reinterpret_cast<typename float32_t3x3::Base const&>(testInput.transpose));
Expand All @@ -201,6 +215,7 @@ class CIntrinsicsTester final : public ITester
void performCpuTests(const IntrinsicsIntputTestValues& commonTestInputValues, const IntrinsicsTestValues& expectedTestValues)
{
IntrinsicsTestValues cpuTestValues;

cpuTestValues.fillTestValues(commonTestInputValues);
verifyTestValues(expectedTestValues, cpuTestValues, ITester::TestType::CPU);

Expand Down Expand Up @@ -233,6 +248,11 @@ class CIntrinsicsTester final : public ITester
verifyTestValue("degrees", expectedTestValues.degrees, testValues.degrees, testType);
verifyTestValue("step", expectedTestValues.step, testValues.step, testType);
verifyTestValue("smoothStep", expectedTestValues.smoothStep, testValues.smoothStep, testType);
verifyTestValue("addCarryResult", expectedTestValues.addCarry.result, testValues.addCarry.result, testType);
verifyTestValue("addCarryCarry", expectedTestValues.addCarry.carry, testValues.addCarry.carry, testType);
// Disabled: current glm implementation is wrong
//verifyTestValue("subBorrowResult", expectedTestValues.subBorrow.result, testValues.subBorrow.result, testType);
//verifyTestValue("subBorrowBorrow", expectedTestValues.subBorrow.borrow, testValues.subBorrow.borrow, testType);

verifyTestVector3dValue("normalize", expectedTestValues.normalize, testValues.normalize, testType);
verifyTestVector3dValue("cross", expectedTestValues.cross, testValues.cross, testType);
Expand All @@ -255,6 +275,11 @@ class CIntrinsicsTester final : public ITester
verifyTestVector3dValue("faceForward", expectedTestValues.faceForward, testValues.faceForward, testType);
verifyTestVector3dValue("reflect", expectedTestValues.reflect, testValues.reflect, testType);
verifyTestVector3dValue("refract", expectedTestValues.refract, testValues.refract, testType);
verifyTestVector3dValue("addCarryVecResult", expectedTestValues.addCarryVec.result, testValues.addCarryVec.result, testType);
verifyTestVector3dValue("addCarryVecCarry", expectedTestValues.addCarryVec.carry, testValues.addCarryVec.carry, testType);
// Disabled: current glm implementation is wrong
//verifyTestVector3dValue("subBorrowVecResult", expectedTestValues.subBorrowVec.result, testValues.subBorrowVec.result, testType);
//verifyTestVector3dValue("subBorrowVecBorrow", expectedTestValues.subBorrowVec.borrow, testValues.subBorrowVec.borrow, testType);

verifyTestMatrix3x3Value("mul", expectedTestValues.mul, testValues.mul, testType);
verifyTestMatrix3x3Value("transpose", expectedTestValues.transpose, testValues.transpose, testType);
Expand Down
1 change: 1 addition & 0 deletions 22_CppCompat/ITester.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class ITester
{
case TestType::CPU:
ss << "CPU TEST ERROR:\n";
break;
case TestType::GPU:
ss << "GPU TEST ERROR:\n";
}
Expand Down
Loading