Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port BxDF functions to HLSL #475

Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
d3f4169
Add files via upload
nahiim Nov 7, 2022
95cc93f
Update animtation.hlsl
nahiim Nov 7, 2022
507b1a6
Update keyframe.hlsl
nahiim Nov 7, 2022
bcb9f77
Update node.hlsl
nahiim Nov 7, 2022
8e61632
Create algorithm.hlsl
devshgraphicsprogramming Nov 7, 2022
b9b29d2
Add files via upload
nahiim Nov 7, 2022
6d7e989
Delete animtation.hlsl
nahiim Nov 7, 2022
6c24d2c
Update node.hlsl
nahiim Nov 7, 2022
ef4f253
Add files via upload
nahiim Nov 7, 2022
b89cad1
Delete node.hlsl
nahiim Nov 7, 2022
c964e09
Add files via upload
nahiim Nov 7, 2022
bb088e9
Update keyframe.hlsl
nahiim Nov 7, 2022
5aac44b
Create scanning_append.hlsl
devshgraphicsprogramming Nov 7, 2022
01fd600
Create common.hlsl
devshgraphicsprogramming Nov 8, 2022
3671194
Create transmission.hlsl
devshgraphicsprogramming Nov 8, 2022
605f3c4
Create reflection.hlsl
devshgraphicsprogramming Nov 8, 2022
2a91a80
Add `quotient_and_pdf` struct and `transmit/reflect` to RayDirInfo co…
devshgraphicsprogramming Nov 8, 2022
6ac724b
Transmission need not know about `nbl::hlsl::reflect`
devshgraphicsprogramming Nov 8, 2022
de66abf
Implement some of Microfacet Caches, missing valid by construction
devshgraphicsprogramming Nov 8, 2022
3bcd088
Implement anisotropic cache valid by construction
devshgraphicsprogramming Nov 8, 2022
2e65bbc
brdf
nahiim Nov 9, 2022
cc39ce3
geom smith
nahiim Nov 9, 2022
9f18406
fixed minor math blunder
nahiim Nov 9, 2022
bfc2143
...
nahiim Nov 9, 2022
8a4eda4
add 3rdparty/dxc/dxc submodule
AnastaZIuk Nov 10, 2022
f9da966
update 3rdparty/dxc/dxc submodule with dxcompiler target fix
AnastaZIuk Nov 10, 2022
c80b0e9
Shapes and ieee754
nahiim Nov 10, 2022
321b252
numeric_limits
nahiim Nov 10, 2022
b5d3a4c
colorspace_EOTF
nahiim Nov 11, 2022
47e3e4c
update dxc submodule with adding clang library correction, add dxc to…
AnastaZIuk Nov 11, 2022
a9841d1
make DXC compile with Nabla's BS via external project
AnastaZIuk Nov 11, 2022
9af73f8
Merge branch 'hlsl' of github.com:Devsh-Graphics-Programming/Nabla in…
AnastaZIuk Nov 11, 2022
4ecbd7c
colorspace completed
nahiim Nov 11, 2022
8eec0c0
fixed typos
nahiim Nov 12, 2022
e644e74
Create HLSL_NABLA_COMPILE_TEST target for compile-testing Nabla's new…
AnastaZIuk Nov 12, 2022
8135e46
Find a way to clean environment for clear DXC compilation, make sure …
AnastaZIuk Nov 13, 2022
4712763
link dxcompiler library to Nabla
AnastaZIuk Nov 13, 2022
a215ee3
add dxc as dependency of HLSL_NABLA_COMPILE_TEST
AnastaZIuk Nov 13, 2022
9dd660f
math
nahiim Nov 14, 2022
255f8e8
maths
nahiim Nov 14, 2022
42b19d7
Merge remote-tracking branch 'origin/hlsl' into local_hlsl
nahiim Nov 14, 2022
95e9e2d
Merge remote-tracking branch 'origin/dxcIntegration' into local_hlsl
nahiim Nov 14, 2022
f01eeee
minor fixes
nahiim Nov 15, 2022
cbf8d71
automated HLSL compilation
nahiim Nov 15, 2022
1990c18
complex and constants
nahiim Nov 17, 2022
953b681
math completed
nahiim Nov 21, 2022
7011441
shapes completed
nahiim Nov 23, 2022
a09b8ef
create random/xoroshiro.hlsl
nahiim Nov 24, 2022
d5e3189
porting hlsl/utils
nahiim Nov 29, 2022
b3a17c9
add hlsl/utils/culling
nahiim Dec 2, 2022
47c82ce
add morton, normal_encode, normal_decode, culling
nahiim Dec 6, 2022
f037e69
utils
nahiim Dec 7, 2022
5f70cca
surface_transform finishing
nahiim Dec 8, 2022
67b22f0
add utils/transform
nahiim Dec 9, 2022
9cfc8fb
update transform.hlsl
nahiim Dec 10, 2022
0efa057
utils, loader, property_pool, blit
nahiim Dec 31, 2022
9720334
Seems like all BRDF functions are ported to HLSL and compiling ok
Crisspl Mar 11, 2023
bb6ec81
ported bsdf functions to HLSL
Crisspl Mar 17, 2023
52589d2
Reworked & renamed bxdf functions to _quotient_and_pdf convention
Crisspl Mar 21, 2023
e2daa63
HLSL BxDF concepts design: common bxdf classes
Crisspl Mar 22, 2023
6853d83
HLSL BxDF concepts design: some work done on NDFs
Crisspl Mar 28, 2023
a49760c
Typo and missing create() for blinnphong
Crisspl Mar 29, 2023
758a390
Fresnels
Crisspl Mar 29, 2023
5e2bf89
Diffuse BxDFs
Crisspl Mar 29, 2023
915ef27
Generic CookTorrance BRDF implementation
Crisspl Mar 29, 2023
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,6 @@
[submodule "examples_tests"]
path = examples_tests
url = git@github.com:Devsh-Graphics-Programming/Nabla-Examples-and-Tests.git
[submodule "3rdparty/dxc/dxc"]
path = 3rdparty/dxc/dxc
url = git@github.com:Devsh-Graphics-Programming/DirectXShaderCompiler.git
18 changes: 17 additions & 1 deletion 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,26 @@ set(BUILD_SHARED_LIBS ${_OLD_BUILD_SHARED_LIBS})
set(BUILD_STATIC_LIBS ${_OLD_BUILD_STATIC_LIBS})
set(BUILD_TESTING ${_OLD_BUILD_TESTING})


# openssl
add_subdirectory(openssl openssl EXCLUDE_FROM_ALL)

# DXC
option(_NBL_COMPILE_WITH_DXC_ "Build Nabla with DXC" ON)
option(_NBL_ENABLE_DXC_COMPILE_TESTS_ "Enable it in order to test compilation of Nabla shaders at build time" OFF)
option(_NBL_DXC_COMPILE_TESTS_ENABLE_CMAKE_LOG_ "Enable more verbose log when creating DXC compile test target - only for Nabla developers!" OFF)
set(_NBL_DXC_CT_PREFIX_CMAKE_LOG_DEBUG_ "[DXC_CT]:" CACHE INTERNAL "only for Nabla developers")
if(_NBL_COMPILE_WITH_DXC_)
message(STATUS "_NBL_COMPILE_WITH_DXC_ enabled, Nabla will be built with DXC!")
add_subdirectory(dxc dxc EXCLUDE_FROM_ALL)

if(_NBL_ENABLE_DXC_COMPILE_TESTS_)
message(STATUS "_NBL_ENABLE_DXC_COMPILE_TESTS_ enabled, DXC compile test target will be executed at build time!")
endif()
else()
if(_NBL_ENABLE_DXC_COMPILE_TESTS_)
message(WARNING "_NBL_ENABLE_DXC_COMPILE_TESTS_ enabled, but _NBL_COMPILE_WITH_DXC_ is turned off! DXC compile tests won't be executed...")
endif()
endif()

