Skip to content

Commit 50b6493

Browse files
author
kevyuu
committed
Merge branch 'master' into mesh_loaders_kevin
2 parents 1bedf2d + 9109197 commit 50b6493

File tree

16 files changed

+247
-144
lines changed

16 files changed

+247
-144
lines changed

.github/workflows/build-nabla.yml

Lines changed: 86 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Nabla Workflow
1+
name: Build
22

33
on:
44
push:
@@ -7,14 +7,16 @@ on:
77

88
permissions:
99
contents: read
10+
checks: write
1011

1112
concurrency:
1213
group: push-lock-${{ github.ref }}
1314
cancel-in-progress: true
1415

1516
jobs:
1617
build-windows:
17-
runs-on: windows-2022
18+
name: Nabla (${{ matrix.os }}, ${{ matrix.vendor }}-${{ matrix.tag }}, ${{ matrix.config }})
19+
runs-on: ${{ matrix.os }}
1820

1921
env:
2022
image: ghcr.io/devsh-graphics-programming/docker-nanoserver-msvc-winsdk
@@ -33,6 +35,7 @@ jobs:
3335
vendor: [msvc]
3436
config: [Release, Debug, RelWithDebInfo]
3537
tag: ['17.13.6']
38+
os: [windows-2022]
3639

3740
steps:
3841
- name: Environment Setup
@@ -129,7 +132,30 @@ jobs:
129132
--preset ci-build-dynamic-${{ matrix.vendor }} `
130133
-t run-compiler-explorer --config ${{ matrix.config }}
131134
132-
- name: Container – Build Examples
135+
- name: Container – Install Nabla
136+
run: |
137+
docker exec orphan `
138+
${{ env.entry }} ${{ env.cmd }} -Command cmake --install `
139+
${{ env.binary }} --config ${{ matrix.config }} `
140+
--prefix ${{ env.install }}
141+
142+
- name: API / Examples / Check Run (Create)
143+
id: check-run-create
144+
uses: actions/github-script@v6
145+
with:
146+
github-token: ${{ secrets.GITHUB_TOKEN }}
147+
result-encoding: string
148+
script: |
149+
const response = await github.rest.checks.create({
150+
owner: context.repo.owner,
151+
repo: context.repo.repo,
152+
name: `Examples (${{ matrix.os }}, ${{ matrix.vendor }}-${{ matrix.tag }}, ${{ matrix.config }})`,
153+
head_sha: context.sha,
154+
status: 'in_progress'
155+
});
156+
return response.data.id;
157+
158+
- name: Container – Build & Install Examples
133159
id: build-examples
134160
continue-on-error: true
135161
run: |
@@ -139,21 +165,39 @@ jobs:
139165
-t examples_tests\all --config ${{ matrix.config }} `
140166
-- -k 0
141167
142-
- name: Container – Install Nabla
143-
run: |
144168
docker exec orphan `
145169
${{ env.entry }} ${{ env.cmd }} -Command cmake --install `
146-
${{ env.binary }} --config ${{ matrix.config }} `
170+
${{ env.binary }}\examples_tests --config ${{ matrix.config }} `
147171
--prefix ${{ env.install }}
148172
149-
- name: Container – Install Examples
150-
id: install-examples
151-
continue-on-error: true
173+
- name: API / Examples / Check Run (Conclusion)
174+
id: outcome-examples
152175
run: |
153-
docker exec orphan `
154-
${{ env.entry }} ${{ env.cmd }} -Command cmake --install `
155-
${{ env.binary }}\examples_tests --config ${{ matrix.config }} `
156-
--prefix ${{ env.install }}
176+
$completedAt = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
177+
if ("${{ steps.build-examples.outcome }}" -eq "success") {
178+
"conclusion=success" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
179+
} else {
180+
"conclusion=failure" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
181+
}
182+
"completed_at=$completedAt" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
183+
184+
- name: API / Examples / Check Run (Update)
185+
uses: actions/github-script@v6
186+
with:
187+
github-token: ${{ secrets.GITHUB_TOKEN }}
188+
script: |
189+
await github.rest.checks.update({
190+
owner: context.repo.owner,
191+
repo: context.repo.repo,
192+
check_run_id: ${{ steps.check-run-create.outputs.result }},
193+
status: 'completed',
194+
conclusion: '${{ steps.outcome-examples.outputs.conclusion }}',
195+
completed_at: '${{ steps.outcome-examples.outputs.completed_at }}',
196+
output: {
197+
title: '',
198+
summary: '[View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) to see details.'
199+
}
200+
});
157201
158202
- name: Container – Save NSC Image
159203
run: |
@@ -268,17 +312,36 @@ jobs:
268312
commit_message: "[CI] badges update"
269313

