Skip to content

Commit 758b1e6

Browse files
fix EXR problems and others caused by MSVC v143
1 parent 4df0db9 commit 758b1e6

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

include/nbl/core/memory/new_delete.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ struct NBL_API AlignedWithAllocator
103103
#define _NBL_DELETE(_obj) nbl::core::impl::AlignedWithAllocator<typename std::remove_reference<typename std::remove_pointer<decltype(_obj)>::type>::type,_NBL_DEFAULT_ALLOCATOR_METATYPE<typename std::remove_reference<typename std::remove_pointer<decltype(_obj)>::type>::type> >::delete_(_obj)
104104

105105
#define _NBL_NEW_ARRAY(_obj_type,count) nbl::core::impl::AlignedWithAllocator<_obj_type,_NBL_DEFAULT_ALLOCATOR_METATYPE<_obj_type> >::new_array(count,_NBL_DEFAULT_ALIGNMENT(_obj_type))
106-
#define _NBL_DELETE_ARRAY(_obj,count) nbl::core::impl::AlignedWithAllocator<typename std::remove_reference<typename std::remove_pointer<decltype(_obj)>::type>::type,_NBL_DEFAULT_ALLOCATOR_METATYPE<typename std::remove_reference<typename std::remove_pointer<decltype(_obj)>::type>::type> >::delete_array(_obj,count)
106+
#define _NBL_DELETE_ARRAY(_obj,count) nbl::core::impl::AlignedWithAllocator<typename std::remove_reference_t<typename std::remove_pointer_t<decltype(_obj)>>,_NBL_DEFAULT_ALLOCATOR_METATYPE<typename std::remove_reference_t<typename std::remove_pointer_t<decltype(_obj)>>> >::delete_array(_obj,count)
107107

108108
//! Extra Utility Macros for when you don't want to always have to deduce the alignment but want to use a specific allocator
109109
//#define _NBL_ASSERT_ALLOCATOR_VALUE_TYPE(_obj_type,_allocator_type) static_assert(std::is_same<_obj_type,_allocator_type::value_type>::value,"Wrong allocator value_type!")

include/nbl/video/IPhysicalDevice.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ class NBL_API2 IPhysicalDevice : public core::Interface, public core::Unmovable
720720
namespace std
721721
{
722722
template<>
723-
struct std::hash<nbl::video::IPhysicalDevice::SFormatImageUsages::SUsage>
723+
struct hash<nbl::video::IPhysicalDevice::SFormatImageUsages::SUsage>
724724
{
725725
inline uint32_t operator()(const nbl::video::IPhysicalDevice::SFormatImageUsages::SUsage& i) const
726726
{
@@ -739,7 +739,7 @@ namespace std
739739
};
740740

741741
template<>
742-
struct std::hash<nbl::video::IPhysicalDevice::SFormatBufferUsages::SUsage>
742+
struct hash<nbl::video::IPhysicalDevice::SFormatBufferUsages::SUsage>
743743
{
744744
inline uint32_t operator()(const nbl::video::IPhysicalDevice::SFormatBufferUsages::SUsage& b) const
745745
{

src/nbl/asset/interchange/CImageWriterOpenEXR.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ namespace nbl::asset::impl
114114
constexpr uint8_t availableChannels = 4;
115115

116116
template<typename ilmType>
117-
bool createAndWriteImage(std::array<ilmType*, availableChannels>& pixelsArrayIlm, const asset::ICPUImage* image, system::IFile* _file)
117+
bool createAndWriteImage(std::array<ilmType*,availableChannels>& pixelsArrayIlm, const asset::ICPUImage* image, system::IFile* _file)
118118
{
119119
const auto& creationParams = image->getCreationParameters();
120120
auto getIlmType = [&creationParams]()
@@ -142,7 +142,8 @@ bool createAndWriteImage(std::array<ilmType*, availableChannels>& pixelsArrayIlm
142142
channelPixelsPtr = _NBL_NEW_ARRAY(ilmType, width * height);
143143

144144
const auto* data = reinterpret_cast<const uint8_t*>(image->getBuffer()->getPointer());
145-
auto writeTexel = [&creationParams,&data,&pixelsArrayIlm](uint32_t ptrOffset, const core::vectorSIMDu32& texelCoord) -> void
145+
// have to use `std::function` cause MSVC is borderline retarded and feel the need to instantiate separate Lambda types for each reference!?
146+
auto writeTexel = std::function([&creationParams,&data,&pixelsArrayIlm](uint32_t ptrOffset, const core::vectorSIMDu32& texelCoord) -> void
146147
{
147148
assert(texelCoord.w==0u && texelCoord.z==0u);
148149

@@ -154,7 +155,7 @@ bool createAndWriteImage(std::array<ilmType*, availableChannels>& pixelsArrayIlm
154155
ilmType channelPixel = *(reinterpret_cast<const ilmType*>(texelPtr) + channelIndex);
155156
*(pixelsArrayIlm[channelIndex] + ptrStyleIlmShiftToDataChannelPixel) = channelPixel;
156157
}
157-
};
158+
});
158159

159160
using StreamToEXR = CRegionBlockFunctorFilter<decltype(writeTexel),true>;
160161
typename StreamToEXR::state_type state(writeTexel,image,nullptr);

src/nbl/asset/interchange/COBJMeshFileLoader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ asset::SAssetBundle COBJMeshFileLoader::loadAsset(system::IFile* _file, const as
9999
};
100100
core::unordered_multiset<pipeline_meta_pair_t,hash_t,key_equal_t> pipelines;
101101

102+
// TODO: map the file whenever possible
102103
std::string fileContents;
103104
fileContents.resize(filesize);
104105
char* const buf = fileContents.data();
@@ -142,6 +143,7 @@ asset::SAssetBundle COBJMeshFileLoader::loadAsset(system::IFile* _file, const as
142143
core::vector<std::string> submeshMaterialNames;
143144
core::vector<uint32_t> vtxSmoothGrp;
144145

146+
// TODO: handle failures much better!
145147
constexpr const char* NO_MATERIAL_MTL_NAME = "#";
146148
bool noMaterial = true;
147149
bool dummyMaterialCreated = false;

0 commit comments

Comments
 (0)