加入volk 和 wma 后 编译不通过, 先保存代码

This commit is contained in:
xsl
2025-10-18 23:59:21 +08:00
parent 4237213658
commit 234e30bd50
605 changed files with 144276 additions and 15 deletions
+29 -3
View File
@@ -3,15 +3,26 @@
#include "AppBase.h"
#include <thread>
#include <mutex>
struct Texture
{
VkSampler sampler;
VkImage image;
VkImageLayout image_layout;
VkDeviceMemory device_memory;
VkImageView view;
uint32_t width, height;
uint32_t mip_levels;
};
class Application : public AppBase
{
public:
void run();
void initVulkan();
virtual void initVulkan();
void initWindow();
void createSurface();
void mainLoop();
@@ -31,7 +42,8 @@ public:
void createSyncObjects();
void drawFrame();
bool isInited() { return inited; }
private:
protected:
VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; // 物理设备
VkDevice device; // 逻辑设备
VkQueue graphicsQueue; // 图形队列
@@ -56,4 +68,18 @@ private:
int currentFrame = 0;
int MAX_FRAMES_IN_FLIGHT = 2;
bool inited = false;
protected:
Texture loadTexture(std::string path);
void processWithVulkan(uint8_t* data, int width, int height, int rowStride, size_t dataSize, Texture& out_texture, bool srgb);
uint32_t findMemoryType(VkPhysicalDevice physicalDevice, uint32_t typeFilter,
VkMemoryPropertyFlags properties);
void createTexture(VkDevice device, VkPhysicalDevice physicalDevice, int width, int height, Texture& texture, bool srgb);
void updateTexture(VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue queue, uint8_t* data, int width, int height, int rowStride, size_t dataSize, Texture& texture);
VkCommandBuffer beginSingleTimeCommands(VkDevice device, VkCommandPool commandPool);
void endSingleTimeCommands(VkDevice device, VkCommandPool commandPool, VkQueue queue, VkCommandBuffer commandBuffer);
void transitionImageLayout(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout oldLayout, VkImageLayout newLayout);
void destroy_texture(Texture texture);
VkQueue queue;
std::mutex mtx;
};