3 #ifndef vtkWebGPURenderWindow_h
4 #define vtkWebGPURenderWindow_h
8 #include "vtkRenderingWebGPUModule.h"
9 #include "vtkTypeUInt8Array.h"
12 VTK_ABI_NAMESPACE_BEGIN
23 this->PowerPreference =
24 high ? wgpu::PowerPreference::HighPerformance : wgpu::PowerPreference::LowPower;
32 virtual bool Initialize() = 0;
37 virtual void CreateAWindow() = 0;
42 virtual void DestroyWindow() = 0;
44 void Start()
override;
61 void Frame()
override;
76 unsigned char*
GetPixelData(
int x,
int y,
int x2,
int y2,
int front,
int right)
override;
80 int x,
int y,
int x2,
int y2,
unsigned char*
data,
int front,
int right)
override;
89 float*
GetRGBAPixelData(
int x,
int y,
int x2,
int y2,
int front,
int right = 0)
override;
91 int x,
int y,
int x2,
int y2,
int front,
vtkFloatArray*
data,
int right = 0)
override;
93 int x,
int y,
int x2,
int y2,
float*
data,
int front,
int blend = 0,
int right = 0)
override;
95 int right = 0)
override;
98 int x,
int y,
int x2,
int y2,
int front,
int right = 0)
override;
102 int blend = 0,
int right = 0)
override;
104 int blend = 0,
int right = 0)
override;
112 int GetZbufferData(
int x1,
int y1,
int x2,
int y2,
float* z)
override;
114 int SetZbufferData(
int x1,
int y1,
int x2,
int y2,
float* buffer)
override;
150 inline wgpu::RenderPassEncoder
NewRenderPass(wgpu::RenderPassDescriptor& descriptor)
152 return this->CommandEncoder.BeginRenderPass(&descriptor);
156 wgpu::RenderBundleEncoderDescriptor& descriptor)
158 return this->Device.CreateRenderBundleEncoder(&descriptor);
165 inline bool HasStencil() {
return this->DepthStencil.HasStencil; }
166 inline wgpu::Device
GetDevice() {
return this->Device; }
168 wgpu::TextureFormat GetPreferredSwapChainTextureFormat();
177 void CreateSwapChain();
178 void DestroySwapChain();
180 void CreateOffscreenColorAttachments();
181 void DestroyOffscreenColorAttachments();
183 void CreateDepthStencilTexture();
184 void DestroyDepthStencilTexture();
186 void CreateFSQGraphicsPipeline();
187 void DestroyFSQGraphicsPipeline();
189 void RenderOffscreenTexture();
191 void FlushCommandBuffers(vtkTypeUInt32 count, wgpu::CommandBuffer* buffers);
193 bool WGPUInitialized =
false;
194 wgpu::PowerPreference PowerPreference = wgpu::PowerPreference::HighPerformance;
250 } BufferMapReadContext;
259 VTK_ABI_NAMESPACE_END
virtual void Start()
Start the rendering process for a frame.
wgpu::RenderBundleEncoder NewRenderBundleEncoder(wgpu::RenderBundleEncoderDescriptor &descriptor)
void SetPowerPreference(bool high=true)
virtual float * GetZbufferData(int, int, int, int)
Set/Get the zbuffer data from the frame buffer.
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
virtual int SetPixelData(int, int, int, int, unsigned char *, int, int=0)
Set/Get the pixel data of an image, transmitted as RGBRGBRGB.
vtkWGPUUserStagingPixelData StagingPixelData
virtual int GetColorBufferSizes(int *)
Get the size of the color buffer.
dynamic, self-adjusting array of float
wgpu::TextureView Framebuffer
void Render() override
Ask each renderer owned by this RenderWindow to render its image and synchronize this process...
vtkWGPUFullScreenQuad FSQ
vtkWGPUColorAttachment ColorAttachment
window superclass for vtkRenderWindow
virtual const char * ReportCapabilities()
Get report of capabilities for the render window.
virtual int SupportsOpenGL()
Does this render window support OpenGL? 0-false, 1-true.
wgpu::BindGroup BindGroup
wgpu::TextureFormat Format
vtkSmartPointer< vtkTypeUInt8Array > dst
wgpu::CommandEncoder GetCommandEncoder()
wgpu::PresentMode PresentMode
virtual int SetZbufferData(int, int, int, int, float *)
Set/Get the zbuffer data from the frame buffer.
a simple class to control print indentation
wgpu::TextureView GetOffscreenColorAttachmentView()
wgpu::TextureView GetDepthStencilView()
vtkWGPUSwapChain SwapChain
wgpu::RenderPipeline Pipeline
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void WaitForCompletion()
Block the thread until the actual rendering is finished().
virtual void Modified()
Update the modification time for this object.
virtual void ReleaseRGBAPixelData(float *)
Same as Get/SetPixelData except that the image also contains an alpha component.
vtkWGPUDeptStencil DepthStencil
dynamic, self-adjusting array of unsigned char
virtual int SetRGBAPixelData(int, int, int, int, float *, int, int=0, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
create a window for renderers to draw into
virtual bool InitializeFromCurrentContext()
Initialize the render window from the information associated with the currently activated OpenGL cont...
virtual const char * GetRenderingBackend()
What rendering backend has the user requested.
virtual unsigned char * GetRGBACharPixelData(int, int, int, int, int, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
virtual void StereoMidpoint()
Intermediate method performs operations required between the rendering of the left and right eye...
vtkNew< vtkTypeUInt8Array > CachedPixelBytes
virtual void End()
Update the system, if needed, at end of render process.
virtual float * GetRGBAPixelData(int, int, int, int, int, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
wgpu::TextureFormat TexFormat
wgpu::RenderPassEncoder NewRenderPass(wgpu::RenderPassDescriptor &descriptor)
wgpu::TextureFormat Format
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
wgpu::TextureDataLayout Layout
wgpu::Buffer OffscreenBuffer
wgpu::TextureFormat GetDepthStencilFormat()
wgpu::CommandEncoder CommandEncoder
virtual void Frame()
A termination method performed at the end of the rendering process to do things like swapping buffers...
virtual int SetRGBACharPixelData(int, int, int, int, unsigned char *, int, int=0, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.