diff --git a/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp b/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp index b2af8676b8..4322e0deee 100644 --- a/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp +++ b/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp @@ -56,14 +56,12 @@ IDrawingSurfaceBackgroundContentProvider^ Direct3DInterop::CreateContentProvider // Interface With Direct3DContentProvider HRESULT Direct3DInterop::Connect(_In_ IDrawingSurfaceRuntimeHostNative* host, _In_ ID3D11Device1* device) { - //m_renderer->SetDevice(device); return S_OK; } void Direct3DInterop::Disconnect() { - std::lock_guard guard(mRenderingMutex); - m_renderer->Disconnect(); + m_renderer->Disconnect(); } // IDrawingSurfaceManipulationHandler @@ -143,8 +141,6 @@ HRESULT Direct3DInterop::PrepareResources(_In_ const LARGE_INTEGER* presentTarge HRESULT Direct3DInterop::Draw(_In_ ID3D11Device1* device, _In_ ID3D11DeviceContext1* context, _In_ ID3D11RenderTargetView* renderTargetView) { - std::lock_guard guard(mRenderingMutex); - m_renderer->UpdateDevice(device, context, renderTargetView); #if 0 if(mCurrentOrientation != WindowOrientation) diff --git a/cocos/platform/wp8-xaml/cpp/Direct3DInterop.h b/cocos/platform/wp8-xaml/cpp/Direct3DInterop.h index 8c6bbad3ba..acda488448 100644 --- a/cocos/platform/wp8-xaml/cpp/Direct3DInterop.h +++ b/cocos/platform/wp8-xaml/cpp/Direct3DInterop.h @@ -87,8 +87,6 @@ private: Windows::Graphics::Display::DisplayOrientations mCurrentOrientation; - std::mutex mRenderingMutex; - Cocos2dEventDelegate^ m_delegate; Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; Cocos2dEditBoxDelegate^ m_editBoxDelegate; diff --git a/cocos/platform/wp8-xaml/cpp/DirectXBase.cpp b/cocos/platform/wp8-xaml/cpp/DirectXBase.cpp index 3b66c14f5b..d14bb0b4b3 100644 --- a/cocos/platform/wp8-xaml/cpp/DirectXBase.cpp +++ b/cocos/platform/wp8-xaml/cpp/DirectXBase.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. ****************************************************************************/ #include "DirectXBase.h" +#include "DirectXHelper.h" using namespace DirectX; using namespace Microsoft::WRL; @@ -167,12 +168,12 @@ void DirectXBase::Render() void DirectXBase::CloseAngle() { + eglMakeCurrent(NULL, NULL, NULL, NULL); - if(m_eglDisplay && m_eglSurface) + if(m_eglPhoneWindow != nullptr) { - eglDestroySurface(m_eglDisplay, m_eglSurface); - m_eglSurface = nullptr; - } + m_eglPhoneWindow->Update(nullptr, nullptr, nullptr); + } if(m_eglDisplay && m_eglContext) { @@ -180,18 +181,17 @@ void DirectXBase::CloseAngle() m_eglContext = nullptr; } - if(m_eglDisplay) + if(m_eglDisplay && m_eglSurface) + { + eglDestroySurface(m_eglDisplay, m_eglSurface); + m_eglSurface = nullptr; + } + + if(m_eglDisplay) { eglTerminate(m_eglDisplay); m_eglDisplay = nullptr; - } - - if(m_eglPhoneWindow != nullptr) - { - m_eglPhoneWindow->Update(nullptr, nullptr, nullptr); - } - - eglMakeCurrent(NULL, NULL, NULL, NULL); + } if(m_device) { @@ -199,11 +199,8 @@ void DirectXBase::CloseAngle() m_device = nullptr; } -#if 0 m_eglPhoneWindow = nullptr; m_eglWindow = nullptr; -#endif // 0 - m_bAngleInitialized = false; } @@ -262,10 +259,12 @@ bool DirectXBase::InitializeAngle(ID3D11Device1* d3dDevice, ID3D11DeviceContext1 m_eglPhoneWindow->Update(d3dDevice, d3dContext, d3dRenderTargetView); + ComPtr u; + HRESULT r = m_eglPhoneWindow.As(&u); if(m_eglWindow == nullptr) { DX::ThrowIfFailed( - CreateWinrtEglWindow(m_eglPhoneWindow.Get(), featureLevel, m_eglWindow.GetAddressOf()) + CreateWinrtEglWindow(u.Get(), featureLevel, m_eglWindow.GetAddressOf()) ); } diff --git a/cocos/platform/wp8-xaml/cpp/DirectXBase.h b/cocos/platform/wp8-xaml/cpp/DirectXBase.h index 1440ad6a1f..69e8daecb5 100644 --- a/cocos/platform/wp8-xaml/cpp/DirectXBase.h +++ b/cocos/platform/wp8-xaml/cpp/DirectXBase.h @@ -27,8 +27,12 @@ THE SOFTWARE. #include #include -#include "DirectXHelper.h" -#include "CCGL.h" +#include "EGL/egl.h" +#include "EGL/eglext.h" +#include "EGL/eglplatform.h" +#include "GLES2/gl2.h" +#include "GLES2/gl2ext.h" +#include "winrtangle.h" // Helper class that initializes DirectX APIs for 3D rendering. ref class DirectXBase abstract