Skip to content

Commit f67c026

Browse files
author
kevyuu
committed
Merge branch 'master' into rt_pipeline_asset_conversion
2 parents 1898a9d + 3de2363 commit f67c026

File tree

75 files changed

+6988
-5094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+6988
-5094
lines changed

03_DeviceSelectionAndSharedSources/Testers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class IntrospectionTesterBase
5656
// if the extension is generic (.glsl or .hlsl) the stage is unknown.
5757
// But it can still be overriden from within the source with a `#pragma shader_stage`
5858
options.stage = shaderStage == IShader::E_SHADER_STAGE::ESS_COMPUTE ? shaderStage : IShader::E_SHADER_STAGE::ESS_VERTEX; // TODO: do smth with it
59-
options.targetSpirvVersion = device->getPhysicalDevice()->getLimits().spirvVersion;
59+
options.preprocessorOptions.targetSpirvVersion = device->getPhysicalDevice()->getLimits().spirvVersion;
6060
// we need to perform an unoptimized compilation with source debug info or we'll lose names of variable sin the introspection
6161
options.spirvOptimizer = nullptr;
6262
options.debugInfoFlags |= IShaderCompiler::E_DEBUG_INFO_FLAGS::EDIF_SOURCE_BIT;

03_DeviceSelectionAndSharedSources/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class DeviceSelectionAndSharedSourcesApp final : public application_templates::M
275275
// if the extension is generic (.glsl or .hlsl) the stage is unknown.
276276
// But it can still be overriden from within the source with a `#pragma shader_stage`
277277
options.stage = shaderStage == IShader::E_SHADER_STAGE::ESS_COMPUTE ? shaderStage : IShader::E_SHADER_STAGE::ESS_VERTEX; // TODO: do smth with it
278-
options.targetSpirvVersion = m_device->getPhysicalDevice()->getLimits().spirvVersion;
278+
options.preprocessorOptions.targetSpirvVersion = m_device->getPhysicalDevice()->getLimits().spirvVersion;
279279
// we need to perform an unoptimized compilation with source debug info or we'll lose names of variable sin the introspection
280280
options.spirvOptimizer = nullptr;
281281
options.debugInfoFlags |= IShaderCompiler::E_DEBUG_INFO_FLAGS::EDIF_SOURCE_BIT;

05_StreamingAndBufferDeviceAddressApp/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ class StreamingAndBufferDeviceAddressApp final : public application_templates::M
113113
// `CAsyncSingleBufferSubAllocator` just allows you suballocate subranges of any `IGPUBuffer` range with deferred/latched frees.
114114
constexpr uint32_t DownstreamBufferSize = sizeof(output_t)<<23;
115115
constexpr uint32_t UpstreamBufferSize = sizeof(input_t)<<23;
116-
117-
m_utils = make_smart_refctd_ptr<IUtilities>(smart_refctd_ptr(m_device),smart_refctd_ptr(m_logger),DownstreamBufferSize,UpstreamBufferSize);
116+
117+
m_utils = IUtilities::create(smart_refctd_ptr(m_device),smart_refctd_ptr(m_logger),DownstreamBufferSize,UpstreamBufferSize);
118118
if (!m_utils)
119119
return logFail("Failed to create Utilities!");
120120
m_upStreamingBuffer = m_utils->getDefaultUpStreamingBuffer();

09_GeometryCreator/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include "common.hpp"
77

