Skip to content

Commit

Permalink
dev merge to master
Browse files Browse the repository at this point in the history
  • Loading branch information
FuXiii committed Jul 12, 2023
2 parents 802ead1 + 81f3428 commit d978ed3
Show file tree
Hide file tree
Showing 7 changed files with 569 additions and 40 deletions.
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@
[submodule "engine/core/thirdparty/glslang"]
path = engine/core/thirdparty/glslang
url = git@github.com:KhronosGroup/glslang.git
[submodule "engine/core/thirdparty/SPIRV-Cross"]
path = engine/core/thirdparty/SPIRV-Cross
url = git@github.com:KhronosGroup/SPIRV-Cross.git
branch = main
[submodule "engine/core/thirdparty/VulkanMemoryAllocator"]
path = engine/core/thirdparty/VulkanMemoryAllocator
url = git@github.com:GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
branch = master
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ Turbo是渲染引擎
* 依赖:`Core``FrameGraph`
* 说明:由于直接使用`Core`层进行渲染相对来说还是会比较繁琐吃力一些,`Render`模块的出现就是将`Core``FrameGraph`结合起来,提供更加方便的工作流,将开发者从繁杂的`Core`层脱离出来,提供更加简单易用的设计架构

## Clone

```CMD
git clone --recursive git@github.com:FuXiii/Turbo.git
```

## Build

* 首先您需要知道的:
Expand Down Expand Up @@ -120,8 +126,8 @@ Turbo是渲染引擎
KTX_FEATURE_STATIC_LIBRARY=ON //目前Turbo按照静态库使用KTX

