save code
This commit is contained in:
@@ -1,23 +1,3 @@
|
||||
/* Copyright (c) 2019-2024, Sascha Willems
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 the "License";
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Texture loading (and display) example (including mip maps)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -25,7 +5,6 @@
|
||||
|
||||
#include "api_vulkan_sample.h"
|
||||
|
||||
// Vertex layout for this example
|
||||
struct TextureLoadingVertexStructure
|
||||
{
|
||||
float pos[3];
|
||||
@@ -36,8 +15,6 @@ struct TextureLoadingVertexStructure
|
||||
class TextureLoading : public ApiVulkanSample
|
||||
{
|
||||
public:
|
||||
// Contains all Vulkan objects that are required to store and use a texture
|
||||
// Note that this repository contains a texture class (vulkan_texture.h) that encapsulates texture loading functionality in a class that is used in subsequent demos
|
||||
struct Texture
|
||||
{
|
||||
VkSampler sampler;
|
||||
@@ -81,8 +58,6 @@ class TextureLoading : public ApiVulkanSample
|
||||
TextureLoading();
|
||||
~TextureLoading();
|
||||
virtual void request_gpu_features(vkb::PhysicalDevice &gpu) override;
|
||||
void load_texture();
|
||||
void destroy_texture(Texture texture);
|
||||
void build_command_buffers() override;
|
||||
void draw();
|
||||
void generate_quad();
|
||||
@@ -96,17 +71,16 @@ 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;
|
||||
|
||||
void destroy_texture(Texture texture);
|
||||
|
||||
public:
|
||||
|
||||
void processWithVulkan(uint8_t* data, int width, int height, int format, int rowStride, size_t dataSize);
|
||||
void processWithVulkan(uint8_t* data, int width, int height, int format, int rowStride, size_t dataSize, Texture& out_texture);
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user