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

HLSL migration of all shaders related to example 48.ArithmeticUnitTest #519

Closed
wants to merge 100 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
faf0901
First hlsl port for Scan
kpentaris Nov 13, 2022
d3d1c90
Change included file ifndef and define to BINOPS instead of MACROS
kpentaris Nov 13, 2022
7978b9a
Add macros.hlsl
kpentaris Nov 13, 2022
01a8151
Move comparator_lt_t to binops.hlsl and create gt, gte, lte
kpentaris Nov 13, 2022
90eac3d
Change min/max to use comparators
kpentaris Nov 13, 2022
30c9d71
change 'in' comparator argument to 'inout'
kpentaris Nov 13, 2022
94fe1f4
add 'bitwise_' prefix on all binops
kpentaris Nov 14, 2022
c8ead16
Add 'inout' to bitwise_max as well
kpentaris Nov 14, 2022
af5f2d0
Add NBL_HLSL_MAX/MIN to macros.hlsl
kpentaris Nov 15, 2022
cb52f01
Partial implementation of scan methods and subgroup primitives
kpentaris Nov 21, 2022
67472ba
Remove unrelated prefix from add, mul, max and min ops
kpentaris Nov 21, 2022
8863194
PR comment changes and some more additions for subgroups
kpentaris Nov 22, 2022
3782a34
Add binop::identity() as well as attempt at SPIR-V implementations of…
kpentaris Nov 23, 2022
e03b142
Add subgroup shuffle functionality and use in alternate implementatio…
kpentaris Nov 26, 2022
5317ee4
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Dec 6, 2022
34ebc4c
First few migrations of the Scan algorithm modules
kpentaris Dec 7, 2022
fa7ee6e
Merge branch 'hlsl' of https://github.com/kpentaris/Nabla into hlsl
kpentaris Dec 7, 2022
045a5ae
small ports of some other scan module components
kpentaris Dec 13, 2022
36473e3
Port and refactor virtual_workgroup.hlsl
kpentaris Dec 16, 2022
e05e236
Port core scan shaders and some other fixes. Missing descirptors for …
kpentaris Dec 19, 2022
8404e62
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Feb 23, 2023
8f8899f
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Apr 7, 2023
1f92e70
Initial porting of arithmetic shaders to HLSL
kpentaris May 14, 2023
a62c600
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris May 14, 2023
ae49fdf
Merge branch 'hlsl' of https://github.com/kpentaris/Nabla into hlsl
kpentaris May 14, 2023
e48ff51
change all #includes to use quotes
kpentaris May 15, 2023
827ff79
HLSL dependencies for example 48 arithmetic unit tests now properly c…
kpentaris May 24, 2023
dc12183
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris May 24, 2023
10a9975
Add hlsl files to builtinResources generator
kpentaris May 26, 2023
7efaebc
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris May 29, 2023
24c1f6d
Merge upstream:master to hlsl branch
kpentaris May 29, 2023
4eb0cbe
Update CMakeLists builtin resources to contain new hlsl stuff
kpentaris May 29, 2023
57827ad
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris May 31, 2023
8d4c3fc
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk Jun 7, 2023
df10f53
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk Jun 7, 2023
dfb89a5
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk Jun 7, 2023
442ebbc
update LIST_BUILTIN_RESOURCE calls
AnastaZIuk Jun 7, 2023
2212de5
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk Jun 7, 2023
93b4c25
Merge upstream master changes to hlsl branch
kpentaris Jun 7, 2023
8a37b5f
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Jun 12, 2023
a89d61c
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Jul 8, 2023
3db8e87
more fixes for arithmetic op shaders. Subgroup ops are operational an…
kpentaris Jul 8, 2023
dd6ef81
progress on workgroup operations
kpentaris Jul 9, 2023
6ae4565
Fixes subgroup and workgroup operations and switches to shuffle based…
kpentaris Jul 14, 2023
324cc29
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Jul 15, 2023
fcd4980
Add hlsl/workgroup/broadcast.hlsl to builtin resources
kpentaris Jul 15, 2023
68db7a4
Merge branch 'hlsl' of https://github.com/kpentaris/Nabla into hlsl
kpentaris Jul 15, 2023
4a93306
Change memory proxies to be defined by each entrypoint file
kpentaris Jul 24, 2023
51f7dcc
First part of changes for PR 519 review
kpentaris Jul 29, 2023
c29b401
Merge upstream to hlsl branch
kpentaris Jul 29, 2023
e242e96
Fix subgroup/workgroup scan code for PR 519
kpentaris Jul 30, 2023
1a6e684
Merge upstream to branch, up to 45b4129
kpentaris Aug 11, 2023
3c19420
Initial commit with changes for PR 519 review
kpentaris Aug 13, 2023
f5c195a
Changes for HLSL migration code review (PR 519)
kpentaris Aug 20, 2023
6339827
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Aug 20, 2023
1b5248c
Merge branch 'hlsl' of https://github.com/kpentaris/Nabla into hlsl
kpentaris Aug 20, 2023
a98b82d
Remove nested namespaces on glsl_compat files and rename to denote su…
kpentaris Aug 23, 2023
cea03c5
Merge new changes from upstream
kpentaris Aug 28, 2023
8d42583
Update hlsl files in builtin resources list
kpentaris Aug 30, 2023
99698c1
fix #include syntax that was using <> to use double quotes
kpentaris Aug 30, 2023
d58f05a
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Sep 2, 2023
5257463
rename basic.hlsl files to core.hlsl
kpentaris Sep 3, 2023
e5aaccc
Breaking commit: Remove scratch.hlsl usage
kpentaris Sep 3, 2023
97e3951
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Sep 5, 2023
35b4b25
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Sep 6, 2023
61aea56
Merge branch 'spirv-headers' into hlsl
kpentaris Sep 6, 2023
9a4e15e
Merge branch 'hlsl' of https://github.com/kpentaris/Nabla into hlsl
kpentaris Sep 6, 2023
309e7df
Merge upstream/master to branch
kpentaris Sep 10, 2023
795463d
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Sep 12, 2023
ce3c027
Revamp scratch usage for arithmetic operations, minimizing scratch size
kpentaris Sep 14, 2023
421db95
Fix formatting for all files TAB->Spaces
kpentaris Sep 14, 2023
14b9577
PR Review 519. Fixes issues with scan, change mem accessors to statef…
kpentaris Sep 19, 2023
eafa0d0
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Sep 19, 2023
f7186ff
Merge branch 'hlsl' of https://github.com/kpentaris/Nabla into hlsl
kpentaris Sep 19, 2023
138a415
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Sep 20, 2023
f3596ab
Update builtin resource list with new HLSL files
kpentaris Sep 20, 2023
a7baf73
Remove edgeBarriers from Broadacast code
kpentaris Sep 20, 2023
fbd06cc
revert change which turned submodule update off
kpentaris Sep 20, 2023
6914d97
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Sep 21, 2023
d619146
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Sep 28, 2023
5cfe363
Merge master to branch
kpentaris Oct 10, 2023
3b67a4a
Deleting files that were accidentally re-introduced with the merge
kpentaris Oct 11, 2023
6169cef
Update CMakeLists.txt with removed files from previous commit
kpentaris Oct 11, 2023
f028082
Merge master to branch
kpentaris Oct 15, 2023
27970d1
PR-519 latest updates
kpentaris Oct 17, 2023
279a6a0
Merge master to branch
kpentaris Oct 19, 2023
9ce8d9d
PR review change progress
kpentaris Oct 19, 2023
bb5b620
Further changes for PR 519
kpentaris Oct 20, 2023
0f23308
PR519 changes, simplify logic for WG reduce and scan
kpentaris Oct 21, 2023
4dff15b
Merge upstream master to branch
kpentaris Oct 21, 2023
2d5baca
PR519 changes, moving binops to functional etc
kpentaris Oct 21, 2023
f485939
Change local invocation index to subgroupcontiguousindex
kpentaris Oct 22, 2023
f0ce3f8
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Oct 22, 2023
1523935
Change code to match removal of namespace on type_traits
kpentaris Oct 22, 2023
42bae1c
move min/max outside of HLSL/CPP ifdefs to make them globally available
kpentaris Oct 23, 2023
9476315
PR519 changes/fixes. Add tessellation ctrl barrier API
kpentaris Oct 24, 2023
cab3db9
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
kpentaris Oct 24, 2023
55d13b2
Merge upstream master to branch
kpentaris Oct 25, 2023
a734d8b
Merge upstream master to branch
kpentaris Oct 29, 2023
edf0200
Pull and merge upstream branch to local
kpentaris Oct 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
9 changes: 0 additions & 9 deletions include/nbl/builtin/hlsl/algorithm.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,6 @@ uint upper_bound(inout Accessor accessor, const uint begin, const uint end, cons
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)
Expand Down
6 changes: 3 additions & 3 deletions include/nbl/builtin/hlsl/bxdf/common.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#ifndef _NBL_BUILTIN_HLSL_BXDF_COMMON_INCLUDED_
#define _NBL_BUILTIN_HLSL_BXDF_COMMON_INCLUDED_