# volk
set(VOLK_PULL_IN_VULKAN OFF CACHE INTERNAL "" FORCE) # Needed to make sure vulkan library will not be linked in examples
Expand Down
52 changes: 52 additions & 0 deletions 3rdparty/dxc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
list(APPEND DXC_CMAKE_ARGS "-DHLSL_OPTIONAL_PROJS_IN_DEFAULT:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DHLSL_ENABLE_ANALYZE:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DHLSL_OFFICIAL_BUILD:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DHLSL_ENABLE_FIXED_VER:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DHLSL_ENABLE_FIXED_VER:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DHLSL_FIXED_VERSION_LOCATION:STRING=")
list(APPEND DXC_CMAKE_ARGS "-DHLSL_BUILD_DXILCONV:BOOL=ON")
list(APPEND DXC_CMAKE_ARGS "-DCLANG_VENDOR:STRING=")
list(APPEND DXC_CMAKE_ARGS "-DENABLE_SPIRV_CODEGEN:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DSPIRV_BUILD_TESTS:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DCLANG_ENABLE_ARCMT:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DCLANG_ENABLE_STATIC_ANALYZER:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DCLANG_INCLUDE_TESTS:BOOL=Off")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_INCLUDE_TESTS:BOOL=Off")
list(APPEND DXC_CMAKE_ARGS "-DHLSL_INCLUDE_TESTS:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_TARGETS_TO_BUILD:STRING=None")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_INCLUDE_DOCS:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_INCLUDE_TESTS:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DLIBCLANG_BUILD_STATIC:BOOL=ON")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_OPTIMIZED_TABLEGEN:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_REQUIRES_EH:BOOL=ON")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_APPEND_VC_REV:BOOL=ON")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_ENABLE_RTTI:BOOL=ON")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_ENABLE_EH:BOOL=ON")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_DEFAULT_TARGET_TRIPLE:STRING=dxil-ms-dx")
list(APPEND DXC_CMAKE_ARGS "-DCLANG_BUILD_EXAMPLES:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DLLVM_REQUIRES_RTTI:BOOL=ON")
list(APPEND DXC_CMAKE_ARGS "-DCLANG_CL:BOOL=OFF")
list(APPEND DXC_CMAKE_ARGS "-DCMAKE_SYSTEM_VERSION=10.0.17763.0")
list(APPEND DXC_CMAKE_ARGS "-DDXC_BUILD_ARCH=x64")

