VTK  9.5.20251126
vtkWebGPUTextureDeviceResource.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 vtkWebGPUTextureDeviceResource_h
5#define vtkWebGPUTextureDeviceResource_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 vtkWebGPUTextureDeviceResource : public vtkObject
18{
19public:
22
23 void PrintSelf(ostream& os, vtkIndent indent) override;
24
47
61
90
109
123
127 virtual unsigned int GetBytesPerPixel() const;
128
133 unsigned int GetPixelComponentsCount() const;
134
136
139 unsigned int GetWidth() const { return Extents[0]; }
140 void SetWidth(unsigned int width) { Extents[0] = width; }
142
144
147 unsigned int GetHeight() const { return Extents[1]; }
148 void SetHeight(unsigned int height) { Extents[1] = height; }
150
152
155 unsigned int GetDepth() const { return Extents[2]; }
156 void SetDepth(unsigned int depth) { Extents[2] = depth; }
158
160
166 VTK_WRAPEXCLUDE void GetSize(unsigned int& x, unsigned int& y, unsigned int& z) const;
167 VTK_WRAPEXCLUDE void GetSize(unsigned int& x, unsigned int& y) const;
168 VTK_WRAPEXCLUDE void GetSize(unsigned int* xyz);
169 unsigned int* GetSize() VTK_SIZEHINT(3);
170
171 VTK_WRAPEXCLUDE virtual void SetSize(unsigned int x, unsigned int y, unsigned int z = 1);
172 virtual void SetSize(unsigned int* xyz) VTK_SIZEHINT(3);
174
176
182
184
190
192
198
200
206
208
211 vtkGetMacro(MipLevelCount, unsigned int);
212 vtkSetMacro(MipLevelCount, unsigned int);
214
215protected:
218
219private:
221 void operator=(const vtkWebGPUTextureDeviceResource&) = delete;
222
223 // Number of pixels in X, Y and Z direction.
224 // Defaulting to 1 in the Z direction because 2D textures are assumed to be the common case.
225 unsigned int Extents[3] = { 0, 0, 1 };
226
227 // Is the texture 1D, 2D or 3D
228 TextureDimension Dimension = TextureDimension::DIMENSION_2D;
229
230 // The format of the texture: RGB or RGBA?
231 TextureFormat Format = TextureFormat::RGBA8_UNORM;
232
233 // The read/write mode of the texture
234 TextureMode Mode = TextureMode::UNDEFINED;
235
236 // The type of value produced when sampling the texture in the shader
237 TextureSampleType SampleType = TextureSampleType::FLOAT;
238
239 // Maximum number of mipmap levels supported by the texture
240 unsigned int MipLevelCount = 1;
241};
242
243VTK_ABI_NAMESPACE_END
244
245#endif
a simple class to control print indentation
Definition vtkIndent.h:108
TextureDimension
How the texture data is arranged.
vtkGetEnumMacro(Dimension, TextureDimension)
Get/set the texture dimension.
unsigned int GetPixelComponentsCount() const
Returns the number of components per pixel for the format of this texture.
unsigned int GetHeight() const
Get/set the height in pixels of the texture.
unsigned int * GetSize()
Get/set the size of the texture.
virtual VTK_WRAPEXCLUDE void SetSize(unsigned int x, unsigned int y, unsigned int z=1)
Get/set the size of the texture.
VTK_WRAPEXCLUDE void GetSize(unsigned int &x, unsigned int &y) const
Get/set the size of the texture.
VTK_WRAPEXCLUDE void GetSize(unsigned int *xyz)
Get/set the size of the texture.
vtkSetEnumMacro(Dimension, TextureDimension)
Get/set the texture dimension.
unsigned int GetDepth() const
Get/set the depth in pixels of the texture.
virtual unsigned int GetBytesPerPixel() const
Number of bytes used per pixel.
TextureFormat
RGBA8_UNORM: Uses RGB + alpha.
TextureSampleType
Determines what kind of value is returned when reading from the texture in the compute shader.
TextureMode
How will the texture be used by the shader.
static vtkWebGPUTextureDeviceResource * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetWidth(unsigned int width)
Get/set the width in pixels of the texture.
void SetDepth(unsigned int depth)
Get/set the depth in pixels of the texture.
unsigned int GetWidth() const
Get/set the width in pixels of the texture.
TextureDataType
Because the compute texture can accept multiple data types as input (std::vector, vtkDataArray) but w...
void SetHeight(unsigned int height)
Get/set the height 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.
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO
#define VTK_WRAPEXCLUDE