VTK  9.7.1
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 
44 VTK_ABI_NAMESPACE_BEGIN
45 
46 class vtkWebGPURenderer;
48 class vtkWindow;
49 
50 class VTKRENDERINGWEBGPU_EXPORT VTK_MARSHALAUTO vtkWebGPURenderPipelineCache : public vtkObject
51 {
52 public:
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
61  void ReleaseGraphicsResources(vtkWindow* window);
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 
123 protected:
125  ~vtkWebGPURenderPipelineCache() override;
126 
127 private:
129  void operator=(const vtkWebGPURenderPipelineCache&) = delete;
130 
131  class vtkInternals;
132  std::unique_ptr<vtkInternals> Internals;
133 };
134 
135 VTK_ABI_NAMESPACE_END
136 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
a simple class to control print indentation
Definition: vtkIndent.h:28
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_MARSHALAUTO
WebGPU rendering window.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Class to create and retrieve render pipelines based on a given key.