Skip to content

Commit 6da9c0b

Browse files
authored
Merge branch 'master' into nsc_macro_def_fix
2 parents bc1477b + 8cbfa75 commit 6da9c0b

55 files changed

Lines changed: 1879 additions & 1343 deletions

Some content is hidden

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

examples_tests

Submodule examples_tests updated 63 files

include/nbl/asset/IAsset.h

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,72 @@ concept Asset = std::is_base_of_v<IAsset,T>;
194194

195195
}
196196

197+
namespace nbl::system::impl
198+
{
199+
template<>
200+
struct to_string_helper<asset::IAsset::E_TYPE>
201+
{
202+
private:
203+
using enum_t = asset::IAsset::E_TYPE;
204+
205+
public:
206+
static inline std::string __call(const enum_t value)
207+
{
208+
switch (value)
209+
{
210+
case enum_t::ET_BUFFER:
211+
return "ICPUBuffer";
212+
case enum_t::ET_BUFFER_VIEW:
213+
return "ICPUBufferView";
214+
case enum_t::ET_SAMPLER:
215+
return "ICPUSampler";
216+
case enum_t::ET_IMAGE:
217+
return "ICPUImage";
218+
case enum_t::ET_IMAGE_VIEW:
219+
return "ICPUImageView";
220+
case enum_t::ET_DESCRIPTOR_SET:
221+
return "ICPUDescriptorSet";
222+
case enum_t::ET_DESCRIPTOR_SET_LAYOUT:
223+
return "ICPUDescriptorSetLayout";
224+
case enum_t::ET_SKELETON:
225+
return "ICPUSkeleton";
226+
case enum_t::ET_ANIMATION_LIBRARY:
227+
return "ICPUAnimationLibrary";
228+
case enum_t::ET_PIPELINE_LAYOUT:
229+
return "ICPUPipelineLayout";
230+
case enum_t::ET_SHADER:
231+
return "IShader";
232+
case enum_t::ET_GEOMETRY:
233+
return "IGeometry<ICPUBuffer>";
234+
case enum_t::ET_RENDERPASS:
235+
return "ICPURenderpass";
236+
case enum_t::ET_FRAMEBUFFER:
237+
return "ICPUFramebuffer";
238+
case enum_t::ET_GRAPHICS_PIPELINE:
239+
return "ICPUGraphicsPipeline";
240+
case enum_t::ET_BOTOM_LEVEL_ACCELERATION_STRUCTURE:
241+
return "ICPUBottomLevelAccelerationStructure";
242+
case enum_t::ET_TOP_LEVEL_ACCELERATION_STRUCTURE:
243+
return "ICPUTopLevelAccelerationStructure";
244+
case enum_t::ET_GEOMETRY_COLLECTION:
245+
return "ICPUGeometryCollection";
246+
case enum_t::ET_MORPH_TARGETS:
247+
return "ICPUMorphTargets";
248+
case enum_t::ET_COMPUTE_PIPELINE:
249+
return "ICPUComputePipeline";
250+
case enum_t::ET_PIPELINE_CACHE:
251+
return "ICPUPipelineCache";
252+
case enum_t::ET_SCENE:
253+
return "ICPUScene";
254+
case enum_t::ET_RAYTRACING_PIPELINE:
255+
return "ICPURayTracingPipeline";
256+
case enum_t::ET_IMPLEMENTATION_SPECIFIC_METADATA:
257+
return "";
258+
default:
259+
break;
260+
}
261+
return "";
262+
}
263+
};
264+
}
197265
#endif

include/nbl/asset/IBuffer.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ struct SBufferRange
120120
inline bool operator!=(const SBufferRange<const BufferType>& rhs) const { return !operator==(rhs); }
121121
};
122122

123+
template<typename BufferType>
124+
struct SStridedRange
125+
{
126+
inline operator bool() const {return range.isValid();}
127+
128+
SBufferRange<BufferType> range = {};
129+
uint32_t stride = 0;
130+
};
131+
123132
}
124133

125134
namespace std

include/nbl/asset/ICPUBuffer.h

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -119,30 +119,32 @@ class ICPUBuffer final : public asset::IBuffer, public IPreHashed
119119
return (m_alignment > 0 && !(m_alignment & (m_alignment - 1)));
120120
}
121121

