VTK  9.5.20250718
vtkWebGPUTexture.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef vtkWebGPUTexture_h
5#define vtkWebGPUTexture_h
6
7#include "vtkObject.h"
8#include "vtkRenderingWebGPUModule.h" // For export macro
9#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
10
11VTK_ABI_NAMESPACE_BEGIN
12
17class VTKRENDERINGWEBGPU_EXPORT VTK_MARSHALAUTO vtkWebGPUTexture : public vtkObject
18{
19public:
22
23 void PrintSelf(ostream& os, vtkIndent indent) override;
24
33 {
34 RGBA8_UNORM = 0,
38 DEPTH_24_PLUS_8_STENCIL
39 };
40
49 {
50 DIMENSION_1D = 0,
52 DIMENSION_3D
53 };
54
66 {
67 UNDEFINED = 0,
70 READ_WRITE_STORAGE
71 };
72
84 {
85 FLOAT = 0,
89 UNSIGNED_INT
90 };
91
101 {
102 VTK_DATA_ARRAY = 0,
103 STD_VECTOR
104 };
105
109 virtual unsigned int GetBytesPerPixel() const;
110
115 unsigned int GetPixelComponentsCount() const;
116
118
121 unsigned int GetWidth() const { return Extents[0]; }
122 void SetWidth(unsigned int width) { Extents[0] = width; }
124
126
129 unsigned int GetHeight() const { return Extents[1]; }
130 void SetHeight(unsigned int height) { Extents[1] = height; }
132
134
137 unsigned int GetDepth() const { return Extents[2]; }
138 void SetDepth(unsigned int depth) { Extents[2] = depth; }
140
142
148 VTK_WRAPEXCLUDE void GetSize(unsigned int& x, unsigned int& y, unsigned int& z) const;
149 VTK_WRAPEXCLUDE void GetSize(unsigned int& x, unsigned int& y) const;
150 VTK_WRAPEXCLUDE void GetSize(unsigned int* xyz);
151 unsigned int* GetSize() VTK_SIZEHINT(3);
152
153 VTK_WRAPEXCLUDE virtual void SetSize(unsigned int x, unsigned int y, unsigned int z = 1);
154 virtual void SetSize(unsigned int* xyz) VTK_SIZEHINT(3);
156
158
161 vtkGetEnumMacro(Dimension, TextureDimension);
162 vtkSetEnumMacro(Dimension, TextureDimension);
164
166
169 vtkGetEnumMacro(Format, TextureFormat);
170 vtkSetEnumMacro(Format, TextureFormat);
172
174
177 vtkGetEnumMacro(Mode, TextureMode);
178 vtkSetEnumMacro(Mode, TextureMode);
180
182
185 vtkGetEnumMacro(SampleType, TextureSampleType);
186 vtkSetEnumMacro(SampleType, TextureSampleType);
188
190
193 vtkGetMacro(MipLevelCount, unsigned int);
194 vtkSetMacro(MipLevelCount, unsigned int);
196
197protected:
199 ~vtkWebGPUTexture() override;
200
201private:
202 vtkWebGPUTexture(const vtkWebGPUTexture&) = delete;
203 void operator=(const vtkWebGPUTexture&) = delete;
204
205 // Number of pixels in X, Y and Z direction.
206 // Defaulting to 1 in the Z direction because 2D textures are assumed to be the common case.
207 unsigned int Extents[3] = { 0, 0, 1 };
208
209 // Is the texture 1D, 2D or 3D
210 TextureDimension Dimension = TextureDimension::DIMENSION_2D;
211
212 // The format of the texture: RGB or RGBA?
213 TextureFormat Format = TextureFormat::RGBA8_UNORM;
214
215 // The read/write mode of the texture
216 TextureMode Mode = TextureMode::UNDEFINED;
217
218 // The type of value produced when sampling the texture in the shader
219 TextureSampleType SampleType = TextureSampleType::FLOAT;
220
221 // Maximum number of mipmap levels supported by the texture
222 unsigned int MipLevelCount = 1;
223};
224
225VTK_ABI_NAMESPACE_END
226
227#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
Abstraction class for WebGPU textures.
VTK_WRAPEXCLUDE void GetSize(unsigned int &x, unsigned int &y) const
Get/set the size of the texture.
void SetDepth(unsigned int depth)
Get/set the depth in pixels of the texture.
VTK_WRAPEXCLUDE void GetSize(unsigned int &x, unsigned int &y, unsigned int &z) const
Get/set the size of the texture.
unsigned int GetWidth() const
Get/set the width in pixels of the texture.
unsigned int GetPixelComponentsCount() const
Returns the number of components per pixel for the format of this texture.
VTK_WRAPEXCLUDE void GetSize(unsigned int *xyz)
Get/set the size of the texture.
unsigned int GetHeight() const
Get/set the height in pixels of the texture.
void SetHeight(unsigned int height)
Get/set the height in pixels of the texture.
TextureMode
How will the texture be used by the shader.
TextureDataType
Because the compute texture can accept multiple data types as input (std::vector, vtkDataArray) but w...
TextureDimension
How the texture data is arranged.
unsigned int * GetSize()
Get/set the size of the texture.
void SetWidth(unsigned int width)
Get/set the width in pixels of the texture.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
unsigned int GetDepth() const
Get/set the depth in pixels of the texture.
TextureSampleType
Determines what kind of value is returned when reading from the texture in the compute shader.
virtual unsigned int GetBytesPerPixel() const
Number of bytes used per pixel.
static vtkWebGPUTexture * New()
TextureFormat
RGBA8_UNORM: Uses RGB + alpha.
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO
#define VTK_WRAPEXCLUDE