VTK  9.3.0
vtkWebGPUInternalsBindGroupLayout.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#ifndef vtkWebGPUInternalsBindGroupLayout_h
4#define vtkWebGPUInternalsBindGroupLayout_h
5
6#include "vtkRenderingWebGPUModule.h"
7#include "vtk_wgpu.h"
8
9#include <initializer_list>
10
11VTK_ABI_NAMESPACE_BEGIN
12class VTKRENDERINGWEBGPU_EXPORT vtkWebGPUInternalsBindGroupLayout
13{
14public:
15 // Helpers to make creating bind group layouts look nicer:
16 //
17 // vtkWebGPUInternalsBindGroupLayout::MakeBindGroupLayout(device, {
18 // {0, wgpu::ShaderStage::Vertex, wgpu::BufferBindingType::Uniform},
19 // {1, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Filtering},
20 // {3, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Float}
21 // });
22 struct LayoutEntryInitializationHelper : wgpu::BindGroupLayoutEntry
23 {
24 // for buffers
25 LayoutEntryInitializationHelper(uint32_t entryBinding, wgpu::ShaderStage entryVisibility,
26 wgpu::BufferBindingType bufferType, bool bufferHasDynamicOffset = false,
27 uint64_t bufferMinBindingSize = 0);
28 // for samplers
29 LayoutEntryInitializationHelper(uint32_t entryBinding, wgpu::ShaderStage entryVisibility,
30 wgpu::SamplerBindingType samplerType);
31 // for texture
32 LayoutEntryInitializationHelper(uint32_t entryBinding, wgpu::ShaderStage entryVisibility,
33 wgpu::TextureSampleType textureSampleType,
34 wgpu::TextureViewDimension viewDimension = wgpu::TextureViewDimension::e2D,
35 bool textureMultisampled = false);
36 // for storage buffers
37 LayoutEntryInitializationHelper(uint32_t entryBinding, wgpu::ShaderStage entryVisibility,
38 wgpu::StorageTextureAccess storageTextureAccess, wgpu::TextureFormat format,
39 wgpu::TextureViewDimension viewDimension = wgpu::TextureViewDimension::e2D);
40
41 LayoutEntryInitializationHelper(const wgpu::BindGroupLayoutEntry& entry);
42 };
43
44 static wgpu::BindGroupLayout MakeBindGroupLayout(const wgpu::Device& device,
45 std::initializer_list<LayoutEntryInitializationHelper> entriesInitializer);
46};
47VTK_ABI_NAMESPACE_END
48
49#endif
50// VTK-HeaderTest-Exclude: vtkWebGPUInternalsBindGroupLayout.h
static wgpu::BindGroupLayout MakeBindGroupLayout(const wgpu::Device &device, std::initializer_list< LayoutEntryInitializationHelper > entriesInitializer)
LayoutEntryInitializationHelper(uint32_t entryBinding, wgpu::ShaderStage entryVisibility, wgpu::StorageTextureAccess storageTextureAccess, wgpu::TextureFormat format, wgpu::TextureViewDimension viewDimension=wgpu::TextureViewDimension::e2D)
LayoutEntryInitializationHelper(uint32_t entryBinding, wgpu::ShaderStage entryVisibility, wgpu::BufferBindingType bufferType, bool bufferHasDynamicOffset=false, uint64_t bufferMinBindingSize=0)
LayoutEntryInitializationHelper(const wgpu::BindGroupLayoutEntry &entry)
LayoutEntryInitializationHelper(uint32_t entryBinding, wgpu::ShaderStage entryVisibility, wgpu::TextureSampleType textureSampleType, wgpu::TextureViewDimension viewDimension=wgpu::TextureViewDimension::e2D, bool textureMultisampled=false)
LayoutEntryInitializationHelper(uint32_t entryBinding, wgpu::ShaderStage entryVisibility, wgpu::SamplerBindingType samplerType)