Windows 下面终于是编译通过

This commit is contained in:
xsl
2025-10-19 16:26:38 +08:00
parent 234e30bd50
commit 2284911161
4 changed files with 30 additions and 20 deletions
+13
View File
@@ -6,6 +6,10 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(MSVC)
add_compile_options(/Zc:__cplusplus)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
@@ -93,9 +97,18 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR WIN32)
vulkan/FaceApp.cpp
vulkan/main.cpp
vulkan/lodepng.cpp
third_party/vma/src/VmaUsage.h
third_party/vma/src/VmaUsage.cpp
third_party/fmt/src/format.cc
vulkan/framework/common/error.cpp
vulkan/framework/common/strings.cpp
vulkan/framework/core/allocated.cpp
)
endif()
target_compile_definitions(sample PRIVATE VK_NO_PROTOTYPES)
target_compile_definitions(sample PRIVATE GLM_ENABLE_EXPERIMENTAL)
target_compile_definitions(sample PRIVATE VULKAN_HPP_NO_STRUCT_CONSTRUCTORS)
+4
View File
@@ -5,6 +5,9 @@
#include "AppBase.h"
#include <thread>
#include <mutex>
#include <vulkan/vulkan.hpp>
#include "framework/core/buffer.h"
#include "framework/core/device.h"
struct Texture
{
@@ -44,6 +47,7 @@ public:
bool isInited() { return inited; }
protected:
std::unique_ptr<vkb::core::DeviceC> v_device;
VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; // 物理设备
VkDevice device; // 逻辑设备
VkQueue graphicsQueue; // 图形队列
+12 -19
View File
@@ -1,5 +1,5 @@
#include "FaceApp.h"
#include "common/helpers.h"
FaceApp::FaceApp(/* args */)
{
@@ -18,27 +18,20 @@ void FaceApp::initVulkan()
void FaceApp::generate_quad()
{
//std::vector<TextureLoadingVertexStructure>& vertices = obj_vertices;
//std::vector<uint32_t> indices = obj_indices;
std::vector<TextureLoadingVertexStructure>& vertices = obj_vertices;
std::vector<uint32_t> indices = obj_indices;
//index_count = static_cast<uint32_t>(indices.size());
index_count = static_cast<uint32_t>(indices.size());
//auto vertex_buffer_size = vkb::to_u32(vertices.size() * sizeof(TextureLoadingVertexStructure));
//auto index_buffer_size = vkb::to_u32(indices.size() * sizeof(uint32_t));
auto vertex_buffer_size = vkb::to_u32(vertices.size() * sizeof(TextureLoadingVertexStructure));
auto index_buffer_size = vkb::to_u32(indices.size() * sizeof(uint32_t));
//// Create buffers
//// For the sake of simplicity we won't stage the vertex data to the gpu memory
//// Vertex buffer
//vertex_buffer = std::make_unique<vkb::core::BufferC>(get_device(),
// vertex_buffer_size,
// VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
// VMA_MEMORY_USAGE_CPU_TO_GPU);
//vertex_buffer->update(vertices.data(), vertex_buffer_size);
vkb::core::DeviceC& cDevice = reinterpret_cast<vkb::core::DeviceC&>(*v_device);
//index_buffer = std::make_unique<vkb::core::BufferC>(get_device(),
// index_buffer_size,
// VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
// VMA_MEMORY_USAGE_CPU_TO_GPU);
auto vertex_buffer = std::make_unique<vkb::core::BufferC>(cDevice, vertex_buffer_size,VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,VMA_MEMORY_USAGE_CPU_TO_GPU);
vertex_buffer->update(vertices.data(), vertex_buffer_size);
//index_buffer->update(indices.data(), index_buffer_size);
index_buffer = std::make_unique<vkb::core::BufferC>(cDevice,index_buffer_size,VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT,VMA_MEMORY_USAGE_CPU_TO_GPU);
index_buffer->update(indices.data(), index_buffer_size);
}
+1 -1
View File
@@ -2,7 +2,7 @@
#define __FaceApp_H__
#include "Application.h"
#include "framework/core/buffer.h"
struct TextureLoadingVertexStructure