1 // 2 // Copyright (c) 2012 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 // SwapChainD3D.h: Defines a back-end specific class that hides the details of the 8 // implementation-specific swapchain. 9 10 #ifndef LIBANGLE_RENDERER_D3D_SWAPCHAIND3D_H_ 11 #define LIBANGLE_RENDERER_D3D_SWAPCHAIND3D_H_ 12 13 #include <GLES2/gl2.h> 14 #include <EGL/egl.h> 15 #include <EGL/eglext.h> 16 17 #include "common/angleutils.h" 18 #include "common/platform.h" 19 #include "libANGLE/Error.h" 20 21 #if !defined(ANGLE_FORCE_VSYNC_OFF) 22 #define ANGLE_FORCE_VSYNC_OFF 0 23 #endif 24 25 namespace gl 26 { 27 class Context; 28 } // namespace gl 29 30 namespace egl 31 { 32 class Display; 33 } // namespace egl 34 35 namespace rx 36 { 37 class RenderTargetD3D; 38 39 class SwapChainD3D : angle::NonCopyable 40 { 41 public: 42 SwapChainD3D(HANDLE shareHandle, 43 IUnknown *d3dTexture, 44 GLenum backBufferFormat, 45 GLenum depthBufferFormat); 46 virtual ~SwapChainD3D(); 47 48 virtual EGLint resize(const gl::Context *context, 49 EGLint backbufferWidth, 50 EGLint backbufferSize) = 0; 51 virtual EGLint reset(const gl::Context *context, 52 EGLint backbufferWidth, 53 EGLint backbufferHeight, 54 EGLint swapInterval) = 0; 55 virtual EGLint swapRect(const gl::Context *context, 56 EGLint x, 57 EGLint y, 58 EGLint width, 59 EGLint height) = 0; 60 virtual void recreate() = 0; getDevice()61 virtual void *getDevice() { return nullptr; } 62 63 virtual RenderTargetD3D *getColorRenderTarget() = 0; 64 virtual RenderTargetD3D *getDepthStencilRenderTarget() = 0; 65 getRenderTargetInternalFormat()66 GLenum getRenderTargetInternalFormat() const { return mOffscreenRenderTargetFormat; } getDepthBufferInternalFormat()67 GLenum getDepthBufferInternalFormat() const { return mDepthBufferFormat; } 68 getShareHandle()69 HANDLE getShareHandle() { return mShareHandle; } 70 virtual void *getKeyedMutex() = 0; 71 72 virtual egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) = 0; 73 74 protected: 75 const GLenum mOffscreenRenderTargetFormat; 76 const GLenum mDepthBufferFormat; 77 78 HANDLE mShareHandle; 79 IUnknown *mD3DTexture; 80 }; 81 82 } // namespace rx 83 #endif // LIBANGLE_RENDERER_D3D_SWAPCHAIND3D_H_ 84