VTK  9.7.1
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 
11 VTK_ABI_NAMESPACE_BEGIN
12 
17 class VTKRENDERINGWEBGPU_EXPORT VTK_MARSHALAUTO vtkWebGPUTextureDeviceResource : public vtkObject
18 {
19 public:
22 
23  void PrintSelf(ostream& os, vtkIndent indent) override;
24 
33  {
34  R8_UNORM = 0,
45  DEPTH_24_PLUS_8_STENCIL
46  };
47 
56  {
57  DIMENSION_1D = 0,
59  DIMENSION_3D
60  };
61 
81  {
82  UNDEFINED = 0,
89  };
90 
102  {
103  FLOAT = 0,
107  UNSIGNED_INT
108  };
109 
119  {
121  STD_VECTOR
122  };
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 
179  vtkGetEnumMacro(Dimension, TextureDimension);
180  vtkSetEnumMacro(Dimension, TextureDimension);
182 
184 
187  vtkGetEnumMacro(Format, TextureFormat);
188  vtkSetEnumMacro(Format, TextureFormat);
190 
192 
195  vtkGetEnumMacro(Mode, TextureMode);
196  vtkSetEnumMacro(Mode, TextureMode);
198 
200 
203  vtkGetEnumMacro(SampleType, TextureSampleType);
204  vtkSetEnumMacro(SampleType, TextureSampleType);
206 
208 
211  vtkGetMacro(MipLevelCount, unsigned int);
212  vtkSetMacro(MipLevelCount, unsigned int);
214 
215 protected:
217  ~vtkWebGPUTextureDeviceResource() override;
218 
219 private:
220  vtkWebGPUTextureDeviceResource(const vtkWebGPUTextureDeviceResource&) = delete;
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 
243 VTK_ABI_NAMESPACE_END
244 
245 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
TextureMode
How will the texture be used by the shader.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
unsigned int GetHeight() const
Get/set the height in pixels of the texture.
unsigned int GetWidth() const
Get/set the width in pixels of the texture.
unsigned int GetDepth() const
Get/set the depth in pixels of the texture.
a simple class to control print indentation
Definition: vtkIndent.h:28
void SetWidth(unsigned int width)
Get/set the width in pixels of the texture.
Abstraction class for WebGPU textures.
TextureFormat
RGBA8_UNORM: Uses RGB + alpha.
#define VTK_SIZEHINT(...)
TextureSampleType
Determines what kind of value is returned when reading from the texture in the compute shader...
TextureDimension
How the texture data is arranged.
TextureDataType
Because the compute texture can accept multiple data types as input (std::vector, vtkDataArray) but w...
void SetDepth(unsigned int depth)
Get/set the depth in pixels of the texture.
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void SetHeight(unsigned int height)
Get/set the height in pixels of the texture.
#define VTK_WRAPEXCLUDE