Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
867b6b8
Created `nbl::system::to_string` utility function
Przemog1 Dec 1, 2025
ac75675
Removed from the `to_string` function specialization of types not pre…
Przemog1 Dec 1, 2025
3e5cbde
Restored the removed `system::to_string` specializations
Przemog1 Dec 1, 2025
7871e1b
Fixes
Przemog1 Dec 1, 2025
e97c681
Updated examples_tests
Przemog1 Dec 15, 2025
8d773e5
Updated examples
Przemog1 Dec 15, 2025
138fb9b
Updated examples
Przemog1 Dec 15, 2025
d81a199
Updated examples
Przemog1 Dec 15, 2025
e9dc279
get latest glm
Dec 15, 2025
5e30ad9
Extended matrix
Przemog1 Dec 15, 2025
95170b9
update gli now
Dec 15, 2025
252c777
fixed example 22
Dec 15, 2025
d86b4cb
Implemented relative approx compare
Przemog1 Dec 17, 2025
f01cee4
Fixed bug in CStdoutLogger
Przemog1 Dec 19, 2025
c319660
Every ILogger::log call now uses string literal as its first argument
Przemog1 Dec 19, 2025
d3c1e84
initial example
keptsecret Feb 4, 2025
babda46
use bxdf creation params struct
keptsecret Feb 6, 2025
462a9b3
triangle and rectangle shapes
keptsecret Feb 7, 2025
7d5d70c
more sampling methods
keptsecret Feb 10, 2025
15801af
spherical rectangle
keptsecret Feb 11, 2025
7419893
fix aniso cache bug
keptsecret Feb 17, 2025
cf2476d
init func to modify bxdf params directly
keptsecret Feb 18, 2025
535e18d
bug fixes
keptsecret Feb 20, 2025
b45f0a8
fix sampling bugs #2
keptsecret Feb 21, 2025
9d1de16
temporary fix for dxc bug issue 7154
keptsecret Feb 25, 2025
28fd99e
some bug fixes again
keptsecret Feb 26, 2025
ed713f8
fix wrong template usage
keptsecret Feb 27, 2025
3de1462
fix typo
keptsecret Mar 4, 2025
3bd988b
fixed some func usage to nbl ver
keptsecret Mar 14, 2025
320bf0e
specify template args
keptsecret Mar 17, 2025
52ad8a9
fix use of static const in func
keptsecret Mar 21, 2025
8aa9903
added more morton order stuff
keptsecret Mar 24, 2025
f7b0eef
use new angle adder
keptsecret Nov 13, 2025
c29fa62
initialize invalid ndf return to inf, not 0
keptsecret Nov 13, 2025
49db9d6
derive trait from cook torrance base
keptsecret Nov 13, 2025
9eb3a18
fix angle adder
keptsecret Nov 13, 2025
f1e3454
optimizations to iridescent fresnel
keptsecret Nov 13, 2025
f4755dd
avoid repeat fresnel calc
keptsecret Nov 13, 2025
558177c
mix reflectance w/ transmission in getScaledReflectance
keptsecret Nov 13, 2025
3f92c27
some minor fixes to fresnel orientedEta usage
keptsecret Nov 14, 2025
0580e99
refactor usage of angle adding
keptsecret Nov 14, 2025
cb542f2
temp? fix for mix_helper on floats
keptsecret Nov 14, 2025
f826120
Created RWMC files
Przemog1 Oct 18, 2025
0a864b1
Refactored resolve.hlsl
Przemog1 Nov 13, 2025
a86a1b3
added missing typename qualifier
keptsecret Nov 14, 2025
df9faf9
minor fixes to spherical rect, latest example
keptsecret Nov 17, 2025
e203109
quaternion struct, renamed spherical tri/rect shapes
keptsecret Nov 18, 2025
07bf4d9
make PartitionRandVar in struct and templated
keptsecret Nov 18, 2025
ff88a7d
precompute values in linear, bilinear sampling; make box muller a struct
keptsecret Nov 18, 2025
6cb5324
precompute cos_sides, csc_sides in shape spherical_tri
keptsecret Nov 19, 2025
7a4f0d6
Fixed `ResolveAccessor` concept
Przemog1 Nov 14, 2025
d97664c
fix spherical tri precompute
keptsecret Nov 20, 2025
0b089b9
make rwmc accumulator match concept
keptsecret Nov 26, 2025
3ba44cb
pack rwmc params to half 2x16
keptsecret Nov 27, 2025
5a80b45
took 1transformation_matrix_utils.hlsl` from Arek's `cameraz` branch
karimsayedre Nov 26, 2025
e14e8ec
change quaternion struct name to match what it will be
keptsecret Dec 2, 2025
a361548
removed temp fix for mix_helper require
keptsecret Dec 4, 2025
77c29e5
fixes more nan problems + a few bugs in iridescent fresnel
keptsecret Dec 5, 2025
13f8052
fixes iridescent fresnel under transmission
keptsecret Dec 5, 2025
a9e7f39
fix wrong get refraction eta in iridescent transmission
keptsecret Dec 5, 2025
6004b83
quantized sequence packing data
keptsecret Dec 8, 2025
e456e26
templated quantized sequence
keptsecret Dec 9, 2025
d1a5eb5
quantized sequence decode
keptsecret Dec 9, 2025
a512e39
quantized sequence get/set values by index, simplify decode func spec…
keptsecret Dec 10, 2025
f8f6ab0
quantized sequence encode should right shift input, changed scramble …
keptsecret Dec 10, 2025
4092952
added decode variant for scramble before decode
keptsecret Dec 11, 2025
9794d36
some minor fixes to quantized sequence set, decode
keptsecret Dec 12, 2025
cc2263a
fix quantized sequence mask being too small, assert conditions
keptsecret Dec 15, 2025
29bc8b0
fixed problems from merging master
keptsecret Dec 15, 2025
6371e60
fix decode scramble key, shifting discard bits in quantization
keptsecret Dec 15, 2025
59d4f79
fix z component storing too many bits in quantized sequence in vec2 d…
keptsecret Dec 15, 2025
7a8b9a5
mix_helper requirements include bool vectors
keptsecret Dec 16, 2025
0063658
fix iridescent oriented eta bug
keptsecret Dec 16, 2025
eb369cf
partitionRandVar stores leftProb, fix minor bugs
keptsecret Dec 16, 2025
92493da
plain const for vector types
keptsecret Dec 16, 2025
38f68a7
fixes to iridescent fresnel, moved getOrientedEtaRcp to dielectric fr…
keptsecret Dec 16, 2025
5c1dc53
adjust mix_helper calling select requirements
keptsecret Dec 16, 2025
a846ae4
restore regular triangle stuff, refactor usage
keptsecret Dec 16, 2025
eb2679e
minor changes to rwmc usage
keptsecret Dec 16, 2025
8fc944a
remove storing texture inside local var of ResolveAccessorAdaptor
keptsecret Dec 16, 2025
f759821
removed accessor, user should provide accessor that matches concept
keptsecret Dec 16, 2025
c356749
fix formatting, name
keptsecret Dec 16, 2025
0478e76
added more things to precompute
keptsecret Dec 16, 2025
5c83e69
changes to splatting params precompute for the last time
keptsecret Dec 16, 2025
ea1919e
check that eta type of dielectric fresnels should be monochrome
keptsecret Dec 16, 2025
367b9bf
Change `Compile flag error` to `Compile flag warning`
devshgraphicsprogramming Dec 16, 2025
e134378
Create docs for NSC prebuilds
AnastaZIuk Dec 18, 2025
a16cce2
Remove duplicate partial specialization for truncate and emulated_vec
Dec 19, 2025
c1f945f
Updated DXC
Przemog1 Dec 20, 2025
a00d122
Adds a flag to NSC to support preprocessing shaders and storing the r…
Fletterio Dec 22, 2025
e42cc99
update docker/compiler-explorer submodule
AnastaZIuk Dec 23, 2025
3347a49
update docker/compiler-explorer submodule
AnastaZIuk Dec 23, 2025
7d89326
update docker/compiler-explorer submodule
AnastaZIuk Dec 23, 2025
184c274
added debug draw aabb extension, moved from ex
keptsecret Jul 8, 2025
e642b55
removed todos
keptsecret Jul 8, 2025
6e49dc7
support hlsl AABBs, also OBBs with transform
keptsecret Jul 9, 2025
9211c07
minor syntax changes
keptsecret Aug 18, 2025
6267b9f
use hlsl cpp compat matrices, aabb
keptsecret Aug 19, 2025
47f40aa
change batch render to use indexed draw
keptsecret Aug 19, 2025
c90dfcf
simplified single AABB draw
keptsecret Aug 20, 2025
17a135c
change batch render to take span of InstanceData
keptsecret Aug 20, 2025
1b7a433
removed vertex buffer, use const vertex array in shader instead
keptsecret Aug 20, 2025
65cf00d
validate creation params, added draw modes at create time
keptsecret Aug 20, 2025
3d9d614
enable debug draw by default
keptsecret Sep 8, 2025
1f423d6
fix embed builtin resource build
keptsecret Sep 16, 2025
1669941
resolve https://github.com/Devsh-Graphics-Programming/Nabla/pull/900#…
AnastaZIuk Sep 16, 2025
789bdbd
fix + optimize aabb vertex calc, includes
keptsecret Nov 27, 2025
00af78c
changed debug_draw library target usage
keptsecret Nov 27, 2025
f36ee1a
some fixes to draw aabb
keptsecret Nov 27, 2025
cf2cb3e
removed commented out bit
keptsecret Nov 28, 2025
0617056
create pipelineLayout util can takes mode, also create layout if miss…
keptsecret Nov 28, 2025
9edb083
aabb local transform is 3x4, common draw param struct between single …
keptsecret Nov 28, 2025
f47e857
write instances data directly to streaming buffer mem
keptsecret Nov 28, 2025
035d632
use single use cmdbuf to fill indices buffer
keptsecret Dec 1, 2025
173995a
roll constructor params into own struct, fix assert in validation
keptsecret Dec 18, 2025
b5dd56b
adds a check against double mounting same archive
keptsecret Dec 18, 2025
4965339
return false if the streaming buffer is too small
keptsecret Dec 19, 2025
1a32499
some fixes to using/filling streaming buffer
keptsecret Dec 22, 2025
18b5a4d
combined draw aabb shaders into unified, added precompile shaders to …
keptsecret Dec 22, 2025
f54d9b2
restore ifdef for mounting builtin resources, minor fixes to mounting
keptsecret Dec 23, 2025
789e88b
simplified usage of streaming buffer alignments, flush unused memory …
keptsecret Dec 23, 2025
b7a03ee
fix calculating remaining instances bytes
keptsecret Dec 23, 2025
e8f4d00
check whether spirv exists
keptsecret Dec 23, 2025
0dce95e
try to fit as much as possible even when fail to allocate, go down by…
keptsecret Dec 23, 2025
5373611
update include paths for debug draw ext
AnastaZIuk Dec 23, 2025
48eb604
fix mount logic for debug draw ext, perform tests on builtins on/off
AnastaZIuk Dec 23, 2025
3e5d7cb
Fixed emulated vector template resolution ambiguity
Fletterio Dec 24, 2025
a75adfa
include `thmath.hlsl` in `functions.hlsl`
karimsayedre Dec 23, 2025
dc6ce11
init
GDBobby Sep 30, 2025
2d9f2f6
i still need to reconcile mesh with compute. its based off graphics r…
GDBobby Oct 3, 2025
bf48d8e
graphics are stable - mesh prototype complete
GDBobby Oct 3, 2025
49b2814
still bug catching in example
GDBobby Oct 9, 2025
0842f40
lingering uncommitted changes
GDBobby Dec 8, 2025
ed1c527
i still need to reconcile mesh with compute. its based off graphics r…
GDBobby Oct 3, 2025
e4abc1f
graphics are stable - mesh prototype complete
GDBobby Oct 3, 2025
7b15bf7
still bug catching in example
GDBobby Oct 9, 2025
d4dd56f
i was using dispatch for mesh shaders for some dumb reason (fixed)
GDBobby Dec 20, 2025
b591c5e
minor cleanup
GDBobby Dec 24, 2025
4cc53a6
cleaning
GDBobby Dec 24, 2025
c86accb
indirect commands are simpler than i expected
GDBobby Dec 24, 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
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
url = [email protected]:Devsh-Graphics-Programming/Nabla-Continous-Integration-Python-Framework.git
[submodule "3rdparty/boost/superproject"]
path = 3rdparty/boost/superproject
url = ../boost.git
url = [email protected]:Devsh-Graphics-Programming/boost.git

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as @AnastaZIuk will tell you, this needs to stay as it was, you need to for the submodules yourself as well.

Its important the submodules are relative.

[submodule "3rdparty/argparse"]
path = 3rdparty/argparse
url = [email protected]:p-ranav/argparse.git
Expand Down Expand Up @@ -117,7 +117,7 @@
url = [email protected]:Devsh-Graphics-Programming/glm.git
[submodule "docker/msvc-winsdk"]
path = docker/msvc-winsdk
url = ../docker-nanoserver-msvc-winsdk
url = [email protected]:Devsh-Graphics-Programming/docker-nanoserver-msvc-winsdk.git
[submodule "3rdparty/gtl"]
path = 3rdparty/gtl
url = https://github.com/greg7mdp/gtl.git
Expand Down
2 changes: 2 additions & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
endif()

# boost
set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE) #forcing boost to be in release
add_subdirectory(boost boost EXCLUDE_FROM_ALL)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "" FORCE) #restoring config from boost

set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE INTERNAL "Skip SPIRV-Headers install")
set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE INTERNAL "Skip SPIRV-Headers examples")
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/dxc/dxc
Submodule dxc updated 88 files
+2 −2 .github/workflows/clang-format-checker.yml
+5 −3 cmake/modules/HCT.cmake
+27 −2 docs/DXIL.rst
+1 −1 external/SPIRV-Headers
+1 −1 external/SPIRV-Tools
+121 −14 include/dxc/DXIL/DxilConstants.h
+268 −0 include/dxc/DXIL/DxilInstructions.h
+28 −3 include/dxc/DXIL/DxilOperations.h
+4 −1 include/dxc/DXIL/DxilShaderModel.h
+11 −1 include/dxc/HlslIntrinsicOp.h
+3 −0 include/dxc/Support/HLSLOptions.td
+1 −0 include/dxc/Support/SPIRVOptions.h
+6 −2 include/dxc/Support/dxcapi.use.h
+423 −219 lib/DXIL/DxilOperations.cpp
+2 −0 lib/DxcSupport/HLSLOptions.cpp
+20 −7 lib/DxilValidation/DxilValidation.cpp
+55 −6 lib/HLSL/HLOperationLower.cpp
+18 −12 lib/Transforms/Scalar/Float2Int.cpp
+2 −2 projects/dxilconv/lib/DxbcConverter/DxbcConverter.cpp
+3 −1 projects/dxilconv/lib/DxbcConverter/DxbcUtil.cpp
+1 −1 tools/clang/.clang-tidy
+3 −3 tools/clang/include/clang/AST/ASTContext.h
+2 −1 tools/clang/include/clang/AST/HlslTypes.h
+1 −1 tools/clang/include/clang/Frontend/CompilerInstance.h
+2 −1 tools/clang/include/clang/Frontend/FrontendAction.h
+9 −9 tools/clang/include/clang/SPIRV/FeatureManager.h
+5 −2 tools/clang/lib/AST/ASTContext.cpp
+2 −2 tools/clang/lib/Frontend/CompilerInstance.cpp
+4 −3 tools/clang/lib/Frontend/FrontendAction.cpp
+3 −0 tools/clang/lib/SPIRV/AlignmentSizeCalculator.cpp
+9 −1 tools/clang/lib/SPIRV/DeclResultIdMapper.cpp
+9 −9 tools/clang/lib/SPIRV/FeatureManager.cpp
+9 −2 tools/clang/lib/SPIRV/InitListHandler.cpp
+2 −4 tools/clang/lib/SPIRV/LowerTypeVisitor.cpp
+128 −13 tools/clang/lib/SPIRV/SpirvEmitter.cpp
+7 −0 tools/clang/lib/SPIRV/SpirvEmitter.h
+111 −4 tools/clang/lib/Sema/SemaHLSL.cpp
+10 −7 tools/clang/test/CodeGenSPIRV/inline-spirv/spv.intrinsicStorageClass.hlsl
+18 −0 tools/clang/test/CodeGenSPIRV/inline-spirv/spv.raytracing.hlsl
+31 −2 tools/clang/test/CodeGenSPIRV/intrinsics.asdouble.hlsl
+197 −11 tools/clang/test/CodeGenSPIRV/intrinsics.countbits.hlsl
+6 −6 tools/clang/test/CodeGenSPIRV/scalar.layout.array.hlsl
+33 −0 tools/clang/test/CodeGenSPIRV/scalar.layout.struct.aligned.size.hlsl
+29 −0 tools/clang/test/CodeGenSPIRV/scalar.layout.struct.array.hlsl
+9 −4 tools/clang/test/CodeGenSPIRV/sm6.quad-any-all.hlsl
+4 −1 tools/clang/test/CodeGenSPIRV/sm6.quad-read-across-diagonal.hlsl
+4 −1 tools/clang/test/CodeGenSPIRV/sm6.quad-read-across-diagonal.vulkan1.2.hlsl
+4 −1 tools/clang/test/CodeGenSPIRV/sm6.quad-read-across-x.hlsl
+4 −1 tools/clang/test/CodeGenSPIRV/sm6.quad-read-across-x.vulkan1.2.hlsl
+4 −1 tools/clang/test/CodeGenSPIRV/sm6.quad-read-across-y.hlsl
+4 −1 tools/clang/test/CodeGenSPIRV/sm6.quad-read-across-y.vulkan1.2.hlsl
+4 −1 tools/clang/test/CodeGenSPIRV/sm6.quad-read-lane-at.hlsl
+35 −0 tools/clang/test/CodeGenSPIRV/sm6.quad-read-lane-at.quad.vulkan1.2.hlsl
+4 −2 tools/clang/test/CodeGenSPIRV/sm6.quad-read-lane-at.vulkan1.2.hlsl
+16 −0 tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.return.counter.hlsl
+25 −0 tools/clang/test/CodeGenSPIRV/spirv-codegen-struct-inheritance.hlsl
+1 −1 tools/clang/test/CodeGenSPIRV/spirv.debug.opline.intrinsic.vulkan1.1.hlsl
+36 −0 tools/clang/test/CodeGenSPIRV/type.constant-buffer.pass.hlsl
+37 −0 tools/clang/test/CodeGenSPIRV/type.texture-buffer.pass.hlsl
+29 −0 tools/clang/test/CodeGenSPIRV/vk.buffer-pointer.different-storage-class.hlsl
+22 −0 tools/clang/test/CodeGenSPIRV/vk.buffer-pointer.initlist.hlsl
+10 −10 tools/clang/test/CodeGenSPIRV/vk.layout.cbuffer.scalar.hlsl
+44 −0 tools/clang/test/DXC/experimental-dxil-6-10-op.ll
+22 −5 tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/derivatives_in_csmsas.hlsl
+26 −0 tools/clang/test/HLSLFileCheck/hlsl/types/cast/cast8.hlsl
+1 −1 tools/clang/test/HLSLFileCheck/validation/callgraph/deriv-in-nested-fn-node-lib68-launch.ll
+9 −3 tools/clang/test/LitDXILValidation/illegalDXILOp.ll
+35 −0 tools/clang/test/LitDXILValidation/invalid-experimental-dxil-6-10-op-on-6-8.ll
+35 −0 tools/clang/test/LitDXILValidation/invalid-experimental-dxil-6-10-op-on-6-9.ll
+3 −0 tools/clang/test/taef_exec/lit.cfg
+5 −2 tools/clang/tools/dxcompiler/dxcdisassembler.cpp
+4 −1 tools/clang/tools/dxcompiler/dxcompilerobj.cpp
+19 −48 tools/clang/unittests/HLSLExec/ExecutionTest.cpp
+242 −134 tools/clang/unittests/HLSLExec/HlslExecTestUtils.cpp
+31 −6 tools/clang/unittests/HLSLExec/HlslExecTestUtils.h
+35 −8 tools/clang/unittests/HLSLExec/LongVectorOps.def
+160 −43 tools/clang/unittests/HLSLExec/LongVectors.cpp
+64 −6 tools/clang/unittests/HLSLExec/ShaderOpArith.xml
+6 −7 tools/clang/unittests/HLSLExec/TableParameterHandler.h
+0 −73 tools/clang/utils/CaptureCmd
+2 −1 unittests/Support/ProgramTest.cpp
+0 −32 utils/DSAclean.py
+1 −1 utils/git/requirements_formatting.txt
+14 −0 utils/hct/gen_intrin_main.txt
+918 −516 utils/hct/hctdb.py
+86 −57 utils/hct/hctdb_instrhelp.py
+12 −2 utils/hct/hlsl_intrinsic_opcodes.json
+3 −3 utils/version/latest-release.json
2 changes: 1 addition & 1 deletion 3rdparty/gli
Submodule gli updated 1 files
+1 −1 gli/core/format.inl
2 changes: 1 addition & 1 deletion 3rdparty/glm
Submodule glm updated 1153 files
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ option(NBL_FAST_MATH "Enable fast low-precision math" OFF) # the reason OFF is b
option(NBL_BUILD_EXAMPLES "Enable building examples" ON)
option(NBL_BUILD_MITSUBA_LOADER "Enable nbl::ext::MitsubaLoader?" OFF) # TODO: once it compies turn this ON by default!
option(NBL_BUILD_IMGUI "Enable nbl::ext::ImGui?" ON)
option(NBL_BUILD_DEBUG_DRAW "Enable Nabla Debug Draw extension?" ON)

option(NBL_BUILD_OPTIX "Enable nbl::ext::OptiX?" OFF)
if(NBL_COMPILE_WITH_CUDA)
Expand Down
2 changes: 1 addition & 1 deletion docker/compiler-explorer
386 changes: 386 additions & 0 deletions docs/nsc-prebuilds.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples_tests
Submodule examples_tests updated 369 files
2 changes: 2 additions & 0 deletions include/nbl/application_templates/MonoDeviceApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class MonoDeviceApplication : public virtual MonoSystemMonoLoggerApplication

const auto supportedPreferredFormats = getPreferredDeviceFeatures().intersectWith(m_physicalDevice->getFeatures());
params.featuresToEnable = getRequiredDeviceFeatures().unionWith(supportedPreferredFormats);
params.featuresToEnable.meshShader = true;
params.featuresToEnable.taskShader = true;
Comment on lines 76 to +78

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can't add this to all examples, override the function like the raytracing examples in the mesh shader example


m_device = m_physicalDevice->createLogicalDevice(std::move(params));
if (!m_device)
Expand Down
1 change: 1 addition & 0 deletions include/nbl/asset/IAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class IAsset : virtual public core::IReferenceCounted
ET_PIPELINE_CACHE = 1ull<<21, //!< asset::ICPUPipelineCache
ET_SCENE = 1ull<<22, //!< reserved, to implement later
ET_RAYTRACING_PIPELINE = 1ull << 23, //!< asset::ICPURayTracingPipeline
ET_MESH_PIPELINE = 1ull << 24,
ET_IMPLEMENTATION_SPECIFIC_METADATA = 1ull<<31u, //!< lights, etc.
//! Reserved special value used for things like terminating lists of this enum

Expand Down
145 changes: 145 additions & 0 deletions include/nbl/asset/ICPUMeshPipeline.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
#ifndef _NBL_I_CPU_MESH_PIPELINE_H_INCLUDED_
#define _NBL_I_CPU_MESH_PIPELINE_H_INCLUDED_


#include "nbl/asset/IMeshPipeline.h"
#include "nbl/asset/ICPURenderpass.h"
#include "nbl/asset/ICPUPipeline.h"


namespace nbl::asset
{

class ICPUMeshPipeline final : public ICPUPipeline<IMeshPipeline<ICPUPipelineLayout,ICPURenderpass>>
{
using pipeline_base_t = IMeshPipeline<ICPUPipelineLayout, ICPURenderpass>;
using base_t = ICPUPipeline<pipeline_base_t>;

public:

static core::smart_refctd_ptr<ICPUMeshPipeline> create(ICPUPipelineLayout* layout, ICPURenderpass* renderpass = nullptr)
{
auto retval = new ICPUMeshPipeline(layout, renderpass);
return core::smart_refctd_ptr<ICPUMeshPipeline>(retval,core::dont_grab);
}

constexpr static inline auto AssetType = ET_MESH_PIPELINE;
inline E_TYPE getAssetType() const override { return AssetType; }

inline const SCachedCreationParams& getCachedCreationParams() const
{
return pipeline_base_t::getCachedCreationParams();
}

inline SCachedCreationParams& getCachedCreationParams()
{
assert(isMutable());
return m_params;
}

inline std::span<const SShaderSpecInfo> getSpecInfos(const hlsl::ShaderStage stage) const override final
{
switch (stage) {
case hlsl::ShaderStage::ESS_TASK: return { &m_specInfos[0], 1 };
case hlsl::ShaderStage::ESS_MESH: return { &m_specInfos[1], 1 };
case hlsl::ShaderStage::ESS_FRAGMENT: return { &m_specInfos[2], 1 };
}
return {};
}

inline std::span<SShaderSpecInfo> getSpecInfos(const hlsl::ShaderStage stage)
{
return base_t::getSpecInfos(stage);
}

SShaderSpecInfo* getSpecInfo(const hlsl::ShaderStage stage)
{
if (!isMutable()) return nullptr;
switch (stage) {
case hlsl::ShaderStage::ESS_TASK: return &m_specInfos[0];
case hlsl::ShaderStage::ESS_MESH: return &m_specInfos[1];
case hlsl::ShaderStage::ESS_FRAGMENT: return &m_specInfos[2];
}
return nullptr;
}

const SShaderSpecInfo* getSpecInfo(const hlsl::ShaderStage stage) const
{
const auto stageIndex = stageToIndex(stage);
if (stageIndex != -1)
return &m_specInfos[stageIndex];
return nullptr;
}

inline bool valid() const override
{
if (!m_layout) return false;
if (!m_layout->valid())return false;

// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkGraphicsPipelineCreateInfo.html#VUID-VkGraphicsPipelineCreateInfo-dynamicRendering-06576
if (!m_renderpass || m_params.subpassIx >= m_renderpass->getSubpassCount()) return false;

core::bitflag<hlsl::ShaderStage> stagePresence = {};
for (auto shader_i = 0u; shader_i < m_specInfos.size(); shader_i++)
{
const auto& info = m_specInfos[shader_i];
if (info.shader)
stagePresence |= indexToStage(shader_i);
}
return hasRequiredStages(stagePresence);
}

protected:
using base_t::base_t;
virtual ~ICPUMeshPipeline() override = default;

std::array<SShaderSpecInfo, MESH_SHADER_STAGE_COUNT> m_specInfos;

private:
explicit ICPUMeshPipeline(ICPUPipelineLayout* layout, ICPURenderpass* renderpass)
: base_t(layout, {}, renderpass)
{}

static inline int8_t stageToIndex(const hlsl::ShaderStage stage)
{
const auto stageIx = hlsl::findLSB(stage);
if (stageIx < 0 || stageIx >= MESH_SHADER_STAGE_COUNT || hlsl::bitCount(stage)!=1)
return -1;
return stageIx;
}

static inline hlsl::ShaderStage indexToStage(const int8_t index)
{
switch (index) {
case 0: return hlsl::ShaderStage::ESS_TASK;
case 1: return hlsl::ShaderStage::ESS_MESH;
case 2: return hlsl::ShaderStage::ESS_FRAGMENT;
}
return hlsl::ShaderStage::ESS_UNKNOWN;
}

inline core::smart_refctd_ptr<base_t> clone_impl(core::smart_refctd_ptr<ICPUPipelineLayout>&& layout, uint32_t depth) const override final
{
auto* newPipeline = new ICPUMeshPipeline(layout.get(), m_renderpass.get());
newPipeline->m_params = m_params;

for (auto specInfo_i = 0u; specInfo_i < m_specInfos.size(); specInfo_i++)
{
newPipeline->m_specInfos[specInfo_i] = m_specInfos[specInfo_i].clone(depth);
}

return core::smart_refctd_ptr<base_t>(newPipeline, core::dont_grab);
}

inline void visitDependents_impl(std::function<bool(const IAsset*)> visit) const override
{
if (!visit(m_layout.get())) return;
if (!visit(m_renderpass.get())) return;
for (const auto& info : m_specInfos)
if (!visit(info.shader.get())) return;
}
};

}

#endif
59 changes: 59 additions & 0 deletions include/nbl/asset/IMeshPipeline.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#ifndef _NBL_ASSET_I_MESH_PIPELINE_H_INCLUDED_
#define _NBL_ASSET_I_MESH_PIPELINE_H_INCLUDED_

#include "nbl/asset/IShader.h"
#include "nbl/asset/RasterizationStates.h"
#include "nbl/asset/IPipeline.h"


namespace nbl::asset {
class IMeshPipelineBase : public virtual core::IReferenceCounted {
public:
constexpr static inline uint8_t MESH_SHADER_STAGE_COUNT = 3u; //i dont know what this is going to be used for yet, might be redundant
struct SCachedCreationParams final {
SRasterizationParams rasterization = {};
SBlendParams blend = {};
uint32_t subpassIx = 0u; //this subpass stuff is eluding me rn. i might just need to crack open the vulkan documentation
uint8_t requireFullSubgroups = false;
};

};

template<typename PipelineLayoutType, typename RenderpassType>
class IMeshPipeline : public IPipeline<PipelineLayoutType>, public IMeshPipelineBase {
protected:
using renderpass_t = RenderpassType;
//using base_creation_params_t = IPipeline<PipelineLayoutType>;//compute uses this, idk if its necessary yet
public:

static inline bool hasRequiredStages(const core::bitflag<hlsl::ShaderStage>& stagePresence)
{
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkGraphicsPipelineCreateInfo.html#VUID-VkGraphicsPipelineCreateInfo-stage-02096
if (!stagePresence.hasFlags(hlsl::ShaderStage::ESS_MESH)) {
return false;
}
//i dont quite understand why igraphicspipeline doesnt require a fragment shader. is it not required by vulkan?
if (!stagePresence.hasFlags(hlsl::ShaderStage::ESS_FRAGMENT)) {
return false;
}

return true;
}

inline const SCachedCreationParams& getCachedCreationParams() const { return m_params; }

protected:
explicit IMeshPipeline(PipelineLayoutType* layout, const SCachedCreationParams& cachedParams, renderpass_t* renderpass) :
IPipeline<PipelineLayoutType>(core::smart_refctd_ptr<PipelineLayoutType>(layout)),
m_params(cachedParams), m_renderpass(core::smart_refctd_ptr<renderpass_t>(renderpass))
{
}

SCachedCreationParams m_params = {};
core::smart_refctd_ptr<renderpass_t> m_renderpass = nullptr;
};

}


#endif
17 changes: 17 additions & 0 deletions include/nbl/builtin/glsl/utils/morton.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ uint nbl_glsl_morton_decode2d8bComponent(in uint x)
return x;
}

uint nbl_glsl_morton_decode2d32bComponent(in uint x)
{
x &= 0x55555555u;
x = (x ^ (x >> 1u)) & 0x33333333u;
x = (x ^ (x >> 2u)) & 0x0f0f0f0fu;
x = (x ^ (x >> 4u)) & 0x00ff00ffu;
x = (x ^ (x >> 8u)) & 0x0000ffffu;
x = (x ^ (x >> 16u));
return x;
}


uvec2 nbl_glsl_morton_decode2d4b(in uint x)
{
return uvec2(nbl_glsl_morton_decode2d4bComponent(x), nbl_glsl_morton_decode2d4bComponent(x >> 1u));
Expand All @@ -32,4 +44,9 @@ uvec2 nbl_glsl_morton_decode2d8b(in uint x)
return uvec2(nbl_glsl_morton_decode2d8bComponent(x), nbl_glsl_morton_decode2d8bComponent(x >> 1u));
}

uvec2 nbl_glsl_morton_decode2d32b(in uint x)
{
return uvec2(nbl_glsl_morton_decode2d32bComponent(x), nbl_glsl_morton_decode2d32bComponent(x >> 1u));
}

#endif
Loading