save code
This commit is contained in:
@@ -47,7 +47,10 @@ class TextureLoading : public ApiVulkanSample
|
||||
VkImageView view;
|
||||
uint32_t width, height;
|
||||
uint32_t mip_levels;
|
||||
} texture;
|
||||
};
|
||||
|
||||
Texture texture = {0};
|
||||
Texture cam_text = {0};
|
||||
|
||||
std::unique_ptr<vkb::core::BufferC> vertex_buffer;
|
||||
std::unique_ptr<vkb::core::BufferC> index_buffer;
|
||||
@@ -71,7 +74,10 @@ class TextureLoading : public ApiVulkanSample
|
||||
VkPipelineLayout pipeline_layout;
|
||||
VkDescriptorSet descriptor_set;
|
||||
VkDescriptorSetLayout descriptor_set_layout;
|
||||
|
||||
static TextureLoading* Get() {
|
||||
return loadTextIns;
|
||||
}
|
||||
static TextureLoading* loadTextIns;
|
||||
TextureLoading();
|
||||
~TextureLoading();
|
||||
virtual void request_gpu_features(vkb::PhysicalDevice &gpu) override;
|
||||
@@ -90,6 +96,22 @@ class TextureLoading : public ApiVulkanSample
|
||||
virtual void render(float delta_time) override;
|
||||
virtual void view_changed() override;
|
||||
virtual void on_update_ui_overlay(vkb::Drawer &drawer) override;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
void processWithVulkan(uint8_t* data, int width, int height, int format, int rowStride, size_t dataSize);
|
||||
|
||||
void createTexture(VkDevice device, VkPhysicalDevice physicalDevice, int width, int height, int format, Texture& texture);
|
||||
|
||||
void updateTexture(VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue queue, uint8_t* data, int width, int height, int rowStride, size_t dataSize, Texture& texture);
|
||||
|
||||
// 辅助函数
|
||||
uint32_t findMemoryType(VkPhysicalDevice physicalDevice, uint32_t typeFilter, VkMemoryPropertyFlags properties);
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
std::unique_ptr<vkb::Application> create_texture_loading();
|
||||
|
||||
Reference in New Issue
Block a user