8-
98
class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinResourcesApplication
109
{
1110
using device_base_t = MonoWindowApplication;

11_FFT/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class FFT_Test final : public application_templates::MonoDeviceApplication, publ
9595
constexpr uint32_t DownstreamBufferSize = sizeof(scalar_t) << 23;
9696
constexpr uint32_t UpstreamBufferSize = sizeof(scalar_t) << 23;
9797

98-
m_utils = make_smart_refctd_ptr<IUtilities>(smart_refctd_ptr(m_device), smart_refctd_ptr(m_logger), DownstreamBufferSize, UpstreamBufferSize);
98+
m_utils = IUtilities::create(smart_refctd_ptr(m_device), smart_refctd_ptr(m_logger), DownstreamBufferSize, UpstreamBufferSize);
9999
if (!m_utils)
100100
return logFail("Failed to create Utilities!");
101101
m_upStreamingBuffer = m_utils->getDefaultUpStreamingBuffer();

21_LRUCacheUnitTest/main.cpp

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
// I've moved out a tiny part of this example into a shared header for reuse, please open and read it.
77
#include "nbl/application_templates/MonoSystemMonoLoggerApplication.hpp"
8+
#include <ranges>
89

910
using namespace nbl;
1011
using namespace core;
@@ -180,6 +181,38 @@ class LRUCacheTestApp final : public nbl::application_templates::MonoSystemMonoL
180181
cache3.insert(1, "bar");
181182
cache3.clear();
182183

184+
// Cache iterator test
185+
constexpr uint32_t cache4Size = 10;
186+
ResizableLRUCache<uint32_t, uint32_t> cache4(cache4Size);
187+
for (auto i = 0u; i < cache4Size; i++)
188+
{
189+
cache4.insert(i, i);
190+
}
191+
// Default iterator is MRU -> LRU
192+
uint32_t counter = cache4Size - 1;
193+
for (auto& pair : cache4)
194+
{
195+
assert(pair.first == counter && pair.second == counter);
196+
counter--;
197+
}
198+
// Reverse LRU -> MRU traversal
199+
counter = 0u;
200+
for (auto it = cache4.crbegin(); it != cache4.crend(); it++)
201+
{
202+
assert(it->first == counter && it->second == counter);
203+
counter++;
204+
}
205+
206+
// Cache copy test
207+
ResizableLRUCache<uint32_t, uint32_t> cache4Copy(cache4);
208+
for (auto it = cache4.cbegin(), itCopy = cache4Copy.cbegin(); it != cache4.cend(); it++, itCopy++)
209+
{
210+
assert(*it == *itCopy);
211+
// Assert deep copy
212+
assert(it.operator->() != itCopy.operator->());
213+
214+
}
215+
183216
// Besides the disposal function that gets called when evicting, we need to check that the Cache properly destroys all resident `Key,Value` pairs when destroyed
184217
struct Foo
185218
{
@@ -208,15 +241,13 @@ class LRUCacheTestApp final : public nbl::application_templates::MonoSystemMonoL
208241

209242
int destroyCounter = 0;
210243
{
211-
ResizableLRUCache<int, Foo> cache4(10u);
244+
ResizableLRUCache<int, Foo> cache5(10u);
212245
for (int i = 0; i < 10; i++)
213-
cache4.insert(i, Foo(&destroyCounter));
246+
cache5.insert(i, Foo(&destroyCounter));
214247
int x = 0;
215248
}
216-
217249
assert(destroyCounter == 10);
218250

219-
220251
m_logger->log("all good");
221252

222253
m_textureLRUCache = std::unique_ptr<TextureLRUCache>(new TextureLRUCache(1024u));

22_CppCompat/ITester.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ITester
7171

7272
asset::IShaderCompiler::SCompilerOptions options = {};
7373
options.stage = shaderStage;
74-
options.targetSpirvVersion = m_device->getPhysicalDevice()->getLimits().spirvVersion;
74+
options.preprocessorOptions.targetSpirvVersion = m_device->getPhysicalDevice()->getLimits().spirvVersion;
7575
options.spirvOptimizer = nullptr;
7676
options.debugInfoFlags |= asset::IShaderCompiler::E_DEBUG_INFO_FLAGS::EDIF_SOURCE_BIT;
7777
options.preprocessorOptions.sourceIdentifier = source->getFilepathHint();
Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
1-
2-
include(common RESULT_VARIABLE RES)
3-
if(NOT RES)
4-
message(FATAL_ERROR "common.cmake not found. Should be in {repo_root}/cmake directory")
5-
endif()
6-
7-
nbl_create_executable_project("" "" "" "" "${NBL_EXECUTABLE_PROJECT_CREATION_PCH_TARGET}")
8-
9-
if(NBL_EMBED_BUILTIN_RESOURCES)
10-
set(_BR_TARGET_ ${EXECUTABLE_NAME}_builtinResourceData)
11-
set(RESOURCE_DIR "app_resources")
12-
13-
get_filename_component(_SEARCH_DIRECTORIES_ "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
14-
get_filename_component(_OUTPUT_DIRECTORY_SOURCE_ "${CMAKE_CURRENT_BINARY_DIR}/src" ABSOLUTE)
15-
get_filename_component(_OUTPUT_DIRECTORY_HEADER_ "${CMAKE_CURRENT_BINARY_DIR}/include" ABSOLUTE)
16-
17-
file(GLOB_RECURSE BUILTIN_RESOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE_DIR}" CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE_DIR}/*")
18-
foreach(RES_FILE ${BUILTIN_RESOURCE_FILES})
19-
LIST_BUILTIN_RESOURCE(RESOURCES_TO_EMBED "${RES_FILE}")
20-
endforeach()
21-
22-
ADD_CUSTOM_BUILTIN_RESOURCES(${_BR_TARGET_} RESOURCES_TO_EMBED "${_SEARCH_DIRECTORIES_}" "${RESOURCE_DIR}" "nbl::this_example::builtin" "${_OUTPUT_DIRECTORY_HEADER_}" "${_OUTPUT_DIRECTORY_SOURCE_}")
23-
24-
LINK_BUILTIN_RESOURCES_TO_TARGET(${EXECUTABLE_NAME} ${_BR_TARGET_})
25-
endif()
1+
include(common)
2+
3+
nbl_create_executable_project("" "" "" "")
4+
5+
NBL_CREATE_RESOURCE_ARCHIVE(
6+
NAMESPACE nbl::this_example::builtin
7+
TARGET ${EXECUTABLE_NAME}_builtins
8+
LINK_TO ${EXECUTABLE_NAME}
9+
BIND app_resources
10+
BUILTINS
11+
common.hlsl
12+
shaderCommon.hlsl
13+
testSubgroup.comp.hlsl
14+
testWorkgroup.comp.hlsl
15+
)

23_Arithmetic2UnitTest/app_resources/shaderCommon.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "common.hlsl"
1+
#include "app_resources/common.hlsl"
22

33
using namespace nbl;
44
using namespace hlsl;

23_Arithmetic2UnitTest/app_resources/testSubgroup.comp.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "nbl/builtin/hlsl/subgroup2/arithmetic_portability.hlsl"
88
#include "nbl/builtin/hlsl/subgroup2/arithmetic_params.hlsl"
99

10-
#include "shaderCommon.hlsl"
10+
#include "app_resources/shaderCommon.hlsl"
1111
#include "nbl/builtin/hlsl/workgroup2/basic.hlsl"
1212

1313
template<class Binop, class device_capabilities>

0 commit comments

Comments
 (0)