VTK  9.5.20251126
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 "vtk_wgpu.h" // for webgpu
14
15#include <cstdint>
16
17VTK_ABI_NAMESPACE_BEGIN
18class vtkWindow;
19class vtkImageData;
21class VTKRENDERINGWEBGPU_EXPORT vtkWebGPURenderTextureDeviceResource
23{
24public:
27 void PrintSelf(ostream& os, vtkIndent indent) override;
28
33
41
42 enum class FilterMode
43 {
47 };
48
56
69
71
81
83
93
95
98 vtkGetEnumMacro(SamplerBindingType, SamplerMode);
99 vtkSetEnumMacro(SamplerBindingType, SamplerMode);
101
103
109
111
114 vtkGetMacro(LODMinClamp, float);
115 vtkSetMacro(LODMinClamp, float);
116 vtkGetMacro(LODMaxClamp, float);
117 vtkSetMacro(LODMaxClamp, float);
119
121
124 vtkGetMacro(MaxAnisotropy, std::uint16_t);
125 vtkSetMacro(MaxAnisotropy, std::uint16_t);
127
129
132 vtkGetMacro(SampleCount, std::uint32_t);
133 vtkSetMacro(SampleCount, std::uint32_t);
135
143 std::vector<void*> dataPlanes, vtkWebGPUConfiguration* wgpuConfiguration, bool cubeMap = false);
144
151 wgpu::BindGroupLayoutEntry MakeSamplerBindGroupLayoutEntry(
152 std::uint32_t binding, wgpu::ShaderStage visibility);
153
159 wgpu::BindGroupEntry MakeSamplerBindGroupEntry(std::uint32_t binding);
160
167 wgpu::BindGroupLayoutEntry MakeTextureViewBindGroupLayoutEntry(
168 std::uint32_t binding, wgpu::ShaderStage visibility);
169
175 wgpu::BindGroupEntry MakeTextureViewBindGroupEntry(std::uint32_t binding);
176
178
182 vtkSetMacro(Label, std::string);
185
187 static wgpu::FilterMode GetWebGPUFilterMode(FilterMode mode);
188 static wgpu::MipmapFilterMode GetWGPUMipMapFilterMode(FilterMode mode);
189 static wgpu::AddressMode GetWebGPUAddressMode(AddressMode mode);
190 static wgpu::SamplerBindingType GetWebGPUSamplerBindingType(SamplerMode mode);
191 static wgpu::CompareFunction GetWebGPUCompareFunction(CompareFunction mode);
192
193protected:
196
197private:
199 void operator=(const vtkWebGPURenderTextureDeviceResource&) = delete;
200
201 AddressMode AddressModeU = AddressMode::UNDEFINED;
202 AddressMode AddressModeV = AddressMode::UNDEFINED;
203 AddressMode AddressModeW = AddressMode::UNDEFINED;
204
207 FilterMode MipmapFilter = FilterMode::UNDEFINED;
208
209 SamplerMode SamplerBindingType = SamplerMode::UNDEFINED;
211
212 float LODMinClamp = 0.0f;
213 float LODMaxClamp = 32.0f;
214 std::uint16_t MaxAnisotropy = 1;
215
216 std::uint32_t SampleCount = 1;
217 std::uint32_t BaseMipLevel = 0;
218
219 std::string Label;
220
221 wgpu::TextureDescriptor TextureDescriptor;
222 wgpu::Texture Texture;
223 wgpu::SamplerDescriptor SamplerDescriptor;
224 wgpu::Sampler Sampler;
225 wgpu::TextureViewDescriptor TextureViewDescriptor;
226 wgpu::TextureView TextureView;
227};
228
229VTK_ABI_NAMESPACE_END
230#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:48