Skip to content
Snippets Groups Projects
Commit e4952916 authored by Sebastian Gaida's avatar Sebastian Gaida
Browse files

Merge branch 'develop' into 87-mesh-shader-implementation

# Conflicts:
#	config/lib/vma/vma.cpp
#	include/vkcv/DrawcallRecording.hpp
#	lib/VulkanMemoryAllocator-Hpp
#	modules/scene/CMakeLists.txt
#	projects/CMakeLists.txt
#	src/vkcv/Context.cpp
#	src/vkcv/Core.cpp
#	src/vkcv/DrawcallRecording.cpp
#	src/vkcv/PipelineManager.cpp
parents e411dc41 7d636b62
No related branches found
No related tags found
1 merge request!74Resolve "Mesh Shader Implementation"
Pipeline #26405 failed
...@@ -3,5 +3,56 @@ ...@@ -3,5 +3,56 @@
#define _DEBUG #define _DEBUG
#endif #endif
#ifndef _MSVC_LANG
#ifdef __MINGW32__
#include <stdint.h>
#include <stdlib.h>
class VmaMutex {
public:
VmaMutex() : m_locked(false) {}
void Lock() {
while (m_locked);
m_locked = true;
}
void Unlock() {
m_locked = false;
}
private:
bool m_locked;
};
#define VMA_MUTEX VmaMutex
template <typename T>
T* custom_overestimate_malloc(size_t size) {
return new T[size + (sizeof(T) - 1) / sizeof(T)];
}
void* custom_aligned_malloc(size_t alignment, size_t size) {
if (alignment > 4) {
return custom_overestimate_malloc<uint64_t>(size);
} else
if (alignment > 2) {
return custom_overestimate_malloc<uint32_t>(size);
} else
if (alignment > 1) {
return custom_overestimate_malloc<uint16_t>(size);
} else {
return custom_overestimate_malloc<uint8_t>(size);
}
}
void custom_free(void *ptr) {
delete[] reinterpret_cast<uint8_t*>(ptr);
}
#define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (custom_aligned_malloc(alignment, size))
#define VMA_SYSTEM_FREE(ptr) (custom_free(ptr))
#endif
#endif
#define VMA_IMPLEMENTATION #define VMA_IMPLEMENTATION
#include "vk_mem_alloc.hpp" #include "vk_mem_alloc.hpp"
...@@ -70,4 +70,4 @@ namespace vkcv { ...@@ -70,4 +70,4 @@ namespace vkcv {
const uint32_t pushConstantOffset, const uint32_t pushConstantOffset,
const MeshShaderDrawcall& drawcall, const MeshShaderDrawcall& drawcall,
const uint32_t firstTask); const uint32_t firstTask);
} }
\ No newline at end of file
#pragma once #pragma once
#include <functional> #include <functional>
#ifndef __MINGW32__
#include <mutex> #include <mutex>
#endif
namespace vkcv { namespace vkcv {
...@@ -27,7 +30,10 @@ namespace vkcv { ...@@ -27,7 +30,10 @@ namespace vkcv {
private: private:
std::vector< event_function<T...> > m_functions; std::vector< event_function<T...> > m_functions;
uint32_t m_id_counter; uint32_t m_id_counter;
#ifndef __MINGW32__
std::mutex m_mutex; std::mutex m_mutex;
#endif
public: public:
...@@ -75,14 +81,18 @@ namespace vkcv { ...@@ -75,14 +81,18 @@ namespace vkcv {
* locks the event so its function handles won't be called * locks the event so its function handles won't be called
*/ */
void lock() { void lock() {
#ifndef __MINGW32__
m_mutex.lock(); m_mutex.lock();
#endif
} }
/** /**
* unlocks the event so its function handles can be called after locking * unlocks the event so its function handles can be called after locking
*/ */
void unlock() { void unlock() {
#ifndef __MINGW32__
m_mutex.unlock(); m_mutex.unlock();
#endif
} }
explicit event(bool locked = false) { explicit event(bool locked = false) {
......
Subproject commit eae6e8d3bd4593e0d7071c85fba2a8f33fbe5dab Subproject commit 3a61240a5354ce56c222969a69825aabb6ba0a21
...@@ -4,18 +4,20 @@ find_package(glm QUIET) ...@@ -4,18 +4,20 @@ find_package(glm QUIET)
if (glm_FOUND) if (glm_FOUND)
list(APPEND vkcv_camera_includes ${GLM_INCLUDE_DIRS}) list(APPEND vkcv_camera_includes ${GLM_INCLUDE_DIRS})
list(APPEND vkcv_camera_libraries glm) list(APPEND vkcv_camera_libraries glm)
list(APPEND vkcv_camera_definitions GLM_DEPTH_ZERO_TO_ONE)
list(APPEND vkcv_camera_definitions GLM_FORCE_LEFT_HANDED)
else() else()
if (EXISTS "${vkcv_camera_lib_path}/glm") if (EXISTS "${vkcv_camera_lib_path}/glm")
add_subdirectory(${vkcv_camera_lib}/glm) add_subdirectory(${vkcv_camera_lib}/glm)
list(APPEND vkcv_camera_includes ${vkcv_camera_lib_path}/glm)
list(APPEND vkcv_camera_libraries glm) list(APPEND vkcv_camera_libraries glm)
list(APPEND vkcv_camera_definitions GLM_DEPTH_ZERO_TO_ONE)
list(APPEND vkcv_camera_definitions GLM_FORCE_LEFT_HANDED)
else() else()
message(WARNING "GLM is required..! Update the submodules!") message(WARNING "GLM is required..! Update the submodules!")
endif () endif ()
endif () endif ()
list(APPEND vkcv_camera_definitions GLM_DEPTH_ZERO_TO_ONE)
list(APPEND vkcv_camera_definitions GLM_FORCE_LEFT_HANDED)
if ((WIN32) AND (${CMAKE_SIZEOF_VOID_P} MATCHES 4))
list(APPEND vkcv_camera_definitions GLM_ENABLE_EXPERIMENTAL)
endif()
...@@ -44,4 +44,4 @@ target_include_directories(vkcv_scene SYSTEM BEFORE PRIVATE ${vkcv_include} ${vk ...@@ -44,4 +44,4 @@ target_include_directories(vkcv_scene SYSTEM BEFORE PRIVATE ${vkcv_include} ${vk
target_include_directories(vkcv_scene BEFORE PUBLIC ${vkcv_scene_include}) target_include_directories(vkcv_scene BEFORE PUBLIC ${vkcv_scene_include})
# linking with libraries from all dependencies and the VkCV framework # linking with libraries from all dependencies and the VkCV framework
target_link_libraries(vkcv_scene vkcv vkcv_asset_loader vkcv_material vkcv_camera) target_link_libraries(vkcv_scene vkcv vkcv_asset_loader vkcv_material vkcv_camera)
\ No newline at end of file
...@@ -100,4 +100,3 @@ namespace vkcv { ...@@ -100,4 +100,3 @@ namespace vkcv {
MeshShaderFunctions.cmdDrawMeshTasks(VkCommandBuffer(cmdBuffer), drawcall.taskCount, firstTask); MeshShaderFunctions.cmdDrawMeshTasks(VkCommandBuffer(cmdBuffer), drawcall.taskCount, firstTask);
} }
} }
...@@ -326,12 +326,12 @@ namespace vkcv ...@@ -326,12 +326,12 @@ namespace vkcv
vk::PipelineLayoutCreateInfo pipelineLayoutCreateInfo( vk::PipelineLayoutCreateInfo pipelineLayoutCreateInfo(
{}, {},
(config.m_DescriptorLayouts), (config.m_DescriptorLayouts),
pushConstantRange); (pushConstantRange));
if (pushConstantSize == 0) {
if (pushConstantSize <= 0) {
pipelineLayoutCreateInfo.pushConstantRangeCount = 0; pipelineLayoutCreateInfo.pushConstantRangeCount = 0;
} }
vk::PipelineLayout vkPipelineLayout{}; vk::PipelineLayout vkPipelineLayout{};
if (m_Device.createPipelineLayout(&pipelineLayoutCreateInfo, nullptr, &vkPipelineLayout) != vk::Result::eSuccess) if (m_Device.createPipelineLayout(&pipelineLayoutCreateInfo, nullptr, &vkPipelineLayout) != vk::Result::eSuccess)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment