VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
metalTexture.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Created by Arnis Lektauers on 08.08.2025.
5//
6#pragma once
7
9#include "Metal/Metal.hpp"
11
13{
19 public:
20 explicit MetalTexture(Texture* texture);
21
23
24 void create(MetalGraphicsDevice* device);
25
26 [[nodiscard]] MTL::Texture* raw() const { return _metalTexture; }
27
32 void setExternalTexture(MTL::Texture* externalTexture);
33
34 void uploadImmediate(GraphicsDevice* device) override;
35
36 void propertyChanged(uint32_t flag) override;
37
38 // Upload texture data to GPU
39 void uploadData(GraphicsDevice* device);
40
41 private:
42 void uploadRawImage(void* imageData, size_t imageDataSize, uint32_t mipLevel, uint32_t index) const;
43 void uploadVolumeData(void* imageData, size_t imageDataSize, uint32_t mipLevel) const;
44
45 Texture* _texture = nullptr;
46
47 MTL::Texture* _metalTexture = nullptr;
48 bool _ownsTexture = true;
49
50 MTL::TextureDescriptor* _descriptor = nullptr;
51
52 // Array of samplers addressed by sample type
53 std::vector<MTL::SamplerState*> _samplers;
54 };
55}
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
void uploadImmediate(GraphicsDevice *device) override
void setExternalTexture(MTL::Texture *externalTexture)
void uploadData(GraphicsDevice *device)
void create(MetalGraphicsDevice *device)
void propertyChanged(uint32_t flag) override