3#ifndef vtkWebGPURenderer_h
4#define vtkWebGPURenderer_h
8#include "vtkRenderingWebGPUModule.h"
13#include <unordered_set>
19VTK_ABI_NAMESPACE_BEGIN
48 vtkGetMacro(LightingComplexity,
int);
56 RenderPostRasterization
104 const std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>>&
120 layouts.emplace_back(this->SceneBindGroupLayout);
153 vtkSetMacro(UseRenderBundles,
bool);
154 vtkBooleanMacro(UseRenderBundles,
bool);
155 vtkGetMacro(UseRenderBundles,
bool);
180 vtkGetMacro(RebuildRenderBundle,
bool);
213 std::size_t LastActorBufferSize = 0;
218 bool UseRenderBundles =
true;
220 bool UseRenderBundles =
false;
222 bool RebuildRenderBundle =
false;
226 int LightingComplexity = 0;
227 std::size_t NumberOfLightsUsed = 0;
261 void PreRenderComputePipelines();
262 void PostRenderComputePipelines();
275 void PostRasterizationRender();
280 void AddPostRasterizationActor(
vtkActor* actor);
286 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> SetupPreRenderComputePipelines;
287 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> SetupPostRenderComputePipelines;
292 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> NotSetupPreRenderComputePipelines;
293 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> NotSetupPostRenderComputePipelines;
302 std::vector<vtkActor*> PostRasterizationActors;
307 wgpu::CommandBuffer EncodePropListRenderCommand(
vtkProp** propList,
int listLength);
313 bool ComputeBuffersInitialized =
false;
324 bool DoClearPass =
true;
332 std::unordered_set<vtkProp*> PropsRendered;
abstract class specifies interface to map data
represents an object (geometry & properties) in a rendered scene
abstract interface to OpenGL FBOs
a simple class to control print indentation
abstract superclass for all actors, volumes and annotations
Context in which a vtkRenderPass will render.
abstract specification for renderers
Hold a reference to a vtkObjectBase instance.
handles properties associated with a texture map
record modification and/or execution time
This culler does both frustum culling and occlusion culling.
The point cloud renderer uses WebGPU compute shaders to render the point cells of a polydata onto the...
void ConfigureComputeRenderBuffers(vtkSmartPointer< vtkWebGPUComputePipeline > computePipeline)
Set up the buffers of a given vtkWebGPUComputePass.
void SetupSceneBindGroup()
void ReleaseGraphicsResources(vtkWindow *w) override
static vtkWebGPURenderer * New()
wgpu::Buffer SceneTransformBuffer
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ConfigureComputePipelines()
Sets the adapter and the device of the render window of this renderer to the compute pipelines of thi...
vtkTimeStamp LightingUploadTimestamp
void AddPostRenderComputePipeline(vtkSmartPointer< vtkWebGPUComputePipeline > pipeline)
Adds a compute pipeline to the renderer that will be executed each frame before/after the rendering p...
wgpu::RenderBundle Bundle
wgpu::BindGroup GetSceneBindGroup()
std::size_t WriteSceneTransformsBuffer(std::size_t offset=0)
int UpdateOpaquePolygonalGeometry() override
Request mappers to run the vtkAlgorithm pipeline (if needed) and consequently update device buffers c...
std::size_t WriteLightsBuffer(std::size_t offset=0)
int UpdateTranslucentPolygonalGeometry() override
Ask all props to update and draw any translucent polygonal geometry.
int UpdateGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Ask all props to update and draw any opaque and translucent geometry.
int UpdateLights() override
Ask all lights to load themselves into rendering pipeline.
void SetUserLightTransform(vtkTransform *transform)
Set the user light transform applied after the camera transform.
wgpu::RenderPassEncoder WGPURenderEncoder
void PopulateBindgroupLayouts(std::vector< wgpu::BindGroupLayout > &layouts)
wgpu::Buffer SceneLightsBuffer
std::unordered_set< vtkProp * > GetPropsRendered()
Returns the list of the actors that were rendered last frame.
void Clear() override
Clear the image to the background color.
wgpu::RenderBundleEncoder WGPUBundleEncoder
vtkTransform * GetUserLightTransform()
Set the user light transform applied after the camera transform.
void DeviceRender() override
Create an image.
wgpu::BindGroup SceneBindGroup
void InvalidateBundle()
Forces the renderer to re-record draw commands into a render bundle.
vtkSmartPointer< vtkTransform > UserLightTransform
Optional user transform for lights.
void AddPreRenderComputePipeline(vtkSmartPointer< vtkWebGPUComputePipeline > pipeline)
Adds a compute pipeline to the renderer that will be executed each frame before/after the rendering p...
wgpu::RenderBundleEncoder GetRenderBundleEncoder()
~vtkWebGPURenderer() override
std::vector< std::size_t > LightIDs
wgpu::RenderPassEncoder GetRenderPassEncoder()
void UpdateBuffers()
Updates / creates the various buffer necessary for the rendering of the props.
const std::vector< vtkSmartPointer< vtkWebGPUComputePipeline > > & GetSetupPostRenderComputePipelines()
Returns the list of compute pipelines of this renderer that have been setup for execution before/afte...
vtkGetEnumMacro(RenderStage, RenderStageEnum)
Query the stage in the rendering process.
const std::vector< vtkSmartPointer< vtkWebGPUComputePipeline > > & GetSetupPreRenderComputePipelines()
Returns the list of compute pipelines of this renderer that have been setup for execution before/afte...
wgpu::BindGroupLayout SceneBindGroupLayout
void SetEnvironmentTexture(vtkTexture *texture, bool isSRGB=false) override
Set/Get the environment texture used for image based lighting.
vtkMTimeType LightingUpdateTime
void SetupBindGroupLayouts()
window superclass for vtkRenderWindow
vtkSmartPointer< vtkPropCollection > Props
wgpu::RenderPipeline Pipeline
vtkTypeUInt32 vtkMTimeType