VTK  9.5.20251210
vtkWebGPUPolyDataMapper.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 vtkWebGPUPolyDataMapper_h
4#define vtkWebGPUPolyDataMapper_h
5
6#include "vtkPolyDataMapper.h"
7
8#include "vtkProperty.h" // for VTK_SURFACE constants
9#include "vtkRenderingWebGPUModule.h" // for export macro
10#include "vtkWebGPUCellToPrimitiveConverter.h" // for TopologySourceType
11#include "vtkWebGPUComputePipeline.h" // for ivar
12#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
13#include "vtk_wgpu.h" // for webgpu
14
15#include <array> // for ivar
16#include <unordered_set> // for the not set compute render buffers
17
18VTK_ABI_NAMESPACE_BEGIN
19class vtkCellArray;
20class vtkWebGPUActor;
26
27class VTKRENDERINGWEBGPU_EXPORT VTK_MARSHALAUTO vtkWebGPUPolyDataMapper : public vtkPolyDataMapper
28{
29public:
32 void PrintSelf(ostream& os, vtkIndent indent) override;
33
48
59
66 {
67 // Pipeline that renders points, is best suitable for rendering 1-pixel wide points.
70 // Pipeline that renders points using a square or circle shape.
73 // Pipeline that is best suitable for rendering 1-pixel thick line segments
76 // Pipeline that can render lines thicker than 1-pixel. This pipeline does not
77 // create joining geometry between contiguous line segments in a polyline.
80 // Pipeline that renders lines with rounded caps and rounded joins.
83 // Pipeline that renders lines with miter joins.
86 // Pipeline that renders triangles
90 };
91
93
97 void RenderPiece(vtkRenderer* renderer, vtkActor* act) override;
98
105
112 bool GetSupportsSelection() override { return false; }
113
125 void MapDataArrayToVertexAttribute(const char* vertexAttributeName, const char* dataArrayName,
126 int fieldAssociation, int componentno = -1) override;
127
135 void MapDataArrayToMultiTextureAttribute(const char* tname, const char* dataArrayName,
136 int fieldAssociation, int componentno = -1) override;
137
141 void RemoveVertexAttributeMapping(const char* vertexAttributeName) override;
142
147
153 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
154
171 PointDataAttributes attribute, int bufferGroup, int bufferBinding, int uniformsGroup,
172 int uniformsBinding);
173
178 CellDataAttributes attribute, int bufferGroup, int bufferBinding, int uniformsGroup,
179 int uniformsBinding);
180
181protected:
184
190 void ComputeBounds() override;
191
203
209 vtkRenderer* renderer, vtkActor* actor, const wgpu::RenderPassEncoder& passEncoder);
211 vtkRenderer* renderer, vtkActor* actor, const wgpu::RenderBundleEncoder& bundleEncoder);
212
218
223
224 virtual std::vector<wgpu::BindGroupLayoutEntry> GetMeshBindGroupLayoutEntries();
225
230 const wgpu::Device& device, const std::string& label);
231
235 wgpu::BindGroupLayout CreateTopologyBindGroupLayout(const wgpu::Device& device,
236 const std::string& label, bool homogeneousCellSize, bool useEdgeArray);
237
238 virtual std::vector<wgpu::BindGroupEntry> GetMeshBindGroupEntries();
239
256 const wgpu::Device& device, const std::string& label);
257
269 wgpu::BindGroup CreateTopologyBindGroup(const wgpu::Device& device, const std::string& label,
271
276
281
288
294
301
308
310
321
326
330 const char* GetGraphicsPipelineTypeAsString(GraphicsPipelineType graphicsPipelineType);
331
336 void SetupGraphicsPipelines(const wgpu::Device& device, vtkRenderer* renderer, vtkActor* actor);
337
342 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss, std::string& fss);
343
345 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss, std::string& fss);
347 vtkWebGPUActor* actor, std::string& vss, std::string& fss);
349 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss, std::string& fss);
351 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss, std::string& fss);
352
354 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss, std::string& fss);
356 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss, std::string& fss);
358 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss, std::string& fss);
360 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss, std::string& fss);
362 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss, std::string& fss);
364 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss, std::string& fss);
366 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss, std::string& fss);
367
369 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
371 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
373 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
375 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
377 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
379 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
381 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
383 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
385 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
387 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
389 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
391 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
393 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
395 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
397 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
399 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
401 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& vss);
402
404 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& fss);
405
407 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& fss);
409 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& fss);
411 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& fss);
413 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& fss);
415 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& fss);
417 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& fss);
419 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& fss);
421 vtkWebGPURenderer* renderer, vtkWebGPUActor* actor, std::string& fss);
422
431 virtual bool IsPipelineSupported(GraphicsPipelineType vtkNotUsed(pipelineType)) { return true; }
433
437 virtual wgpu::PrimitiveTopology GetPrimitiveTopologyForPipeline(
438 GraphicsPipelineType pipelineType);
439
441 {
442 std::uint32_t VertexCount = 0;
443 std::uint32_t InstanceCount = 0;
444 };
449
457 {
458 // point attributes.
459 wgpu::Buffer Buffer;
460 uint64_t Size = 0;
461 };
464 struct
465 {
466 vtkTypeFloat32 PlaneEquations[6][4];
467 vtkTypeUInt32 PlaneCount = 0;
468 } ClippingPlanesData;
470
478
482 // used by RenderPiece and functions it calls to reduce
483 // calls to get the input and allow for rendering of
484 // other polydata (not the input)
486 // vtkRenderer culls props to frustum. At that point, it requests
487 // mappers for bounds of the geometry. We cache the vtkAlgorithm output
488 // so that `UpdateMeshGeometryBuffers` can reuse it without climbing up
489 // vtkAlgorithm pipeline.
492
493 // 1 bind group for this polydata mesh
494 wgpu::BindGroup MeshAttributeBindGroup;
495
497 {
498 // buffer for point ids.
499 wgpu::Buffer ConnectivityBuffer;
500 // buffer for the cell ids.
501 wgpu::Buffer CellIdBuffer;
502 // buffer for edge array. this lets fragment shader hide internal edges of a polygon
503 // when edge visibility is turned on.
504 wgpu::Buffer EdgeArrayBuffer;
505 // uniform buffer for cell id offset.
507 // // buffer for indirect draw command
508 // wgpu::Buffer IndirectDrawBuffer;
509 // bind group for the primitive size uniform.
510 wgpu::BindGroup BindGroup;
511 // maximum number of vertices in a cell
512 vtkTypeUInt32 MaxCellSize = 0;
513 // vertexCount for draw call.
514 vtkTypeUInt32 VertexCount = 0;
515 };
516
517 enum BindingGroup : int
518 {
523 // Clipping planes are bound to the same group as the mesh attributes
524 // because they vary based on the mapper's shift/scale and the actor's
525 // transformation matrix.
529 };
530 static_assert(GROUP_NB_BINDGROUPS <= 4,
531 "Number of bind groups exceeds 4! Most devices can support only up to 4 bind groups");
532 std::array<std::uint32_t, GROUP_NB_BINDGROUPS> NumberOfBindings = {};
537
538 // Cache these so that subsequent executions of UpdateMeshGeometryBuffers() do not unnecessarily
539 // invoke MapScalars().
542 vtkTypeUInt32 LastNumClipPlanes = 0;
553
554private:
556 friend class vtkWebGPURenderer;
557
561 wgpu::Buffer GetPointDataWGPUBuffer(PointDataAttributes attribute)
562 {
563 return this->PointBuffers[attribute].Buffer;
564 }
565
569 wgpu::Buffer GetCellDataWGPUBuffer(CellDataAttributes attribute)
570 {
571 return this->CellBuffers[attribute].Buffer;
572 }
573
580 std::vector<vtkSmartPointer<vtkWebGPUComputeRenderBuffer>> SetupComputeRenderBuffers;
581
585 std::unordered_set<vtkSmartPointer<vtkWebGPUComputeRenderBuffer>> NotSetupComputeRenderBuffers;
586
590 const PointDataAttributes PointDataAttributesOrder[PointDataAttributes::POINT_NB_ATTRIBUTES] = {
591 PointDataAttributes::POINT_POSITIONS, PointDataAttributes::POINT_COLORS,
592 PointDataAttributes::POINT_NORMALS, PointDataAttributes::POINT_TANGENTS,
593 PointDataAttributes::POINT_UVS, PointDataAttributes::POINT_COLOR_UVS
594 };
595
599 const CellDataAttributes CellDataAttributesOrder[CellDataAttributes::CELL_NB_ATTRIBUTES] = {
600 CellDataAttributes::CELL_COLORS, CellDataAttributes::CELL_NORMALS
601 };
602
603 std::map<std::pair<vtkActor*, vtkRenderer*>, ActorState> CachedActorRendererProperties;
604
605 vtkWebGPUPolyDataMapper(const vtkWebGPUPolyDataMapper&) = delete;
606 void operator=(const vtkWebGPUPolyDataMapper&) = delete;
607};
608VTK_ABI_NAMESPACE_END
609#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
object to represent cell connectivity
a simple class to control print indentation
Definition vtkIndent.h:108
Allocate and hold a VTK object.
Definition vtkNew.h:167
std::uintptr_t MapperHashType
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:69
abstract specification for renderers
Hold a reference to a vtkObjectBase instance.
record modification and/or execution time
TopologySourceType
All supported types of topology.
Render buffers are returned by calls to vtkWebGPUPolyDataMapper::AcquirePointAttributeComputeRenderBu...
Create a webgpu device for use in rendering and compute pipelines.
vtkTimeStamp PointAttributesBuildTimestamp[POINT_NB_ATTRIBUTES]
Timestamps help reuse previous resources as much as possible.
PointDataAttributes
All the attributes supported by the point data buffer.
unsigned long GetPointAttributeByteSize(vtkWebGPUPolyDataMapper::PointDataAttributes attribute)
Returns the size of the 'sub-buffer' within the whole point data SSBO for the given attribute.
void ProcessSelectorPixelBuffers(vtkHardwareSelector *sel, std::vector< unsigned int > &pixeloffsets, vtkProp *prop) override
allows a mapper to update a selections color buffers Called from a prop which in turn is called from ...
virtual void ReplaceShaderCustomDef(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
virtual void ReplaceVertexShaderMainEnd(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
virtual void ReplaceShaderMeshAttributeBindings(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
virtual void ReplaceVertexShaderPositionVC(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
virtual void ReplaceShaderVertexOutputDef(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
virtual void ReplaceVertexShaderNormalTransform(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
virtual void ReplaceFragmentShaderMainEnd(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &fss)
virtual void ReplaceFragmentShaderMainStart(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &fss)
virtual void ReplaceFragmentShaderClippingPlanes(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &fss)
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
unsigned long GetExactCellBufferSize(CellDataAttributes attribute)
Calculates the size of a buffer that is large enough to contain all the values from the cell attribut...
vtkTypeFloat32 PlaneEquations[6][4]
std::array< std::uint32_t, GROUP_NB_BINDGROUPS > NumberOfBindings
virtual void ReplaceVertexShaderPicking(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
vtkTimeStamp ClippingPlanesBuildTimestamp
Timestamps help reuse previous resources as much as possible.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
unsigned long GetCellAttributeElementSize(vtkWebGPUPolyDataMapper::CellDataAttributes attribute)
Returns the size in bytes of one element of the given attribute.
bool HasCellAttributes[CELL_NB_ATTRIBUTES]
void MapDataArrayToVertexAttribute(const char *vertexAttributeName, const char *dataArrayName, int fieldAssociation, int componentno=-1) override
Select a data array from the point/cell data and map it to a generic vertex attribute.
virtual void ReplaceShaderClippingPlanesBindings(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
void RemoveAllVertexAttributeMappings() override
Remove all vertex attributes.
wgpu::BindGroupLayout CreateTopologyBindGroupLayout(const wgpu::Device &device, const std::string &label, bool homogeneousCellSize, bool useEdgeArray)
Create a bind group layout for the TopologyRenderInfo::BindGroup
void DeducePointCellAttributeAvailability(vtkPolyData *mesh)
Looks at the point/cell data of vtkPolyData object and determines which attributes are available.
AttributeBuffer CellBuffers[CELL_NB_ATTRIBUTES]
vtkPolyDataMapper::MapperHashType GenerateHash(vtkPolyData *polydata) override
This hash integer is computed by concrete graphics implementation of this class.
vtkSmartPointer< vtkWebGPUTexture > ColorTextureHostResource
virtual std::vector< wgpu::BindGroupEntry > GetMeshBindGroupEntries()
virtual void ReplaceShaderRendererBindings(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
void ResetPointCellAttributeState()
Reset the internal Has{Point,Cell}Attribute booleans to false.
vtkTimeStamp CellAttributesBuildTimestamp[CELL_NB_ATTRIBUTES]
Timestamps help reuse previous resources as much as possible.
vtkSmartPointer< vtkWebGPUComputeRenderBuffer > AcquirePointAttributeComputeRenderBuffer(PointDataAttributes attribute, int bufferGroup, int bufferBinding, int uniformsGroup, int uniformsBinding)
Returns an already configured (ready to be added to a vtkWebGPUComputePipeline) buffer bound to the g...
virtual void ReplaceFragmentShaderOutputDef(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &fss)
wgpu::BindGroupLayout CreateMeshAttributeBindGroupLayout(const wgpu::Device &device, const std::string &label)
Create a bind group layout for the mesh attribute bind group.
vtkSmartPointer< vtkWebGPUComputeRenderBuffer > AcquireCellAttributeComputeRenderBuffer(CellDataAttributes attribute, int bufferGroup, int bufferBinding, int uniformsGroup, int uniformsBinding)
Same as AcquirePointAttributeComputeRenderBuffer but for cell data attributes.
virtual void ReplaceShaderActorBindings(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
virtual void ReplaceVertexShaderClippingPlanes(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
AttributeBuffer PointBuffers[POINT_NB_ATTRIBUTES]
virtual std::vector< wgpu::BindGroupLayoutEntry > GetMeshBindGroupLayoutEntries()
virtual void ReplaceFragmentShaderColors(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &fss)
TopologyBindGroupInfo TopologyBindGroupInfos[vtkWebGPUCellToPrimitiveConverter::NUM_TOPOLOGY_SOURCE_TYPES]
virtual void ReplaceVertexShaderEdges(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
virtual void ReplaceVertexShaderPrimitiveId(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
unsigned long GetExactPointBufferSize(PointDataAttributes attribute)
Calculates the size of a buffer that is large enough to contain all the values from the point attribu...
wgpu::BindGroup CreateTopologyBindGroup(const wgpu::Device &device, const std::string &label, vtkWebGPUCellToPrimitiveConverter::TopologySourceType topologySourceType)
Create a bind group for the primitives of a mesh.
void SetupGraphicsPipelines(const wgpu::Device &device, vtkRenderer *renderer, vtkActor *actor)
Creates the graphics pipeline.
std::string GraphicsPipelineKeys[GFX_PIPELINE_NB_TYPES]
void RecordDrawCommands(vtkRenderer *renderer, vtkActor *actor, const wgpu::RenderPassEncoder &passEncoder)
Record draw calls in the render pass encoder.
virtual void ReplaceVertexShaderPosition(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
void RemoveVertexAttributeMapping(const char *vertexAttributeName) override
Remove a vertex attribute mapping.
virtual bool IsPipelineSupported(GraphicsPipelineType pipelineType)
Whether shaders must be built to target the specific pipeline.
static vtkWebGPUPolyDataMapper * New()
virtual void ReplaceVertexShaderMainStart(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
virtual void ReplaceFragmentShaderNormals(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &fss)
~vtkWebGPUPolyDataMapper() override
virtual void ReplaceFragmentShaderEdges(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &fss)
virtual DrawCallArgs GetDrawCallArgsForDrawingVertices(vtkWebGPUCellToPrimitiveConverter::TopologySourceType topologySourceType)
virtual wgpu::PrimitiveTopology GetPrimitiveTopologyForPipeline(GraphicsPipelineType pipelineType)
Get the primitive topology type that should be used for the given pipeline.
void RecordDrawCommands(vtkRenderer *renderer, vtkActor *actor, const wgpu::RenderBundleEncoder &bundleEncoder)
virtual DrawCallArgs GetDrawCallArgs(GraphicsPipelineType pipelineType, vtkWebGPUCellToPrimitiveConverter::TopologySourceType topologySourceType)
const char * GetGraphicsPipelineTypeAsString(GraphicsPipelineType graphicsPipelineType)
Get the name of the graphics pipeline type as a string.
vtkNew< vtkWebGPUCellToPrimitiveConverter > CellConverter
void MapDataArrayToMultiTextureAttribute(const char *tname, const char *dataArrayName, int fieldAssociation, int componentno=-1) override
This method will Map the specified data array for use as a texture coordinate for texture tname.
virtual void ReplaceFragmentShaderLights(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &fss)
void UpdateClippingPlanesBuffer(vtkWebGPUConfiguration *wgpuConfiguration, vtkActor *actor)
Updates the clipping planes buffer with the current clipping planes data.
unsigned long GetCellAttributeByteSize(vtkWebGPUPolyDataMapper::CellDataAttributes attribute)
Returns the size of the 'sub-buffer' within the whole cell data SSBO for the given attribute.
vtkTimeStamp IndirectDrawBufferUploadTimeStamp[vtkWebGPUCellToPrimitiveConverter::NUM_TOPOLOGY_SOURCE_TYPES]
Timestamps help reuse previous resources as much as possible.
virtual void ReplaceShaderConstantsDef(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
virtual void ReplaceShaderClippingPlanesDef(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
virtual void ReplaceShaderActorDef(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
void RenderPiece(vtkRenderer *renderer, vtkActor *act) override
Implemented by sub classes.
virtual void ReplaceVertexShaderTangents(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
virtual void ReplaceVertexShaderInputDef(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
virtual void ReplaceFragmentShaderPicking(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &fss)
GraphicsPipelineType
This mapper uses different wgpu::RenderPipeline to render a list of primitives.
virtual void ReplaceShaderCustomBindings(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
static bool IsPipelineForHomogeneousCellSize(GraphicsPipelineType pipelineType)
virtual void ReplaceVertexShaderUVs(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
void UpdateMeshGeometryBuffers(vtkWebGPURenderWindow *wgpuRenderWindow)
Creates buffers as needed and updates them with point/cell attributes, topology, draw parameters.
virtual void ReplaceVertexShaderCamera(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
bool GetNeedToRebuildGraphicsPipelines(vtkActor *actor, vtkRenderer *renderer)
Get whether the graphics pipeline needs rebuilt.
virtual void ReplaceVertexShaderCellId(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
virtual void ApplyShaderReplacements(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
Generates vertex and fragment shader code.
unsigned long GetPointAttributeElementSize(vtkWebGPUPolyDataMapper::PointDataAttributes attribute)
Returns the size in bytes of one element of the given attribute.
bool HasPointAttributes[POINT_NB_ATTRIBUTES]
wgpu::BindGroup CreateMeshAttributeBindGroup(const wgpu::Device &device, const std::string &label)
Create a bind group for the point and cell attributes of a mesh.
bool CacheActorRendererProperties(vtkActor *actor, vtkRenderer *renderer)
This method keeps track of few properties of the actor which when changed, require rebuilding a rende...
virtual void ReplaceVertexShaderNormals(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
CellDataAttributes
All the attributes supported by the cell data buffer.
void ComputeBounds() override
Called in GetBounds().
virtual void ReplaceVertexShaderVertexId(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
virtual void ReplaceShaderTopologyBindings(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss, std::string &fss)
virtual void ReplaceVertexShaderColors(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss)
WebGPU rendering window.
vtkWebGPUTexture is a concrete implementation of the abstract class vtkTexture for WebGPU.
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
#define VTK_SURFACE
#define VTK_MARSHALAUTO