Skip to content

Commit ff95b3b

Browse files
Merge pull request #172 from Devsh-Graphics-Programming/new_tgmath
New tgmath
2 parents 82bf36b + cfe94ab commit ff95b3b

File tree

16 files changed

+2034
-14
lines changed

16 files changed

+2034
-14
lines changed

22_CppCompat/CIntrinsicsTester.h

Lines changed: 264 additions & 0 deletions
Large diffs are not rendered by default.

22_CppCompat/CTgmathTester.h

Lines changed: 360 additions & 0 deletions
Large diffs are not rendered by default.

22_CppCompat/ITester.h

Lines changed: 335 additions & 0 deletions
Large diffs are not rendered by default.

22_CppCompat/app_resources/common.hlsl

Lines changed: 425 additions & 4 deletions
Large diffs are not rendered by default.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//// Copyright (C) 2023-2024 - DevSH Graphics Programming Sp. z O.O.
2+
//// This file is part of the "Nabla Engine".
3+
//// For conditions of distribution and use, see copyright notice in nabla.h
4+
#pragma shader_stage(compute)
5+
6+
#include "common.hlsl"
7+
8+
[[vk::binding(0, 0)]] RWStructuredBuffer<IntrinsicsIntputTestValues> inputTestValues;
9+
[[vk::binding(1, 0)]] RWStructuredBuffer<IntrinsicsTestValues> outputTestValues;
10+
11+
[numthreads(256, 1, 1)]
12+
void main(uint3 invocationID : SV_DispatchThreadID)
13+
{
14+
if(invocationID.x == 0)
15+
outputTestValues[0].fillTestValues(inputTestValues[0]);
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//// Copyright (C) 2023-2024 - DevSH Graphics Programming Sp. z O.O.
2+
//// This file is part of the "Nabla Engine".
3+
//// For conditions of distribution and use, see copyright notice in nabla.h
4+
#pragma shader_stage(compute)
5+
6+
#include "common.hlsl"
7+
8+
[[vk::binding(0, 0)]] RWStructuredBuffer<TgmathIntputTestValues> inputTestValues;
9+
[[vk::binding(1, 0)]] RWStructuredBuffer<TgmathTestValues> outputTestValues;
10+
11+
[numthreads(256, 1, 1)]
12+
void main(uint3 invocationID : SV_DispatchThreadID)
13+
{
14+
if(invocationID.x == 0)
15+
outputTestValues[0].fillTestValues(inputTestValues[0]);
16+
}

22_CppCompat/main.cpp

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#include "app_resources/common.hlsl"
1313

14+
#include "CTgmathTester.h"
15+
#include "CIntrinsicsTester.h"
1416

1517
using namespace nbl::core;
1618
using namespace nbl::hlsl;
@@ -56,11 +58,31 @@ class CompatibilityTest final : public MonoDeviceApplication, public MonoAssetMa
5658
return false;
5759
if (!asset_base_t::onAppInitialized(std::move(system)))
5860
return false;
59-
61+
62+
ITester::PipelineSetupData pplnSetupData;
63+
pplnSetupData.device = m_device;
64+
pplnSetupData.api = m_api;
65+
pplnSetupData.assetMgr = m_assetMgr;
66+
pplnSetupData.logger = m_logger;
67+
pplnSetupData.physicalDevice = m_physicalDevice;
68+
pplnSetupData.computeFamilyIndex = getComputeQueue()->getFamilyIndex();
69+
70+
{
71+
CTgmathTester tgmathTester;
72+
pplnSetupData.testShaderPath = "app_resources/tgmathTest.comp.hlsl";
73+
tgmathTester.setupPipeline<TgmathIntputTestValues, TgmathTestValues>(pplnSetupData);
74+
tgmathTester.performTests();
75+
}
76+
{
77+
CIntrinsicsTester intrinsicsTester;
78+
pplnSetupData.testShaderPath = "app_resources/intrinsicsTest.comp.hlsl";
79+
intrinsicsTester.setupPipeline<IntrinsicsIntputTestValues, IntrinsicsTestValues>(pplnSetupData);
80+
intrinsicsTester.performTests();
81+
}
82+
6083
m_queue = m_device->getQueue(0, 0);
6184
m_commandPool = m_device->createCommandPool(m_queue->getFamilyIndex(), IGPUCommandPool::CREATE_FLAGS::RESET_COMMAND_BUFFER_BIT);
6285
m_commandPool->createCommandBuffers(IGPUCommandPool::BUFFER_LEVEL::PRIMARY, { &m_cmdbuf,1 }, smart_refctd_ptr(m_logger));
63-
6486

6587
smart_refctd_ptr<IGPUShader> shader;
6688
{
@@ -211,7 +233,6 @@ class CompatibilityTest final : public MonoDeviceApplication, public MonoAssetMa
211233
constexpr auto StartedValue = 0;
212234

213235
smart_refctd_ptr<ISemaphore> progress = m_device->createSemaphore(StartedValue);
214-
215236

216237
m_cmdbuf->reset(IGPUCommandBuffer::RESET_FLAGS::RELEASE_RESOURCES_BIT);
217238
m_cmdbuf->begin(IGPUCommandBuffer::USAGE::ONE_TIME_SUBMIT_BIT);
@@ -562,7 +583,7 @@ void cpu_tests()
562583
auto zero = cross(x,x);
563584
auto lenX2 = dot(x,x);
564585
//auto z_inv = inverse(z); //busted return type conversion
565-
auto mid = lerp(x,x,0.5f);
586+
auto mid = nbl::hlsl::mix(x,x,float32_t3(0.5f));
566587
//auto w = transpose(y); //also busted
567588

568589

@@ -761,8 +782,8 @@ void cpu_tests()
761782
TEST_CMATH(fdim, 2, type) \
762783

763784

764-
TEST_CMATH_FOR_TYPE(float32_t)
765-
TEST_CMATH_FOR_TYPE(float64_t)
785+
//TEST_CMATH_FOR_TYPE(float32_t)
786+
//TEST_CMATH_FOR_TYPE(float64_t)
766787
#endif
767788
std::cout << "cpu tests done\n";
768789
}

28_FFTBloom/app_resources/fft_convolve_ifft.hlsl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "fft_mirror_common.hlsl"
2-
#include "nbl/builtin/hlsl/bitreverse.hlsl"
32

43
[[vk::binding(3, 0)]] Texture2DArray<float32_t2> kernelChannels;
54
[[vk::binding(1, 0)]] SamplerState samplerState;

28_FFTBloom/app_resources/kernel_fft_second_axis.hlsl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "fft_mirror_common.hlsl"
22
#include "nbl/builtin/hlsl/colorspace/encodeCIEXYZ.hlsl"
3-
#include "nbl/builtin/hlsl/bitreverse.hlsl"
43

54
[[vk::binding(2, 0)]] RWTexture2DArray<float32_t2> kernelChannels;
65

62_CAD/Hatch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ bool Hatch::Segment::isStraightLineConstantMajor() const
1616
p1 = originalBezier->P1[major],
1717
p2 = originalBezier->P2[major];
1818
//assert(p0 <= p1 && p1 <= p2); (PRECISION ISSUES ARISE ONCE MORE)
19-
return abs(p1 - p0) <= core::exp2(-24.0) && abs(p2 - p0) <= exp(-24);
19+
return abs(p1 - p0) <= core::exp2(-24.0) && abs(p2 - p0) <= hlsl::exp(-24.0f);
2020
}
2121

2222
std::array<double, 2> Hatch::Segment::intersect(const Segment& other) const

0 commit comments

Comments
 (0)