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// SwapChain.h: Defines a back-end specific class that hides the details of the 8// implementation-specific swapchain. 9 10#ifndef LIBGLESV2_RENDERER_SWAPCHAIN_H_ 11#define LIBGLESV2_RENDERER_SWAPCHAIN_H_ 12 13#include "common/angleutils.h" 14 15#if !defined(ANGLE_FORCE_VSYNC_OFF) 16#define ANGLE_FORCE_VSYNC_OFF 0 17#endif 18 19namespace rx 20{ 21 22class SwapChain 23{ 24 public: 25 SwapChain(HWND window, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat) 26 : mWindow(window), mShareHandle(shareHandle), mBackBufferFormat(backBufferFormat), mDepthBufferFormat(depthBufferFormat) 27 { 28 } 29 30 virtual ~SwapChain() {}; 31 32 virtual EGLint resize(EGLint backbufferWidth, EGLint backbufferSize) = 0; 33 virtual EGLint reset(EGLint backbufferWidth, EGLint backbufferHeight, EGLint swapInterval) = 0; 34 virtual EGLint swapRect(EGLint x, EGLint y, EGLint width, EGLint height) = 0; 35 virtual void recreate() = 0; 36 37 virtual HANDLE getShareHandle() {return mShareHandle;}; 38 39 protected: 40 const HWND mWindow; // Window that the surface is created for. 41 const GLenum mBackBufferFormat; 42 const GLenum mDepthBufferFormat; 43 44 HANDLE mShareHandle; 45}; 46 47} 48#endif // LIBGLESV2_RENDERER_SWAPCHAIN_H_ 49