#include <nbl/builtin/hlsl/limits.hlsl>
#include <nbl/builtin/hlsl/numbers.hlsl>
#include <nbl/builtin/hlsl/math/functions.glsl>
#include "nbl/builtin/hlsl/limits.hlsl"
#include "nbl/builtin/hlsl/numbers.hlsl"
#include "nbl/builtin/hlsl/math/functions.glsl"

namespace nbl
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
// Copyright (C) 2022 - DevSH Graphics Programming Sp. z O.O.
// Copyright (C) 2023 - 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_BINOPS_INCLUDED_
#define _NBL_BUILTIN_HLSL_BINOPS_INCLUDED_
#ifndef _NBL_BUILTIN_HLSL_FUNCTIONAL_INCLUDED_
#define _NBL_BUILTIN_HLSL_FUNCTIONAL_INCLUDED_

namespace nbl
{
namespace hlsl
{
namespace binops
{
#ifndef __HLSL_VERSION // CPP

template<class T> using bit_and = std::bit_and;
template<class T> using bit_or = std::bit_or;
template<class T> using bit_xor = std::bit_xor;
template<class T> using plus = std::plus;
template<class T> using multiplies = std::multiplies;
template<class T> using greater = std::greater;
template<class T> using less = std::less;
template<class T> using greater_equal = std::greater_equal;
template<class T> using less_equal = std::less_equal;
devshgraphicsprogramming marked this conversation as resolved.
Show resolved Hide resolved

#else // HLSL

template<typename T>
struct bitwise_and
struct bit_and
{
T operator()(const T lhs, const T rhs)
{
return lhs&rhs;
return lhs & rhs;
}

static T identity()
devshgraphicsprogramming marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -25,11 +37,11 @@ struct bitwise_and
};

template<typename T>
struct bitwise_or
struct bit_or
{
T operator()(const T lhs, const T rhs)
{
return lhs|rhs;
return lhs | rhs;
}

static T identity()
Expand All @@ -39,11 +51,11 @@ struct bitwise_or
};

template<typename T>
struct bitwise_xor
struct bit_xor
{
T operator()(const T lhs, const T rhs)
{
return lhs^rhs;
return lhs ^ rhs;
}

static T identity()
Expand All @@ -53,11 +65,11 @@ struct bitwise_xor
};

template<typename T>
struct add
struct plus
{
T operator()(const T lhs, const T rhs)
{
return lhs+rhs;
return lhs + rhs;
}

static T identity()
Expand All @@ -67,11 +79,11 @@ struct add
};

template<typename T>
struct mul
struct multiplies
{
T operator()(const T lhs, const T rhs)
{
return lhs*rhs;
return lhs * rhs;
}

static T identity()
Expand All @@ -81,48 +93,47 @@ struct mul
};

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

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

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

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

template<typename T>
struct min
struct minimum
{
devshgraphicsprogramming marked this conversation as resolved.
Show resolved Hide resolved
T operator()(const T lhs, const T rhs)
{
comparator_lt_t<T> comp;
return comp(lhs, rhs) ? lhs : rhs;
return (rhs < lhs) ? rhs : lhs;
devshgraphicsprogramming marked this conversation as resolved.
Show resolved Hide resolved
}

static T identity()
Expand All @@ -132,12 +143,11 @@ struct min
};

template<typename T>
struct max
struct maximum
{
T operator()(const T lhs, const T rhs)
{
comparator_gt_t<T> comp;
return comp(lhs, rhs) ? lhs : rhs;
return (lhs < rhs) ? rhs : lhs;
}

static T identity()
Expand All @@ -146,7 +156,8 @@ struct max
}
};

}
#endif

}
}

