VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
vulkanTexture.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Vulkan texture implementation — VkImage + VkImageView + VkSampler.
5//
6#pragma once
7
8#ifdef VISUTWIN_HAS_VULKAN
9
10#include <vulkan/vulkan.h>
11#include <vk_mem_alloc.h>
12
15
16namespace visutwin::canvas
17{
18 class GraphicsDevice;
19 class Texture;
20 class VulkanGraphicsDevice;
21}
22
24{
25 class VulkanTexture : public HardwareTexture
26 {
27 public:
28 explicit VulkanTexture(Texture* owner);
29 ~VulkanTexture() override;
30
31 void uploadImmediate(GraphicsDevice* device) override;
32 void propertyChanged(uint32_t flag) override;
33
34 [[nodiscard]] VkImage image() const { return _image; }
35 [[nodiscard]] VkImageView imageView() const { return _imageView; }
36 [[nodiscard]] VkSampler sampler() const { return _sampler; }
37
38 private:
39 void createSampler(VulkanGraphicsDevice* device);
40
41 Texture* _owner = nullptr;
42 VkDevice _vkDevice = VK_NULL_HANDLE;
43 VmaAllocator _allocator = VK_NULL_HANDLE;
44 VkImage _image = VK_NULL_HANDLE;
45 VmaAllocation _allocation = VK_NULL_HANDLE;
46 VkImageView _imageView = VK_NULL_HANDLE;
47 VkSampler _sampler = VK_NULL_HANDLE;
48 };
49}
50
51#endif // VISUTWIN_HAS_VULKAN
Abstract GPU interface for resource creation, state management, and draw submission.
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.
Definition texture.h:57