VTK  9.7.1
vtkWebGPUComputeRenderTexture.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 vtkWebGPUComputeRenderTexture_h
5 #define vtkWebGPUComputeRenderTexture_h
6 
7 #include "vtkRenderingWebGPUModule.h" // For export macro
8 #include "vtkWeakPointer.h" // for weak pointer on the associated compute pass
9 #include "vtkWebGPUComputePass.h" // For compute pass
11 #include "vtkWebGPUComputeTextureView.h" // For the texture view aspect attribute
12 
13 VTK_ABI_NAMESPACE_BEGIN
14 
20 class VTKRENDERINGWEBGPU_EXPORT vtkWebGPUComputeRenderTexture : public vtkWebGPUComputeTexture
21 {
22 public:
25 
26  void PrintSelf(ostream& os, vtkIndent indent) override;
27 
36  {
37  UNDEFINED = 0,
39  COLOR_BUFFER
40  };
41 
43 
46  vtkGetEnumMacro(Type, RenderTextureType);
47  vtkSetEnumMacro(Type, RenderTextureType);
49 
51 
58 
60 
64  void SetWebGPUTexture(wgpu::Texture texture) { this->WebGPUTexture = texture; };
65  wgpu::Texture GetWebGPUTexture() { return this->WebGPUTexture; };
67 
69 
76  vtkWeakPointer<vtkWebGPUComputePass> GetAssociatedComputePass();
77  void SetAssociatedComputePass(vtkWeakPointer<vtkWebGPUComputePass> computePass);
79 
80 protected:
83 
84 private:
86  void operator=(const vtkWebGPUComputeRenderTexture&) = delete;
87 
88  // Aspect for the future texture view of this texture in a compute pass
90  vtkWebGPUComputeTextureView::TextureViewAspect::ASPECT_ALL;
91 
92  // We may want vtkWebGPUComputePipeline::AddTexture() not to create a new device texture for this
93  // vtkWebGPUComputeBuffer but rather use an existing one that has been created elsewhere (by a
94  // webGPUPolyDataMapper for example). This is the attribute that points to this 'already existing'
95  // buffer.
96  wgpu::Texture WebGPUTexture = nullptr;
97 
105  vtkWeakPointer<vtkWebGPUComputePass> AssociatedComputePass = nullptr;
106 
110  RenderTextureType Type = UNDEFINED;
111 };
112 
113 VTK_ABI_NAMESPACE_END
114 
115 #endif
void SetWebGPUTexture(wgpu::Texture texture)
Get/set the WebGPU texture (used when this ComputeTexture points to an already existing device buffer...
TextureViewAspect
What will the shader sample from the texture when calling a sampling function.
static vtkWebGPUComputeTexture * New()
Render textures are returned by calls to vtkWebGPUPolyDataMapper::AcquireXXXXRenderTexture() and repr...
wgpu::Texture GetWebGPUTexture()
Get/set the WebGPU texture (used when this ComputeTexture points to an already existing device buffer...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkGetEnumMacro(Dimension, TextureDimension)
Get/set the texture dimension.
Represents the set of parameters that will be used to create a compute shader texture on the device w...
vtkSetEnumMacro(Dimension, TextureDimension)
Get/set the texture dimension.
RenderTextureType
What type of texture of the vtk render pipeline is this ComputeRenderTexture referring to...