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 // SwapChain11.h: Defines a back-end specific class for the D3D11 swap chain. 8 9 #ifndef LIBGLESV2_RENDERER_SWAPCHAIN11_H_ 10 #define LIBGLESV2_RENDERER_SWAPCHAIN11_H_ 11 12 #include "common/angleutils.h" 13 #include "libGLESv2/renderer/SwapChain.h" 14 15 namespace rx 16 { 17 class Renderer11; 18 19 class SwapChain11 : public SwapChain 20 { 21 public: 22 SwapChain11(Renderer11 *renderer, HWND window, HANDLE shareHandle, 23 GLenum backBufferFormat, GLenum depthBufferFormat); 24 virtual ~SwapChain11(); 25 26 EGLint resize(EGLint backbufferWidth, EGLint backbufferHeight); 27 virtual EGLint reset(EGLint backbufferWidth, EGLint backbufferHeight, EGLint swapInterval); 28 virtual EGLint swapRect(EGLint x, EGLint y, EGLint width, EGLint height); 29 virtual void recreate(); 30 31 virtual ID3D11Texture2D *getOffscreenTexture(); 32 virtual ID3D11RenderTargetView *getRenderTarget(); 33 virtual ID3D11ShaderResourceView *getRenderTargetShaderResource(); 34 35 virtual ID3D11Texture2D *getDepthStencilTexture(); 36 virtual ID3D11DepthStencilView *getDepthStencil(); 37 38 EGLint getWidth() const { return mWidth; } 39 EGLint getHeight() const { return mHeight; } 40 41 static SwapChain11 *makeSwapChain11(SwapChain *swapChain); 42 43 private: 44 DISALLOW_COPY_AND_ASSIGN(SwapChain11); 45 46 void release(); 47 void initPassThroughResources(); 48 void releaseOffscreenTexture(); 49 EGLint resetOffscreenTexture(int backbufferWidth, int backbufferHeight); 50 51 Renderer11 *mRenderer; 52 EGLint mHeight; 53 EGLint mWidth; 54 bool mAppCreatedShareHandle; 55 unsigned int mSwapInterval; 56 bool mPassThroughResourcesInit; 57 58 IDXGISwapChain *mSwapChain; 59 60 ID3D11Texture2D *mBackBufferTexture; 61 ID3D11RenderTargetView *mBackBufferRTView; 62 63 ID3D11Texture2D *mOffscreenTexture; 64 ID3D11RenderTargetView *mOffscreenRTView; 65 ID3D11ShaderResourceView *mOffscreenSRView; 66 67 ID3D11Texture2D *mDepthStencilTexture; 68 ID3D11DepthStencilView *mDepthStencilDSView; 69 70 ID3D11Buffer *mQuadVB; 71 ID3D11SamplerState *mPassThroughSampler; 72 ID3D11InputLayout *mPassThroughIL; 73 ID3D11VertexShader *mPassThroughVS; 74 ID3D11PixelShader *mPassThroughPS; 75 }; 76 77 } 78 #endif // LIBGLESV2_RENDERER_SWAPCHAIN11_H_ 79