//2022/7/30 关于解决Turbo核心库的依赖库问题解决,核心库对于VulkanMemoryAllocator使用动态加载Vulkan API方式,这也是Turbo引擎加载Vulkan API的方式
VMA_STATIC_VULKAN_FUNCTIONS=0
VMA_DYNAMIC_VULKAN_FUNCTIONS=1
VMA_STATIC_VULKAN_FUNCTIONS=OFF
VMA_DYNAMIC_VULKAN_FUNCTIONS=ON
```

*注:如果编译有遇到问题请查看[`常见问题文档`](./docs/FAQ.md)如果还是没有解决方法请提`Issue`*
Expand Down Expand Up @@ -3309,3 +3315,21 @@ Turbo是渲染引擎
>
>* `./samples`下更新`VulkanKHRRayTracingTest.cpp`探索实时光追的加速结构,成功创建一个底层加速结构
* 2023/7/6 设计架构
>
>* `./samples`下更新`VulkanKHRRayTracingTest.cpp`探索压缩实时光追的加速结构
* 2023/7/10 设计架构
>
>* `./samples`下更新`VulkanKHRRayTracingTest.cpp`探索实时光追的顶层加速结构
* 2023/7/11 设计架构
>
>* `./samples`下更新`VulkanKHRRayTracingTest.cpp`探索实时光追的顶层加速结构
* 2023/7/12 设计架构
>
>* `./samples`下更新`VulkanKHRRayTracingTest.cpp`探索实时光追的顶层加速结构
>* `./engine/core`下`thirdparty`中`SPIRV-Cross`和`VulkanMemoryAllocator`转成`submodules`
>* `./engine/core`下更新`CMakeLists.txt`适配新版的`VulkanMemoryAllocator`
>* `README`增加`Clone`章节
25 changes: 23 additions & 2 deletions engine/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,20 @@ aux_source_directory(./src/ SRCS)

add_subdirectory(./thirdparty)

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/VulkanMemoryAllocator/src/VmaUsage.cpp")
set(VMA_SRCS
./thirdparty/VulkanMemoryAllocator/src/VmaUsage.cpp
./thirdparty/VulkanMemoryAllocator/include/vk_mem_alloc.h
)
else()
message(FATAL_ERROR "Can not find VulkanMemoryAllocator")
endif()

message(STATUS "${VMA_SRCS}")

add_library(${PROJECT_NAME} STATIC
$<TARGET_OBJECTS:VulkanMemoryAllocator>
${VMA_SRCS}
#$<TARGET_OBJECTS:VulkanMemoryAllocator>
$<TARGET_OBJECTS:MachineIndependent>
$<TARGET_OBJECTS:glslang>
$<TARGET_OBJECTS:glslang-default-resource-limits>
Expand All @@ -19,7 +31,16 @@ $<TARGET_OBJECTS:SPIRV>
$<TARGET_OBJECTS:spirv-cross-core>
$<TARGET_OBJECTS:spirv-cross-glsl>
$<TARGET_OBJECTS:spirv-cross-hlsl>
${SRCS}
${SRCS}
)

target_compile_definitions(${PROJECT_NAME} PUBLIC
VMA_STATIC_VULKAN_FUNCTIONS=$<BOOL:${VMA_STATIC_VULKAN_FUNCTIONS}>
VMA_DYNAMIC_VULKAN_FUNCTIONS=$<BOOL:${VMA_DYNAMIC_VULKAN_FUNCTIONS}>
VMA_DEBUG_ALWAYS_DEDICATED_MEMORY=$<BOOL:${VMA_DEBUG_ALWAYS_DEDICATED_MEMORY}>
VMA_DEBUG_INITIALIZE_ALLOCATIONS=$<BOOL:${VMA_DEBUG_INITIALIZE_ALLOCATIONS}>
VMA_DEBUG_GLOBAL_MUTEX=$<BOOL:${VMA_DEBUG_GLOBAL_MUTEX}>
VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT=$<BOOL:${VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT}>
)

target_include_directories(${PROJECT_NAME}
Expand Down
1 change: 1 addition & 0 deletions engine/core/thirdparty/SPIRV-Cross
Submodule SPIRV-Cross added at b8e742
1 change: 1 addition & 0 deletions engine/core/thirdparty/VulkanMemoryAllocator
Submodule VulkanMemoryAllocator added at 9b0fc3
72 changes: 59 additions & 13 deletions samples/CPPStandardTest.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,62 @@
#include <concepts>
#include <iostream>
#include <list>
#include <type_traits>

template<typename T, typename ... U>
concept IsAnyOf = (std::same_as<T, U> || ...);

template<typename T>
concept IsPrintable = std::integral<T> || std::floating_point<T> ||
IsAnyOf<std::remove_cvref_t<std::remove_pointer_t<std::decay_t<T>>>, char, wchar_t>;

void println(IsPrintable auto const ... arguments)
struct A_Test
{
(std::wcout << ... << arguments) << '\n';
}

int main() { println("Example: ", 3.14, " : ", 42, " : [", 'a', L'-', L"Z]"); }
};

template <typename T>
class TestUniformBuffer
{
private:
uint32_t testValue;

public:
struct Descriptor
{
uint32_t testValue;
};

void Create(const std::string &name, const Descriptor &descriptor, void *allocator)
{
this->testValue = descriptor.testValue;
std::cout << "Size:" << sizeof(T) << std::endl;
}

uint32_t GetValue() const
{
return this->testValue;
}
};

class TestContext
{
public:
template <typename T>
void BindingTestUniformBuffer(const TestUniformBuffer<T> &tub)
{
std::cout << "Value:" << tub.GetValue() << std::endl;
}
};

int main()
{
std::cout << "Hello World" << std::endl;

bool is_class = std::is_class_v<A_Test>;
std::cout << is_class << ":A_Test" << std::endl;

struct B_Test
{
float test;
uint16_t uint16_t_test;
double double_test;
};

TestUniformBuffer<B_Test> test_buffer;
test_buffer.Create("test uniform bffer", {123}, nullptr);

TestContext tc;
tc.BindingTestUniformBuffer(test_buffer);
}
Loading

0 comments on commit d978ed3

Please sign in to comment.