VTK  9.7.20261013
vtkWebGPUDeepFramebuffer.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
25
26#ifndef vtkWebGPUDeepFramebuffer_h
27#define vtkWebGPUDeepFramebuffer_h
28
29#include "vtkObject.h"
30
31#include "vtkRenderingWebGPUModule.h" // for export macro
32#include "vtkSmartPointer.h" // for ivar
33#include "vtk_wgpu.h" // for the WebGPU C API
34
35#include <cstdint> // for fixed width types
36
37VTK_ABI_NAMESPACE_BEGIN
39
40class VTKRENDERINGWEBGPU_EXPORT vtkWebGPUDeepFramebuffer : public vtkObject
41{
42public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
52 vtkGetMacro(AverageLayersPerPixel, std::uint32_t);
53 vtkSetClampMacro(AverageLayersPerPixel, std::uint32_t, 1, 64);
54
59
65 bool Resize(int width, int height);
66
71 void Clear();
72
77 WGPUBuffer GetHeadPointersBuffer() { return this->HeadPointersBuffer; }
78 WGPUBuffer GetFragmentNodesBuffer() { return this->FragmentNodesBuffer; }
79 WGPUBuffer GetFragmentCounterBuffer() { return this->FragmentCounterBuffer; }
80
84 vtkGetMacro(Width, int);
85 vtkGetMacro(Height, int);
86 vtkGetMacro(FragmentNodeCapacity, std::uint32_t);
87
92
93protected:
96
97private:
102 static constexpr std::uint32_t FragmentNodeSize = 28;
103
107 static constexpr std::uint32_t InvalidIndex = 0xFFFFFFFFu;
108
110 void operator=(const vtkWebGPUDeepFramebuffer&) = delete;
111
113
114 WGPUBuffer HeadPointersBuffer = nullptr;
115 WGPUBuffer FragmentNodesBuffer = nullptr;
116 WGPUBuffer FragmentCounterBuffer = nullptr;
117
118 int Width = 0;
119 int Height = 0;
120 std::uint32_t AverageLayersPerPixel = 8;
121 std::uint32_t FragmentNodeCapacity = 0;
122};
123VTK_ABI_NAMESPACE_END
124
125#endif
a simple class to control print indentation
Definition vtkIndent.h:108
Hold a reference to a vtkObjectBase instance.
Create a webgpu device for use in rendering and compute pipelines.
~vtkWebGPUDeepFramebuffer() override
void ReleaseGraphicsResources()
Release the buffers.
static vtkWebGPUDeepFramebuffer * New()
void SetWGPUConfiguration(vtkWebGPUConfiguration *config)
The configuration used to allocate the buffers.
bool Resize(int width, int height)
Allocate the buffers for a width x height viewport, reallocating only when the size actually changed.
void Clear()
Reset the counter to zero and every head pointer to InvalidIndex.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
WGPUBuffer GetHeadPointersBuffer()
The buffers, for binding into render and compute passes.