1 // 2 // Copyright (c) 2014 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 7 // SurfaceImpl.h: Implementation methods of egl::Surface 8 9 #ifndef LIBANGLE_RENDERER_SURFACEIMPL_H_ 10 #define LIBANGLE_RENDERER_SURFACEIMPL_H_ 11 12 #include <EGL/egl.h> 13 #include <EGL/eglext.h> 14 15 #include "common/angleutils.h" 16 #include "libANGLE/Error.h" 17 #include "libANGLE/FramebufferAttachment.h" 18 #include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h" 19 20 namespace angle 21 { 22 struct Format; 23 } 24 25 namespace gl 26 { 27 class FramebufferState; 28 } 29 30 namespace egl 31 { 32 class Display; 33 struct Config; 34 struct SurfaceState; 35 class Thread; 36 } 37 38 namespace rx 39 { 40 class FramebufferImpl; 41 42 class SurfaceImpl : public FramebufferAttachmentObjectImpl 43 { 44 public: 45 SurfaceImpl(const egl::SurfaceState &surfaceState); 46 ~SurfaceImpl() override; destroy(const egl::Display * display)47 virtual void destroy(const egl::Display *display) {} 48 49 virtual egl::Error initialize(const egl::Display *display) = 0; 50 virtual FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) = 0; 51 virtual egl::Error swap(const gl::Context *context) = 0; 52 virtual egl::Error swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects); 53 virtual egl::Error postSubBuffer(const gl::Context *context, 54 EGLint x, 55 EGLint y, 56 EGLint width, 57 EGLint height) = 0; 58 virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) = 0; 59 virtual egl::Error bindTexImage(gl::Texture *texture, EGLint buffer) = 0; 60 virtual egl::Error releaseTexImage(EGLint buffer) = 0; 61 virtual egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) = 0; 62 virtual void setSwapInterval(EGLint interval) = 0; 63 64 // width and height can change with client window resizing 65 virtual EGLint getWidth() const = 0; 66 virtual EGLint getHeight() const = 0; 67 68 virtual EGLint isPostSubBufferSupported() const = 0; 69 virtual EGLint getSwapBehavior() const = 0; 70 71 // Used to query color format from pbuffers created from D3D textures. getD3DTextureColorFormat()72 virtual const angle::Format *getD3DTextureColorFormat() const 73 { 74 UNREACHABLE(); 75 return nullptr; 76 } 77 78 protected: 79 const egl::SurfaceState &mState; 80 }; 81 82 } 83 84 #endif // LIBANGLE_RENDERER_SURFACEIMPL_H_ 85 86