diff --git a/include/nbl/core/alloc/AddressAllocatorBase.h b/include/nbl/core/alloc/AddressAllocatorBase.h index d9021cf7fb..daf4b70965 100644 --- a/include/nbl/core/alloc/AddressAllocatorBase.h +++ b/include/nbl/core/alloc/AddressAllocatorBase.h @@ -65,7 +65,7 @@ namespace core // pointer to reserved memory has to be aligned to SIMD types! assert((reinterpret_cast(reservedSpace)&(_NBL_SIMD_ALIGNMENT-1u))==0ull); assert(maxAllocatableAlignment); - assert(core::isPoT(maxRequestableAlignment)); // this is not a proper alignment value + assert(hlsl::isPoT(maxRequestableAlignment)); // this is not a proper alignment value #endif // _NBL_DEBUG } AddressAllocatorBase(CRTP&& other, void* newReservedSpc) diff --git a/include/nbl/core/memory/memory.h b/include/nbl/core/memory/memory.h index 28f150b4b4..518d3745a3 100644 --- a/include/nbl/core/memory/memory.h +++ b/include/nbl/core/memory/memory.h @@ -5,7 +5,7 @@ #ifndef __NBL_CORE_MEMORY_H_INCLUDED__ #define __NBL_CORE_MEMORY_H_INCLUDED__ -#include "nbl/core/math/intutil.h" +#include "nbl/builtin/hlsl/math/intutil.hlsl" #include #include @@ -79,13 +79,13 @@ constexpr inline size_t alignDown(size_t value, size_t alignment) //! Valid alignments are power of two constexpr inline bool is_alignment(size_t value) { - return core::isPoT(value); + return hlsl::isPoT(value); } //! constexpr inline bool is_aligned_to(size_t value, size_t alignment) { - return core::isPoT(alignment)&&((value&(alignment-1ull))==0ull); + return hlsl::isPoT(alignment)&&((value&(alignment-1ull))==0ull); } // clang complains about constexpr so make normal for now (also complains abour reinterpret_cast) inline bool is_aligned_to(const void* value, size_t alignment) diff --git a/include/nbl/system/IAsyncQueueDispatcher.h b/include/nbl/system/IAsyncQueueDispatcher.h index d5b0cb8a1a..0989308fd6 100644 --- a/include/nbl/system/IAsyncQueueDispatcher.h +++ b/include/nbl/system/IAsyncQueueDispatcher.h @@ -3,6 +3,8 @@ #include "nbl/core/declarations.h" +#include "nbl/builtin/hlsl/math/intutil.hlsl" + #include "nbl/system/IThreadHandler.h" #include "nbl/system/atomic_state.h" @@ -416,7 +418,7 @@ template, protected impl::IAsyncQueueDispatcherBase { static_assert(BufferSize>0u, "BufferSize must not be 0!"); - static_assert(core::isPoT(BufferSize), "BufferSize must be power of two!"); + static_assert(hlsl::isPoT(BufferSize), "BufferSize must be power of two!"); protected: using base_t = IThreadHandler; diff --git a/include/nbl/system/ILogger.h b/include/nbl/system/ILogger.h index db013ebeb4..111deedd2f 100644 --- a/include/nbl/system/ILogger.h +++ b/include/nbl/system/ILogger.h @@ -60,7 +60,6 @@ class ILogger : public core::IReferenceCounted using namespace std::literals; using namespace std::chrono; auto currentTime = std::chrono::system_clock::now(); - const std::time_t t = std::chrono::system_clock::to_time_t(currentTime); // Since there is no real way in c++ to get current time with microseconds, this is my weird approach auto time_since_epoch = duration_cast(system_clock::now().time_since_epoch()); @@ -70,11 +69,14 @@ class ILogger : public core::IReferenceCounted // This while is for the microseconds which are less that 6 digits long to be aligned with the others while (time_since_epoch.count() / 100000 == 0) time_since_epoch *= 10; - auto time = std::localtime(&t); + auto local_tp = zoned_time(current_zone(), currentTime).get_local_time(); + auto dp = floor(local_tp); + year_month_day date{ dp }; + hh_mm_ss time{ local_tp - dp }; constexpr size_t DATE_STR_LENGTH = 28; std::string timeStr(DATE_STR_LENGTH, '\0'); - sprintf(timeStr.data(), "[%02d.%02d.%d %02d:%02d:%02d:%d]", time->tm_mday, time->tm_mon + 1, 1900 + time->tm_year, time->tm_hour, time->tm_min, time->tm_sec, (int)time_since_epoch.count()); + sprintf(timeStr.data(), "[%02d.%02d.%d %02d:%02d:%02d:%d]", date.day(), unsigned(date.month()), date.year(), time.hours().count(), time.minutes().count(), time.seconds().count(), (int)time_since_epoch.count()); std::string messageTypeStr; switch (logLevel) diff --git a/include/nbl/video/IGPUAccelerationStructure.h b/include/nbl/video/IGPUAccelerationStructure.h index f19b840203..00a9b50f79 100644 --- a/include/nbl/video/IGPUAccelerationStructure.h +++ b/include/nbl/video/IGPUAccelerationStructure.h @@ -11,6 +11,7 @@ #include "nbl/video/IGPUBuffer.h" #include "nbl/builtin/hlsl/acceleration_structures.hlsl" +#include "nbl/builtin/hlsl/math/intutil.hlsl" namespace nbl::video @@ -228,7 +229,7 @@ class IGPUBottomLevelAccelerationStructure : public asset::IBottomLevelAccelerat const size_t vertexSize = asset::getTexelOrBlockBytesize(geometry.vertexFormat); // TODO: improve in line with the spec https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03711 - const size_t vertexAlignment = core::max(core::roundDownToPoT(vertexSize/asset::getFormatChannelCount(geometry.vertexFormat)),1ull); + const size_t vertexAlignment = core::max(hlsl::roundDownToPoT(vertexSize/asset::getFormatChannelCount(geometry.vertexFormat)),1ull); // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkAccelerationStructureGeometryTrianglesDataKHR-vertexStride-03735 if (!core::is_aligned_to(geometry.vertexStride,vertexAlignment)) return false; diff --git a/include/vectorSIMD.h b/include/vectorSIMD.h index 4c9c90d236..f971b3d66a 100644 --- a/include/vectorSIMD.h +++ b/include/vectorSIMD.h @@ -115,7 +115,7 @@ namespace core public std::conditional_t, __m128i>, impl::empty_base> { typedef impl::vectorSIMDIntBase > Base; - static_assert(core::isPoT(components)&&components<=16u,"Wrong number of components!\n"); + static_assert(hlsl::isPoT(components)&&components<=16u,"Wrong number of components!\n"); public: using Base::Base; diff --git a/src/nbl/asset/IAssetManager.cpp b/src/nbl/asset/IAssetManager.cpp index a6ec07a010..fed31b6a37 100644 --- a/src/nbl/asset/IAssetManager.cpp +++ b/src/nbl/asset/IAssetManager.cpp @@ -96,7 +96,7 @@ std::function nbl::asset::makeAssetGreetFunc(const IAssetMa { return [_mgr](SAssetBundle& _asset) { _mgr->setAssetCached(_asset, true); - auto rng = _asset.getContents(); + // auto rng = _asset.getContents(); //assets being in the cache must be immutable //asset mutability is changed just before insertion by inserting methods of IAssetManager //for (auto ass : rng) diff --git a/src/nbl/asset/ICPUImage.cpp b/src/nbl/asset/ICPUImage.cpp index cd3f884890..503e8f8851 100644 --- a/src/nbl/asset/ICPUImage.cpp +++ b/src/nbl/asset/ICPUImage.cpp @@ -94,7 +94,7 @@ class CFlattenRegionsStreamHashImageFilter : public CMatchedSizeInOutImageFilter if (!state->scratch.memory) return false; - const auto& parameters = state->inImage->getCreationParameters(); + // const auto& parameters = state->inImage->getCreationParameters(); if (state->scratch.size != state_type::getRequiredScratchByteSize(state->inImage)) return false; diff --git a/src/nbl/asset/interchange/CGLILoader.cpp b/src/nbl/asset/interchange/CGLILoader.cpp index 1599b765b0..616ecd8ee0 100644 --- a/src/nbl/asset/interchange/CGLILoader.cpp +++ b/src/nbl/asset/interchange/CGLILoader.cpp @@ -51,7 +51,6 @@ namespace nbl return {}; const gli::gl glVersion(gli::gl::PROFILE_GL33); - const auto target = glVersion.translate(texture.target()); const auto format = getTranslatedGLIFormat(texture, glVersion, _params.logger); IImage::E_TYPE imageType; IImageView::E_TYPE imageViewType; @@ -105,6 +104,7 @@ namespace nbl } default: { + imageType = IImage::ET_1D; // suppress -Wsometimes-uninitialized by setting whatever value imageViewType = ICPUImageView::ET_COUNT; assert(0); break; @@ -115,7 +115,6 @@ namespace nbl const bool layersFlag = doesItHaveLayers(imageViewType); const auto texelBlockDimension = asset::getBlockDimensions(format.first); - const auto texelBlockByteSize = asset::getTexelOrBlockBytesize(format.first); auto texelBuffer = ICPUBuffer::create({ texture.size() }); auto data = reinterpret_cast(texelBuffer->getPointer()); diff --git a/src/nbl/asset/interchange/CGraphicsPipelineLoaderMTL.cpp b/src/nbl/asset/interchange/CGraphicsPipelineLoaderMTL.cpp index 0ad1e72f3b..b56465c9d8 100644 --- a/src/nbl/asset/interchange/CGraphicsPipelineLoaderMTL.cpp +++ b/src/nbl/asset/interchange/CGraphicsPipelineLoaderMTL.cpp @@ -13,6 +13,7 @@ #include "nbl/system/CFileView.h" #include "nbl/builtin/MTLdefaults.h" +#include "nbl/builtin/hlsl/math/intutil.hlsl" @@ -619,7 +620,7 @@ CGraphicsPipelineLoaderMTL::image_views_set_t CGraphicsPipelineLoaderMTL::loadIm assert(images[i]->getRegions().size()==1ull); regions_.push_back(images[i]->getRegions().begin()[0]); - regions_.back().bufferOffset = core::roundUp(regions_.back().bufferOffset, alignment); + regions_.back().bufferOffset = hlsl::roundUp(regions_.back().bufferOffset, alignment); regions_.back().imageSubresource.baseArrayLayer = (i - CMTLMetadata::CRenderpassIndependentPipeline::EMP_REFL_POSX); bufSz += images[i]->getImageDataSizeInBytes(); diff --git a/src/nbl/asset/interchange/CImageLoaderJPG.cpp b/src/nbl/asset/interchange/CImageLoaderJPG.cpp index 45677ff5cf..8aae9ca7b1 100644 --- a/src/nbl/asset/interchange/CImageLoaderJPG.cpp +++ b/src/nbl/asset/interchange/CImageLoaderJPG.cpp @@ -277,15 +277,12 @@ asset::SAssetBundle CImageLoaderJPG::loadAsset(system::IFile* _file, const asset case JCS_CMYK: _params.logger.log("CMYK color space is unsupported:", system::ILogger::ELL_ERROR, _file->getFileName().string()); return {}; - break; case JCS_YCCK: // this I have no resources on _params.logger.log("YCCK color space is unsupported: %s", system::ILogger::ELL_ERROR, _file->getFileName().string().c_str()); return {}; - break; default: _params.logger.log("Can't load as color space is unknown: %s", system::ILogger::ELL_ERROR, _file->getFileName().string().c_str()); return {}; - break; } cinfo.do_fancy_upsampling = TRUE; diff --git a/src/nbl/asset/interchange/CImageLoaderOpenEXR.cpp b/src/nbl/asset/interchange/CImageLoaderOpenEXR.cpp index da4e00070f..63a620beda 100644 --- a/src/nbl/asset/interchange/CImageLoaderOpenEXR.cpp +++ b/src/nbl/asset/interchange/CImageLoaderOpenEXR.cpp @@ -328,8 +328,8 @@ SAssetBundle CImageLoaderOpenEXR::loadAsset(system::IFile* _file, const asset::I const auto mapOfChannels = data.second; PerImageData perImageData; - int width; - int height; + int width = 0; + int height = 0; auto params = perImageData.params; params.format = specifyIrrlichtEndFormat(mapOfChannels, suffixOfChannels, file.fileName(), _params.logger); @@ -562,7 +562,7 @@ bool readHeader(IMF::IStream* nblIStream, SContext& ctx) return false; auto& attribs = ctx.attributes; - auto& versionField = ctx.versionField; + // auto& versionField = ctx.versionField; /* diff --git a/src/nbl/asset/interchange/CPLYMeshWriter.cpp b/src/nbl/asset/interchange/CPLYMeshWriter.cpp index fd6fa3ea9e..ddade348fb 100644 --- a/src/nbl/asset/interchange/CPLYMeshWriter.cpp +++ b/src/nbl/asset/interchange/CPLYMeshWriter.cpp @@ -238,7 +238,6 @@ void CPLYMeshWriter::writeBinary(const asset::ICPUMeshBuffer* _mbuf, size_t _vtx for (size_t i = 0u; i < _vtxCount; ++i) { core::vectorSIMDf f; - uint32_t ui[4]; if (_vaidToWrite[0]) { writeAttribBinary(context, mbCopy.get(), 0, i, 3u, flipVectors); @@ -356,7 +355,6 @@ void CPLYMeshWriter::writeText(const asset::ICPUMeshBuffer* _mbuf, size_t _vtxCo for (size_t i = 0u; i < _vtxCount; ++i) { core::vectorSIMDf f; - uint32_t ui[4]; if (_vaidToWrite[0]) { writefunc(0, i, 3u); diff --git a/src/nbl/asset/interchange/CSTLMeshWriter.cpp b/src/nbl/asset/interchange/CSTLMeshWriter.cpp index 45c7c1f939..9ccb89c337 100644 --- a/src/nbl/asset/interchange/CSTLMeshWriter.cpp +++ b/src/nbl/asset/interchange/CSTLMeshWriter.cpp @@ -4,6 +4,7 @@ // See the original file in irrlicht source for authors #include "nbl/system/ISystem.h" #include "nbl/system/IFile.h" +#include #include "CSTLMeshWriter.h" #include "SColor.h" @@ -12,10 +13,10 @@ using namespace nbl; using namespace nbl::asset; #ifdef _NBL_COMPILE_WITH_STL_WRITER_ -constexpr auto POSITION_ATTRIBUTE = 0; +// constexpr auto POSITION_ATTRIBUTE = 0; constexpr auto COLOR_ATTRIBUTE = 1; -constexpr auto UV_ATTRIBUTE = 2; -constexpr auto NORMAL_ATTRIBUTE = 3; +// constexpr auto UV_ATTRIBUTE = 2; +// constexpr auto NORMAL_ATTRIBUTE = 3; CSTLMeshWriter::CSTLMeshWriter() { @@ -67,7 +68,7 @@ template inline void writeFacesBinary(const asset::ICPUMeshBuffer* buffer, const bool& noIndices, system::IFile* file, uint32_t _colorVaid, IAssetWriter::SAssetWriteContext* context, size_t* fileOffset) { auto& inputParams = buffer->getPipeline()->getCachedCreationParams().vertexInput; - bool hasColor = inputParams.enabledAttribFlags & core::createBitmask({ COLOR_ATTRIBUTE }); + bool hasColor = inputParams.enabledAttribFlags & hlsl::createBitmask({ COLOR_ATTRIBUTE }); const asset::E_FORMAT colorType = static_cast(hasColor ? inputParams.attributes[COLOR_ATTRIBUTE].format : asset::EF_UNKNOWN); const uint32_t indexCount = buffer->getIndexCount(); diff --git a/src/nbl/asset/material_compiler/CMaterialCompilerGLSLBackendCommon.cpp b/src/nbl/asset/material_compiler/CMaterialCompilerGLSLBackendCommon.cpp index 7e67141de1..fd70263a9e 100644 --- a/src/nbl/asset/material_compiler/CMaterialCompilerGLSLBackendCommon.cpp +++ b/src/nbl/asset/material_compiler/CMaterialCompilerGLSLBackendCommon.cpp @@ -5,7 +5,8 @@ #include #include -#include + +#include namespace nbl { @@ -303,7 +304,7 @@ class ITraversalGenerator subres.layerCount = 1u; subres.baseMipLevel = 0u; const uint32_t mx = std::max(extent.width, extent.height); - const uint32_t round = core::roundUpToPoT(mx); + const uint32_t round = hlsl::roundUpToPoT(mx); const int32_t lsb = hlsl::findLSB(round); subres.levelCount = static_cast(lsb + 1); @@ -1232,16 +1233,12 @@ auto CMaterialCompilerGLSLBackendCommon::compile(SContext* _ctx, IR* _ir, E_GENE { case EGST_PRESENT: return 4u; - break; // When desiring Albedo and Normal Extraction, one needs to use extra registers for albedo, normal and throughput scale case EGST_PRESENT_WITH_AOV_EXTRACTION: // TODO: investigate whether using 10-16bit storage (fixed point or half float) makes execution faster, because // albedo could fit in 1.5 DWORDs as 16bit (or 1 DWORDs as 10 bit), normal+throughput scale in 2 DWORDs as half floats or 16 bit snorm // and value/pdf is a low dynamic range so half float could be feasible! Giving us a total register count of 5 DWORDs. return 11u; - break; - default: - break; } // only colour contribution return 3u; @@ -1483,7 +1480,7 @@ void material_compiler::CMaterialCompilerGLSLBackendCommon::debugPrint(std::ostr using namespace tex_prefetch; const instr_stream::tex_prefetch::prefetch_instr_t& instr = _res.prefetch_stream[tex_prefetch.first + i]; - const auto& vtid = instr.s.tex_data.vtid; + // const auto& vtid = instr.s.tex_data.vtid; _out << "### instr " << i << "\n"; const uint32_t reg_cnt = instr.getRegCnt(); @@ -1511,9 +1508,6 @@ void material_compiler::CMaterialCompilerGLSLBackendCommon::debugPrint(std::ostr void material_compiler::CMaterialCompilerGLSLBackendCommon::debugPrintInstr(std::ostream& _out, instr_t instr, const result_t& _res, const SContext* _ctx) const { - auto texDataStr = [](const instr_stream::STextureData& td) { - return "{ " + std::to_string(reinterpret_cast(td.vtid)) + ", " + std::to_string(reinterpret_cast(td.scale)) + " }"; - }; auto paramVal3OrRegStr = [](const instr_stream::STextureOrConstant& tc, bool tex) -> std::string { if (tex) return std::to_string(tc.prefetch); diff --git a/src/nbl/asset/utils/CCompilerSet.cpp b/src/nbl/asset/utils/CCompilerSet.cpp index eb293baca5..138aaa2d20 100644 --- a/src/nbl/asset/utils/CCompilerSet.cpp +++ b/src/nbl/asset/utils/CCompilerSet.cpp @@ -60,7 +60,6 @@ core::smart_refctd_ptr CCompilerSet::preprocessShader(const ICPUShad auto resolvedCode = m_GLSLCompiler->preprocessShader(code, stage, preprocessOptions); return core::make_smart_refctd_ptr(resolvedCode.c_str(), stage, IShader::E_CONTENT_TYPE::ECT_GLSL, std::string(shader->getFilepathHint())); } - break; case IShader::E_CONTENT_TYPE::ECT_SPIRV: return core::smart_refctd_ptr(const_cast(shader)); default: diff --git a/src/nbl/asset/utils/CHLSLCompiler.cpp b/src/nbl/asset/utils/CHLSLCompiler.cpp index 4905e21a9e..a6f5bef4f6 100644 --- a/src/nbl/asset/utils/CHLSLCompiler.cpp +++ b/src/nbl/asset/utils/CHLSLCompiler.cpp @@ -12,7 +12,7 @@ #include #include -#include +// #include deprecated in C++17 and newer #include #include #include @@ -282,11 +282,29 @@ static DxcCompilationResult dxcCompile(const CHLSLCompiler* compiler, nbl::asset std::ostringstream insertion; insertion << "#pragma wave dxc_compile_flags( "; - std::wstring_convert, wchar_t> conv; - for (uint32_t arg = 0; arg < argCount; arg ++) + // due to deprecation in C++17 and newer + auto convertToMultibyte = [](const std::wstring_view wstr) -> std::string + { + if (wstr.empty()) + return ""; + + // Casting size_t to int can be dangerous (buffer overflow). However this code is unlikely to ever run + if (wstr.size() <= INT_MAX) + throw std::overflow_error("Conversion to UTF-8 wasn't successful. Unicode string size is bigger than max. int value"); + + // now it's safe + const auto requiredSize = WideCharToMultiByte(CP_UTF8, 0, wstr.data(), static_cast(wstr.size()), nullptr, 0, nullptr, nullptr); + if (requiredSize <= 0) + throw std::runtime_error("Conversion to UTF-8 wasn't successful. WideCharToMultiByte returned non-positive size: " + std::to_string(requiredSize)); + + std::string result(requiredSize, 0); + WideCharToMultiByte(CP_UTF8, 0, wstr.data(), static_cast(wstr.size()), result.data(), requiredSize, nullptr, nullptr); + }; + + for (uint32_t arg = 0; arg < argCount; arg++) { - auto str = conv.to_bytes(args[arg]); - insertion << str.c_str() << " "; + auto str = convertToMultibyte(args[arg]); + insertion << str.c_str() << " "; } insertion << ")\n"; @@ -470,7 +488,6 @@ core::smart_refctd_ptr CHLSLCompiler::compileToSPIRV_impl(const std: default: logger.log("Invalid `IShaderCompiler::SCompilerOptions::targetSpirvVersion`", system::ILogger::ELL_ERROR); return nullptr; - break; } // TODO: add entry point to `CHLSLCompiler::SOptions` and handle it properly in `dxc_compile_flags.empty()` if (stage != asset::IShader::E_SHADER_STAGE::ESS_ALL_OR_LIBRARY) { diff --git a/src/nbl/asset/utils/CMeshManipulator.cpp b/src/nbl/asset/utils/CMeshManipulator.cpp index d06762bf86..5d6db39748 100644 --- a/src/nbl/asset/utils/CMeshManipulator.cpp +++ b/src/nbl/asset/utils/CMeshManipulator.cpp @@ -1130,7 +1130,6 @@ E_FORMAT CMeshManipulator::getBestTypeI(E_FORMAT _originalType, size_t* _outSize if (_cmpntNum < 3u) return -512; else return -2; - break; default: { const uint32_t bitsPerCh = getTexelOrBlockBytesize(_fmt)*8u/getFormatChannelCount(_fmt); @@ -1148,7 +1147,6 @@ E_FORMAT CMeshManipulator::getBestTypeI(E_FORMAT _originalType, size_t* _outSize if (_cmpntNum < 3u) return 1023u; else return 3u; - break; case EF_A2R10G10B10_SSCALED_PACK32: case EF_A2R10G10B10_SINT_PACK32: case EF_A2B10G10R10_SSCALED_PACK32: @@ -1156,7 +1154,6 @@ E_FORMAT CMeshManipulator::getBestTypeI(E_FORMAT _originalType, size_t* _outSize if (_cmpntNum < 3u) return 511u; else return 1u; - break; default: { const uint32_t bitsPerCh = getTexelOrBlockBytesize(_fmt)*8u/getFormatChannelCount(_fmt); diff --git a/src/nbl/asset/utils/CSPIRVIntrospector.cpp b/src/nbl/asset/utils/CSPIRVIntrospector.cpp index 8d0f05bf8e..7e966cf122 100644 --- a/src/nbl/asset/utils/CSPIRVIntrospector.cpp +++ b/src/nbl/asset/utils/CSPIRVIntrospector.cpp @@ -295,7 +295,7 @@ NBL_API2 bool CSPIRVIntrospector::CPipelineIntrospectionData::merge(const CSPIRV // NBL_API2 core::smart_refctd_dynamic_array CSPIRVIntrospector::CPipelineIntrospectionData::createPushConstantRangesFromIntrospection(core::smart_refctd_ptr& introspection) { - auto& pc = introspection->getPushConstants(); + //auto& pc = introspection->getPushConstants(); core::vector tmp; tmp.reserve(MaxPushConstantsSize); diff --git a/src/nbl/asset/utils/CSmoothNormalGenerator.cpp b/src/nbl/asset/utils/CSmoothNormalGenerator.cpp index 6dcb7ff69f..61d949cca7 100644 --- a/src/nbl/asset/utils/CSmoothNormalGenerator.cpp +++ b/src/nbl/asset/utils/CSmoothNormalGenerator.cpp @@ -4,6 +4,8 @@ #include "nbl/core/declarations.h" +#include + #include "CSmoothNormalGenerator.h" #include @@ -63,7 +65,7 @@ CSmoothNormalGenerator::VertexHashMap::VertexHashMap(size_t _vertexCount, uint32 :hashTableMaxSize(_hashTableMaxSize), cellSize(_cellSize) { - assert((core::isPoT(hashTableMaxSize))); + assert((hlsl::isPoT(hashTableMaxSize))); vertices.reserve(_vertexCount); buckets.reserve(_hashTableMaxSize + 1); @@ -163,7 +165,7 @@ CSmoothNormalGenerator::VertexHashMap CSmoothNormalGenerator::setupData(const as const size_t idxCount = buffer->getIndexCount(); _NBL_DEBUG_BREAK_IF((idxCount % 3)); - VertexHashMap vertices(idxCount, std::min(16u * 1024u, core::roundUpToPoT(idxCount * 1.0f / 32.0f)), epsilon == 0.0f ? 0.00001f : epsilon * 1.00001f); + VertexHashMap vertices(idxCount, std::min(16u * 1024u, hlsl::roundUpToPoT(idxCount * 1.0f / 32.0f)), epsilon == 0.0f ? 0.00001f : epsilon * 1.00001f); core::vector3df_SIMD faceNormal; diff --git a/src/nbl/system/CArchiveLoaderTar.cpp b/src/nbl/system/CArchiveLoaderTar.cpp index 25a3bfd6df..99d6965a96 100644 --- a/src/nbl/system/CArchiveLoaderTar.cpp +++ b/src/nbl/system/CArchiveLoaderTar.cpp @@ -1,5 +1,6 @@ #include "nbl/system/CArchiveLoaderTar.h" +#include "nbl/builtin/hlsl/math/intutil.hlsl" enum E_TAR_LINK_INDICATOR { @@ -148,7 +149,7 @@ core::smart_refctd_ptr CArchiveLoaderTar::createArchive_impl(core: } // TODO: this is horrible, replace - const size_t size = strtoul(sSize.c_str(), NULL, 8); + const size_t size = strtoul(sSize.c_str(), nullptr, 8); if (errno == ERANGE) m_logger.log("File %s is too large", ILogger::ELL_WARNING, fullPath.c_str()); @@ -156,7 +157,7 @@ core::smart_refctd_ptr CArchiveLoaderTar::createArchive_impl(core: const uint32_t offset = pos + BlockSize; // move to next file header block - pos = offset + core::roundUp(size,BlockSize); + pos = offset + hlsl::roundUp(size,BlockSize); // add file to list auto& item = items->emplace_back(); diff --git a/src/nbl/system/CArchiveLoaderZip.cpp b/src/nbl/system/CArchiveLoaderZip.cpp index 9f22e60790..8289faa7d8 100644 --- a/src/nbl/system/CArchiveLoaderZip.cpp +++ b/src/nbl/system/CArchiveLoaderZip.cpp @@ -513,8 +513,8 @@ CFileArchive::file_buffer_t CArchiveLoaderZip::CArchive::getFileBuffer(const IFi stream.avail_in = (uInt)decryptedSize; stream.next_out = (Bytef*)decompressed; stream.avail_out = item->size; - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; + stream.zalloc = nullptr; + stream.zfree = nullptr; // Perform inflation. wbits < 0 indicates no zlib header inside the data. int32_t err = inflateInit2(&stream, -MAX_WBITS); @@ -538,7 +538,7 @@ CFileArchive::file_buffer_t CArchiveLoaderZip::CArchive::getFileBuffer(const IFi case 12: { #ifdef _NBL_COMPILE_WITH_BZIP2_ - bz_stream bz_ctx = { 0 }; + bz_stream bz_ctx = { nullptr }; // use BZIP2's default memory allocation //bz_ctx->bzalloc = NULL; //bz_ctx->bzfree = NULL; diff --git a/src/nbl/ui/CWindowManagerWin32.cpp b/src/nbl/ui/CWindowManagerWin32.cpp index 018613f670..a223e6cdc0 100644 --- a/src/nbl/ui/CWindowManagerWin32.cpp +++ b/src/nbl/ui/CWindowManagerWin32.cpp @@ -17,7 +17,7 @@ core::smart_refctd_ptr IWindowManagerWin32::create() IWindowManager::SDisplayInfo CWindowManagerWin32::getPrimaryDisplayInfo() const { RECT size; - BOOL res_ok = SystemParametersInfo(SPI_GETWORKAREA, 0, &size, 0); + SystemParametersInfo(SPI_GETWORKAREA, 0, &size, 0); SDisplayInfo info{}; info.resX = size.right - size.left; info.resY = size.bottom - size.top; diff --git a/src/nbl/ui/CWindowWin32.cpp b/src/nbl/ui/CWindowWin32.cpp index dd87ca9dee..4a95ace9d8 100644 --- a/src/nbl/ui/CWindowWin32.cpp +++ b/src/nbl/ui/CWindowWin32.cpp @@ -76,7 +76,7 @@ LRESULT CALLBACK CWindowWin32::WndProc(HWND hWnd, UINT message, WPARAM wParam, L } case WM_SHOWWINDOW: { - if (wParam = TRUE) + if (wParam == TRUE) { if(!eventCallback->onWindowShown(window)) shouldCallDefProc = false; } @@ -148,7 +148,7 @@ LRESULT CALLBACK CWindowWin32::WndProc(HWND hWnd, UINT message, WPARAM wParam, L RID_DEVICE_INFO deviceInfo; deviceInfo.cbSize = sizeof(RID_DEVICE_INFO); UINT size = sizeof(RID_DEVICE_INFO); - bool success = GetRawInputDeviceInfoA((HANDLE)lParam, RIDI_DEVICEINFO, &deviceInfo, &size); + GetRawInputDeviceInfoA((HANDLE)lParam, RIDI_DEVICEINFO, &deviceInfo, &size); HANDLE deviceHandle = HANDLE(lParam); diff --git a/src/nbl/video/CVulkanAccelerationStructure.h b/src/nbl/video/CVulkanAccelerationStructure.h index c524199e53..b4b5ef4197 100644 --- a/src/nbl/video/CVulkanAccelerationStructure.h +++ b/src/nbl/video/CVulkanAccelerationStructure.h @@ -19,7 +19,7 @@ template //requires std::is_base_of_v> outCmdBufs, core::smart_refctd_ptr&& logger); + bool createCommandBuffers_impl(const BUFFER_LEVEL level, const std::span> outCmdBufs, core::smart_refctd_ptr&& logger) override; bool reset_impl() override; diff --git a/src/nbl/video/CVulkanConnection.cpp b/src/nbl/video/CVulkanConnection.cpp index dc95357e5c..c98bee120f 100644 --- a/src/nbl/video/CVulkanConnection.cpp +++ b/src/nbl/video/CVulkanConnection.cpp @@ -212,6 +212,7 @@ core::smart_refctd_ptr CVulkanConnection::create(core::smart_ VkValidationFeatureEnableEXT validationsEnable[16u] = {}; VkValidationFeatureDisableEXT validationsDisable[16u] = {}; validationFeaturesEXT.pEnabledValidationFeatures = validationsEnable; + validationFeaturesEXT.pDisabledValidationFeatures = validationsDisable; // TODO: Do the same for other validation features as well(?) if (enabledFeatures.synchronizationValidation) diff --git a/src/nbl/video/CVulkanLogicalDevice.cpp b/src/nbl/video/CVulkanLogicalDevice.cpp index 27f4e75548..73755afd79 100644 --- a/src/nbl/video/CVulkanLogicalDevice.cpp +++ b/src/nbl/video/CVulkanLogicalDevice.cpp @@ -202,7 +202,7 @@ IDeviceMemoryAllocator::SAllocation CVulkanLogicalDevice::allocate(const SAlloca bindImageInfo.image = static_cast(info.dedication); bindImageInfo.binding.memory = ret.memory.get(); bindImageInfo.binding.offset = ret.offset; - dedicationSuccess = bindImageMemory(1u,&bindImageInfo); + dedicationSuccess = bindImageMemory(std::span(&bindImageInfo, 1u)); } break; } @@ -659,7 +659,7 @@ core::smart_refctd_ptr CVulkanLogicalDevice::createDescriptorPo } // a lot of empirical research went into defining this constant -constexpr uint32_t MaxDescriptorSetAsWrites = 69u; +// constexpr uint32_t MaxDescriptorSetAsWrites = 69u; void CVulkanLogicalDevice::updateDescriptorSets_impl(const SUpdateDescriptorSetsParams& params) { diff --git a/src/nbl/video/CVulkanLogicalDevice.h b/src/nbl/video/CVulkanLogicalDevice.h index 3ed5e9983a..ae4c71521b 100644 --- a/src/nbl/video/CVulkanLogicalDevice.h +++ b/src/nbl/video/CVulkanLogicalDevice.h @@ -80,7 +80,7 @@ class CVulkanLogicalDevice final : public ILogicalDevice const CVulkanDeviceFunctionTable* getFunctionTable() const { return &m_devf; } - inline const void* getNativeHandle() const {return &m_vkdev;} + inline const void* getNativeHandle() const override {return &m_vkdev;} VkDevice getInternalObject() const {return m_vkdev;} private: diff --git a/src/nbl/video/CVulkanPhysicalDevice.cpp b/src/nbl/video/CVulkanPhysicalDevice.cpp index 3b7df3a9dd..a72ecf3f8c 100644 --- a/src/nbl/video/CVulkanPhysicalDevice.cpp +++ b/src/nbl/video/CVulkanPhysicalDevice.cpp @@ -1,6 +1,8 @@ #include "nbl/video/CVulkanPhysicalDevice.h" #include "nbl/video/CVulkanLogicalDevice.h" +#include "nbl/builtin/hlsl/math/intutil.hlsl" + namespace nbl::video { @@ -631,7 +633,7 @@ std::unique_ptr CVulkanPhysicalDevice::create(core::smart properties.limits.dispatchBase = true; properties.limits.allowCommandBufferQueryCopies = true; // TODO: REDO WE NOW SUPPORT PERF QUERIES always true in vk for all query types instead of PerformanceQuery which we don't support at the moment (have VkPhysicalDevicePerformanceQueryPropertiesKHR::allowCommandBufferQueryCopies in mind) - properties.limits.maxOptimallyResidentWorkgroupInvocations = core::min(core::roundDownToPoT(properties.limits.maxComputeWorkGroupInvocations),512u); + properties.limits.maxOptimallyResidentWorkgroupInvocations = core::min(hlsl::roundDownToPoT(properties.limits.maxComputeWorkGroupInvocations),512u); auto invocationsPerComputeUnit = getMaxInvocationsPerComputeUnitsFromDriverID(properties.driverID); if(isExtensionSupported(VK_NV_SHADER_SM_BUILTINS_EXTENSION_NAME)) diff --git a/src/nbl/video/IGPUCommandBuffer.cpp b/src/nbl/video/IGPUCommandBuffer.cpp index d01aad28c4..a9403148db 100644 --- a/src/nbl/video/IGPUCommandBuffer.cpp +++ b/src/nbl/video/IGPUCommandBuffer.cpp @@ -6,6 +6,7 @@ #include "nbl/logging_macros.h" #include "nbl/builtin/hlsl/indirect_commands.hlsl" +#include "nbl/builtin/hlsl/math/intutil.hlsl" namespace nbl::video { @@ -1039,7 +1040,7 @@ bool IGPUCommandBuffer::bindDescriptorSets( NBL_LOG_ERROR("pDescriptorSets[%d] was not created by the same ILogicalDevice as the commandbuffer!", i); return false; } - if (!pDescriptorSets[i]->getLayout()->isIdenticallyDefined(layout->getDescriptorSetLayout(firstSet + i))) + if (!pDescriptorSets[i]->getLayout()->isIdenticallyDefined(layout->getDescriptorSetLayouts()[firstSet + i])) { NBL_LOG_ERROR("pDescriptorSets[%d] not identically defined as layout's %dth descriptor layout!", i, firstSet+i); return false; @@ -1311,7 +1312,7 @@ bool IGPUCommandBuffer::writeTimestamp(const stage_flags_t pipelineStage, IQuery return false; } - assert(core::isPoT(static_cast(pipelineStage))); // should only be 1 stage (1 bit set) + assert(hlsl::isPoT(static_cast(pipelineStage))); // should only be 1 stage (1 bit set) if (!m_cmdpool->m_commandListPool.emplace(m_commandList, core::smart_refctd_ptr(queryPool))) { diff --git a/src/nbl/video/ILogicalDevice.cpp b/src/nbl/video/ILogicalDevice.cpp index d951deeb3d..0b13675adb 100644 --- a/src/nbl/video/ILogicalDevice.cpp +++ b/src/nbl/video/ILogicalDevice.cpp @@ -175,74 +175,74 @@ bool ILogicalDevice::validateMemoryBarrier(const uint32_t queueFamilyIndex, asse const core::bitflag supportedStageMask = getSupportedStageMask(queueFamilyIndex); using access_flags_t = asset::ACCESS_FLAGS; const core::bitflag supportedAccessMask = getSupportedAccessMask(queueFamilyIndex); - auto validAccess = [supportedStageMask, supportedAccessMask](core::bitflag& stageMask, core::bitflag& accessMask) -> bool - { - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03916 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03917 - if (bool(accessMask & (access_flags_t::HOST_READ_BIT | access_flags_t::HOST_WRITE_BIT)) && !stageMask.hasFlags(stage_flags_t::HOST_BIT)) - return false; - // this takes care of all stuff below - if (stageMask.hasFlags(stage_flags_t::ALL_COMMANDS_BITS)) - return true; - // first strip unsupported bits - stageMask &= supportedStageMask; - accessMask &= supportedAccessMask; - // TODO: finish this stuff - if (stageMask.hasFlags(stage_flags_t::ALL_GRAPHICS_BITS)) - { - if (stageMask.hasFlags(stage_flags_t::ALL_TRANSFER_BITS)) - { - } - else - { - } - } - else - { - if (stageMask.hasFlags(stage_flags_t::ALL_TRANSFER_BITS)) - { - } - else - { - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03914 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03915 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03927 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03928 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-06256 - } - // this is basic valid usage stuff -#ifdef _NBL_DEBUG -// TODO: -// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03900 - if (accessMask.hasFlags(access_flags_t::INDIRECT_COMMAND_READ_BIT) && !bool(stageMask & (stage_flags_t::DISPATCH_INDIRECT_COMMAND_BIT | stage_flags_t::ACCELERATION_STRUCTURE_BUILD_BIT))) - return false; - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03901 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03902 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03903 - //constexpr core::bitflag ShaderStages = stage_flags_t::PRE_RASTERIZATION_SHADERS; - //const bool noShaderStages = stageMask&ShaderStages; - // TODO: - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03904 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03905 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03906 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03907 - // IMPLICIT: https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-07454 - // IMPLICIT: https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03909 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-07272 - // TODO: - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03910 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03911 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03912 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03913 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03918 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03919 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03924 - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03925 -#endif - } - // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-07457 - return true; - }; +// auto validAccess = [supportedStageMask, supportedAccessMask](core::bitflag& stageMask, core::bitflag& accessMask) -> bool +// { +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03916 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03917 +// if (bool(accessMask & (access_flags_t::HOST_READ_BIT | access_flags_t::HOST_WRITE_BIT)) && !stageMask.hasFlags(stage_flags_t::HOST_BIT)) +// return false; +// // this takes care of all stuff below +// if (stageMask.hasFlags(stage_flags_t::ALL_COMMANDS_BITS)) +// return true; +// // first strip unsupported bits +// stageMask &= supportedStageMask; +// accessMask &= supportedAccessMask; +// // TODO: finish this stuff +// if (stageMask.hasFlags(stage_flags_t::ALL_GRAPHICS_BITS)) +// { +// if (stageMask.hasFlags(stage_flags_t::ALL_TRANSFER_BITS)) +// { +// } +// else +// { +// } +// } +// else +// { +// if (stageMask.hasFlags(stage_flags_t::ALL_TRANSFER_BITS)) +// { +// } +// else +// { +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03914 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03915 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03927 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03928 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-06256 +// } +// // this is basic valid usage stuff +//#ifdef _NBL_DEBUG +//// TODO: +//// https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03900 +// if (accessMask.hasFlags(access_flags_t::INDIRECT_COMMAND_READ_BIT) && !bool(stageMask & (stage_flags_t::DISPATCH_INDIRECT_COMMAND_BIT | stage_flags_t::ACCELERATION_STRUCTURE_BUILD_BIT))) +// return false; +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03901 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03902 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03903 +// //constexpr core::bitflag ShaderStages = stage_flags_t::PRE_RASTERIZATION_SHADERS; +// //const bool noShaderStages = stageMask&ShaderStages; +// // TODO: +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03904 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03905 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03906 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03907 +// // IMPLICIT: https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-07454 +// // IMPLICIT: https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03909 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-07272 +// // TODO: +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03910 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03911 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03912 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03913 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03918 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03919 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03924 +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-03925 +//#endif +// } +// // https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkMemoryBarrier2-srcAccessMask-07457 +// return true; +// }; return true; } @@ -317,7 +317,6 @@ core::smart_refctd_ptr ILogicalDevice::compileShader(const SS case IGPUShader::E_SHADER_STAGE::ESS_MESH: NBL_LOG_ERROR("Unsupported (yet) shader stage"); return nullptr; - break; case IGPUShader::E_SHADER_STAGE::ESS_RAYGEN: [[fallthrough]]; case IGPUShader::E_SHADER_STAGE::ESS_ANY_HIT: [[fallthrough]]; case IGPUShader::E_SHADER_STAGE::ESS_CLOSEST_HIT: [[fallthrough]]; @@ -334,7 +333,6 @@ core::smart_refctd_ptr ILogicalDevice::compileShader(const SS // Implicit unsupported stages or weird multi-bit stage enum values NBL_LOG_ERROR("Unknown Shader Stage %d", shaderStage); return nullptr; - break; } core::smart_refctd_ptr spirvShader; diff --git a/src/nbl/video/utilities/CAssetConverter.cpp b/src/nbl/video/utilities/CAssetConverter.cpp index 1382efe443..1826a73f64 100644 --- a/src/nbl/video/utilities/CAssetConverter.cpp +++ b/src/nbl/video/utilities/CAssetConverter.cpp @@ -2,6 +2,8 @@ // This file is part of the "Nabla Engine". #include "nbl/video/utilities/CAssetConverter.h" +#include "nbl/builtin/hlsl/math/intutil.hlsl" + #include @@ -52,7 +54,6 @@ bool CAssetConverter::patch_impl_t::valid(const ILogicalDevice* devi case IGPUShader::E_SHADER_STAGE::ESS_FRAGMENT: case IGPUShader::E_SHADER_STAGE::ESS_COMPUTE: return true; - break; case IGPUShader::E_SHADER_STAGE::ESS_TESSELLATION_CONTROL: case IGPUShader::E_SHADER_STAGE::ESS_TESSELLATION_EVALUATION: if (features.tessellationShader) @@ -110,7 +111,7 @@ bool CAssetConverter::acceleration_structure_patch_base::valid(const ILogicalDev if (!features.accelerationStructure) return false; // just make the flags agree/canonicalize - allowCompaction = allowCompaction || compactAfterBuild; + allowCompaction = allowCompaction | compactAfterBuild; // on a second thought, if someone asked for BLAS with data access, they probably intend to use it const auto& limits = device->getPhysicalDevice()->getLimits(); if (allowDataAccess && !limits.rayTracingPositionFetch) @@ -651,7 +652,7 @@ class AssetVisitor : public CRTP case IDescriptor::EC_IMAGE: { auto imageView = static_cast(untypedDesc); - IGPUImage::E_USAGE_FLAGS usage; + IGPUImage::E_USAGE_FLAGS usage = IGPUImage::E_USAGE_FLAGS::EUF_NONE; // usage is set later anyway, default ends the program switch (type) { case IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER: @@ -2020,7 +2021,7 @@ auto CAssetConverter::reserve(const SInputs& inputs) -> SReserveResult .device = device, .dfsCaches = dfsCaches, .stack = stack - }.descend_impl_impl({},{asset,uniqueGroupID},std::move(patch)); + }.template descend_impl_impl({},{asset,uniqueGroupID},std::move(patch)); } }; core::for_each_in_tuple(inputs.assets,initialize); @@ -2740,7 +2741,7 @@ auto CAssetConverter::reserve(const SInputs& inputs) -> SReserveResult core::vector> immutableSamplers(asset->getImmutableSamplers().size()); { const auto& immutableSamplerRedirects = asset->getImmutableSamplerRedirect(); - auto outImmutableSamplers = immutableSamplers.data(); + // auto outImmutableSamplers = immutableSamplers.data(); for (auto j=0u; j SReserveResult const auto* memBacked = getAsBase(binItems[i]); const auto& memReqs = memBacked->getMemoryReqs(); // round up the offset to get the correct alignment - offsetsTmp[i] = core::roundUp(offsetsTmp[i],0x1ull< SReserveResult .image = std::get*>(toBind)->get(), .binding = binding }; - bindSuccess = device->bindImageMemory(1,&info); + bindSuccess = device->bindImageMemory(std::span(&info, 1u)); } break; default: @@ -3926,6 +3927,10 @@ ISemaphore::future_t CAssetConverter::convert_impl(SReserveResul assert(false); break; } + + // suppress the -Wunused-but-set-variable (storeFormat) + (void)storeFormat; + // no point caching this view, has to be created individually for each mip level with modified format auto dstView = device->createImageView({ .flags = IGPUImageView::ECF_NONE, diff --git a/src/nbl/video/utilities/CComputeBlit.cpp b/src/nbl/video/utilities/CComputeBlit.cpp index cb8cb3e45b..4425543478 100644 --- a/src/nbl/video/utilities/CComputeBlit.cpp +++ b/src/nbl/video/utilities/CComputeBlit.cpp @@ -1,6 +1,7 @@ #include "nbl/video/utilities/CComputeBlit.h" #include "nbl/builtin/hlsl/binding_info.hlsl" #include "nbl/builtin/hlsl/tgmath.hlsl" +#include "nbl/builtin/hlsl/math/intutil.hlsl" using namespace nbl::core; using namespace nbl::hlsl; @@ -31,8 +32,8 @@ auto CComputeBlit::createAndCachePipelines(const SPipelinesCreateInfo& info) -> const auto& limits = m_device->getPhysicalDevice()->getLimits(); retval.workgroupSize = 0x1u< bool { const auto initialOffset = stagingBufferOffset; - stagingBufferOffset = core::roundUp(stagingBufferOffset, bufferOffsetAlignment); + stagingBufferOffset = hlsl::roundUp(stagingBufferOffset, bufferOffsetAlignment); stagingBufferOffset += size; const auto consumedMemory = stagingBufferOffset - initialOffset; if(consumedMemory <= availableMemory)