зеркало из https://github.com/AvaloniaUI/angle.git
Vulkan: Implement robustness extensions.
Device recovery is not possible but device loss can be tracked. BUG=angleproject:2787 Change-Id: Ib94dd557b6b005a560b7a64275b176f7b1777211 Reviewed-on: https://chromium-review.googlesource.com/1194458 Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Родитель
16c20140e0
Коммит
2fe5e1d3e6
|
@ -563,7 +563,14 @@ gl::Error ContextVk::drawElementsIndirect(const gl::Context *context,
|
|||
|
||||
GLenum ContextVk::getResetStatus()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
if (mRenderer->isDeviceLost())
|
||||
{
|
||||
// TODO(geofflang): It may be possible to track which context caused the device lost and
|
||||
// return either GL_GUILTY_CONTEXT_RESET or GL_INNOCENT_CONTEXT_RESET.
|
||||
// http://anglebug.com/2787
|
||||
return GL_UNKNOWN_CONTEXT_RESET;
|
||||
}
|
||||
|
||||
return GL_NO_ERROR;
|
||||
}
|
||||
|
||||
|
@ -1175,6 +1182,11 @@ void ContextVk::handleError(VkResult errorCode, const char *file, unsigned int l
|
|||
errorStream << "Internal Vulkan error: " << VulkanResultString(errorCode) << ", in " << file
|
||||
<< ", line " << line << ".";
|
||||
|
||||
if (errorCode == VK_ERROR_DEVICE_LOST)
|
||||
{
|
||||
mRenderer->markDeviceLost();
|
||||
}
|
||||
|
||||
mErrors->handleError(gl::Error(glErrorCode, glErrorCode, errorStream.str()));
|
||||
}
|
||||
|
||||
|
|
|
@ -52,14 +52,14 @@ egl::Error DisplayVk::makeCurrent(egl::Surface * /*drawSurface*/,
|
|||
|
||||
bool DisplayVk::testDeviceLost()
|
||||
{
|
||||
// TODO(jmadill): Figure out how to do device lost in Vulkan.
|
||||
return false;
|
||||
return mRenderer->isDeviceLost();
|
||||
}
|
||||
|
||||
egl::Error DisplayVk::restoreLostDevice(const egl::Display *display)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::EglBadAccess();
|
||||
// A vulkan device cannot be restored, the entire renderer would have to be re-created along
|
||||
// with any other EGL objects that reference it.
|
||||
return egl::EglBadDisplay();
|
||||
}
|
||||
|
||||
std::string DisplayVk::getVendorString() const
|
||||
|
@ -165,6 +165,7 @@ gl::Version DisplayVk::getMaxSupportedESVersion() const
|
|||
|
||||
void DisplayVk::generateExtensions(egl::DisplayExtensions *outExtensions) const
|
||||
{
|
||||
outExtensions->createContextRobustness = true;
|
||||
outExtensions->surfaceOrientation = true;
|
||||
outExtensions->displayTextureShareGroup = true;
|
||||
|
||||
|
@ -193,6 +194,11 @@ void DisplayVk::handleError(VkResult result, const char *file, unsigned int line
|
|||
errorStream << "Internal Vulkan error: " << VulkanResultString(result) << ", in " << file
|
||||
<< ", line " << line << ".";
|
||||
mStoredErrorString = errorStream.str();
|
||||
|
||||
if (result == VK_ERROR_DEVICE_LOST)
|
||||
{
|
||||
mRenderer->markDeviceLost();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(jmadill): Remove this. http://anglebug.com/2491
|
||||
|
|
|
@ -299,6 +299,7 @@ RendererVk::RendererVk()
|
|||
mDevice(VK_NULL_HANDLE),
|
||||
mLastCompletedQueueSerial(mQueueSerialFactory.generate()),
|
||||
mCurrentQueueSerial(mQueueSerialFactory.generate()),
|
||||
mDeviceLost(false),
|
||||
mPipelineCacheVkUpdateTimeout(kPipelineCacheVkUpdatePeriod)
|
||||
{
|
||||
}
|
||||
|
@ -355,6 +356,16 @@ void RendererVk::onDestroy(vk::Context *context)
|
|||
mPhysicalDevice = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
void RendererVk::markDeviceLost()
|
||||
{
|
||||
mDeviceLost = true;
|
||||
}
|
||||
|
||||
bool RendererVk::isDeviceLost() const
|
||||
{
|
||||
return mDeviceLost;
|
||||
}
|
||||
|
||||
angle::Result RendererVk::initialize(DisplayVk *displayVk,
|
||||
const egl::AttributeMap &attribs,
|
||||
const char *wsiName)
|
||||
|
|
|
@ -48,6 +48,9 @@ class RendererVk : angle::NonCopyable
|
|||
const char *wsiName);
|
||||
void onDestroy(vk::Context *context);
|
||||
|
||||
void markDeviceLost();
|
||||
bool isDeviceLost() const;
|
||||
|
||||
std::string getVendorString() const;
|
||||
std::string getRendererDescription() const;
|
||||
|
||||
|
@ -183,6 +186,8 @@ class RendererVk : angle::NonCopyable
|
|||
Serial mLastCompletedQueueSerial;
|
||||
Serial mCurrentQueueSerial;
|
||||
|
||||
bool mDeviceLost;
|
||||
|
||||
struct CommandBatch final : angle::NonCopyable
|
||||
{
|
||||
CommandBatch();
|
||||
|
|
|
@ -46,6 +46,7 @@ void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties,
|
|||
outExtensions->framebufferBlit = true;
|
||||
outExtensions->copyTexture = true;
|
||||
outExtensions->debugMarker = true;
|
||||
outExtensions->robustness = true;
|
||||
|
||||
// TODO(lucferron): Eventually remove everything above this line in this function as the caps
|
||||
// get implemented.
|
||||
|
|
|
@ -228,7 +228,7 @@ TEST_P(EGLRobustnessTest, DISABLED_ResettingDisplayWorks)
|
|||
// if there was a TDR caused by D3D so we don't run D3D tests at the same time as the OpenGL tests.
|
||||
#define D3D_HAS_PRIORITY 1
|
||||
#if D3D_HAS_PRIORITY && (defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11))
|
||||
ANGLE_INSTANTIATE_TEST(EGLRobustnessTest, ES2_D3D9(), ES2_D3D11());
|
||||
ANGLE_INSTANTIATE_TEST(EGLRobustnessTest, ES2_VULKAN(), ES2_D3D9(), ES2_D3D11());
|
||||
#else
|
||||
ANGLE_INSTANTIATE_TEST(EGLRobustnessTest, ES2_OPENGL());
|
||||
ANGLE_INSTANTIATE_TEST(EGLRobustnessTest, ES2_VULKAN(), ES2_OPENGL());
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче