VTK  9.5.20250825
vtkWebGPURenderPipelineCache.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
35#ifndef vtkWebGPURenderPipelineCache_h
36#define vtkWebGPURenderPipelineCache_h
37
38#include "vtkObject.h"
39
40#include "vtkRenderingWebGPUModule.h" // for export macro
41#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
42#include "vtk_wgpu.h" // for webgpu
43
44VTK_ABI_NAMESPACE_BEGIN
45
48class vtkWindow;
49
50class VTKRENDERINGWEBGPU_EXPORT VTK_MARSHALAUTO vtkWebGPURenderPipelineCache : public vtkObject
51{
52public:
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
62
67 wgpu::RenderPipeline GetRenderPipeline(const std::string& key);
68
74 std::string GetPipelineKey(wgpu::RenderPipelineDescriptor* descriptor, const char* shaderSource);
75
82 std::string GetPipelineKey(wgpu::RenderPipelineDescriptor* descriptor,
83 const char* vertexShaderSource, const char* fragmentShaderSource);
84
92 void CreateRenderPipeline(wgpu::RenderPipelineDescriptor* descriptor,
93 vtkWebGPURenderWindow* wgpuRenderWindow, const char* shaderSource);
94
103 void CreateRenderPipeline(wgpu::RenderPipelineDescriptor* descriptor,
104 vtkWebGPURenderWindow* wgpuRenderWindow, const char* vertexShaderSource,
105 const char* fragmentShaderSource);
106
114 static bool Substitute(
115 std::string& source, const std::string& search, const std::string& replace, bool all);
116
121 void DestroyRenderPipeline(const std::string& key);
122
123protected:
126
127private:
129 void operator=(const vtkWebGPURenderPipelineCache&) = delete;
130
131 class vtkInternals;
132 std::unique_ptr<vtkInternals> Internals;
133};
134
135VTK_ABI_NAMESPACE_END
136#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
Class to create and retrieve render pipelines based on a given key.
static bool Substitute(std::string &source, const std::string &search, const std::string &replace, bool all)
Substitute all occurrences of search with replace in source.
static vtkWebGPURenderPipelineCache * New()
void DestroyRenderPipeline(const std::string &key)
Destroy the render pipeline associated with the given hash.
void ReleaseGraphicsResources(vtkWindow *window)
Reset the pipeline cache.
std::string GetPipelineKey(wgpu::RenderPipelineDescriptor *descriptor, const char *vertexShaderSource, const char *fragmentShaderSource)
Get a unique hash for the given combination of render pipeline descriptor and shader source.
~vtkWebGPURenderPipelineCache() override
void CreateRenderPipeline(wgpu::RenderPipelineDescriptor *descriptor, vtkWebGPURenderWindow *wgpuRenderWindow, const char *shaderSource)
Create a render pipeline for the given combination of render pipeline descriptor and shader source.
wgpu::RenderPipeline GetRenderPipeline(const std::string &key)
Get a render pipeline associated with the given hash.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::string GetPipelineKey(wgpu::RenderPipelineDescriptor *descriptor, const char *shaderSource)
Get a unique hash for the given combination of render pipeline descriptor and shader source.
void CreateRenderPipeline(wgpu::RenderPipelineDescriptor *descriptor, vtkWebGPURenderWindow *wgpuRenderWindow, const char *vertexShaderSource, const char *fragmentShaderSource)
Create a render pipeline for the given combination of render pipeline descriptor and shader source.
WebGPU rendering window.
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_MARSHALAUTO