270314
deploy-production:
271-
name: Deploy to production host
315+
name: Deploy Godbolt production image
272316
if: ${{ always() && github.ref == 'refs/heads/master' }}
273317
needs: build-windows
274-
runs-on: ubuntu-latest
318+
runs-on: windows-2022
275319

276320
steps:
277-
- name: Pull latest images, re-run containers
278-
uses: appleboy/ssh-action@v1
279-
with:
280-
host: ${{ secrets.CE_HOST }}
281-
username: ${{ secrets.CE_USER }}
282-
key: ${{ secrets.CE_KEY }}
283-
script: |
284-
powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -NoExit -File C:\Scripts\startup-docker.ps1
321+
- name: Invoke Web Request
322+
run: |
323+
function Invoke-UpdateImages {
324+
param(
325+
[string]$Token,
326+
[string]$Url = 'https://godbolt.devsh.eu/api/update-images'
327+
)
328+
329+
$resp = Invoke-WebRequest -Method Post `
330+
-Uri $Url `
331+
-Headers @{ 'X-API-Token' = $Token } `
332+
-SkipHttpErrorCheck
333+
334+
$httpCode = $resp.StatusCode
335+
$body = $resp.Content | ConvertFrom-Json
336+
337+
Write-Host "HTTP code : $httpCode"
338+
Write-Host "status : $($body.status)"
339+
Write-Host "message : $($body.message)"
340+
341+
if ($httpCode -ne 200) {
342+
throw "Request failed"
343+
}
344+
}
345+
346+
$token = '${{ secrets.CE_IMAGE_UPDATE_TOKEN }}'
347+
Invoke-UpdateImages -Token $token

3rdparty/dxc/dxc

Submodule dxc updated 342 files

CMakePresets.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"name": "ci-configure-base",
1111
"hidden": true,
1212
"cacheVariables": {
13+
"CMAKE_SUPPRESS_REGENERATION": "ON",
1314
"NBL_EMBED_BUILTIN_RESOURCES": "ON",
1415
"NBL_UPDATE_GIT_SUBMODULE": "OFF",
1516
"NBL_COMPILE_WITH_CUDA": "OFF",
@@ -475,4 +476,4 @@
475476
}
476477
}
477478
]
478-
}
479+
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
</div>
55

66
<p align="center">
7-
<a href="https://github.com/Devsh-Graphics-Programming/Nabla/actions">
8-
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Devsh-Graphics-Programming/Nabla/badges/nabla/build.json" alt="Build Status" /></a>
7+
<a href="https://github.com/Devsh-Graphics-Programming/Nabla/actions/workflows/build-nabla.yml">
8+
<img src="https://github.com/Devsh-Graphics-Programming/Nabla/actions/workflows/build-nabla.yml/badge.svg" alt="Build Status" /></a>
99
<a href="https://opensource.org/licenses/Apache-2.0">
1010
<img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="License: Apache 2.0" /></a>
1111
<a href="https://discord.gg/krsBcABm7u">

cmake/common.cmake

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,13 +1325,17 @@ struct DeviceConfigCaps
13251325
endif()
13261326

13271327
set(REQUIRED_SINGLE_ARGS TARGET BINARY_DIR OUTPUT_VAR INPUTS INCLUDE NAMESPACE MOUNT_POINT_DEFINE)
1328-
cmake_parse_arguments(IMPL "" "${REQUIRED_SINGLE_ARGS}" "COMMON_OPTIONS" ${ARGV})
1328+
cmake_parse_arguments(IMPL "" "${REQUIRED_SINGLE_ARGS};LINK_TO" "COMMON_OPTIONS;DEPENDS" ${ARGV})
13291329
NBL_PARSE_REQUIRED(IMPL ${REQUIRED_SINGLE_ARGS})
13301330

13311331
if(NOT TARGET ${IMPL_TARGET})
13321332
add_library(${IMPL_TARGET} INTERFACE)
13331333
endif()
13341334

1335+
if(IMPL_LINK_TO)
1336+
target_link_libraries(${IMPL_LINK_TO} PUBLIC ${IMPL_TARGET})
1337+
endif()
1338+
13351339
if(IS_ABSOLUTE "${IMPL_INCLUDE}")
13361340
message(FATAL_ERROR "INCLUDE argument must be relative path")
13371341
endif()
@@ -1429,6 +1433,10 @@ namespace @IMPL_NAMESPACE@ {
14291433
endif()
14301434
endif()
14311435

1436+
if(IMPL_DEPENDS)
1437+
list(APPEND DEPENDS_ON ${IMPL_DEPENDS})
1438+
endif()
1439+
14321440
set(HAS_CAPS FALSE)
14331441
set(CAPS_LENGTH 0)
14341442
string(JSON CAPS_TYPE TYPE "${IMPL_INPUTS}" ${INDEX} CAPS)
@@ -1625,9 +1633,14 @@ endfunction()
16251633

16261634
function(NBL_CREATE_RESOURCE_ARCHIVE)
16271635
set(REQUIRED_SINGLE_ARGS TARGET BIND NAMESPACE)
1628-
cmake_parse_arguments(IMPL "" "${REQUIRED_SINGLE_ARGS}" "BUILTINS" ${ARGV})
1636+
cmake_parse_arguments(IMPL "" "${REQUIRED_SINGLE_ARGS}" "BUILTINS;LINK_TO" ${ARGV})
16291637
NBL_PARSE_REQUIRED(IMPL ${REQUIRED_SINGLE_ARGS})
16301638

1639+
if(NOT NBL_EMBED_BUILTIN_RESOURCES)
1640+
add_library(${IMPL_TARGET} INTERFACE) # dummy, could use LINK_TO but makes no difference in this case
1641+
return()
1642+
endif()
1643+
16311644
set(IMPL_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${IMPL_TARGET}")
16321645

16331646
set(_BUNDLE_ARCHIVE_ABSOLUTE_PATH_ "")
@@ -1641,17 +1654,18 @@ function(NBL_CREATE_RESOURCE_ARCHIVE)
16411654
get_filename_component(BUILTIN_ARCHIVE_INPUT_ABS_ENTRY "${IMPL_INPUT_DIRECTORY}" ABSOLUTE)
16421655
set(BUILTIN_KEY_ENTRY_ABS "${BUILTIN_ARCHIVE_INPUT_ABS_ENTRY}/${_BUNDLE_ARCHIVE_ABSOLUTE_PATH_}")
16431656

1644-
if(NBL_EMBED_BUILTIN_RESOURCES)
1645-
foreach(IT ${IMPL_BUILTINS})
1646-
if(NBL_LOG_VERBOSE)
1647-
message(STATUS "[${IMPL_TARGET}'s Builtins]: Registered \"${IT}\" key")
1648-
endif()
1657+
unset(NBL_RESOURCES_TO_EMBED)
1658+
foreach(IT ${IMPL_BUILTINS})
1659+
if(NBL_LOG_VERBOSE)
1660+
message(STATUS "[${IMPL_TARGET}'s Builtins]: Registered \"${IT}\" key")
1661+
endif()
16491662

1650-
LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED ${IT})
1651-
endforeach()
1663+
LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED ${IT})
1664+
endforeach()
16521665

1653-
ADD_CUSTOM_BUILTIN_RESOURCES(${IMPL_TARGET} NBL_RESOURCES_TO_EMBED "${_BUNDLE_SEARCH_DIRECTORY_}" "${_BUNDLE_ARCHIVE_ABSOLUTE_PATH_}" "${_BUILTIN_RESOURCES_NAMESPACE_}" "${_OUTPUT_DIRECTORY_HEADER_}" "${_OUTPUT_DIRECTORY_SOURCE_}" "${_LINK_MODE_}")
1654-
else()
1655-
add_library(${IMPL_TARGET} INTERFACE) # dummy
1666+
ADD_CUSTOM_BUILTIN_RESOURCES(${IMPL_TARGET} NBL_RESOURCES_TO_EMBED "${_BUNDLE_SEARCH_DIRECTORY_}" "${_BUNDLE_ARCHIVE_ABSOLUTE_PATH_}" "${_BUILTIN_RESOURCES_NAMESPACE_}" "${_OUTPUT_DIRECTORY_HEADER_}" "${_OUTPUT_DIRECTORY_SOURCE_}" "${_LINK_MODE_}")
1667+
1668+
if(IMPL_LINK_TO)
1669+
LINK_BUILTIN_RESOURCES_TO_TARGET(${IMPL_LINK_TO} ${IMPL_TARGET})
16561670
endif()
16571671
endfunction()

examples_tests

Submodule examples_tests updated 52 files

include/nbl/builtin/hlsl/algorithm.hlsl

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#define _NBL_BUILTIN_HLSL_ALGORITHM_INCLUDED_
66

77
#include "nbl/builtin/hlsl/functional.hlsl"
8+
#include "nbl/builtin/hlsl/math/intutil.hlsl"
89

910
namespace nbl
1011
{
@@ -91,16 +92,10 @@ NBL_CONSTEXPR_INLINE_FUNC void swap(NBL_REF_ARG(T) lhs, NBL_REF_ARG(T) rhs)
9192
namespace impl
9293
{
9394

94-
// TODO: move this to some other header
95-
bool isNPoT(const uint x)
96-
{
97-
return x&(x-1);
98-
}
99-
10095
template<class Accessor, class Comparator>
10196
struct bound_t
10297
{
103-
static bound_t<Accessor,Comparator> setup(uint begin, const uint end, const typename Accessor::value_type _value, const Comparator _comp)
98+
static bound_t<Accessor,Comparator> setup(uint32_t begin, const uint32_t end, const typename Accessor::value_type _value, const Comparator _comp)
10499
{
105100
bound_t<Accessor,Comparator> retval;
106101
retval.comp = _comp;
@@ -111,12 +106,12 @@ struct bound_t
111106
}
112107

113108

114-
uint operator()(NBL_REF_ARG(Accessor) accessor)
109+
uint32_t operator()(NBL_REF_ARG(Accessor) accessor)
115110
{
116111
if (isNPoT(len))
117112
{
118-
const uint newLen = 0x1u<<firstbithigh(len);
119-
const uint testPoint = it+(len-newLen);
113+
const uint32_t newLen = 0x1u<<nbl::hlsl::findMSB(len);
114+
const uint32_t testPoint = it+(len-newLen);
120115
len = newLen;
121116
comp_step(accessor,testPoint);
122117
}
@@ -133,24 +128,24 @@ struct bound_t
133128
void iteration(NBL_REF_ARG(Accessor) accessor)
134129
{
135130
len >>= 1;
136-
const uint mid = it+len;
131+
const uint32_t mid = it+len;
137132
comp_step(accessor,mid);
138133
}
139134

140-
void comp_step(NBL_REF_ARG(Accessor) accessor, const uint testPoint, const uint rightBegin)
135+
void comp_step(NBL_REF_ARG(Accessor) accessor, const uint32_t testPoint, const uint32_t rightBegin)
141136
{
142137
if (comp(accessor[testPoint],value))
143138
it = rightBegin;
144139
}
145-
void comp_step(NBL_REF_ARG(Accessor) accessor, const uint testPoint)
140+
void comp_step(NBL_REF_ARG(Accessor) accessor, const uint32_t testPoint)
146141
{
147142
comp_step(accessor,testPoint,testPoint);
148143
}
149144

150145
Comparator comp;
151146
typename Accessor::value_type value;
152-
uint it;
153-
uint len;
147+
uint32_t it;
148+
uint32_t len;
154149
};
155150

156151
template<class Accessor, class Comparator>
@@ -168,14 +163,14 @@ struct lower_to_upper_comparator_transform_t
168163

169164

170165
template<class Accessor, class Comparator>
171-
uint lower_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const typename Accessor::value_type value, const Comparator comp)
166+
uint32_t lower_bound(NBL_REF_ARG(Accessor) accessor, const uint32_t begin, const uint32_t end, const typename Accessor::value_type value, const Comparator comp)
172167
{
173168
impl::bound_t<Accessor,Comparator> implementation = impl::bound_t<Accessor,Comparator>::setup(begin,end,value,comp);
174169
return implementation(accessor);
175170
}
176171

177172
template<class Accessor, class Comparator>
178-
uint upper_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const typename Accessor::value_type value, const Comparator comp)
173+
uint32_t upper_bound(NBL_REF_ARG(Accessor) accessor, const uint32_t begin, const uint32_t end, const typename Accessor::value_type value, const Comparator comp)
179174
{
180175
//using TransformedComparator = impl::lower_to_upper_comparator_transform_t<Accessor,Comparator>;
181176
//TransformedComparator transformedComparator;
@@ -191,7 +186,7 @@ namespace impl
191186

192187
// extra indirection due to https://github.com/microsoft/DirectXShaderCompiler/issues/4771
193188
template<class Accessor, typename T>
194-
uint lower_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const T value)
189+
uint32_t lower_bound(NBL_REF_ARG(Accessor) accessor, const uint32_t begin, const uint32_t end, const T value)
195190
{
196191
//using Comparator = nbl::hlsl::less<T>;
197192
//Comparator comp;
@@ -200,7 +195,7 @@ uint lower_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint en
200195
return nbl::hlsl::lower_bound<Accessor, nbl::hlsl::less<T> >(accessor,begin,end,value,comp);
201196
}
202197
template<class Accessor, typename T>
203-
uint upper_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const T value)
198+
uint32_t upper_bound(NBL_REF_ARG(Accessor) accessor, const uint32_t begin, const uint32_t end, const T value)
204199
{
205200
//using Comparator = nbl::hlsl::less<T>;
206201
//Comparator comp;
@@ -212,12 +207,12 @@ uint upper_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint en
212207
}
213208

214209
template<class Accessor>
215-
uint lower_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const typename Accessor::value_type value)
210+
uint32_t lower_bound(NBL_REF_ARG(Accessor) accessor, const uint32_t begin, const uint32_t end, const typename Accessor::value_type value)
216211
{
217212
return impl::lower_bound<Accessor,typename Accessor::value_type>(accessor,begin,end,value);
218213
}
219214
template<class Accessor>
220-
uint upper_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const typename Accessor::value_type value)
215+
uint32_t upper_bound(NBL_REF_ARG(Accessor) accessor, const uint32_t begin, const uint32_t end, const typename Accessor::value_type value)
221216
{
222217
return impl::upper_bound<Accessor,typename Accessor::value_type>(accessor,begin,end,value);
223218
}

0 commit comments

Comments
 (0)