set(DXC_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dxc" CACHE INTERNAL "")
set(DXC_BINARY_DIR_EP "${CMAKE_CURRENT_BINARY_DIR}/external/dxc" CACHE INTERNAL "")
set(DXC_BINARY_DIR_GE "${DXC_BINARY_DIR_EP}/Release" CACHE INTERNAL "")
set(DXC_BIN_DIR "${DXC_BINARY_DIR_GE}/Release/bin" CACHE INTERNAL "")
set(DXC_LIB_DIR "${DXC_BINARY_DIR_GE}/Release/lib" CACHE INTERNAL "")
set(DXC_EXECUTABLE "${DXC_BIN_DIR}/dxc.exe" CACHE INTERNAL "")
set(DXC_DXCOMPILER_LIB "${DXC_LIB_DIR}/dxcompiler.lib" CACHE INTERNAL "")

ExternalProject_Add(dxc
DOWNLOAD_COMMAND ""
SOURCE_DIR "${DXC_SOURCE_DIR}"
BINARY_DIR "${DXC_BINARY_DIR_EP}"
BUILD_COMMAND "${CMAKE_COMMAND}" --build "${DXC_BINARY_DIR_GE}" --config Release --target dxc --target dxcompiler -v
CONFIGURE_COMMAND "${CMAKE_COMMAND}" -S "${DXC_SOURCE_DIR}" -B "${DXC_BINARY_DIR_GE}" -G "${CMAKE_GENERATOR}" "-Ax64" -T "${CMAKE_GENERATOR_TOOLSET}" ${DXC_CMAKE_ARGS}
INSTALL_COMMAND ""
TEST_COMMAND ""
LOG_INSTALL 1
)

unset(DXC_CMAKE_ARGS)
1 change: 1 addition & 0 deletions 3rdparty/dxc/dxc
Submodule dxc added at ac9f2c
114 changes: 114 additions & 0 deletions compile.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@

@echo off

setlocal enabledelayedexpansion


:: List of shaders to compile (paths relative to include/nbl/builtin/hlsl/)
set file_path[0]=common
set file_path[1]=algorithm
set file_path[2]=ieee754

set file_path[3]=limits/numeric

set file_path[4]=math/complex
set file_path[5]=math/constants
set file_path[6]=math/functions
set file_path[7]=math/binary_operator_functions
set file_path[8]=math/quaternions

set file_path[9]=scene/animation
set file_path[10]=scene/keyframe
set file_path[11]=scene/node

set file_path[12]=format/constants
set file_path[13]=format/decode
set file_path[14]=format/encode

set file_path[15]=colorspace/decodeCIEXYZ
set file_path[16]=colorspace/encodeCIEXYZ
set file_path[17]=colorspace/EOTF
set file_path[18]=colorspace/OETF

set file_path[19]=shapes/aabb
set file_path[20]=shapes/rectangle
set file_path[21]=shapes/triangle
set file_path[22]=shapes/frustum

set file_path[23]=random/xoroshiro

set file_path[24]=utils/compressed_normal_matrix_t
set file_path[25]=utils/acceleration_structures
set file_path[26]=utils/common
set file_path[27]=utils/culling
set file_path[28]=utils/morton
set file_path[29]=utils/normal_decode
set file_path[30]=utils/normal_encode
set file_path[31]=utils/surface_transform
set file_path[32]=utils/transform
rem set file_path[33]=utils/indirect_commands

set file_path[33]=loader/mtl/common

set file_path[34]=lod_library/structs
rem set file_path[36]=lod_library/descriptor_set

set file_path[35]=property_pool/transfer

set file_path[36]=blit/formats_encode
rem set file_path[37]=blit/blit/descriptors




rem set file_path[23]=bxdf/fresnel






set "XOUTPUT_PATH=include/nbl/builtin/hlsl/xoutput/"
set "HLSL_PATH=include/nbl/builtin/hlsl/"


:: Count elements in "file_path" array
set /a len=0
:Loop
if defined file_path[%len%] (
set /a len+=1
GOTO :Loop
)
set /a len-=1


cd include/nbl/builtin/hlsl


:: Create non-existing file paths
for /L %%a in (0, 1, %len%) do (
if not exist "xoutput\!file_path[%%a]!" (
mkdir "xoutput/!file_path[%%a]!"
rmdir "xoutput\!file_path[%%a]!"
)
)

cd ../../../../

echo:
echo:
echo Compiling HLSL shaders...
echo:
echo:
:: Compile all
for /L %%a in (0, 1, %len%) do (
3rdparty\dxc\dxc\bin\x64\dxc.exe -HV 2021 -T lib_6_7 -I include/ -Zi -Qembed_debug -Fo %XOUTPUT_PATH%!file_path[%%a]!.bin %HLSL_PATH%!file_path[%%a]!.hlsl
)
echo:
echo:
echo Done Compiling!
echo Compiled shaders are in - "%XOUTPUT_PATH%"
echo:
echo:

pause
2 changes: 1 addition & 1 deletion examples_tests
Submodule examples_tests updated 56 files
+1 −1 0.ImportanceSamplingEnvMaps/CMakeLists.txt
+1 −1 01.HelloWorld/CMakeLists.txt
+1 −1 02.ComputeShader/CMakeLists.txt
+1 −1 03.GPU_Mesh/CMakeLists.txt
+1 −1 04.Keyframe/CMakeLists.txt
+1 −1 05.NablaTutorialExample/CMakeLists.txt
+1 −1 06.MeshLoaders/CMakeLists.txt
+1 −1 07.SubpassBaking/CMakeLists.txt
+0 −1 09.ColorSpaceTest/CMakeLists.txt
+5 −4 09.ColorSpaceTest/main.cpp
+1 −1 10.AllocatorTest/CMakeLists.txt
+1 −1 11.LoDSystem/CMakeLists.txt
+1 −1 12.glTF/CMakeLists.txt
+1 −1 13.EmptyExample/CMakeLists.txt
+1 −1 14.ComputeScan/CMakeLists.txt
+1 −1 16.OrderIndependentTransparency/CMakeLists.txt
+0 −1 17.SimpleBulletIntegration/CMakeLists.txt
+0 −1 18.MitsubaLoader/CMakeLists.txt
+1 −1 20.Megatexture/CMakeLists.txt
+1 −1 21.DynamicTextureIndexing/CMakeLists.txt
+0 −1 22.RaytracedAO/CMakeLists.txt
+1 −1 23.Autoexposure/CMakeLists.txt
+1 −1 25.Blur/CMakeLists.txt
+1 −1 27.PLYSTLDemo/CMakeLists.txt
+1 −1 29.SpecializationConstants/CMakeLists.txt
+1 −1 33.Draw3DLine/CMakeLists.txt
+1 −1 34.LRUCacheUnitTest/CMakeLists.txt
+1 −1 35.GeometryCreator/CMakeLists.txt
+0 −1 36.CUDAInterop/CMakeLists.txt
+1 −1 38.EXRSplit/CMakeLists.txt
+0 −1 39.DenoiserTonemapper/CMakeLists.txt
+1 −1 40.GLITest/CMakeLists.txt
+1 −1 41.VisibilityBuffer/CMakeLists.txt
+1 −1 42.FragmentShaderPathTracer/CMakeLists.txt
+1 −1 43.SumAndCDFFilters/CMakeLists.txt
+1 −1 44.LevelCurveExtraction/CMakeLists.txt
+1 −1 45.BRDFEvalTest/CMakeLists.txt
+1 −1 46.SamplingValidation/CMakeLists.txt
+0 −1 47.DerivMapTest/CMakeLists.txt
+1 −1 48.ArithmeticUnitTest/CMakeLists.txt
+1 −1 49.ComputeFFT/CMakeLists.txt
+1 −1 50.NewAPITest/CMakeLists.txt
+1 −1 51.RadixSort/CMakeLists.txt
+1 −1 52.SystemTest/CMakeLists.txt
+1 −1 53.ComputeShaders/CMakeLists.txt
+1 −1 54.Transformations/CMakeLists.txt
+1 −1 55.RGB18E7S3/CMakeLists.txt
+1 −1 56.RayQuery/CMakeLists.txt
+1 −1 58.MediaUnpackingOnAndroid/CMakeLists.txt
+1 −1 60.ClusteredRendering/CMakeLists.txt
+1 −1 61.BlitFilterTest/CMakeLists.txt
+0 −7 CMakeLists.txt
+1 −4 common/CommonAPI.cpp
+0 −15 common/CommonPCH/CMakeLists.txt
+0 −10 common/CommonPCH/PCH.hpp
+0 −9 common/CommonPCH/main.cpp
153 changes: 153 additions & 0 deletions include/nbl/builtin/hlsl/algorithm.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
// Copyright (C) 2022 - 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
#ifndef _NBL_BUILTIN_HLSL_ALGORITHM_INCLUDED_
#define _NBL_BUILTIN_HLSL_ALGORITHM_INCLUDED_

namespace nbl
{
namespace hlsl
{


namespace impl
{

// TODO: move this to some other header
bool isNPoT(const uint x)
{
return x&(x-1);
}

template<class Accessor, class Comparator>
struct bound_t
{
static bound_t<Accessor,Comparator> setup(uint begin, const uint end, const typename Accessor::value_type _value, const Comparator _comp)
{
bound_t<Accessor,Comparator> retval;
retval.comp = _comp;
retval.value = _value;
retval.it = begin;
retval.len = end-begin;
return retval;
}


uint operator()(inout Accessor accessor)
{
if (isNPoT(len))
{
const uint newLen = 0x1u<<firstbithigh(len);
const uint testPoint = it+(len-newLen);
len = newLen;
comp_step(accessor,testPoint);
}
while (len)
{
// could unroll 3 times or more
iteration(accessor);
iteration(accessor);
}
comp_step(accessor,it,it+1u);
return it;
}

void iteration(inout Accessor accessor)
{
len >>= 1;
const uint mid = it+len;
comp_step(accessor,mid);
}

void comp_step(inout Accessor accessor, const uint testPoint, const uint rightBegin)
{
if (comp(accessor[testPoint],value))
it = rightBegin;
}
void comp_step(inout Accessor accessor, const uint testPoint)
{
comp_step(accessor,testPoint,testPoint);
}

Comparator comp;
typename Accessor::value_type value;
uint it;
uint len;
};

template<class Accessor, class Comparator>
struct lower_to_upper_comparator_transform_t
{
bool operator()(const typename Accessor::value_type lhs, const typename Accessor::value_type rhs)
{
return !comp(rhs,lhs);
}

Comparator comp;
};

}


template<class Accessor, class Comparator>
uint lower_bound(inout Accessor accessor, const uint begin, const uint end, const typename Accessor::value_type value, const Comparator comp)
{
impl::bound_t<Accessor,Comparator> implementation = impl::bound_t<Accessor,Comparator>::setup(begin,end,value,comp);
return implementation(accessor);
}

template<class Accessor, class Comparator>
uint upper_bound(inout Accessor accessor, const uint begin, const uint end, const typename Accessor::value_type value, const Comparator comp)
{
using TransformedComparator = impl::lower_to_upper_comparator_transform_t<Accessor,Comparator>;
TransformedComparator transformedComparator;
transformedComparator.comp = comp;
return lower_bound<Accessor,TransformedComparator>(accessor,begin,end,value,transformedComparator);
}


namespace impl
{

template<typename T>
struct comparator_lt_t
{
bool operator()(const T lhs, const T rhs)
{
return lhs<rhs;
}
};

// extra indirection due to https://github.com/microsoft/DirectXShaderCompiler/issues/4771
template<class Accessor, typename T>
uint lower_bound(inout Accessor accessor, const uint begin, const uint end, const T value)
{
using Comparator = impl::comparator_lt_t<T>;
Comparator comp;
return nbl::hlsl::lower_bound<Accessor,Comparator>(accessor,begin,end,value,comp);
}
template<class Accessor, typename T>
uint upper_bound(inout Accessor accessor, const uint begin, const uint end, const T value)
{
using Comparator = impl::comparator_lt_t<T>;
Comparator comp;
return nbl::hlsl::upper_bound<Accessor,Comparator>(accessor,begin,end,value,comp);
}

}

template<class Accessor>
uint lower_bound(inout Accessor accessor, const uint begin, const uint end, const typename Accessor::value_type value)
{
return impl::lower_bound<Accessor,typename Accessor::value_type>(accessor,begin,end,value);
}
template<class Accessor>
uint upper_bound(inout Accessor accessor, const uint begin, const uint end, const typename Accessor::value_type value)
{
return impl::upper_bound<Accessor,typename Accessor::value_type>(accessor,begin,end,value);
}

}
}

#endif
Loading