Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
ba9fde5
hlsl bxdf test dir
keptsecret Dec 17, 2024
4f9dc9f
test bxdf compiles
keptsecret Dec 17, 2024
2091701
minor namespace changes
keptsecret Dec 17, 2024
385bcec
added bsdf test
keptsecret Dec 19, 2024
5ba4dfd
Merge branch 'master' into bxdf_unit_tests
keptsecret Dec 19, 2024
9212b65
fix namespace
keptsecret Dec 20, 2024
32f959d
Example 62 fix
Przemog1 Dec 20, 2024
8128422
Merge branch 'master' into bxdf_unit_tests
keptsecret Dec 23, 2024
70b28d8
working? test
keptsecret Dec 23, 2024
f177090
rng test util struct
keptsecret Dec 25, 2024
382c862
beckmann dielectric test
keptsecret Dec 25, 2024
e0bde55
Updated examples
Przemog1 Dec 28, 2024
46c80dc
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla-…
Przemog1 Dec 28, 2024
677323b
Fixes
Przemog1 Dec 30, 2024
1bc825d
Merge branch 'bxdf_unit_tests' of github.com:Devsh-Graphics-Programmi…
Przemog1 Dec 30, 2024
76db120
Merge branch 'master' into bxdf_unit_tests
keptsecret Jan 3, 2025
9de6ae8
fix syntax
keptsecret Jan 3, 2025
6dbc89a
more tests (all brdfs) and utils
keptsecret Jan 6, 2025
9c379eb
template tests
keptsecret Jan 7, 2025
5140f85
all existing tests into templates
keptsecret Jan 7, 2025
fb7b31b
simplify test template and usage
keptsecret Jan 8, 2025
3c415fd
diff v test
keptsecret Jan 8, 2025
3524449
test metadata struct for more info
keptsecret Jan 8, 2025
ef188ba
smooth dielectric bsdf tests
keptsecret Jan 8, 2025
17b253c
improve rng function
keptsecret Jan 9, 2025
59d14c3
fix bugs in rng
keptsecret Jan 9, 2025
fac1ed1
fix tests, use uniform sampling
keptsecret Jan 10, 2025
1ecd0c0
use new sampling
keptsecret Jan 10, 2025
c983141
hash to uint2 seed
keptsecret Jan 10, 2025
c02c9f0
use glm quaternions instead
keptsecret Jan 10, 2025
0c3d657
callbacks on detect error
keptsecret Jan 13, 2025
01d4799
fix callback usage bugs
keptsecret Jan 13, 2025
887c3a0
changed ior, spectral_type usage in bxdf
keptsecret Jan 13, 2025
9ab4e8e
use new pcg hlsl
keptsecret Jan 14, 2025
c8859c0
callback reruns bxdf compute
keptsecret Jan 14, 2025
414f961
added bxdf names for debugging
keptsecret Jan 14, 2025
fe23efc
Saving work
Przemog1 Jan 14, 2025
cdff4c6
Merge branch 'bxdf_unit_tests' of github.com:Devsh-Graphics-Programmi…
Przemog1 Jan 14, 2025
55362eb
Saving work
Przemog1 Jan 15, 2025
138bd7f
Adjustments
Przemog1 Jan 18, 2025
969778f
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla-…
Przemog1 Jan 18, 2025
ae6e570
Removed test code
Przemog1 Jan 21, 2025
806b879
Removed `bitreverse.hlsl` references
Przemog1 Jan 22, 2025
daccef9
Implemented C++ side tgmath tests
Przemog1 Jan 22, 2025
bc4cbbe
Implemented HLSL side tgmath tests
Przemog1 Jan 25, 2025
e91f070
Implemented intrinsics.hlsl tests
Przemog1 Jan 28, 2025
a8ac36c
Implemented `logFail`
Przemog1 Jan 28, 2025
bcd079a
Fixed gpu tests
Przemog1 Jan 28, 2025
0714468
Fixes
Przemog1 Jan 28, 2025
c39b0df
Renamed `lerp` to `mix`
Przemog1 Jan 29, 2025
086987d
Added log2 tests
Przemog1 Jan 29, 2025
06ed533
Extened tgmath tests
Przemog1 Jan 30, 2025
a927463
Added tests for new intirnsics functions
Przemog1 Jan 30, 2025
3ad088a
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla-…
Przemog1 Feb 3, 2025
2bc6d88
Example 62 fix
Przemog1 Feb 3, 2025
99cb3cf
Added modfStruct and frexpStruct tests
Przemog1 Feb 3, 2025
ccc637a
Bug fix
Przemog1 Feb 3, 2025
6087653
Updated tests
Przemog1 Feb 4, 2025
a460800
Updated tests
Przemog1 Feb 10, 2025
5d6fdb9
Updated tests
Przemog1 Feb 11, 2025
2e3d959
Corrections
Przemog1 Feb 11, 2025
cfe94ab
Update
Przemog1 Feb 21, 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
264 changes: 264 additions & 0 deletions 22_CppCompat/CIntrinsicsTester.h

