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 ID3D11Device1 *displayD3D11Device1, 35 const FunctionsGL *functionsGL, 36 const FunctionsWGL *functionsWGL); 37 ~D3DTextureSurfaceWGL() override; 38 39 static egl::Error ValidateD3DTextureClientBuffer(EGLenum buftype, 40 EGLClientBuffer clientBuffer, 41 ID3D11Device *d3d11Device, 42 ID3D11Device1 *d3d11Device1); 43 44 egl::Error initialize(const egl::Display *display) override; 45 egl::Error makeCurrent(const gl::Context *context) override; 46 egl::Error unMakeCurrent(const gl::Context *context) override; 47 48 egl::Error swap(const gl::Context *context) override; 49 egl::Error postSubBuffer(const gl::Context *context, 50 EGLint x, 51 EGLint y, 52 EGLint width, 53 EGLint height) override; 54 egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override; 55 egl::Error bindTexImage(const gl::Context *context, 56 gl::Texture *texture, 57 EGLint buffer) override; 58 egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override; 59 void setSwapInterval(EGLint interval) override; 60 61 EGLint getWidth() const override; 62 EGLint getHeight() const override; 63 64 EGLint isPostSubBufferSupported() const override; 65 EGLint getSwapBehavior() const override; 66 67 FramebufferImpl *createDefaultFramebuffer(const gl::Context *context, 68 const gl::FramebufferState &data) override; 69 70 HDC getDC() const override; 71 72 const angle::Format *getD3DTextureColorFormat() const override; 73 74 private: 75 EGLenum mBuftype; 76 EGLClientBuffer mClientBuffer; 77 78 ID3D11Device *mDisplayD3D11Device; 79 ID3D11Device1 *mDisplayD3D11Device1; 80 81 DisplayWGL *mDisplay; 82 StateManagerGL *mStateManager; 83 const FunctionsGL *mFunctionsGL; 84 const FunctionsWGL *mFunctionsWGL; 85 86 HDC mDeviceContext; 87 88 size_t mWidth; 89 size_t mHeight; 90 91 const angle::Format *mColorFormat; 92 93 HANDLE mDeviceHandle; 94 IUnknown *mObject; 95 IDXGIKeyedMutex *mKeyedMutex; 96 HANDLE mBoundObjectTextureHandle; 97 HANDLE mBoundObjectRenderbufferHandle; 98 99 GLuint mColorRenderbufferID; 100 GLuint mDepthStencilRenderbufferID; 101 }; 102 } // namespace rx 103 104 #endif // LIBANGLE_RENDERER_GL_WGL_D3DTEXTIRESURFACEWGL_H_ 105