Skip to content

Commit f44c0eb

Browse files
committed
make Nabla Clang build work
1 parent 09ceaf6 commit f44c0eb

File tree

12 files changed

+38
-28
lines changed

12 files changed

+38
-28
lines changed

cmake/adjust/template/vendor/CXX_Clang.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ set(NBL_CXX_RELWITHDEBINFO_COMPILE_OPTIONS "")
1515

1616
# Global
1717
list(APPEND NBL_CXX_COMPILE_OPTIONS
18-
-Wno-everything # TMP
1918
-Wextra
2019
-fno-strict-aliasing
2120
-msse4.2

cmake/adjust/template/vendor/C_Clang.cmake

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ set(NBL_C_RELEASE_COMPILE_OPTIONS
1414
set(NBL_C_RELWITHDEBINFO_COMPILE_OPTIONS "")
1515

1616
# Global
17-
list(APPEND NBL_C_COMPILE_OPTIONS
18-
-Wno-everything # TMP
17+
list(APPEND NBL_C_COMPILE_OPTIONS
1918
-Wextra
2019
-fno-strict-aliasing
2120
-msse4.2

include/nbl/asset/IRenderpass.h

+11-5
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ class NBL_API2 IRenderpass
8383
};
8484

8585
// The arrays pointed to by this array must be terminated by `DepthStencilAttachmentsEnd` value, which implicitly satisfies a few VUIDs
86-
constexpr static inline SDepthStencilAttachmentDescription DepthStencilAttachmentsEnd = {};
86+
static const SDepthStencilAttachmentDescription DepthStencilAttachmentsEnd; // have to initialize out of line because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88165
8787
const SDepthStencilAttachmentDescription* depthStencilAttachments = &DepthStencilAttachmentsEnd;
8888
// The arrays pointed to by this array must be terminated by `ColorAttachmentsEnd` value, which implicitly satisfies a few VUIDs
89-
constexpr static inline SColorAttachmentDescription ColorAttachmentsEnd = {};
89+
static const SColorAttachmentDescription ColorAttachmentsEnd; // have to initialize out of line because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88165
9090
const SColorAttachmentDescription* colorAttachments = &ColorAttachmentsEnd;
9191

9292
struct SSubpassDescription final
@@ -200,7 +200,7 @@ class NBL_API2 IRenderpass
200200
SColorAttachmentsRef colorAttachments[MaxColorAttachments] = {};
201201

202202
// The arrays pointed to by this array must be terminated by `InputAttachmentsEnd` value
203-
constexpr static inline SInputAttachmentRef InputAttachmentsEnd = {};
203+
static const SInputAttachmentRef InputAttachmentsEnd;
204204
const SInputAttachmentRef* inputAttachments = &InputAttachmentsEnd;
205205

206206
struct SPreserveAttachmentRef
@@ -233,7 +233,7 @@ class NBL_API2 IRenderpass
233233
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSubpassDescription2.html#VUID-VkSubpassDescription2-pipelineBindPoint-04953
234234
//E_PIPELINE_BIND_POINT pipelineBindPoint : 2 = EPBP_GRAPHICS;
235235
};
236-
constexpr static inline SSubpassDescription SubpassesEnd = {};
236+
static const SSubpassDescription SubpassesEnd;
237237
const SSubpassDescription* subpasses = &SubpassesEnd;
238238

239239
struct SSubpassDependency final
@@ -259,7 +259,7 @@ class NBL_API2 IRenderpass
259259
bool valid() const;
260260
};
261261
// The arrays pointed to by this array must be terminated by `DependenciesEnd` value
262-
constexpr static inline SSubpassDependency DependenciesEnd = {};
262+
static const SSubpassDependency DependenciesEnd;
263263
const SSubpassDependency* dependencies = &DependenciesEnd;
264264

265265

@@ -380,6 +380,12 @@ class NBL_API2 IRenderpass
380380
uint32_t m_loadOpColorAttachmentEnd = ~0u;
381381
};
382382