Large diffs are not rendered by default.

360 changes: 360 additions & 0 deletions 22_CppCompat/CTgmathTester.h

Large diffs are not rendered by default.

335 changes: 335 additions & 0 deletions 22_CppCompat/ITester.h

Large diffs are not rendered by default.

429 changes: 425 additions & 4 deletions 22_CppCompat/app_resources/common.hlsl

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions 22_CppCompat/app_resources/intrinsicsTest.comp.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//// Copyright (C) 2023-2024 - DevSH Graphics Programming Sp. z O.O.
//// This file is part of the "Nabla Engine".
//// For conditions of distribution and use, see copyright notice in nabla.h
#pragma shader_stage(compute)

#include "common.hlsl"

[[vk::binding(0, 0)]] RWStructuredBuffer<IntrinsicsIntputTestValues> inputTestValues;
[[vk::binding(1, 0)]] RWStructuredBuffer<IntrinsicsTestValues> outputTestValues;

[numthreads(256, 1, 1)]
void main(uint3 invocationID : SV_DispatchThreadID)
{
if(invocationID.x == 0)
outputTestValues[0].fillTestValues(inputTestValues[0]);
}
16 changes: 16 additions & 0 deletions 22_CppCompat/app_resources/tgmathTest.comp.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//// Copyright (C) 2023-2024 - DevSH Graphics Programming Sp. z O.O.
//// This file is part of the "Nabla Engine".
//// For conditions of distribution and use, see copyright notice in nabla.h
#pragma shader_stage(compute)

#include "common.hlsl"

[[vk::binding(0, 0)]] RWStructuredBuffer<TgmathIntputTestValues> inputTestValues;
[[vk::binding(1, 0)]] RWStructuredBuffer<TgmathTestValues> outputTestValues;

[numthreads(256, 1, 1)]
void main(uint3 invocationID : SV_DispatchThreadID)
{
if(invocationID.x == 0)
outputTestValues[0].fillTestValues(inputTestValues[0]);
}
33 changes: 27 additions & 6 deletions 22_CppCompat/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include "app_resources/common.hlsl"

#include "CTgmathTester.h"
#include "CIntrinsicsTester.h"

using namespace nbl::core;
using namespace nbl::hlsl;
Expand Down Expand Up @@ -56,11 +58,31 @@ class CompatibilityTest final : public MonoDeviceApplication, public MonoAssetMa
return false;
if (!asset_base_t::onAppInitialized(std::move(system)))
return false;


ITester::PipelineSetupData pplnSetupData;
pplnSetupData.device = m_device;
pplnSetupData.api = m_api;
pplnSetupData.assetMgr = m_assetMgr;
pplnSetupData.logger = m_logger;
pplnSetupData.physicalDevice = m_physicalDevice;
pplnSetupData.computeFamilyIndex = getComputeQueue()->getFamilyIndex();

