Skip to content
Snippets Groups Projects
Verified Commit 8eb02d10 authored by Tobias Frisch's avatar Tobias Frisch
Browse files

[#101] Fix for MSVC

parent 8f0e83dc
No related branches found
No related tags found
No related merge requests found
Pipeline #26596 failed
...@@ -65,7 +65,7 @@ add_library(vkcv STATIC ${vkcv_sources}) ...@@ -65,7 +65,7 @@ add_library(vkcv STATIC ${vkcv_sources})
if(MSVC) if(MSVC)
#enable multicore compilation on visual studio #enable multicore compilation on visual studio
target_compile_options(vkcv PRIVATE "/MP" "/openmp") target_compile_options(vkcv PRIVATE "/MP" "/openmp" "/Zc:offsetof-")
#set source groups to create proper filters in visual studio #set source groups to create proper filters in visual studio
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${vkcv_sources}) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${vkcv_sources})
......
#include "vkcv/FeatureManager.hpp" #include "vkcv/FeatureManager.hpp"
#include <stddef.h>
#include <string.h> #include <string.h>
namespace vkcv { namespace vkcv {
...@@ -11,16 +12,16 @@ vk::PhysicalDeviceFeatures2 query; \ ...@@ -11,16 +12,16 @@ vk::PhysicalDeviceFeatures2 query; \
query.setPNext(&supported); \ query.setPNext(&supported); \
m_physicalDevice.getFeatures2(&query) m_physicalDevice.getFeatures2(&query)
#define vkcv_check_feature(attribute) { \ #define vkcv_check_feature(attribute) { \
const char *f = reinterpret_cast<const char*>(&(features)); \ const char *f = reinterpret_cast<const char*>(&(features)); \
const char *s = reinterpret_cast<const char*>(&(supported)); \ const char *s = reinterpret_cast<const char*>(&(supported)); \
const vk::Bool32* fb = reinterpret_cast<const vk::Bool32*>(f + offsetof(typeof(features), attribute)); \ const vk::Bool32* fb = reinterpret_cast<const vk::Bool32*>(f + offsetof(typeof((features)), attribute)); \
const vk::Bool32* sb = reinterpret_cast<const vk::Bool32*>(s + offsetof(typeof(features), attribute)); \ const vk::Bool32* sb = reinterpret_cast<const vk::Bool32*>(s + offsetof(typeof((features)), attribute)); \
if ((*fb) && (!*sb)) { \ if ((*fb) && (!*sb)) { \
vkcv_log(((required)? LogLevel::ERROR : LogLevel::WARNING), \ vkcv_log(((required)? LogLevel::ERROR : LogLevel::WARNING), \
"Feature '" #attribute "' is not supported"); \ "Feature '" #attribute "' is not supported"); \
return false; \ return false; \
} \ } \
} }
bool FeatureManager::checkSupport(const vk::PhysicalDevice16BitStorageFeatures &features, bool required) const { bool FeatureManager::checkSupport(const vk::PhysicalDevice16BitStorageFeatures &features, bool required) const {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment