mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1092582. Add support to ANGLE for using IDXGIKeyedMutex.
This commit is contained in:
parent
9d622e3111
commit
a0f8fa61fd
@ -458,6 +458,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSu
|
|||||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x3208
|
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x3208
|
||||||
#endif /* EGL_ANGLE_platform_angle_opengl */
|
#endif /* EGL_ANGLE_platform_angle_opengl */
|
||||||
|
|
||||||
|
#ifndef EGL_ANGLE_keyed_mutex
|
||||||
|
#define EGL_ANGLE_keyed_mutex 1
|
||||||
|
#define EGL_DXGI_KEYED_MUTEX_ANGLE 0x3209
|
||||||
|
#endif /* EGL_ANGLE_keyed_mutex */
|
||||||
|
|
||||||
#ifndef EGL_ARM_pixmap_multisample_discard
|
#ifndef EGL_ARM_pixmap_multisample_discard
|
||||||
#define EGL_ARM_pixmap_multisample_discard 1
|
#define EGL_ARM_pixmap_multisample_discard 1
|
||||||
#define EGL_DISCARD_SAMPLES_ARM 0x3286
|
#define EGL_DISCARD_SAMPLES_ARM 0x3286
|
||||||
|
@ -495,6 +495,12 @@ EGLBoolean __stdcall eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surf
|
|||||||
*value = (void*) (swapchain ? swapchain->getShareHandle() : NULL);
|
*value = (void*) (swapchain ? swapchain->getShareHandle() : NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case EGL_DXGI_KEYED_MUTEX_ANGLE:
|
||||||
|
{
|
||||||
|
rx::SwapChain *swapchain = eglSurface->getSwapChain();
|
||||||
|
*value = (void*) (swapchain ? swapchain->getKeyedMutex() : NULL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
|
return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
|
||||||
}
|
}
|
||||||
|
@ -171,10 +171,11 @@ if CONFIG['MOZ_HAS_WINSDK_WITH_D3D']:
|
|||||||
'renderer/d3d/d3d11/RenderStateCache.cpp',
|
'renderer/d3d/d3d11/RenderStateCache.cpp',
|
||||||
'renderer/d3d/d3d11/RenderTarget11.cpp',
|
'renderer/d3d/d3d11/RenderTarget11.cpp',
|
||||||
'renderer/d3d/d3d11/ShaderExecutable11.cpp',
|
'renderer/d3d/d3d11/ShaderExecutable11.cpp',
|
||||||
'renderer/d3d/d3d11/SwapChain11.cpp',
|
|
||||||
'renderer/d3d/d3d11/TextureStorage11.cpp',
|
'renderer/d3d/d3d11/TextureStorage11.cpp',
|
||||||
'renderer/d3d/d3d11/VertexBuffer11.cpp',
|
'renderer/d3d/d3d11/VertexBuffer11.cpp',
|
||||||
]
|
]
|
||||||
|
SOURCES += ['renderer/d3d/d3d11/SwapChain11.cpp']
|
||||||
|
SOURCES['renderer/d3d/d3d11/SwapChain11.cpp'].flags += ['-DANGLE_RESOURCE_SHARE_TYPE=D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX']
|
||||||
|
|
||||||
|
|
||||||
if CONFIG['GNU_CXX']:
|
if CONFIG['GNU_CXX']:
|
||||||
|
@ -40,6 +40,7 @@ class SwapChain
|
|||||||
virtual void recreate() = 0;
|
virtual void recreate() = 0;
|
||||||
|
|
||||||
virtual HANDLE getShareHandle() {return mShareHandle;};
|
virtual HANDLE getShareHandle() {return mShareHandle;};
|
||||||
|
virtual void* getKeyedMutex() {return NULL;};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
rx::NativeWindow mNativeWindow; // Handler for the Window that the surface is created for.
|
rx::NativeWindow mNativeWindow; // Handler for the Window that the surface is created for.
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
|
|
||||||
#include "common/NativeWindow.h"
|
#include "common/NativeWindow.h"
|
||||||
|
|
||||||
|
// This can be defined to other values like D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX as needed
|
||||||
|
#ifndef ANGLE_RESOURCE_SHARE_TYPE
|
||||||
|
#define ANGLE_RESOURCE_SHARE_TYPE D3D11_RESOURCE_MISC_SHARED
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace rx
|
namespace rx
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -26,6 +31,7 @@ SwapChain11::SwapChain11(Renderer11 *renderer, rx::NativeWindow nativeWindow, HA
|
|||||||
SwapChain(nativeWindow, shareHandle, backBufferFormat, depthBufferFormat)
|
SwapChain(nativeWindow, shareHandle, backBufferFormat, depthBufferFormat)
|
||||||
{
|
{
|
||||||
mSwapChain = NULL;
|
mSwapChain = NULL;
|
||||||
|
mKeyedMutex = NULL;
|
||||||
mBackBufferTexture = NULL;
|
mBackBufferTexture = NULL;
|
||||||
mBackBufferRTView = NULL;
|
mBackBufferRTView = NULL;
|
||||||
mOffscreenTexture = NULL;
|
mOffscreenTexture = NULL;
|
||||||
@ -54,6 +60,7 @@ SwapChain11::~SwapChain11()
|
|||||||
void SwapChain11::release()
|
void SwapChain11::release()
|
||||||
{
|
{
|
||||||
SafeRelease(mSwapChain);
|
SafeRelease(mSwapChain);
|
||||||
|
SafeRelease(mKeyedMutex);
|
||||||
SafeRelease(mBackBufferTexture);
|
SafeRelease(mBackBufferTexture);
|
||||||
SafeRelease(mBackBufferRTView);
|
SafeRelease(mBackBufferRTView);
|
||||||
SafeRelease(mOffscreenTexture);
|
SafeRelease(mOffscreenTexture);
|
||||||
@ -161,7 +168,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
|
|||||||
offscreenTextureDesc.Usage = D3D11_USAGE_DEFAULT;
|
offscreenTextureDesc.Usage = D3D11_USAGE_DEFAULT;
|
||||||
offscreenTextureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
|
offscreenTextureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
|
||||||
offscreenTextureDesc.CPUAccessFlags = 0;
|
offscreenTextureDesc.CPUAccessFlags = 0;
|
||||||
offscreenTextureDesc.MiscFlags = useSharedResource ? D3D11_RESOURCE_MISC_SHARED : 0;
|
offscreenTextureDesc.MiscFlags = useSharedResource ? ANGLE_RESOURCE_SHARE_TYPE : 0;
|
||||||
|
|
||||||
HRESULT result = device->CreateTexture2D(&offscreenTextureDesc, NULL, &mOffscreenTexture);
|
HRESULT result = device->CreateTexture2D(&offscreenTextureDesc, NULL, &mOffscreenTexture);
|
||||||
|
|
||||||
@ -205,6 +212,18 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
IDXGIKeyedMutex *keyedMutex = NULL;
|
||||||
|
result = mOffscreenTexture->QueryInterface(__uuidof(IDXGIKeyedMutex), (void**)&keyedMutex);
|
||||||
|
|
||||||
|
if (FAILED(result))
|
||||||
|
{
|
||||||
|
mKeyedMutex = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mKeyedMutex = keyedMutex;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ class SwapChain11 : public SwapChain
|
|||||||
|
|
||||||
EGLint getWidth() const { return mWidth; }
|
EGLint getWidth() const { return mWidth; }
|
||||||
EGLint getHeight() const { return mHeight; }
|
EGLint getHeight() const { return mHeight; }
|
||||||
|
virtual void* getKeyedMutex() { return mKeyedMutex; };
|
||||||
|
|
||||||
static SwapChain11 *makeSwapChain11(SwapChain *swapChain);
|
static SwapChain11 *makeSwapChain11(SwapChain *swapChain);
|
||||||
|
|
||||||
@ -57,6 +58,7 @@ class SwapChain11 : public SwapChain
|
|||||||
bool mPassThroughResourcesInit;
|
bool mPassThroughResourcesInit;
|
||||||
|
|
||||||
IDXGISwapChain *mSwapChain;
|
IDXGISwapChain *mSwapChain;
|
||||||
|
IDXGIKeyedMutex *mKeyedMutex;
|
||||||
|
|
||||||
ID3D11Texture2D *mBackBufferTexture;
|
ID3D11Texture2D *mBackBufferTexture;
|
||||||
ID3D11RenderTargetView *mBackBufferRTView;
|
ID3D11RenderTargetView *mBackBufferRTView;
|
||||||
|
Loading…
Reference in New Issue
Block a user