Commit 192a0147 by Trevor David Black Committed by Commit Bot

Multithreading in D3D11 minimum viable product

Bug: b/168046573 Change-Id: I676a148333cbf5e9ca508768503e62cb14d8eeb0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2629618 Commit-Queue: Doug Horn <doughorn@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTrevor David Black <vantablack@google.com>
parent 383442e5
...@@ -615,6 +615,7 @@ config("angle_backend_config") { ...@@ -615,6 +615,7 @@ config("angle_backend_config") {
if (angle_enable_d3d11) { if (angle_enable_d3d11) {
configs += [ "src/libANGLE/renderer/d3d:angle_d3d11_backend_config" ] configs += [ "src/libANGLE/renderer/d3d:angle_d3d11_backend_config" ]
defines += [ "ANGLE_FORCE_CONTEXT_CHECK_EVERY_CALL=1" ]
} }
if (angle_enable_d3d9) { if (angle_enable_d3d9) {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"scripts/entry_point_packed_gl_enums.json": "scripts/entry_point_packed_gl_enums.json":
"846be5dc8cb36076207699b025633fcc", "846be5dc8cb36076207699b025633fcc",
"scripts/generate_entry_points.py": "scripts/generate_entry_points.py":
"bc6672944802037582be20087f3b3b37", "6dc1c4d30732995fbb1152c059cc53e0",
"scripts/gl.xml": "scripts/gl.xml":
"f66967f3f3d696b5d8306fd80bbd49a8", "f66967f3f3d696b5d8306fd80bbd49a8",
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
...@@ -98,19 +98,19 @@ ...@@ -98,19 +98,19 @@
"src/libEGL/libEGL_autogen.def": "src/libEGL/libEGL_autogen.def":
"3f504d6280dc1d847bc2dedc51fa2640", "3f504d6280dc1d847bc2dedc51fa2640",
"src/libGL/entry_points_gl_1_autogen.cpp": "src/libGL/entry_points_gl_1_autogen.cpp":
"0f26c0b86e01b7ad7e5cdaab5720b997", "6298b625003f6c19961dd96953f1e3a2",
"src/libGL/entry_points_gl_1_autogen.h": "src/libGL/entry_points_gl_1_autogen.h":
"f5d504daaf2434ca7d0b8a6bb1afc61a", "f5d504daaf2434ca7d0b8a6bb1afc61a",
"src/libGL/entry_points_gl_2_autogen.cpp": "src/libGL/entry_points_gl_2_autogen.cpp":
"1201f427b96d61acc81d4927d22509a7", "755f3089084ce4c62e2d73b4abdb3fd8",
"src/libGL/entry_points_gl_2_autogen.h": "src/libGL/entry_points_gl_2_autogen.h":
"6d3e89c9fa3cb69203153c6cfab9e120", "6d3e89c9fa3cb69203153c6cfab9e120",
"src/libGL/entry_points_gl_3_autogen.cpp": "src/libGL/entry_points_gl_3_autogen.cpp":
"02869ec21e923b01af7b5202c67b0a91", "3b6f657c88fcf7d26d0f7cfc9041f81d",
"src/libGL/entry_points_gl_3_autogen.h": "src/libGL/entry_points_gl_3_autogen.h":
"2dbae6f95a4f72417e50844e45e6f313", "2dbae6f95a4f72417e50844e45e6f313",
"src/libGL/entry_points_gl_4_autogen.cpp": "src/libGL/entry_points_gl_4_autogen.cpp":
"c050f45c0435016e39dd0b729aba8d80", "84b94ec8c72f62f2f4e5d0d3bd62d15e",
"src/libGL/entry_points_gl_4_autogen.h": "src/libGL/entry_points_gl_4_autogen.h":
"859b5ca20dbbadd7dbb947df91bc09af", "859b5ca20dbbadd7dbb947df91bc09af",
"src/libGL/libGL_autogen.cpp": "src/libGL/libGL_autogen.cpp":
...@@ -132,27 +132,27 @@ ...@@ -132,27 +132,27 @@
"src/libGLESv2/entry_points_egl_ext_autogen.h": "src/libGLESv2/entry_points_egl_ext_autogen.h":
"5ae83ea21ee98991b68847f66793553f", "5ae83ea21ee98991b68847f66793553f",
"src/libGLESv2/entry_points_gles_1_0_autogen.cpp": "src/libGLESv2/entry_points_gles_1_0_autogen.cpp":
"3f839ee50c3040b6f41a368c9a385762", "722355a5383a7a4b60c871eb700813d9",
"src/libGLESv2/entry_points_gles_1_0_autogen.h": "src/libGLESv2/entry_points_gles_1_0_autogen.h":
"1d3aef77845a416497070985a8e9cb31", "1d3aef77845a416497070985a8e9cb31",
"src/libGLESv2/entry_points_gles_2_0_autogen.cpp": "src/libGLESv2/entry_points_gles_2_0_autogen.cpp":
"6765a75b56164b992de66218ce1263f1", "1367e754e621e8da53c60ba0722da08b",
"src/libGLESv2/entry_points_gles_2_0_autogen.h": "src/libGLESv2/entry_points_gles_2_0_autogen.h":
"e682cd8f55110969f68d6a59573e0312", "e682cd8f55110969f68d6a59573e0312",
"src/libGLESv2/entry_points_gles_3_0_autogen.cpp": "src/libGLESv2/entry_points_gles_3_0_autogen.cpp":
"6a3a3797a331bddd2929806da77a8e91", "4b4353529422f514f5ab091f427cf0ce",
"src/libGLESv2/entry_points_gles_3_0_autogen.h": "src/libGLESv2/entry_points_gles_3_0_autogen.h":
"3ae6c2e3e9791a9c7491c1181a46abab", "3ae6c2e3e9791a9c7491c1181a46abab",
"src/libGLESv2/entry_points_gles_3_1_autogen.cpp": "src/libGLESv2/entry_points_gles_3_1_autogen.cpp":
"fc3a696601c70c48d4928359276200f7", "3fb6e0a9eb1726b00226269d25291468",
"src/libGLESv2/entry_points_gles_3_1_autogen.h": "src/libGLESv2/entry_points_gles_3_1_autogen.h":
"0cadd684407fad3e288654da30527f78", "0cadd684407fad3e288654da30527f78",
"src/libGLESv2/entry_points_gles_3_2_autogen.cpp": "src/libGLESv2/entry_points_gles_3_2_autogen.cpp":
"45d9c66f503aacd7d6ed2b7ec97f2231", "2aa61fad0a2b89aad3bec0b674fa4cd3",
"src/libGLESv2/entry_points_gles_3_2_autogen.h": "src/libGLESv2/entry_points_gles_3_2_autogen.h":
"647f932a299cdb4726b60bbba059f0d2", "647f932a299cdb4726b60bbba059f0d2",
"src/libGLESv2/entry_points_gles_ext_autogen.cpp": "src/libGLESv2/entry_points_gles_ext_autogen.cpp":
"00b8aad01accfac8593f97b8246adf43", "330731d6ccb097ada03b5e36cd919b43",
"src/libGLESv2/entry_points_gles_ext_autogen.h": "src/libGLESv2/entry_points_gles_ext_autogen.h":
"3053361e33ec158829377b67b742b260", "3053361e33ec158829377b67b742b260",
"src/libGLESv2/libGLESv2_autogen.cpp": "src/libGLESv2/libGLESv2_autogen.cpp":
......
...@@ -171,7 +171,7 @@ void GL_APIENTRY GL_{name}{explicit_context_suffix}({explicit_context_param}{exp ...@@ -171,7 +171,7 @@ void GL_APIENTRY GL_{name}{explicit_context_suffix}({explicit_context_param}{exp
if ({valid_context_check}) if ({valid_context_check})
{{{assert_explicit_context}{packed_gl_enum_conversions} {{{assert_explicit_context}{packed_gl_enum_conversions}
std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context); std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
bool isCallValid = (context->skipValidation() || Validate{name}({validate_params})); bool isCallValid = (context->skipValidation() || Validate{name}({validate_params}));
if (isCallValid) if (isCallValid)
{{ {{
...@@ -195,7 +195,7 @@ TEMPLATE_GLES_ENTRY_POINT_WITH_RETURN = """\ ...@@ -195,7 +195,7 @@ TEMPLATE_GLES_ENTRY_POINT_WITH_RETURN = """\
{return_type} returnValue; {return_type} returnValue;
if ({valid_context_check}) if ({valid_context_check})
{{{assert_explicit_context}{packed_gl_enum_conversions} {{{assert_explicit_context}{packed_gl_enum_conversions}
std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context); std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
bool isCallValid = (context->skipValidation() || Validate{name}({validate_params})); bool isCallValid = (context->skipValidation() || Validate{name}({validate_params}));
if (isCallValid) if (isCallValid)
{{ {{
......
...@@ -8888,6 +8888,12 @@ bool Context::supportsGeometryOrTesselation() const ...@@ -8888,6 +8888,12 @@ bool Context::supportsGeometryOrTesselation() const
mState.getExtensions().tessellationShaderEXT; mState.getExtensions().tessellationShaderEXT;
} }
void Context::dirtyAllState()
{
mState.setAllDirtyBits();
mState.setAllDirtyObjects();
}
// ErrorSet implementation. // ErrorSet implementation.
ErrorSet::ErrorSet(Context *context) : mContext(context) {} ErrorSet::ErrorSet(Context *context) : mContext(context) {}
......
...@@ -617,6 +617,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -617,6 +617,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
egl::ShareGroup *getShareGroup() const { return mState.getShareGroup(); } egl::ShareGroup *getShareGroup() const { return mState.getShareGroup(); }
bool supportsGeometryOrTesselation() const; bool supportsGeometryOrTesselation() const;
void dirtyAllState();
private: private:
void initialize(); void initialize();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -25,6 +25,10 @@ ANGLE_REQUIRE_CONSTANT_INIT std::atomic<angle::GlobalMutex *> g_Mutex(nullptr); ...@@ -25,6 +25,10 @@ ANGLE_REQUIRE_CONSTANT_INIT std::atomic<angle::GlobalMutex *> g_Mutex(nullptr);
static_assert(std::is_trivially_destructible<decltype(g_Mutex)>::value, static_assert(std::is_trivially_destructible<decltype(g_Mutex)>::value,
"global mutex is not trivially destructible"); "global mutex is not trivially destructible");
ANGLE_REQUIRE_CONSTANT_INIT gl::Context *g_LastContext(nullptr);
static_assert(std::is_trivially_destructible<decltype(g_LastContext)>::value,
"global last context is not trivially destructible");
void SetContextToAndroidOpenGLTLSSlot(gl::Context *value) void SetContextToAndroidOpenGLTLSSlot(gl::Context *value)
{ {
#if defined(ANGLE_PLATFORM_ANDROID) #if defined(ANGLE_PLATFORM_ANDROID)
...@@ -73,6 +77,16 @@ angle::GlobalMutex &GetGlobalMutex() ...@@ -73,6 +77,16 @@ angle::GlobalMutex &GetGlobalMutex()
return *g_Mutex; return *g_Mutex;
} }
gl::Context *GetGlobalLastContext()
{
return g_LastContext;
}
void SetGlobalLastContext(gl::Context *context)
{
g_LastContext = context;
}
Thread *GetCurrentThread() Thread *GetCurrentThread()
{ {
Thread *current = gCurrentThread; Thread *current = gCurrentThread;
......
...@@ -92,6 +92,8 @@ class Thread; ...@@ -92,6 +92,8 @@ class Thread;
extern thread_local Thread *gCurrentThread; extern thread_local Thread *gCurrentThread;
angle::GlobalMutex &GetGlobalMutex(); angle::GlobalMutex &GetGlobalMutex();
gl::Context *GetGlobalLastContext();
void SetGlobalLastContext(gl::Context *context);
Thread *GetCurrentThread(); Thread *GetCurrentThread();
Debug *GetDebug(); Debug *GetDebug();
void SetContextCurrent(Thread *thread, gl::Context *context); void SetContextCurrent(Thread *thread, gl::Context *context);
...@@ -138,10 +140,22 @@ ANGLE_INLINE Context *GetValidGlobalContext() ...@@ -138,10 +140,22 @@ ANGLE_INLINE Context *GetValidGlobalContext()
void GenerateContextLostErrorOnContext(Context *context); void GenerateContextLostErrorOnContext(Context *context);
void GenerateContextLostErrorOnCurrentGlobalContext(); void GenerateContextLostErrorOnCurrentGlobalContext();
ANGLE_INLINE std::unique_lock<angle::GlobalMutex> GetShareGroupLock(const Context *context) ANGLE_INLINE std::unique_lock<angle::GlobalMutex> GetContextLock(Context *context)
{ {
#if defined(ANGLE_FORCE_CONTEXT_CHECK_EVERY_CALL)
auto lock = std::unique_lock<angle::GlobalMutex>(egl::GetGlobalMutex());
// TODO(b/177574181): This should be handled in a backend-specific way.
// if previous context different from current context, dirty all state
if (context != egl::GetGlobalLastContext())
{
context->dirtyAllState();
SetGlobalLastContext(context);
}
return lock;
#else
return context->isShared() ? std::unique_lock<angle::GlobalMutex>(egl::GetGlobalMutex()) return context->isShared() ? std::unique_lock<angle::GlobalMutex>(egl::GetGlobalMutex())
: std::unique_lock<angle::GlobalMutex>(); : std::unique_lock<angle::GlobalMutex>();
#endif
} }
} // namespace gl } // namespace gl
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// Globally disable Metal testing for now // Globally disable Metal testing for now
4235 METAL : dEQP-EGL.* = SKIP 4235 METAL : dEQP-EGL.* = SKIP
// Only Vulkan supports multithreading // Only Vulkan and D3D11 support multithreading
3916 OPENGL : dEQP-EGL.functional.sharing.gles2.multithread.* = SKIP 3916 OPENGL : dEQP-EGL.functional.sharing.gles2.multithread.* = SKIP
3916 OPENGL : dEQP-EGL.functional.multithread.* = SKIP 3916 OPENGL : dEQP-EGL.functional.multithread.* = SKIP
3916 OPENGL : dEQP-EGL.functional.render.multi_thread.* = SKIP 3916 OPENGL : dEQP-EGL.functional.render.multi_thread.* = SKIP
...@@ -16,10 +16,6 @@ ...@@ -16,10 +16,6 @@
3916 GLES : dEQP-EGL.functional.multithread.* = SKIP 3916 GLES : dEQP-EGL.functional.multithread.* = SKIP
3916 GLES : dEQP-EGL.functional.render.multi_thread.* = SKIP 3916 GLES : dEQP-EGL.functional.render.multi_thread.* = SKIP
3916 GLES : dEQP-EGL.functional.color_clears.multi_thread.* = SKIP 3916 GLES : dEQP-EGL.functional.color_clears.multi_thread.* = SKIP
3916 D3D11 : dEQP-EGL.functional.sharing.gles2.multithread.* = SKIP
3916 D3D11 : dEQP-EGL.functional.multithread.* = SKIP
3916 D3D11 : dEQP-EGL.functional.render.multi_thread.* = SKIP
3916 D3D11 : dEQP-EGL.functional.color_clears.multi_thread.* = SKIP
3916 D3D9 : dEQP-EGL.functional.sharing.gles2.multithread.* = SKIP 3916 D3D9 : dEQP-EGL.functional.sharing.gles2.multithread.* = SKIP
3916 D3D9 : dEQP-EGL.functional.multithread.* = SKIP 3916 D3D9 : dEQP-EGL.functional.multithread.* = SKIP
3916 D3D9 : dEQP-EGL.functional.render.multi_thread.* = SKIP 3916 D3D9 : dEQP-EGL.functional.render.multi_thread.* = SKIP
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment