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 // SwapChain9.h: Defines a back-end specific class for the D3D9 swap chain. 8 9 #ifndef LIBANGLE_RENDERER_D3D_D3D9_SWAPCHAIN9_H_ 10 #define LIBANGLE_RENDERER_D3D_D3D9_SWAPCHAIN9_H_ 11 12 #include "common/angleutils.h" 13 #include "libANGLE/renderer/d3d/SwapChainD3D.h" 14 #include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h" 15 16 namespace rx 17 { 18 class NativeWindow9; 19 class Renderer9; 20 21 class SwapChain9 : public SwapChainD3D 22 { 23 public: 24 SwapChain9(Renderer9 *renderer, 25 NativeWindow9 *nativeWindow, 26 HANDLE shareHandle, 27 IUnknown *d3dTexture, 28 GLenum backBufferFormat, 29 GLenum depthBufferFormat, 30 EGLint orientation); 31 ~SwapChain9() override; 32 33 EGLint resize(const gl::Context *context, EGLint backbufferWidth, EGLint backbufferHeight) 34 override; 35 EGLint reset(const gl::Context *context, 36 EGLint backbufferWidth, 37 EGLint backbufferHeight, 38 EGLint swapInterval) override; 39 EGLint swapRect(const gl::Context *context, 40 EGLint x, 41 EGLint y, 42 EGLint width, 43 EGLint height) override; 44 void recreate() override; 45 46 RenderTargetD3D *getColorRenderTarget() override; 47 RenderTargetD3D *getDepthStencilRenderTarget() override; 48 49 virtual IDirect3DSurface9 *getRenderTarget(); 50 virtual IDirect3DSurface9 *getDepthStencil(); 51 virtual IDirect3DTexture9 *getOffscreenTexture(); 52 getWidth()53 EGLint getWidth() const { return mWidth; } getHeight()54 EGLint getHeight() const { return mHeight; } 55 56 void *getKeyedMutex() override; 57 58 egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override; 59 60 private: 61 void release(); 62 63 Renderer9 *mRenderer; 64 EGLint mWidth; 65 EGLint mHeight; 66 EGLint mSwapInterval; 67 68 NativeWindow9 *mNativeWindow; 69 70 IDirect3DSwapChain9 *mSwapChain; 71 IDirect3DSurface9 *mBackBuffer; 72 IDirect3DSurface9 *mRenderTarget; 73 IDirect3DSurface9 *mDepthStencil; 74 IDirect3DTexture9* mOffscreenTexture; 75 76 SurfaceRenderTarget9 mColorRenderTarget; 77 SurfaceRenderTarget9 mDepthStencilRenderTarget; 78 }; 79 80 } 81 #endif // LIBANGLE_RENDERER_D3D_D3D9_SWAPCHAIN9_H_ 82