Make WIN32 vulkan macro target-wide

This commit is contained in:
Jack Andersen 2017-12-29 15:06:44 -10:00
parent fa8989bed3
commit 2ada7130d3
3 changed files with 9 additions and 11 deletions

View File

@ -76,7 +76,7 @@ elseif(WIN32)
message(STATUS "Enabling Vulkan support") message(STATUS "Enabling Vulkan support")
list(GET VULKAN_SDK_DIRS 0 VULKAN_SDK_DIR) list(GET VULKAN_SDK_DIRS 0 VULKAN_SDK_DIR)
include_directories("${VULKAN_SDK_DIR}/Include") include_directories("${VULKAN_SDK_DIR}/Include")
list(APPEND _BOO_SYS_DEFINES -DBOO_HAS_VULKAN=1) list(APPEND _BOO_SYS_DEFINES -DBOO_HAS_VULKAN=1 -DVK_USE_PLATFORM_WIN32_KHR=1)
list(APPEND _BOO_SYS_INCLUDES "${VULKAN_SDK_DIR}/Include") list(APPEND _BOO_SYS_INCLUDES "${VULKAN_SDK_DIR}/Include")
list(APPEND PLAT_SRCS lib/graphicsdev/Vulkan.cpp list(APPEND PLAT_SRCS lib/graphicsdev/Vulkan.cpp
lib/graphicsdev/VulkanDispatchTable.cpp) lib/graphicsdev/VulkanDispatchTable.cpp)
@ -204,7 +204,7 @@ else(NOT GEKKO)
lib/inputdev/HIDDeviceUdev.cpp lib/inputdev/HIDDeviceUdev.cpp
lib/graphicsdev/Vulkan.cpp lib/graphicsdev/Vulkan.cpp
lib/graphicsdev/VulkanDispatchTable.cpp) lib/graphicsdev/VulkanDispatchTable.cpp)
list(APPEND _BOO_SYS_DEFINES -DBOO_HAS_VULKAN=1) list(APPEND _BOO_SYS_DEFINES -DBOO_HAS_VULKAN=1 -DVK_USE_PLATFORM_XCB_KHR=1)
list(APPEND _BOO_SYS_LIBS xcb X11-xcb dl udev) list(APPEND _BOO_SYS_LIBS xcb X11-xcb dl udev)
else() else()
list(APPEND PLAT_SRCS list(APPEND PLAT_SRCS

View File

@ -2,12 +2,6 @@
#ifndef HELPERSDISPATCHTABLE_H #ifndef HELPERSDISPATCHTABLE_H
#define HELPERSDISPATCHTABLE_H #define HELPERSDISPATCHTABLE_H
#ifdef _WIN32
#define VK_USE_PLATFORM_WIN32_KHR
#else
#define VK_USE_PLATFORM_XCB_KHR
#endif
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
namespace vk { namespace vk {

View File

@ -13,7 +13,11 @@ static inline uint16_t bswap16(uint16_t val) {return __builtin_bswap16(val); }
static inline uint16_t bswap16(uint16_t val) {return __builtin_byteswap(val);} static inline uint16_t bswap16(uint16_t val) {return __builtin_byteswap(val);}
#endif #endif
#define RAD_TO_DEG (180.0/M_PI) #ifndef M_PIF
#define M_PIF 3.14159265358979323846f /* pi */
#endif
#define RAD_TO_DEG (180.f/M_PIF)
namespace boo namespace boo
{ {
@ -91,8 +95,8 @@ void DualshockPad::receivedHIDReport(const uint8_t* data, size_t length, HIDRepo
float accXval = -((double)state.m_accelerometer[0] - zeroG); float accXval = -((double)state.m_accelerometer[0] - zeroG);
float accYval = -((double)state.m_accelerometer[1] - zeroG); float accYval = -((double)state.m_accelerometer[1] - zeroG);
float accZval = -((double)state.m_accelerometer[2] - zeroG); float accZval = -((double)state.m_accelerometer[2] - zeroG);
state.accPitch = (atan2(accYval, accZval) + M_PI) * RAD_TO_DEG; state.accPitch = (atan2(accYval, accZval) + M_PIF) * RAD_TO_DEG;
state.accYaw = (atan2(accXval, accZval) + M_PI) * RAD_TO_DEG; state.accYaw = (atan2(accXval, accZval) + M_PIF) * RAD_TO_DEG;
state.gyroZ = (state.m_gyrometerZ / 1023.f); state.gyroZ = (state.m_gyrometerZ / 1023.f);
{ {