383+
constexpr inline IRenderpass::SCreationParams::SDepthStencilAttachmentDescription IRenderpass::SCreationParams::DepthStencilAttachmentsEnd = {};
384+
constexpr inline IRenderpass::SCreationParams::SColorAttachmentDescription IRenderpass::SCreationParams::ColorAttachmentsEnd = {};
385+
constexpr inline IRenderpass::SCreationParams::SSubpassDescription::SInputAttachmentRef IRenderpass::SCreationParams::SSubpassDescription::InputAttachmentsEnd = {};
386+
constexpr inline IRenderpass::SCreationParams::SSubpassDescription IRenderpass::SCreationParams::SubpassesEnd = {};
387+
constexpr inline IRenderpass::SCreationParams::SSubpassDependency IRenderpass::SCreationParams::DependenciesEnd = {};
388+
383389
inline bool IRenderpass::compatible(const IRenderpass* other) const
384390
{
385391
// If you find yourself spending a lot of time here in your profile, go ahead and implement a precomputed hash and store it in the renderpass

include/nbl/asset/filters/CBlitImageFilter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ class CBlitImageFilter :
464464

465465
auto phaseCount = IBlitUtilities::getPhaseCount(inExtentLayerCount.xyz, outExtentLayerCount.xyz, inImageType);
466466
phaseCount = hlsl::max(phaseCount,hlsl::uint32_t3(1,1,1));
467-
const auto axisOffsets = blit_utils_t::template getScaledKernelPhasedLUTAxisOffsets(phaseCount,real_window_size);
467+
const auto axisOffsets = blit_utils_t::getScaledKernelPhasedLUTAxisOffsets(phaseCount,real_window_size);
468468
constexpr auto MaxAxisCount = 3;
469469
lut_value_t* scaledKernelPhasedLUTPixel[MaxAxisCount];
470470
for (auto i = 0; i < MaxAxisCount; ++i)

include/nbl/asset/filters/kernels/WeightFunctions.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,12 @@ class CWeightFunction1D final : public impl::IWeightFunction1D<decltype(std::dec
337337
inline void stretchAndScale(const float stretchFactor)
338338
{
339339
stretch(stretchFactor);
340-
this->scale(base_t::value_t(1)/stretchFactor);
340+
this->scale(typename base_t::value_t(1)/stretchFactor);
341341
}
342342

343343
inline base_t::value_t weight(const float x) const
344344
{
345-
return static_cast<double>(this->getTotalScale()*function_t::weight<derivative>(x*this->getInvStretch()));
345+
return static_cast<double>(this->getTotalScale()*function_t::template weight<derivative>(x*this->getInvStretch()));
346346
}
347347

348348
// Integral of `weight(x) dx` from -INF to +INF

include/nbl/asset/utils/CSPIRVIntrospector.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,13 @@ class NBL_API2 CSPIRVIntrospector : public core::Uncopyable
208208
// `memberStrides[i]` only relevant if `memberTypes[i]->isArray()`
209209
inline ptr_t<member_stride_t,Mutable> memberStrides() const {return memberOffsets()+memberCount;}
210210
using member_matrix_info_t = MatrixInfo;
211-
inline ptr_t<member_matrix_info_t,Mutable> memberMatrixInfos() const {return reinterpret_cast<ptr_t<member_matrix_info_t,Mutable>&>(memberStrides()+memberCount); }
211+
inline ptr_t<member_matrix_info_t,Mutable> memberMatrixInfos() const
212+
{
213+
auto t = memberStrides() + memberCount;
214+
215+
return reinterpret_cast<ptr_t<member_matrix_info_t,Mutable>&>(t);
216+
217+
}
212218

213219
constexpr static inline size_t StoragePerMember = sizeof(member_type_t)+sizeof(member_name_t)+sizeof(member_size_t)+sizeof(member_offset_t)+sizeof(member_stride_t)+sizeof(member_matrix_info_t);
214220

include/nbl/video/ILogicalDevice.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ inline bool ILogicalDevice::validateMemoryBarrier(const uint32_t queueFamilyInde
15021502
return false;
15031503
};
15041504
// CANNOT CHECK: https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkImageMemoryBarrier2-oldLayout-01197
1505-
if (mismatchedLayout.operator()<false>(barrier.oldLayout) || mismatchedLayout.operator()<true>(barrier.newLayout))
1505+
if (mismatchedLayout.template operator()<false>(barrier.oldLayout) || mismatchedLayout.template operator()<true>(barrier.newLayout))
15061506
return false;
15071507
}
15081508

include/nbl/video/utilities/CSubpassKiln.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class CSubpassKiln
198198
if (begin==end)
199199
return;
200200

201-
bake_impl(cmdbuf->getOriginDevice()->getPhysicalDevice()->getLimits().indirectDrawCount, drawIndirectBuffer, drawCountBuffer)(cmdbuf, begin, end);
201+
bake_impl(cmdbuf->getOriginDevice()->getPhysicalDevice()->getLimits().drawIndirectCount, drawIndirectBuffer, drawCountBuffer)(cmdbuf, begin, end);
202202
}
203203

