3#ifndef vtkWebGPURenderer_h
4#define vtkWebGPURenderer_h
8#include "vtkRenderingWebGPUModule.h"
14#include <unordered_map>
15#include <unordered_set>
21VTK_ABI_NAMESPACE_BEGIN
50 vtkGetMacro(LightingComplexity,
int);
58 RenderPostRasterization
101 const std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>>&
118 layouts.emplace_back(this->SceneBindGroupLayout);
119 layouts.emplace_back(this->ActorBindGroupLayout);
152 vtkSetMacro(UseRenderBundles,
bool);
153 vtkBooleanMacro(UseRenderBundles,
bool);
154 vtkGetMacro(UseRenderBundles,
bool);
203 std::size_t LastActorBufferSize = 0;
211 bool UseRenderBundles =
true;
213 bool UseRenderBundles =
false;
221 wgpu::RenderBundle Bundle =
nullptr;
222 vtkTypeUInt32 DynamicOffset = 0;
226 int LightingComplexity = 0;
227 std::size_t NumberOfLightsUsed = 0;
237 uint32_t TotalRequests = 0;
268 void PreRenderComputePipelines();
269 void PostRenderComputePipelines();
282 void PostRasterizationRender();
287 void AddPostRasterizationActor(
vtkActor* actor);
293 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> SetupPreRenderComputePipelines;
294 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> SetupPostRenderComputePipelines;
299 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> NotSetupPreRenderComputePipelines;
300 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> NotSetupPostRenderComputePipelines;
309 std::vector<vtkActor*> PostRasterizationActors;
314 wgpu::CommandBuffer EncodePropListRenderCommand(
vtkProp** propList,
int listLength);
320 bool ComputeBuffersInitialized =
false;
331 bool DoClearPass =
true;
339 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::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)
std::size_t WriteActorBlocksBuffer(std::size_t offset=0)
std::unordered_map< vtkProp *, vtkWGPUPropItem > PropWGPUItems
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
wgpu::BindGroup GetActorBindGroup()
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.
wgpu::RenderBundleEncoder WGPUBundleEncoder
vtkTransform * GetUserLightTransform()
Set the user light transform applied after the camera transform.
void DeviceRender() override
Create an image.
wgpu::Buffer ActorBlocksBuffer
wgpu::BindGroup SceneBindGroup
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...
wgpu::BindGroup ActorBindGroup
vtkGetEnumMacro(RenderStage, RenderStageEnum)
Query the stage in the rendering process.
std::vector< wgpu::RenderBundle > Bundles
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.
wgpu::BindGroupLayout ActorBindGroupLayout
vtkMTimeType LightingUpdateTime
void SetupBindGroupLayouts()
void SetupActorBindGroup()
window superclass for vtkRenderWindow
vtkSmartPointer< vtkPropCollection > Props
wgpu::RenderPipeline Pipeline
vtkTypeUInt32 vtkMTimeType