122-
protected:
123-
inline void discardContent_impl() override
124-
{
125-
if (m_data)
126-
m_mem_resource->deallocate(m_data, m_creationParams.size, m_alignment);
127-
m_data = nullptr;
128-
m_mem_resource = nullptr;
129-
m_creationParams.size = 0ull;
130-
}
131-
132-
private:
133-
ICPUBuffer(SCreationParams&& params) :
134-
asset::IBuffer({ params.size, EUF_TRANSFER_DST_BIT }), m_data(params.data),
135-
m_mem_resource(params.memoryResource), m_alignment(params.alignment) {}
136-
137-
~ICPUBuffer() override {
138-
discardContent_impl();
139-
}
140-
141-
inline void visitDependents_impl(std::function<bool(const IAsset*)> visit) const override {}
142-
143-
void* m_data;
144-
core::smart_refctd_ptr<core::refctd_memory_resource> m_mem_resource;
145-
size_t m_alignment;
122+
protected:
123+
inline void discardContent_impl() override
124+
{
125+
if (m_data)
126+
m_mem_resource->deallocate(m_data, m_creationParams.size, m_alignment);
127+
m_data = nullptr;
128+
m_mem_resource = nullptr;
129+
m_creationParams.size = 0ull;
130+
}
131+
132+
private:
133+
// TODO: we should remove the addition of TRANSFER_DST_BIT because its the asset converter patcher that handles that
134+
// But we need LLVM-pipe CI first so I don't have to test 70 examples by hand
135+
inline ICPUBuffer(SCreationParams&& params) : asset::IBuffer({params.size,params.usage|EUF_TRANSFER_DST_BIT}),
136+
m_data(params.data), m_mem_resource(params.memoryResource), m_alignment(params.alignment) {}
137+
138+
inline ~ICPUBuffer() override
139+
{
140+
discardContent_impl();
141+
}
142+
143+
inline void visitDependents_impl(std::function<bool(const IAsset*)> visit) const override {}
144+
145+
void* m_data;
146+
core::smart_refctd_ptr<core::refctd_memory_resource> m_mem_resource;
147+
size_t m_alignment;
146148
};
147149

148150
} // end namespace nbl::asset

include/nbl/asset/ICPUGeometryCollection.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ class NBL_API2 ICPUGeometryCollection : public IAsset, public IGeometryCollectio
2424
inline E_TYPE getAssetType() const override {return AssetType;}
2525

2626
//
27-
inline bool valid() const //override
27+
inline bool valid() const override
2828
{
2929
for (const auto& ref : m_geometries)
30-
if (!ref.geometry->valid())
31-
return false;
30+
{
31+
if (!ref.operator bool() || !ref.geometry->valid())
32+
return false;
33+
if (ref.jointRedirectView.src && ref.jointRedirectView.composed.getRange<hlsl::shapes::AABB<1,uint32_t>>().maxVx[0]>=getJointCount())
34+
return false;
35+
}
3236
return true;
3337
}
3438

@@ -61,6 +65,8 @@ class NBL_API2 ICPUGeometryCollection : public IAsset, public IGeometryCollectio
6165
return false;
6266
}
6367

68+
//
69+
inline const core::vector<SGeometryReference>& getGeometries() const {return base_t::getGeometries();}
6470
//
6571
inline core::vector<SGeometryReference>* getGeometries()
6672
{

include/nbl/asset/ICPURayTracingPipeline.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ namespace nbl::asset
1313
{
1414

1515
//! CPU Version of RayTracing Pipeline
16-
class ICPURayTracingPipeline final : public ICPUPipeline<IRayTracingPipeline<ICPUPipelineLayout>>
16+
class ICPURayTracingPipeline final : public ICPUPipeline<IRayTracingPipeline<ICPUPipelineLayout,ICPUBuffer>>
1717
{
18-
using pipeline_base_t = IRayTracingPipeline<ICPUPipelineLayout>;
18+
using pipeline_base_t = IRayTracingPipeline<ICPUPipelineLayout,ICPUBuffer>;
1919
using base_t = ICPUPipeline<pipeline_base_t>;
2020

2121
public:

0 commit comments

Comments
 (0)