204204
protected:

src/nbl/video/CVulkanCommandBuffer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ bool CVulkanCommandBuffer::beginRenderPass_impl(const SRenderpassBeginInfo& info
661661
.renderArea = info.renderArea,
662662
// Implicitly but could be optimizedif needed
663663
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkRenderPassBeginInfo.html#VUID-VkRenderPassBeginInfo-clearValueCount-00902
664-
.clearValueCount = vk_clearValues.size()/sizeof(VkClearValue),
664+
.clearValueCount = static_cast<uint32_t>(vk_clearValues.size()/sizeof(VkClearValue)),
665665
// Implicit
666666
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkRenderPassBeginInfo.html#VUID-VkRenderPassBeginInfo-clearValueCount-04962
667667
.pClearValues = vk_clearValues.data()

src/nbl/video/CVulkanDeviceMemoryBacked.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ CVulkanDeviceMemoryBacked<Interface>::CVulkanDeviceMemoryBacked(
4040
assert(vkHandle!=VK_NULL_HANDLE);
4141
}
4242

43-
template CVulkanDeviceMemoryBacked<IGPUBuffer>;
44-
template CVulkanDeviceMemoryBacked<IGPUImage>;
43+
template class CVulkanDeviceMemoryBacked<IGPUBuffer>;
44+
template class CVulkanDeviceMemoryBacked<IGPUImage>;
4545

4646
}

src/nbl/video/IGPUAccelerationStructure.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ uint32_t IGPUBottomLevelAccelerationStructure::BuildInfo<BufferType>::valid(cons
140140
retval += geometryCount*MaxBuffersPerGeometry;
141141
return retval;
142142
}
143-
template uint32_t IGPUBottomLevelAccelerationStructure::BuildInfo<IGPUBuffer>::template valid<uint32_t>(const uint32_t* const) const;
144-
template uint32_t IGPUBottomLevelAccelerationStructure::BuildInfo<asset::ICPUBuffer>::template valid<uint32_t>(const uint32_t* const) const;
143+
template uint32_t IGPUBottomLevelAccelerationStructure::BuildInfo<IGPUBuffer>::valid<uint32_t>(const uint32_t* const) const;
144+
template uint32_t IGPUBottomLevelAccelerationStructure::BuildInfo<asset::ICPUBuffer>::valid<uint32_t>(const uint32_t* const) const;
145145
using BuildRangeInfo = hlsl::acceleration_structures::bottom_level::BuildRangeInfo;
146-
template uint32_t IGPUBottomLevelAccelerationStructure::BuildInfo<IGPUBuffer>::template valid<BuildRangeInfo>(const BuildRangeInfo* const) const;
147-
template uint32_t IGPUBottomLevelAccelerationStructure::BuildInfo<asset::ICPUBuffer>::template valid<BuildRangeInfo>(const BuildRangeInfo* const) const;
146+
template uint32_t IGPUBottomLevelAccelerationStructure::BuildInfo<IGPUBuffer>::valid<BuildRangeInfo>(const BuildRangeInfo* const) const;
147+
template uint32_t IGPUBottomLevelAccelerationStructure::BuildInfo<asset::ICPUBuffer>::valid<BuildRangeInfo>(const BuildRangeInfo* const) const;
148148

