• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 // Copyright 2015 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 // D3DTextureSurfaceWGL.h: WGL implementation of egl::Surface for D3D texture interop.
8 
9 #ifndef LIBANGLE_RENDERER_GL_WGL_D3DTEXTIRESURFACEWGL_H_
10 #define LIBANGLE_RENDERER_GL_WGL_D3DTEXTIRESURFACEWGL_H_
11 
12 #include "libANGLE/renderer/gl/wgl/SurfaceWGL.h"
13 
14 #include <GL/wglext.h>
15 
16 namespace rx
17 {
18 
19 class FunctionsGL;
20 class FunctionsWGL;
21 class DisplayWGL;
22 class StateManagerGL;
23 
24 class D3DTextureSurfaceWGL : public SurfaceWGL
25 {
26   public:
27     D3DTextureSurfaceWGL(const egl::SurfaceState &state,
28                          StateManagerGL *stateManager,
29                          EGLenum buftype,
30                          EGLClientBuffer clientBuffer,
31                          DisplayWGL *display,
32                          HDC deviceContext,
33                          ID3D11Device *displayD3D11Device,
34                          const FunctionsGL *functionsGL,
35                          const FunctionsWGL *functionsWGL);
36     ~D3DTextureSurfaceWGL() override;
37 
38     static egl::Error ValidateD3DTextureClientBuffer(EGLenum buftype,
39                                                      EGLClientBuffer clientBuffer,
40                                                      ID3D11Device *d3d11Device);
41 
42     egl::Error initialize(const egl::Display *display) override;
43     egl::Error makeCurrent(const gl::Context *context) override;
44     egl::Error unMakeCurrent(const gl::Context *context) override;
45 
46     egl::Error swap(const gl::Context *context) override;
47     egl::Error postSubBuffer(const gl::Context *context,
48                              EGLint x,
49                              EGLint y,
50                              EGLint width,
51                              EGLint height) override;
52     egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
53     egl::Error bindTexImage(const gl::Context *context,
54                             gl::Texture *texture,
55                             EGLint buffer) override;
56     egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
57     void setSwapInterval(EGLint interval) override;
58 
59     EGLint getWidth() const override;
60     EGLint getHeight() const override;
61 
62     EGLint isPostSubBufferSupported() const override;
63     EGLint getSwapBehavior() const override;
64 
65     FramebufferImpl *createDefaultFramebuffer(const gl::Context *context,
66                                               const gl::FramebufferState &data) override;
67 
68     HDC getDC() const override;
69 
70     const angle::Format *getD3DTextureColorFormat() const override;
71 
72   private:
73     EGLenum mBuftype;
74     EGLClientBuffer mClientBuffer;
75 
76     ID3D11Device *mDisplayD3D11Device;
77 
78     DisplayWGL *mDisplay;
79     StateManagerGL *mStateManager;
80     const FunctionsGL *mFunctionsGL;
81     const FunctionsWGL *mFunctionsWGL;
82 
83     HDC mDeviceContext;
84 
85     size_t mWidth;
86     size_t mHeight;
87 
88     const angle::Format *mColorFormat;
89 
90     HANDLE mDeviceHandle;
91     IUnknown *mObject;
92     IDXGIKeyedMutex *mKeyedMutex;
93     HANDLE mBoundObjectTextureHandle;
94     HANDLE mBoundObjectRenderbufferHandle;
95 
96     GLuint mColorRenderbufferID;
97     GLuint mDepthStencilRenderbufferID;
98 };
99 }  // namespace rx
100 
101 #endif  // LIBANGLE_RENDERER_GL_WGL_D3DTEXTIRESURFACEWGL_H_
102