tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SwapChainD3D.h (2382B)


      1 //
      2 // Copyright 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 <EGL/egl.h>
     14 #include <EGL/eglext.h>
     15 #include <GLES2/gl2.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 DisplayD3D;
     38 class RenderTargetD3D;
     39 
     40 class SwapChainD3D : angle::NonCopyable
     41 {
     42  public:
     43    SwapChainD3D(HANDLE shareHandle,
     44                 IUnknown *d3dTexture,
     45                 GLenum backBufferFormat,
     46                 GLenum depthBufferFormat);
     47    virtual ~SwapChainD3D();
     48 
     49    virtual EGLint resize(DisplayD3D *displayD3D,
     50                          EGLint backbufferWidth,
     51                          EGLint backbufferSize) = 0;
     52    virtual EGLint reset(DisplayD3D *displayD3D,
     53                         EGLint backbufferWidth,
     54                         EGLint backbufferHeight,
     55                         EGLint swapInterval)    = 0;
     56    virtual EGLint swapRect(DisplayD3D *displayD3D,
     57                            EGLint x,
     58                            EGLint y,
     59                            EGLint width,
     60                            EGLint height)       = 0;
     61    virtual void recreate()                      = 0;
     62 
     63    virtual RenderTargetD3D *getColorRenderTarget()        = 0;
     64    virtual RenderTargetD3D *getDepthStencilRenderTarget() = 0;
     65 
     66    GLenum getRenderTargetInternalFormat() const { return mOffscreenRenderTargetFormat; }
     67    GLenum getDepthBufferInternalFormat() const { return mDepthBufferFormat; }
     68 
     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_