Expand Down
4 changes: 2 additions & 2 deletions include/nbl/builtin/hlsl/glsl_compat/core.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ T atomicCompSwap(NBL_REF_ARG(T) ptr, T comparator, T value)
}

void barrier() {
spirv::controlBarrier(2, 2, 0x8 | 0x100);
spirv::controlBarrier(spv::ScopeWorkgroup, spv::ScopeWorkgroup, spv::MemorySemanticsAcquireReleaseMask | spv::MemorySemanticsWorkgroupMemoryMask);
devshgraphicsprogramming marked this conversation as resolved.
Show resolved Hide resolved
}

void memoryBarrierShared() {
spirv::memoryBarrier(1, 0x8 | 0x100);
spirv::memoryBarrier(spv::ScopeDevice, spv::MemorySemanticsAcquireReleaseMask | spv::MemorySemanticsWorkgroupMemoryMask);
}

}
Expand Down
12 changes: 6 additions & 6 deletions include/nbl/builtin/hlsl/glsl_compat/subgroup_basic.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,27 @@ uint4 gl_SubgroupLtMask() {
}

bool subgroupElect() {
return spirv::subgroupElect(/*subgroup execution scope*/ 3);
return spirv::subgroupElect(spv::ScopeSubgroup);
}

void subgroupBarrier() {
spirv::controlBarrier(3, 3, SpvMemorySemanticsImageMemoryMask | SpvMemorySemanticsWorkgroupMemoryMask | SpvMemorySemanticsUniformMemoryMask | SpvMemorySemanticsAcquireReleaseMask);
spirv::controlBarrier(spv::ScopeSubgroup, spv::ScopeSubgroup, spv::MemorySemanticsImageMemoryMask | spv::MemorySemanticsWorkgroupMemoryMask | spv::MemorySemanticsUniformMemoryMask | spv::MemorySemanticsAcquireReleaseMask);
}

void subgroupMemoryBarrier() {
spirv::memoryBarrier(3, SpvMemorySemanticsImageMemoryMask | SpvMemorySemanticsWorkgroupMemoryMask | SpvMemorySemanticsUniformMemoryMask | SpvMemorySemanticsAcquireReleaseMask);
spirv::memoryBarrier(spv::ScopeSubgroup, spv::MemorySemanticsImageMemoryMask | spv::MemorySemanticsWorkgroupMemoryMask | spv::MemorySemanticsUniformMemoryMask | spv::MemorySemanticsAcquireReleaseMask);
}

void subgroupMemoryBarrierBuffer() {
spirv::memoryBarrier(3, SpvMemorySemanticsAcquireReleaseMask | SpvMemorySemanticsUniformMemoryMask);
spirv::memoryBarrier(spv::ScopeSubgroup, spv::MemorySemanticsAcquireReleaseMask | spv::MemorySemanticsUniformMemoryMask);
}

void subgroupMemoryBarrierShared() {
spirv::memoryBarrier(3, SpvMemorySemanticsAcquireReleaseMask | SpvMemorySemanticsWorkgroupMemoryMask);
spirv::memoryBarrier(spv::ScopeSubgroup, spv::MemorySemanticsAcquireReleaseMask | spv::MemorySemanticsWorkgroupMemoryMask);
}

void subgroupMemoryBarrierImage() {
spirv::memoryBarrier(3, SpvMemorySemanticsAcquireReleaseMask | SpvMemorySemanticsImageMemoryMask);
spirv::memoryBarrier(spv::ScopeSubgroup, spv::MemorySemanticsAcquireReleaseMask | spv::MemorySemanticsImageMemoryMask);
}

}
Expand Down
26 changes: 0 additions & 26 deletions include/nbl/builtin/hlsl/spirv_intrinsics/ballot.hlsl

This file was deleted.

2 changes: 1 addition & 1 deletion include/nbl/builtin/hlsl/spirv_intrinsics/core.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define _NBL_BUILTIN_HLSL_SPIRV_INTRINSICS_CORE_INCLUDED_


#include "spirv/unified1/spirv.h"
#include "spirv/unified1/spirv.hpp"


namespace nbl
Expand Down
32 changes: 0 additions & 32 deletions include/nbl/builtin/hlsl/spirv_intrinsics/shuffle.hlsl

This file was deleted.

Loading