4#ifndef vtkWebGPUPolyDataMapper2DInternals_h
5#define vtkWebGPUPolyDataMapper2DInternals_h
8#include "vtkRenderingWebGPUModule.h"
15VTK_ABI_NAMESPACE_BEGIN
33 enum GraphicsPipeline2DType :
int
36 GFX_PIPELINE_2D_POINTS = 0,
38 GFX_PIPELINE_2D_LINES,
40 GFX_PIPELINE_2D_TRIANGLES,
41 NUM_GFX_PIPELINE_2D_NB_TYPES
46 vtkTypeFloat32 WCVCMatrix[4][4];
47 vtkTypeFloat32 Color[4];
48 vtkTypeFloat32 PointSize;
49 vtkTypeFloat32 LineWidth;
51 vtkTypeUInt32 Padding;
54 struct MeshAttributeArrayDescriptor
56 vtkTypeUInt32 Start = 0;
57 vtkTypeUInt32 NumTuples = 0;
58 vtkTypeUInt32 NumComponents = 0;
63 MeshAttributeArrayDescriptor Positions;
64 MeshAttributeArrayDescriptor UVs;
65 MeshAttributeArrayDescriptor Colors;
75 struct TopologyBindGroupInfo
78 wgpu::Buffer TopologyBuffer;
82 wgpu::BindGroup BindGroup;
84 vtkTypeUInt32 VertexCount = 0;
87 bool RebuildGraphicsPipelines =
false;
88 bool UseCellScalarMapping =
false;
89 bool UsePointScalarMapping =
false;
91 std::map<GraphicsPipeline2DType, vtkWebGPUCellToPrimitiveConverter::TopologySourceType>
92 PipelineBindGroupCombos = {
98 const std::array<wgpu::PrimitiveTopology, NUM_GFX_PIPELINE_2D_NB_TYPES>
99 GraphicsPipeline2DPrimitiveTypes = { wgpu::PrimitiveTopology::TriangleStrip,
100 wgpu::PrimitiveTopology::TriangleStrip, wgpu::PrimitiveTopology::TriangleList };
101 const std::array<std::string, NUM_GFX_PIPELINE_2D_NB_TYPES> VertexShaderEntryPoints = {
102 "pointVertexMain",
"lineVertexMain",
"polygonVertexMain"
105 std::string GraphicsPipeline2DKeys[NUM_GFX_PIPELINE_2D_NB_TYPES];
111 MeshDescriptor MeshArraysDescriptor;
113 ShaderSSBO Mapper2DStateData;
114 ShaderSSBO AttributeDescriptorData;
117 TopologyBindGroupInfo
120 wgpu::BindGroup MeshAttributeBindGroup;
127 static wgpu::BindGroupLayout CreateMeshAttributeBindGroupLayout(
128 const wgpu::Device& device,
const std::string& label);
133 static wgpu::BindGroupLayout CreateTopologyBindGroupLayout(
134 const wgpu::Device& device,
const std::string& label);
139 static const char* GetGraphicsPipelineTypeAsString(GraphicsPipeline2DType graphicsPipelineType);
a actor that draws 2D data
represent and manipulate 4x4 transformation matrices
Allocate and hold a VTK object.
represent and manipulate 3D points
Hold a reference to a vtkObjectBase instance.
record modification and/or execution time
abstract specification for Viewports
@ TOPOLOGY_SOURCE_POLYGONS
@ NUM_TOPOLOGY_SOURCE_TYPES
Internal implementation details of vtkWebGPUPolyDataMapper2D.
void RecordDrawCommands(vtkViewport *viewport, const wgpu::RenderBundleEncoder &encoder)
void UpdateBuffers(vtkViewport *viewport, vtkActor2D *actor, vtkWebGPUPolyDataMapper2D *mapper)
Convert cells to primitives, update topology and mesh data in webgpu buffers used by shader program.
void RecordDrawCommands(vtkViewport *viewport, const wgpu::RenderPassEncoder &encoder)
Record draw calls in the render pass encoder.
void ReleaseGraphicsResources(vtkWindow *w)
Release any graphics resources that are being consumed by this mapper.
~vtkWebGPUPolyDataMapper2DInternals()
vtkWebGPUPolyDataMapper2DInternals()
2D PolyData support for WebGPU
window superclass for vtkRenderWindow