3#ifndef vtkWebGPURenderer_h
4#define vtkWebGPURenderer_h
8#include "vtkRenderingWebGPUModule.h"
10#include "vtkTypeUInt32Array.h"
16#include <unordered_map>
17#include <unordered_set>
23VTK_ABI_NAMESPACE_BEGIN
52 vtkGetMacro(LightingComplexity,
int);
90 const std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>>&
111 layouts.emplace_back(this->SceneBindGroupLayout);
112 layouts.emplace_back(this->ActorBindGroupLayout);
146 vtkSetMacro(UseRenderBundles,
bool);
147 vtkBooleanMacro(UseRenderBundles,
bool);
148 vtkGetMacro(UseRenderBundles,
bool);
205 bool UseRenderBundles =
true;
207 bool UseRenderBundles =
false;
215 wgpu::RenderBundle Bundle =
nullptr;
221 std::size_t NumberOfPropsUpdated = 0;
222 int LightingComplexity = 0;
223 std::size_t NumberOfLightsUsed = 0;
233 uint32_t TotalRequests = 0;
264 void PreRenderComputePipelines();
265 void PostRenderComputePipelines();
278 void PostRasterizationRender();
283 void AddPostRasterizationActor(
vtkActor* actor);
289 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> SetupPreRenderComputePipelines;
290 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> SetupPostRenderComputePipelines;
295 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> NotSetupPreRenderComputePipelines;
296 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> NotSetupPostRenderComputePipelines;
305 std::vector<vtkActor*> PostRasterizationActors;
310 wgpu::CommandBuffer EncodePropListRenderCommand(
vtkProp** propList,
int listLength);
316 bool ComputeBuffersInitialized =
false;
322 bool PrepareRenderDone =
false;
327 bool DoClearPass =
true;
335 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 themselves.
wgpu::ShaderModule HasShaderCache(const std::string &source)
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 DeviceRenderOpaqueGeometry(vtkFrameBufferObjectBase *fbo) override
Request mappers to bind descriptor sets (bind groups) and encode draw commands.
wgpu::BindGroup GetActorBindGroup()
void RenderProps()
Encodes the draw commands for the this->PropArrayCount props currently contained in this->PropArray.
void PopulateBindgroupLayouts(std::vector< wgpu::BindGroupLayout > &layouts)
wgpu::Buffer SceneLightsBuffer
std::size_t UpdateBufferData()
std::unordered_set< vtkProp * > GetPropsRendered()
Returns the list of the actors that were rendered last frame.
void DeviceRenderTranslucentPolygonalGeometry(vtkFrameBufferObjectBase *fbo) override
Render translucent polygonal geometry.
vtkTransform * GetUserLightTransform()
Set the user light transform applied after the camera transform.
int RenderGeometry()
Request props to encode render commands.
void PrepareRender()
Updates / creates the various buffer necessary for the rendering of the props.
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...
~vtkWebGPURenderer() override
std::vector< std::size_t > LightIDs
wgpu::RenderPassEncoder GetRenderPassEncoder()
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
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.
std::unordered_map< std::string, wgpu::ShaderModule > ShaderCache
void InsertShader(const std::string &source, wgpu::ShaderModule shader)
wgpu::BindGroupLayout ActorBindGroupLayout
vtkMTimeType LightingUpdateTime
void SetupBindGroupLayouts()
void SetupActorBindGroup()
window superclass for vtkRenderWindow
vtkSmartPointer< vtkPropCollection > Props
wgpu::RenderPipeline Pipeline
vtkSmartPointer< vtkTypeUInt32Array > DynamicOffsets
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkTypeUInt32 vtkMTimeType