VTK  9.6.20260517
vtkWebGPURenderTextureDeviceResource.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
8#ifndef vtkWebGPURenderTextureDeviceResource_h
9#define vtkWebGPURenderTextureDeviceResource_h
10#include "vtkDataArray.h"
11#include "vtkRenderingWebGPUModule.h" // For export macro
13#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
14#include "vtk_wgpu.h" // for webgpu
15
16#include <cstdint>
17
18VTK_ABI_NAMESPACE_BEGIN
19class vtkWindow;
20class vtkImageData;
24{
25public:
28 void PrintSelf(ostream& os, vtkIndent indent) override;
29
34
42
43 enum class FilterMode
44 {
48 };
49
57
70
72
82
84
94
96
99 vtkGetEnumMacro(SamplerBindingType, SamplerMode);
100 vtkSetEnumMacro(SamplerBindingType, SamplerMode);
102
104
110
112
115 vtkGetMacro(LODMinClamp, float);
116 vtkSetMacro(LODMinClamp, float);
117 vtkGetMacro(LODMaxClamp, float);
118 vtkSetMacro(LODMaxClamp, float);
120
122
125 vtkGetMacro(MaxAnisotropy, vtkTypeUInt16);
126 vtkSetMacro(MaxAnisotropy, vtkTypeUInt16);
128
130
133 vtkGetMacro(SampleCount, vtkTypeUInt32);
134 vtkSetMacro(SampleCount, vtkTypeUInt32);
136
144 std::vector<void*> dataPlanes, vtkWebGPUConfiguration* wgpuConfiguration, bool cubeMap = false);
145
152 wgpu::BindGroupLayoutEntry MakeSamplerBindGroupLayoutEntry(
153 std::uint32_t binding, wgpu::ShaderStage visibility);
154
160 wgpu::BindGroupEntry MakeSamplerBindGroupEntry(std::uint32_t binding);
161
168 wgpu::BindGroupLayoutEntry MakeTextureViewBindGroupLayoutEntry(
169 std::uint32_t binding, wgpu::ShaderStage visibility);
170
176 wgpu::BindGroupEntry MakeTextureViewBindGroupEntry(std::uint32_t binding);
177
179
183 vtkSetMacro(Label, std::string);
186
188 static wgpu::FilterMode GetWebGPUFilterMode(FilterMode mode);
189 static wgpu::MipmapFilterMode GetWGPUMipMapFilterMode(FilterMode mode);
190 static wgpu::AddressMode GetWebGPUAddressMode(AddressMode mode);
191 static wgpu::SamplerBindingType GetWebGPUSamplerBindingType(SamplerMode mode);
192 static wgpu::CompareFunction GetWebGPUCompareFunction(CompareFunction mode);
193
194protected:
197
198private:
200 void operator=(const vtkWebGPURenderTextureDeviceResource&) = delete;
201
202 AddressMode AddressModeU = AddressMode::UNDEFINED;
203 AddressMode AddressModeV = AddressMode::UNDEFINED;
204 AddressMode AddressModeW = AddressMode::UNDEFINED;
205
208 FilterMode MipmapFilter = FilterMode::UNDEFINED;
209
210 SamplerMode SamplerBindingType = SamplerMode::UNDEFINED;
212
213 float LODMinClamp = 0.0f;
214 float LODMaxClamp = 32.0f;
215 vtkTypeUInt16 MaxAnisotropy = 1;
216
217 vtkTypeUInt32 SampleCount = 1;
218 vtkTypeUInt32 BaseMipLevel = 0;
219
220 std::string Label;
221
222 wgpu::TextureDescriptor TextureDescriptor;
223 wgpu::Texture Texture;
224 wgpu::SamplerDescriptor SamplerDescriptor;
225 wgpu::Sampler Sampler;
226 wgpu::TextureViewDescriptor TextureViewDescriptor;
227 wgpu::TextureView TextureView;
228};
229
230VTK_ABI_NAMESPACE_END
231#endif
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
Create a webgpu device for use in rendering and compute pipelines.
vtkGetEnumMacro(AddressModeW, AddressMode)
Get/set the address mode for U, V and W directions.
void ReleaseGraphicsResources(vtkWindow *window)
Release graphics resources associated with this texture.
static const char * GetTextureSampleTypeString(TextureSampleType type)
wgpu::BindGroupEntry MakeSamplerBindGroupEntry(std::uint32_t binding)
Create a sampler bind group entry.
static wgpu::AddressMode GetWebGPUAddressMode(AddressMode mode)
vtkSetEnumMacro(MipmapFilter, FilterMode)
Get/set the filter mode for magnification, minification and mipmap.
wgpu::BindGroupLayoutEntry MakeTextureViewBindGroupLayoutEntry(std::uint32_t binding, wgpu::ShaderStage visibility)
Create a texture view bind group layout entry.
vtkGetEnumMacro(SamplerBindingType, SamplerMode)
Get/set the sampler type for the texture.
vtkGetEnumMacro(MinFilter, FilterMode)
Get/set the filter mode for magnification, minification and mipmap.
vtkSetEnumMacro(AddressModeU, AddressMode)
Get/set the address mode for U, V and W directions.
vtkSetEnumMacro(CompareFunc, CompareFunction)
Get/set the compare function for depth textures.
vtkGetEnumMacro(MipmapFilter, FilterMode)
Get/set the filter mode for magnification, minification and mipmap.
static wgpu::SamplerBindingType GetWebGPUSamplerBindingType(SamplerMode mode)
vtkGetEnumMacro(AddressModeV, AddressMode)
Get/set the address mode for U, V and W directions.
static vtkWebGPURenderTextureDeviceResource * New()
vtkSetStdStringFromCharMacro(Label)
Get/set the label for the texture.
static wgpu::FilterMode GetWebGPUFilterMode(FilterMode mode)
vtkSetEnumMacro(MagFilter, FilterMode)
Get/set the filter mode for magnification, minification and mipmap.
vtkGetCharFromStdStringMacro(Label)
Get/set the label for the texture.
vtkSetEnumMacro(AddressModeV, AddressMode)
Get/set the address mode for U, V and W directions.
vtkGetEnumMacro(AddressModeU, AddressMode)
Get/set the address mode for U, V and W directions.
static wgpu::MipmapFilterMode GetWGPUMipMapFilterMode(FilterMode mode)
wgpu::BindGroupLayoutEntry MakeSamplerBindGroupLayoutEntry(std::uint32_t binding, wgpu::ShaderStage visibility)
Create a sampler bind group layout entry.
vtkGetEnumMacro(MagFilter, FilterMode)
Get/set the filter mode for magnification, minification and mipmap.
vtkSetEnumMacro(SamplerBindingType, SamplerMode)
Get/set the sampler type for the texture.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static wgpu::CompareFunction GetWebGPUCompareFunction(CompareFunction mode)
void SendToWebGPUDevice(std::vector< void * > dataPlanes, vtkWebGPUConfiguration *wgpuConfiguration, bool cubeMap=false)
Send the texture data to the WebGPU device.
vtkSetEnumMacro(MinFilter, FilterMode)
Get/set the filter mode for magnification, minification and mipmap.
vtkSetEnumMacro(AddressModeW, AddressMode)
Get/set the address mode for U, V and W directions.
wgpu::BindGroupEntry MakeTextureViewBindGroupEntry(std::uint32_t binding)
Create a texture view bind group entry.
vtkGetEnumMacro(CompareFunc, CompareFunction)
Get/set the compare function for depth textures.
TextureSampleType
Determines what kind of value is returned when reading from the texture in the compute shader.
window superclass for vtkRenderWindow
Definition vtkWindow.h:61
#define VTK_MARSHALAUTO