149149
bool IGPUBottomLevelAccelerationStructure::validVertexFormat(const asset::E_FORMAT format) const
150150
{

src/nbl/video/utilities/CAssetConverter.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ auto CAssetConverter::reserve(const SInputs& inputs) -> SReserveResult
21422142
{
21432143
for (auto& entry : conversionRequests)
21442144
for (auto i=0ull; i<entry.second.copyCount; i++)
2145-
assign.operator()<true>(entry.first,entry.second.firstCopyIx,i,device->createSampler(entry.second.canonicalAsset->getParams()));
2145+
assign.template operator()<true>(entry.first,entry.second.firstCopyIx,i,device->createSampler(entry.second.canonicalAsset->getParams()));
21462146
}
21472147
if constexpr (std::is_same_v<AssetType,ICPUBuffer>)
21482148
{
@@ -2461,7 +2461,7 @@ auto CAssetConverter::reserve(const SInputs& inputs) -> SReserveResult
24612461
{
24622462
// since we don't have dependants we don't care about our group ID
24632463
// we create threadsafe pipeline caches, because we have no idea how they may be used
2464-
assign.operator()<true>(entry.first,entry.second.firstCopyIx,i,device->createPipelineCache(asset,false));
2464+
assign.template operator()<true>(entry.first,entry.second.firstCopyIx,i,device->createPipelineCache(asset,false));
24652465
}
24662466
}
24672467
}
@@ -2506,7 +2506,7 @@ auto CAssetConverter::reserve(const SInputs& inputs) -> SReserveResult
25062506
{
25072507
// since we don't have dependants we don't care about our group ID
25082508
// we create threadsafe pipeline caches, because we have no idea how they may be used
2509-
assign.operator()<true>(entry.first,entry.second.firstCopyIx,i,device->createRenderpass(asset->getCreationParameters()));
2509+
assign.template operator()<true>(entry.first,entry.second.firstCopyIx,i,device->createRenderpass(asset->getCreationParameters()));
25102510
}
25112511
}
25122512
}
@@ -2653,7 +2653,7 @@ auto CAssetConverter::reserve(const SInputs& inputs) -> SReserveResult
26532653
gpuObj.get()->setObjectDebugName(debugName.str().c_str());
26542654
}
26552655
// insert into staging cache
2656-
stagingCache.emplace(gpuObj.get(),CCache<AssetType>::key_t(contentHash,uniqueCopyGroupID));
2656+
stagingCache.emplace(gpuObj.get(),typename CCache<AssetType>::key_t(contentHash,uniqueCopyGroupID));
26572657
// propagate back to dfsCache
26582658
created.gpuObj = std::move(gpuObj);
26592659
// record if a device memory allocation will be needed
@@ -2668,11 +2668,11 @@ auto CAssetConverter::reserve(const SInputs& inputs) -> SReserveResult
26682668
// this is super annoying, was hoping metaprogramming with `has_type` would actually work
26692669
auto getConversionRequests = [&]<typename AssetU>()->auto&{return std::get<SReserveResult::conversion_requests_t<AssetU>>(retval.m_conversionRequests);};
26702670
if constexpr (std::is_same_v<AssetType,ICPUBuffer>)
2671-
getConversionRequests.operator()<ICPUBuffer>().emplace_back(core::smart_refctd_ptr<const AssetType>(instance.asset),created.gpuObj.get());;
2671+
getConversionRequests.template operator()<ICPUBuffer>().emplace_back(core::smart_refctd_ptr<const AssetType>(instance.asset),created.gpuObj.get());;
26722672
if constexpr (std::is_same_v<AssetType,ICPUImage>)
26732673
{
26742674
const uint16_t recomputeMips = created.patch.recomputeMips;
2675-
getConversionRequests.operator()<ICPUImage>().emplace_back(core::smart_refctd_ptr<const AssetType>(instance.asset),created.gpuObj.get(),recomputeMips);
2675+
getConversionRequests.template operator()<ICPUImage>().emplace_back(core::smart_refctd_ptr<const AssetType>(instance.asset),created.gpuObj.get(),recomputeMips);
26762676
}
26772677
// TODO: BLAS and TLAS requests
26782678
}
@@ -2939,7 +2939,7 @@ auto CAssetConverter::reserve(const SInputs& inputs) -> SReserveResult
29392939
// if something with this content hash is in the stagingCache, then it must match the `found->gpuObj`
29402940
if (auto finalCacheIt=stagingCache.find(gpuObj.get()); finalCacheIt!=stagingCache.end())
29412941
{
2942-
const bool matches = finalCacheIt->second==CCache<AssetType>::key_t(found.contentHash,uniqueCopyGroupID);
2942+
const bool matches = finalCacheIt->second==typename CCache<AssetType>::key_t(found.contentHash,uniqueCopyGroupID);
29432943
assert(matches);
29442944
}
29452945
}

0 commit comments

Comments
 (0)