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 HDC getDC() const override; 68 const angle::Format *getD3DTextureColorFormat() const override; 69 70 egl::Error attachToFramebuffer(const gl::Context *context, 71 gl::Framebuffer *framebuffer) override; 72 egl::Error detachFromFramebuffer(const gl::Context *context, 73 gl::Framebuffer *framebuffer) override; 74 75 private: 76 EGLenum mBuftype; 77 EGLClientBuffer mClientBuffer; 78 79 ID3D11Device *mDisplayD3D11Device; 80 ID3D11Device1 *mDisplayD3D11Device1; 81 82 DisplayWGL *mDisplay; 83 StateManagerGL *mStateManager; 84 const FunctionsGL *mFunctionsGL; 85 const FunctionsWGL *mFunctionsWGL; 86 87 HDC mDeviceContext; 88 89 size_t mWidth; 90 size_t mHeight; 91 92 const angle::Format *mColorFormat; 93 94 HANDLE mDeviceHandle; 95 IUnknown *mObject; 96 IDXGIKeyedMutex *mKeyedMutex; 97 HANDLE mBoundObjectTextureHandle; 98 HANDLE mBoundObjectRenderbufferHandle; 99 100 GLuint mFramebufferID; 101 GLuint mColorRenderbufferID; 102 GLuint mDepthStencilRenderbufferID; 103 }; 104 } // namespace rx 105 106 #endif // LIBANGLE_RENDERER_GL_WGL_D3DTEXTIRESURFACEWGL_H_ 107