VTK  9.7.1
vtkWebGPUTextureView.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 vtkWebGPUTextureView_h
5 #define vtkWebGPUTextureView_h
6 
7 #include "vtkObject.h"
8 #include "vtkRenderingWebGPUModule.h" // For export macro
9 #include "vtkWebGPUTextureDeviceResource.h" // for TextureFormat, TextureDimension, ...
10 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
11 
12 VTK_ABI_NAMESPACE_BEGIN
13 
18 class VTKRENDERINGWEBGPU_EXPORT VTK_MARSHALAUTO vtkWebGPUTextureView : public vtkObject
19 {
20 public:
22  static vtkWebGPUTextureView* New();
23 
24  void PrintSelf(ostream& os, vtkIndent indent) override;
25 
38  {
39  ASPECT_ALL = 0,
41  ASPECT_STENCIL
42  };
43 
57  {
58  UNDEFINED = 0,
62  READ_WRITE_STORAGE
63  };
64 
66 
69  vtkGetMacro(BaseMipLevel, int);
70  vtkSetMacro(BaseMipLevel, int);
72 
74 
78  vtkGetMacro(MipLevelCount, int);
79  vtkSetMacro(MipLevelCount, int);
81 
83 
86  vtkGetMacro(Group, vtkIdType);
87  vtkSetMacro(Group, vtkIdType);
89 
91 
94  vtkGetMacro(Binding, vtkIdType);
95  vtkSetMacro(Binding, vtkIdType);
97 
99 
102  vtkGetMacro(Aspect, vtkWebGPUTextureView::TextureViewAspect);
103  vtkSetMacro(Aspect, vtkWebGPUTextureView::TextureViewAspect);
105 
107 
110  vtkGetMacro(Dimension, vtkWebGPUTextureDeviceResource::TextureDimension);
111  vtkSetMacro(Dimension, vtkWebGPUTextureDeviceResource::TextureDimension);
113 
115 
121 
123 
126  vtkGetMacro(Mode, vtkWebGPUTextureView::TextureViewMode);
127  vtkSetMacro(Mode, vtkWebGPUTextureView::TextureViewMode);
129 
131 
135  vtkGetMacro(Label, std::string&);
136  vtkSetMacro(Label, std::string);
138 
139 protected:
141  ~vtkWebGPUTextureView() override;
142 
143 private:
145  void operator=(const vtkWebGPUTextureView&) = delete;
146 
147  // Mip level of the base texture that this texture view gives a view on
148  int BaseMipLevel = 0;
149  // How many mip levels this texture view give the shader access to
150  int MipLevelCount = 1;
151 
152  // Bind group of the texture view
153  vtkIdType Group = -1;
154 
155  // Binding of the texture view
156  vtkIdType Binding = -1;
157 
158  // What aspect of the texture is going to be sampled by the samplers in the shaders sampling this
159  // texture
160  vtkWebGPUTextureView::TextureViewAspect Aspect = TextureViewAspect::ASPECT_ALL;
161 
162  // Dimension of the texture view
164  vtkWebGPUTextureDeviceResource::TextureDimension::DIMENSION_2D;
165 
166  // Format of the texture view
168  vtkWebGPUTextureDeviceResource::TextureFormat::RGBA8_UNORM;
169 
170  // Mode of the texture view
171  vtkWebGPUTextureView::TextureViewMode Mode = vtkWebGPUTextureView::TextureViewMode::UNDEFINED;
172 
173  // Label used for debugging if something goes wrong
174  std::string Label = "Texture view";
175 };
176 
177 VTK_ABI_NAMESPACE_END
178 
179 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
Abstraction class for WebGPU texture views.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
TextureViewAspect
What will the shader sample from the texture when calling a sampling function.
int vtkIdType
Definition: vtkType.h:363
a simple class to control print indentation
Definition: vtkIndent.h:28
TextureFormat
RGBA8_UNORM: Uses RGB + alpha.
TextureDimension
How the texture data is arranged.
TextureViewMode
The mode of the texture view to define what operations will be doable on the texture in the shader...
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...