• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2024 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // SurfaceWgpu.h:
7 //    Defines the class interface for SurfaceWgpu, implementing SurfaceImpl.
8 //
9 
10 #ifndef LIBANGLE_RENDERER_WGPU_SURFACEWGPU_H_
11 #define LIBANGLE_RENDERER_WGPU_SURFACEWGPU_H_
12 
13 #include "libANGLE/renderer/SurfaceImpl.h"
14 
15 namespace rx
16 {
17 
18 class SurfaceWgpu : public SurfaceImpl
19 {
20   public:
21     SurfaceWgpu(const egl::SurfaceState &surfaceState);
22     ~SurfaceWgpu() override;
23 
24     egl::Error initialize(const egl::Display *display) override;
25     egl::Error swap(const gl::Context *context) override;
26     egl::Error postSubBuffer(const gl::Context *context,
27                              EGLint x,
28                              EGLint y,
29                              EGLint width,
30                              EGLint height) override;
31     egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
32     egl::Error bindTexImage(const gl::Context *context,
33                             gl::Texture *texture,
34                             EGLint buffer) override;
35     egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
36     egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override;
37     egl::Error getMscRate(EGLint *numerator, EGLint *denominator) override;
38     void setSwapInterval(EGLint interval) override;
39 
40     // width and height can change with client window resizing
41     EGLint getWidth() const override;
42     EGLint getHeight() const override;
43 
44     EGLint isPostSubBufferSupported() const override;
45     EGLint getSwapBehavior() const override;
46 
47     angle::Result initializeContents(const gl::Context *context,
48                                      GLenum binding,
49                                      const gl::ImageIndex &imageIndex) override;
50 
51     egl::Error attachToFramebuffer(const gl::Context *context,
52                                    gl::Framebuffer *framebuffer) override;
53     egl::Error detachFromFramebuffer(const gl::Context *context,
54                                      gl::Framebuffer *framebuffer) override;
55 
56     angle::Result getAttachmentRenderTarget(const gl::Context *context,
57                                             GLenum binding,
58                                             const gl::ImageIndex &imageIndex,
59                                             GLsizei samples,
60                                             FramebufferAttachmentRenderTarget **rtOut) override;
61 };
62 
63 }  // namespace rx
64 
65 #endif  // LIBANGLE_RENDERER_WGPU_SURFACEWGPU_H_
66