Skip to content

Commit c0dffe3

Browse files
author
devsh
committed
get Nabla compiling
1 parent 8f1564a commit c0dffe3

File tree

5 files changed

+26
-24
lines changed

5 files changed

+26
-24
lines changed

include/nbl/asset/IGeometry.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class IGeometryBase : public virtual core::IReferenceCounted
104104
template<typename Visitor>
105105
inline void visitAABB(Visitor& visitor)
106106
{
107-
switch (format)
107+
switch (rangeFormat)
108108
{
109109
case EAABBFormat::F64:
110110
visitor(encodedDataRange.f64);
@@ -158,7 +158,7 @@ class IGeometryBase : public virtual core::IReferenceCounted
158158
inline void resetRange(const EAABBFormat newFormat)
159159
{
160160
rangeFormat = newFormat;
161-
auto tmp = [](auto& aabb)->void{aabb = aabb.clear();};
161+
auto tmp = [](auto& aabb)->void{aabb = aabb.create();};
162162
visitAABB(tmp);
163163
}
164164
inline void resetRange() {resetRange(rangeFormat);}
@@ -235,7 +235,7 @@ class NBL_API2 IGeometry : public std::conditional_t<std::is_same_v<BufferType,I
235235
const auto stride = composed.getStride();
236236
if (stride==0)
237237
return 0ull;
238-
return src.length/stride;
238+
return src.size/stride;
239239
}
240240

241241
//

include/nbl/asset/IPolygonGeometry.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class NBL_API2 IPolygonGeometry : public IIndexableGeometry<BufferType>, public
139139
return false;
140140
// there needs to be at least one vertex to reference (it also needs to be formatted)
141141
const auto& positionBase = base_t::m_positionView.composed;
142-
const auto vertexCount = positionBase.getElementCount();
142+
const auto vertexCount = base_t::m_positionView.getElementCount();
143143
if (vertexCount==0 || !positionBase.isFormatted())
144144
return false;
145145
if (m_normalView && m_normalView.getElementCount()<vertexCount)
@@ -159,7 +159,7 @@ class NBL_API2 IPolygonGeometry : public IIndexableGeometry<BufferType>, public
159159
inline EPrimitiveType getPrimitiveType() const override final {return PrimitiveType;}
160160

161161
//
162-
inline const IGeometryBase::SAABBStorage& getAABB() const override final {return base_t::m_positionView.encodedDataRange;}
162+
inline const IGeometryBase::SAABBStorage& getAABB() const override final {return base_t::m_positionView.composed.encodedDataRange;}
163163

164164
//
165165
inline uint64_t getVertexReferenceCount() const {return base_t::getIndexView() ? base_t::getIndexCount():base_t::m_positionView.getElementCount();}
@@ -189,7 +189,7 @@ class NBL_API2 IPolygonGeometry : public IIndexableGeometry<BufferType>, public
189189
struct SJointWeight
190190
{
191191
// one thing this doesn't check is whether every vertex has a weight and index
192-
inline operator bool() const {return indices && isIntegerFormat(indices.format) && weights && weights.isFormatted() && indices.getElementCount()==weights.getElementCount();}
192+
inline operator bool() const {return indices && isIntegerFormat(indices.composed.format) && weights && weights.composed.isFormatted() && indices.getElementCount()==weights.getElementCount();}
193193

194194
SDataView indices;
195195
// Assumption is that only non-zero weights are present, which is why the joints are indexed (sparseness)

src/nbl/asset/interchange/CGraphicsPipelineLoaderMTL.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O.
1+
// Copyright (C) 2018-2025 - DevSH Graphics Programming Sp. z O.O.
22
// This file is part of the "Nabla Engine".
33
// For conditions of distribution and use, see copyright notice in nabla.h
44

@@ -15,17 +15,11 @@
1515
#include "nbl/builtin/MTLdefaults.h"
1616

1717

18-
1918
using namespace nbl;
2019
using namespace asset;
2120

22-
#define VERT_SHADER_NO_UV_CACHE_KEY "nbl/builtin/shader/loader/mtl/vertex_no_uv.vert"
23-
#define VERT_SHADER_UV_CACHE_KEY "nbl/builtin/shader/loader/mtl/vertex_uv.vert"
24-
#define FRAG_SHADER_NO_UV_CACHE_KEY "nbl/builtin/shader/loader/mtl/fragment_no_uv.frag"
25-
#define FRAG_SHADER_UV_CACHE_KEY "nbl/builtin/shader/loader/mtl/fragment_uv.frag"
2621

27-
CGraphicsPipelineLoaderMTL::CGraphicsPipelineLoaderMTL(IAssetManager* _am, core::smart_refctd_ptr<system::ISystem>&& sys) :
28-
IRenderpassIndependentPipelineLoader(_am), m_system(std::move(sys))
22+
CGraphicsPipelineLoaderMTL::CGraphicsPipelineLoaderMTL(IAssetManager* _am, core::smart_refctd_ptr<system::ISystem>&& sys) : m_system(std::move(sys))
2923
{
3024
#if 0 // Remove IRenderpassIndependentPipelines and use MC for Mesh Loaders
3125
//create vertex shaders and insert them into cache
@@ -70,6 +64,7 @@ CGraphicsPipelineLoaderMTL::CGraphicsPipelineLoaderMTL(IAssetManager* _am, core:
7064
#endif
7165
}
7266

67+
#if 0
7368
void CGraphicsPipelineLoaderMTL::initialize()
7469
{
7570
IRenderpassIndependentPipelineLoader::initialize();
@@ -123,6 +118,7 @@ void CGraphicsPipelineLoaderMTL::initialize()
123118

124119
insertBuiltinAssetIntoCache(m_assetMgr, bundle, "nbl/builtin/renderpass_independent_pipeline/loader/mtl/missing_material_pipeline");
125120
}
121+
#endif
126122

127123
bool CGraphicsPipelineLoaderMTL::isALoadableFileFormat(system::IFile* _file, const system::logger_opt_ptr logger) const
128124
{
@@ -138,6 +134,8 @@ bool CGraphicsPipelineLoaderMTL::isALoadableFileFormat(system::IFile* _file, con
138134

139135
SAssetBundle CGraphicsPipelineLoaderMTL::loadAsset(system::IFile* _file, const IAssetLoader::SAssetLoadParams& _params, IAssetLoader::IAssetLoaderOverride* _override, uint32_t _hierarchyLevel)
140136
{
137+
return {};
138+
#if 0 // Remove IRenderpassIndependentPipelines and use MC for Mesh Loaders
141139
SContext ctx(
142140
asset::IAssetLoader::SAssetLoadContext{
143141
_params,
@@ -196,12 +194,12 @@ SAssetBundle CGraphicsPipelineLoaderMTL::loadAsset(system::IFile* _file, const I
196194
if (materials.empty())
197195
return SAssetBundle(nullptr, {});
198196
return SAssetBundle(std::move(meta),std::move(retval));
197+
#endif
199198
}
200199

200+
#if 0 // Remove IRenderpassIndependentPipelines and use MC for Mesh Loaders
201201
core::smart_refctd_ptr<ICPURenderpassIndependentPipeline> CGraphicsPipelineLoaderMTL::makePipelineFromMtl(SContext& _ctx, const SMtl& _mtl, bool hasUV)
202202
{
203-
return nullptr;
204-
#if 0 // Remove IRenderpassIndependentPipelines and use MC for Mesh Loaders
205203
SBlendParams blendParams;
206204

207205
std::string cacheKey("nbl/builtin/renderpass_independent_pipeline/loader/mtl/");
@@ -323,8 +321,8 @@ core::smart_refctd_ptr<ICPURenderpassIndependentPipeline> CGraphicsPipelineLoade
323321
ppln = core::make_smart_refctd_ptr<ICPURenderpassIndependentPipeline>(std::move(layout), shaders, shaders+2u, vtxParams, blendParams, SPrimitiveAssemblyParams{}, SRasterizationParams{});
324322
}
325323
return ppln;
326-
#endif
327324
}
325+
#endif
328326

329327
namespace
330328
{
@@ -403,6 +401,7 @@ namespace
403401
}
404402
}
405403

404+
#if 0
406405
const char* CGraphicsPipelineLoaderMTL::readTexture(const char* _bufPtr, const char* const _bufEnd, SMtl* _currMaterial, const char* _mapType) const
407406
{
408407
static const std::unordered_map<std::string, CMTLMetadata::CRenderpassIndependentPipeline::E_MAP_TYPE> str2type =
@@ -912,3 +911,4 @@ auto CGraphicsPipelineLoaderMTL::readMaterials(system::IFile* _file, const syste
912911

913912
return materials;
914913
}
914+
#endif

src/nbl/asset/interchange/CGraphicsPipelineLoaderMTL.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
namespace nbl::asset
1313
{
1414

15-
class CGraphicsPipelineLoaderMTL final : public IGeometryLoader
15+
class CGraphicsPipelineLoaderMTL final : public IAssetLoader // TODO: Material Asset and Loader
1616
{
17+
#if 0
1718
struct SMtl
1819
{
1920
CMTLMetadata::CRenderpassIndependentPipeline::SMaterialParameters params;
@@ -26,7 +27,7 @@ class CGraphicsPipelineLoaderMTL final : public IGeometryLoader
2627

2728
inline bool isClampToBorder(CMTLMetadata::CRenderpassIndependentPipeline::E_MAP_TYPE m) const { return (clamp >> m) & 1u; }
2829
};
29-
30+
#endif
3031
struct SContext
3132
{
3233
SContext(const IAssetLoader::SAssetLoadContext& _innerCtx, uint32_t _topHierarchyLevel, IAssetLoader::IAssetLoaderOverride* _override)
@@ -40,8 +41,6 @@ class CGraphicsPipelineLoaderMTL final : public IGeometryLoader
4041
public:
4142
CGraphicsPipelineLoaderMTL(IAssetManager* _am, core::smart_refctd_ptr<system::ISystem>&& sys);
4243

43-
void initialize() override;
44-
4544
bool isALoadableFileFormat(system::IFile* _file, const system::logger_opt_ptr logger=nullptr) const override;
4645

4746
const char** getAssociatedFileExtensions() const override
@@ -50,11 +49,12 @@ class CGraphicsPipelineLoaderMTL final : public IGeometryLoader
5049
return extensions;
5150
}
5251

53-
uint64_t getSupportedAssetTypesBitfield() const override { return asset::IAsset::ET_RENDERPASS_INDEPENDENT_PIPELINE; }
52+
// uint64_t getSupportedAssetTypesBitfield() const override { return asset::IAsset::ET_MATERIAL; }
5453

5554
asset::SAssetBundle loadAsset(system::IFile* _file, const asset::IAssetLoader::SAssetLoadParams& _params, asset::IAssetLoader::IAssetLoaderOverride* _override, uint32_t _hierarchyLevel = 0u) override;
5655

5756
private:
57+
#if 0
5858
core::smart_refctd_ptr<ICPURenderpassIndependentPipeline> makePipelineFromMtl(SContext& ctx, const SMtl& _mtl, bool hasUV);
5959
core::vector<SMtl> readMaterials(system::IFile* _file, const system::logger_opt_ptr logger) const;
6060
const char* readTexture(const char* _bufPtr, const char* const _bufEnd, SMtl* _currMaterial, const char* _mapType) const;
@@ -63,7 +63,8 @@ class CGraphicsPipelineLoaderMTL final : public IGeometryLoader
6363
using image_views_set_t = std::array<core::smart_refctd_ptr<ICPUImageView>, CMTLMetadata::CRenderpassIndependentPipeline::EMP_REFL_POSX + 1u>;
6464
image_views_set_t loadImages(const std::string& relDir, SMtl& _mtl, SContext& _ctx);
6565
core::smart_refctd_ptr<ICPUDescriptorSet> makeDescSet(image_views_set_t&& _views, ICPUDescriptorSetLayout* _dsLayout, SContext& _ctx);
66-
private:
66+
#endif
67+
6768
core::smart_refctd_ptr<system::ISystem> m_system;
6869

6970
};

src/nbl/asset/utils/CGeometryCreator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace nbl::asset
1515
{
1616

17+
#if 0
1718
core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createCube(const hlsl::float32_t3 size) const
1819
{
1920
using namespace hlsl;
@@ -1703,7 +1704,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createIcoSphere(fl
17031704

17041705
return icosphereGeometry;
17051706
}
1706-
1707+
#endif
17071708

17081709
} // end namespace nbl::asset
17091710

0 commit comments

Comments
 (0)