{
CTgmathTester tgmathTester;
pplnSetupData.testShaderPath = "app_resources/tgmathTest.comp.hlsl";
tgmathTester.setupPipeline<TgmathIntputTestValues, TgmathTestValues>(pplnSetupData);
tgmathTester.performTests();
}
{
CIntrinsicsTester intrinsicsTester;
pplnSetupData.testShaderPath = "app_resources/intrinsicsTest.comp.hlsl";
intrinsicsTester.setupPipeline<IntrinsicsIntputTestValues, IntrinsicsTestValues>(pplnSetupData);
intrinsicsTester.performTests();
}

m_queue = m_device->getQueue(0, 0);
m_commandPool = m_device->createCommandPool(m_queue->getFamilyIndex(), IGPUCommandPool::CREATE_FLAGS::RESET_COMMAND_BUFFER_BIT);
m_commandPool->createCommandBuffers(IGPUCommandPool::BUFFER_LEVEL::PRIMARY, { &m_cmdbuf,1 }, smart_refctd_ptr(m_logger));


smart_refctd_ptr<IGPUShader> shader;
{
Expand Down Expand Up @@ -211,7 +233,6 @@ class CompatibilityTest final : public MonoDeviceApplication, public MonoAssetMa
constexpr auto StartedValue = 0;

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


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


Expand Down Expand Up @@ -761,8 +782,8 @@ void cpu_tests()
TEST_CMATH(fdim, 2, type) \


TEST_CMATH_FOR_TYPE(float32_t)
TEST_CMATH_FOR_TYPE(float64_t)
//TEST_CMATH_FOR_TYPE(float32_t)
//TEST_CMATH_FOR_TYPE(float64_t)
#endif
std::cout << "cpu tests done\n";
}
1 change: 0 additions & 1 deletion 28_FFTBloom/app_resources/fft_convolve_ifft.hlsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "fft_mirror_common.hlsl"
#include "nbl/builtin/hlsl/bitreverse.hlsl"

[[vk::binding(3, 0)]] Texture2DArray<float32_t2> kernelChannels;
[[vk::binding(1, 0)]] SamplerState samplerState;
Expand Down
1 change: 0 additions & 1 deletion 28_FFTBloom/app_resources/kernel_fft_second_axis.hlsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "fft_mirror_common.hlsl"
#include "nbl/builtin/hlsl/colorspace/encodeCIEXYZ.hlsl"
#include "nbl/builtin/hlsl/bitreverse.hlsl"

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

Expand Down
2 changes: 1 addition & 1 deletion 62_CAD/Hatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bool Hatch::Segment::isStraightLineConstantMajor() const
p1 = originalBezier->P1[major],
p2 = originalBezier->P2[major];
//assert(p0 <= p1 && p1 <= p2); (PRECISION ISSUES ARISE ONCE MORE)
return abs(p1 - p0) <= core::exp2(-24.0) && abs(p2 - p0) <= exp(-24);
return abs(p1 - p0) <= core::exp2(-24.0) && abs(p2 - p0) <= hlsl::exp(-24.0f);
}

std::array<double, 2> Hatch::Segment::intersect(const Segment& other) const
Expand Down
15 changes: 11 additions & 4 deletions 62_CAD/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ using namespace video;
#include "HatchGlyphBuilder.h"
#include "GeoTexture.h"

#include <nbl/builtin/hlsl/tgmath.hlsl>

//TODO: remove
#include <nbl/builtin/hlsl/concepts/core.hlsl>
#include <nbl/builtin/hlsl/concepts/vector.hlsl>
#include <nbl/builtin/hlsl/concepts/matrix.hlsl>

#include <chrono>
#define BENCHMARK_TILL_FIRST_FRAME

Expand Down Expand Up @@ -66,7 +73,7 @@ constexpr std::array<float, (uint32_t)ExampleMode::CASE_COUNT> cameraExtents =
600.0, // CASE_8
};

constexpr ExampleMode mode = ExampleMode::CASE_5;
constexpr ExampleMode mode = ExampleMode::CASE_4;

class Camera2D
{
Expand Down Expand Up @@ -393,9 +400,9 @@ class ComputerAidedDesign final : public examples::SimpleWindowedApplication, pu
}

IGPUSampler::SParams samplerParams = {};
samplerParams.TextureWrapU = IGPUSampler::ETC_CLAMP_TO_BORDER;
samplerParams.TextureWrapV = IGPUSampler::ETC_CLAMP_TO_BORDER;
samplerParams.TextureWrapW = IGPUSampler::ETC_CLAMP_TO_BORDER;
samplerParams.TextureWrapU = IGPUSampler::E_TEXTURE_CLAMP::ETC_CLAMP_TO_BORDER;
samplerParams.TextureWrapV = IGPUSampler::E_TEXTURE_CLAMP::ETC_CLAMP_TO_BORDER;
samplerParams.TextureWrapW = IGPUSampler::E_TEXTURE_CLAMP::ETC_CLAMP_TO_BORDER;
samplerParams.BorderColor = IGPUSampler::ETBC_FLOAT_OPAQUE_WHITE; // positive means outside shape
samplerParams.MinFilter = IGPUSampler::ETF_LINEAR;
samplerParams.MaxFilter = IGPUSampler::ETF_LINEAR;
Expand Down
1 change: 1 addition & 0 deletions 62_CAD/shaders/globals.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <nbl/builtin/hlsl/cpp_compat/basic.h>
#include <nbl/builtin/hlsl/cpp_compat/matrix.hlsl>
#include <nbl/builtin/hlsl/shapes/beziers.hlsl>
#include <nbl/builtin/hlsl/tgmath.hlsl>

#ifdef __HLSL_VERSION
#include <nbl/builtin/hlsl/math/equations/quadratic.hlsl>
Expand Down
28 changes: 28 additions & 0 deletions 66_HLSLBxDFTests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
set(NBL_INCLUDE_SEARCH_DIRECTORIES
"${CMAKE_CURRENT_SOURCE_DIR}/include"
)

include(common RESULT_VARIABLE RES)
if(NOT RES)
message(FATAL_ERROR "common.cmake not found. Should be in {repo_root}/cmake directory")
endif()

nbl_create_executable_project("" "" "${NBL_INCLUDE_SEARCH_DIRECTORIES}" "" "${NBL_EXECUTABLE_PROJECT_CREATION_PCH_TARGET}")

if(NBL_EMBED_BUILTIN_RESOURCES)
set(_BR_TARGET_ ${EXECUTABLE_NAME}_builtinResourceData)
set(RESOURCE_DIR "app_resources")

get_filename_component(_SEARCH_DIRECTORIES_ "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
get_filename_component(_OUTPUT_DIRECTORY_SOURCE_ "${CMAKE_CURRENT_BINARY_DIR}/src" ABSOLUTE)
get_filename_component(_OUTPUT_DIRECTORY_HEADER_ "${CMAKE_CURRENT_BINARY_DIR}/include" ABSOLUTE)

file(GLOB_RECURSE BUILTIN_RESOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE_DIR}" CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE_DIR}/*")
foreach(RES_FILE ${BUILTIN_RESOURCE_FILES})
LIST_BUILTIN_RESOURCE(RESOURCES_TO_EMBED "${RES_FILE}")
endforeach()

ADD_CUSTOM_BUILTIN_RESOURCES(${_BR_TARGET_} RESOURCES_TO_EMBED "${_SEARCH_DIRECTORIES_}" "${RESOURCE_DIR}" "nbl::this_example::builtin" "${_OUTPUT_DIRECTORY_HEADER_}" "${_OUTPUT_DIRECTORY_SOURCE_}")

LINK_BUILTIN_RESOURCES_TO_TARGET(${EXECUTABLE_NAME} ${_BR_TARGET_})
endif()
Loading