aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-autoroll <android-autoroll@skia-public.iam.gserviceaccount.com>2022-02-09 04:31:39 +0000
committerandroid-autoroll <android-autoroll@skia-public.iam.gserviceaccount.com>2022-02-09 04:31:39 +0000
commit030756f9e30473e050b159da3ef639d37a488eb4 (patch)
tree03de8685e076ae90b00882ab698ac99159d51307
parent6c49cd94278e08aca36a33059831ee2b17b39775 (diff)
parent71d06198c62b4aecd40197d55f5dd17ab60e7695 (diff)
downloadangle-android-t-preview-1.tar.gz
Roll ANGLE from a39618436fcb to 71d06198c62b (2 revisions)android-t-preview-2android-t-preview-1android-t-beta-3android-t-preview-1
https://chromium.googlesource.com/angle/angle.git/+log/a39618436fcb..71d06198c62b Please enable autosubmit on changes if possible when approving them. If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/angle-android-autoroll Please CC ianelliott@google.com on the revert to ensure that a human is aware of the problem. To file a bug in ANGLE: https://bugs.chromium.org/p/angleproject/issues/entry To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Test: Presubmit checks will test this change. Exempt-From-Owner-Approval: The autoroll bot does not require owner approval. Change-Id: I97ee97ef67b02d45c84b9eef926f6e7d8b0acbd9
-rw-r--r--include/platform/Feature.h1
-rw-r--r--include/platform/FeaturesVk.h5
-rw-r--r--src/libANGLE/renderer/vulkan/ContextVk.h6
-rw-r--r--src/libANGLE/renderer/vulkan/FramebufferVk.cpp4
-rw-r--r--src/libANGLE/renderer/vulkan/RendererVk.cpp15
-rw-r--r--src/libANGLE/renderer/vulkan/RendererVk.h1
-rw-r--r--src/libANGLE/renderer/vulkan/TextureVk.cpp6
-rw-r--r--src/tests/egl_tests/EGLContextSharingTest.cpp143
-rw-r--r--src/tests/test_utils/angle_test_configs.cpp5
-rw-r--r--src/tests/test_utils/angle_test_configs.h8
-rw-r--r--util/EGLPlatformParameters.h23
-rw-r--r--util/EGLWindow.cpp5
12 files changed, 206 insertions, 16 deletions
diff --git a/include/platform/Feature.h b/include/platform/Feature.h
index 07758546bc..0c82fe50b7 100644
--- a/include/platform/Feature.h
+++ b/include/platform/Feature.h
@@ -25,6 +25,7 @@ namespace angle
enum class FeatureCategory
{
+ AppWorkarounds,
FrontendWorkarounds,
FrontendFeatures,
OpenGLWorkarounds,
diff --git a/include/platform/FeaturesVk.h b/include/platform/FeaturesVk.h
index 3244da8988..63dbfaadf5 100644
--- a/include/platform/FeaturesVk.h
+++ b/include/platform/FeaturesVk.h
@@ -631,6 +631,11 @@ struct FeaturesVk : FeatureSetBase
"On some platforms present region rectangles are expected to have a bottom-left origin, "
"instead of top-left origin as from spec",
&members};
+
+ // Whether we force submit updates to immutable textures.
+ Feature forceSubmitImmutableTextureUpdates = {
+ "forceSubmitImmutableTextureUpdates", FeatureCategory::AppWorkarounds,
+ "Force submit updates to immutable textures", &members, "http://anglebug.com/6929"};
};
inline FeaturesVk::FeaturesVk() = default;
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.h b/src/libANGLE/renderer/vulkan/ContextVk.h
index 06f29e9c8f..f0a1c0b759 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.h
+++ b/src/libANGLE/renderer/vulkan/ContextVk.h
@@ -553,6 +553,12 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText
return angle::Result::Continue;
}
+ angle::Result submitStagedTextureUpdates()
+ {
+ // Staged updates are recorded in outside RP cammand buffer, submit them.
+ return flushOutsideRenderPassCommands();
+ }
+
angle::Result beginNewRenderPass(const vk::Framebuffer &framebuffer,
const gl::Rectangle &renderArea,
const vk::RenderPassDesc &renderPassDesc,
diff --git a/src/libANGLE/renderer/vulkan/FramebufferVk.cpp b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
index 62cffc24fb..d0b1202b52 100644
--- a/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
+++ b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp
@@ -2385,10 +2385,12 @@ angle::Result FramebufferVk::clearWithCommand(ContextVk *contextVk,
updateRenderPassReadOnlyDepthMode(contextVk, renderpassCommands);
}
+ const uint32_t layerCount = mState.isMultiview() ? 1 : mCurrentFramebufferDesc.getLayerCount();
+
VkClearRect rect = {};
rect.rect.extent.width = scissoredRenderArea.width;
rect.rect.extent.height = scissoredRenderArea.height;
- rect.layerCount = mCurrentFramebufferDesc.getLayerCount();
+ rect.layerCount = layerCount;
vk::RenderPassCommandBuffer *renderPassCommandBuffer = &renderpassCommands->getCommandBuffer();
renderPassCommandBuffer->clearAttachments(static_cast<uint32_t>(attachments.size()),
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index 098adba412..c8410ebae4 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -161,17 +161,15 @@ constexpr const char *kSkippedMessages[] = {
// http://anglebug.com/5331
"VUID-VkSubpassDescriptionDepthStencilResolve-depthResolveMode-parameter",
"VUID-VkSubpassDescriptionDepthStencilResolve-stencilResolveMode-parameter",
- // https://issuetracker.google.com/175584609
+ // http://issuetracker.google.com/175584609
"VUID-vkCmdDraw-None-04584",
"VUID-vkCmdDrawIndexed-None-04584",
"VUID-vkCmdDrawIndirect-None-04584",
"VUID-vkCmdDrawIndirectCount-None-04584",
"VUID-vkCmdDrawIndexedIndirect-None-04584",
"VUID-vkCmdDrawIndexedIndirectCount-None-04584",
- // https://anglebug.com/5912
+ // http://anglebug.com/5912
"VUID-VkImageViewCreateInfo-pNext-01585",
- // https://anglebug.com/6262
- "VUID-vkCmdClearAttachments-baseArrayLayer-00018",
// http://anglebug.com/6442
"UNASSIGNED-CoreValidation-Shader-InterfaceTypeMismatch",
// http://anglebug.com/6514
@@ -1992,6 +1990,9 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
// Initialize features and workarounds.
initFeatures(displayVk, deviceExtensionNames);
+ // App based feature overrides.
+ appBasedFeatureOverrides(displayVk, deviceExtensionNames);
+
// Enable VK_KHR_shared_presentable_image
if (ExtensionFound(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME, deviceExtensionNames))
{
@@ -3159,6 +3160,12 @@ void RendererVk::initFeatures(DisplayVk *displayVk,
}
}
+void RendererVk::appBasedFeatureOverrides(DisplayVk *display,
+ const vk::ExtensionNameList &extensions)
+{
+ // NOOP for now.
+}
+
angle::Result RendererVk::initPipelineCache(DisplayVk *display,
vk::PipelineCache *pipelineCache,
bool *success)
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.h b/src/libANGLE/renderer/vulkan/RendererVk.h
index 23e92891ab..e9d2ae9a5c 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.h
+++ b/src/libANGLE/renderer/vulkan/RendererVk.h
@@ -524,6 +524,7 @@ class RendererVk : angle::NonCopyable
void queryDeviceExtensionFeatures(const vk::ExtensionNameList &deviceExtensionNames);
void initFeatures(DisplayVk *display, const vk::ExtensionNameList &extensions);
+ void appBasedFeatureOverrides(DisplayVk *display, const vk::ExtensionNameList &extensions);
angle::Result initPipelineCache(DisplayVk *display,
vk::PipelineCache *pipelineCache,
bool *success);
diff --git a/src/libANGLE/renderer/vulkan/TextureVk.cpp b/src/libANGLE/renderer/vulkan/TextureVk.cpp
index 79353a3504..0eac5372cf 100644
--- a/src/libANGLE/renderer/vulkan/TextureVk.cpp
+++ b/src/libANGLE/renderer/vulkan/TextureVk.cpp
@@ -559,6 +559,12 @@ angle::Result TextureVk::setSubImageImpl(const gl::Context *context,
if (shouldFlush)
{
ANGLE_TRY(ensureImageInitialized(contextVk, ImageMipLevels::EnabledLevels));
+
+ // If forceSubmitImmutableTextureUpdates is enabled, submit the staged updates as well
+ if (contextVk->getFeatures().forceSubmitImmutableTextureUpdates.enabled)
+ {
+ ANGLE_TRY(contextVk->submitStagedTextureUpdates());
+ }
}
return angle::Result::Continue;
diff --git a/src/tests/egl_tests/EGLContextSharingTest.cpp b/src/tests/egl_tests/EGLContextSharingTest.cpp
index f8b3b332db..9f9c17140a 100644
--- a/src/tests/egl_tests/EGLContextSharingTest.cpp
+++ b/src/tests/egl_tests/EGLContextSharingTest.cpp
@@ -1082,6 +1082,144 @@ TEST_P(EGLContextSharingTestNoFixture, SwapBuffersShared)
eglDestroySurface(mDisplay, pbufferSurface);
ASSERT_EGL_SUCCESS();
}
+
+class EGLContextSharingTestNoSyncTextureUploads : public EGLContextSharingTest
+{};
+
+// Test that an application that does not synchronize when using textures across shared contexts can
+// still see texture updates. This behavior is not required by the GLES specification, but is
+// exhibited by some applications. That application will malfunction if our implementation does not
+// handle this in the way it expects. Only the vulkan backend has the workaround needed for this
+// usecase.
+TEST_P(EGLContextSharingTestNoSyncTextureUploads, NoSync)
+{
+ EGLDisplay display = getEGLWindow()->getDisplay();
+ EGLConfig config = getEGLWindow()->getConfig();
+ EGLSurface surface = getEGLWindow()->getSurface();
+
+ const EGLint inShareGroupContextAttribs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};
+
+ mContexts[0] = eglCreateContext(display, config, nullptr, inShareGroupContextAttribs);
+ mContexts[1] = eglCreateContext(display, config, mContexts[0], inShareGroupContextAttribs);
+ ASSERT_EGL_SUCCESS();
+
+ ASSERT_NE(EGL_NO_CONTEXT, mContexts[0]);
+ ASSERT_NE(EGL_NO_CONTEXT, mContexts[1]);
+
+ GLTexture textureFromCtx0;
+ constexpr size_t kTextureCount = 10;
+ GLTexture textures[kTextureCount];
+
+ // Synchronization tools to ensure the two threads are interleaved as designed by this test.
+ std::mutex mutex;
+ std::condition_variable condVar;
+ enum class Step
+ {
+ Start,
+ Ctx0Current,
+ Ctx1Current,
+ TexturesDone,
+ Finish,
+ Abort,
+ };
+ Step currentStep = Step::Start;
+
+ std::thread creatingThread = std::thread([&]() {
+ ThreadSynchronization<Step> threadSynchronization(&currentStep, &mutex, &condVar);
+
+ ASSERT_TRUE(threadSynchronization.waitForStep(Step::Start));
+ ASSERT_EGL_TRUE(eglMakeCurrent(display, surface, surface, mContexts[0]));
+ ASSERT_EGL_SUCCESS();
+ threadSynchronization.nextStep(Step::Ctx0Current);
+
+ ASSERT_TRUE(threadSynchronization.waitForStep(Step::Ctx1Current));
+
+ // Create the shared textures that will be accessed by the other context
+ glBindTexture(GL_TEXTURE_2D, textureFromCtx0);
+ glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 1, 1);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ ASSERT_GL_TRUE(glIsTexture(textureFromCtx0));
+
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &GLColor::red);
+ glFinish();
+
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &GLColor::blue);
+ // Do not glFinish
+
+ // We set 6 to be the threshold to flush texture updates.
+ // We create redundant textures here to ensure that we trigger that threshold.
+ for (size_t i = 0; i < kTextureCount; i++)
+ {
+ glBindTexture(GL_TEXTURE_2D, textures[i]);
+ glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 1, 1);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ ASSERT_GL_TRUE(glIsTexture(textures[i]));
+
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
+ &GLColor::blue);
+ }
+
+ ASSERT_GL_NO_ERROR();
+
+ threadSynchronization.nextStep(Step::TexturesDone);
+ ASSERT_TRUE(threadSynchronization.waitForStep(Step::Finish));
+ });
+
+ std::thread samplingThread = std::thread([&]() {
+ ThreadSynchronization<Step> threadSynchronization(&currentStep, &mutex, &condVar);
+
+ ASSERT_TRUE(threadSynchronization.waitForStep(Step::Ctx0Current));
+ ASSERT_EGL_TRUE(eglMakeCurrent(display, surface, surface, mContexts[1]));
+ ASSERT_EGL_SUCCESS();
+ threadSynchronization.nextStep(Step::Ctx1Current);
+
+ ASSERT_TRUE(threadSynchronization.waitForStep(Step::TexturesDone));
+
+ ASSERT_GL_TRUE(glIsTexture(textureFromCtx0));
+ ASSERT_GL_NO_ERROR();
+
+ // Draw using ctx0 texture as sampler
+ GLTexture ctx1tex;
+ glBindTexture(GL_TEXTURE_2D, ctx1tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ GLColor::black.data());
+ ASSERT_GL_NO_ERROR();
+
+ GLFramebuffer fbo;
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ctx1tex, 0);
+ ASSERT_GL_NO_ERROR();
+
+ GLuint sampler;
+ glGenSamplers(1, &sampler);
+
+ ASSERT_GL_NO_ERROR();
+
+ ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Texture2D(), essl1_shaders::fs::Texture2D());
+ glUseProgram(program);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, textureFromCtx0);
+ glBindSampler(0, sampler);
+ glUniform1i(glGetUniformLocation(program, essl1_shaders::PositionAttrib()), 0);
+ ASSERT_GL_NO_ERROR();
+
+ drawQuad(program, essl1_shaders::PositionAttrib(), 0.5);
+ ASSERT_GL_NO_ERROR();
+
+ EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::blue);
+
+ threadSynchronization.nextStep(Step::Finish);
+ });
+
+ creatingThread.join();
+ samplingThread.join();
+
+ ASSERT_NE(currentStep, Step::Abort);
+ ASSERT_EGL_SUCCESS();
+}
+
} // anonymous namespace
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EGLContextSharingTest);
@@ -1102,3 +1240,8 @@ ANGLE_INSTANTIATE_TEST(EGLContextSharingTestNoFixture,
WithNoFixture(ES3_OPENGL()),
WithNoFixture(ES2_VULKAN()),
WithNoFixture(ES3_VULKAN()));
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EGLContextSharingTestNoSyncTextureUploads);
+ANGLE_INSTANTIATE_TEST(EGLContextSharingTestNoSyncTextureUploads,
+ WithForceSubmitImmutableTextureUpdates(ES2_VULKAN()),
+ WithForceSubmitImmutableTextureUpdates(ES3_VULKAN()));
diff --git a/src/tests/test_utils/angle_test_configs.cpp b/src/tests/test_utils/angle_test_configs.cpp
index 01a6956c1b..1144ff1386 100644
--- a/src/tests/test_utils/angle_test_configs.cpp
+++ b/src/tests/test_utils/angle_test_configs.cpp
@@ -326,6 +326,11 @@ std::ostream &operator<<(std::ostream &stream, const PlatformParameters &pp)
stream << "_HighPowerGPU";
}
+ if (pp.eglParameters.forceSubmitImmutableTextureUpdates == EGL_TRUE)
+ {
+ stream << "_VulkanForceSubmitImmutableTextureUpdates";
+ }
+
return stream;
}
diff --git a/src/tests/test_utils/angle_test_configs.h b/src/tests/test_utils/angle_test_configs.h
index be3e2d476a..7eed65dcaa 100644
--- a/src/tests/test_utils/angle_test_configs.h
+++ b/src/tests/test_utils/angle_test_configs.h
@@ -341,6 +341,14 @@ inline PlatformParameters WithVulkanPreferCPUForBufferSubData(const PlatformPara
paramsOut.eglParameters.WithVulkanPreferCPUForBufferSubData = EGL_TRUE;
return paramsOut;
}
+
+inline PlatformParameters WithForceSubmitImmutableTextureUpdates(const PlatformParameters &params)
+{
+ PlatformParameters withForceSubmitImmutableTextureUpdates = params;
+ withForceSubmitImmutableTextureUpdates.eglParameters.forceSubmitImmutableTextureUpdates =
+ EGL_TRUE;
+ return withForceSubmitImmutableTextureUpdates;
+}
} // namespace angle
#endif // ANGLE_TEST_CONFIGS_H_
diff --git a/util/EGLPlatformParameters.h b/util/EGLPlatformParameters.h
index 1d28f7a73e..7c122c0559 100644
--- a/util/EGLPlatformParameters.h
+++ b/util/EGLPlatformParameters.h
@@ -58,17 +58,17 @@ struct EGLPlatformParameters
auto tie() const
{
- return std::tie(renderer, majorVersion, minorVersion, deviceType, presentPath,
- debugLayersEnabled, transformFeedbackFeature, allocateNonZeroMemoryFeature,
- emulateCopyTexImage2DFromRenderbuffers, shaderStencilOutputFeature,
- genMultipleMipsPerPassFeature, platformMethods, robustness,
- emulatedPrerotation, asyncCommandQueueFeatureVulkan,
- hasExplicitMemBarrierFeatureMtl, hasCheapRenderPassFeatureMtl,
- forceBufferGPUStorageFeatureMtl, supportsVulkanViewportFlip,
- supportsVulkanMultiDrawIndirect, WithVulkanPreferCPUForBufferSubData,
- emulatedVAOs, generateSPIRVThroughGlslang, captureLimits,
- forceRobustResourceInit, directMetalGeneration, forceInitShaderVariables,
- forceVulkanFallbackFormat, displayPowerPreference);
+ return std::tie(
+ renderer, majorVersion, minorVersion, deviceType, presentPath, debugLayersEnabled,
+ transformFeedbackFeature, allocateNonZeroMemoryFeature,
+ emulateCopyTexImage2DFromRenderbuffers, shaderStencilOutputFeature,
+ genMultipleMipsPerPassFeature, platformMethods, robustness, emulatedPrerotation,
+ asyncCommandQueueFeatureVulkan, hasExplicitMemBarrierFeatureMtl,
+ hasCheapRenderPassFeatureMtl, forceBufferGPUStorageFeatureMtl,
+ supportsVulkanViewportFlip, supportsVulkanMultiDrawIndirect,
+ WithVulkanPreferCPUForBufferSubData, emulatedVAOs, generateSPIRVThroughGlslang,
+ captureLimits, forceRobustResourceInit, directMetalGeneration, forceInitShaderVariables,
+ forceVulkanFallbackFormat, displayPowerPreference, forceSubmitImmutableTextureUpdates);
}
EGLint renderer = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
@@ -99,6 +99,7 @@ struct EGLPlatformParameters
EGLint forceInitShaderVariables = EGL_DONT_CARE;
EGLint forceVulkanFallbackFormat = EGL_DONT_CARE;
EGLint displayPowerPreference = EGL_DONT_CARE;
+ EGLint forceSubmitImmutableTextureUpdates = EGL_DONT_CARE;
angle::PlatformMethods *platformMethods = nullptr;
};
diff --git a/util/EGLWindow.cpp b/util/EGLWindow.cpp
index 13a72bd2c7..d9e89636e0 100644
--- a/util/EGLWindow.cpp
+++ b/util/EGLWindow.cpp
@@ -333,6 +333,11 @@ bool EGLWindow::initializeDisplay(OSWindow *osWindow,
enabledFeatureOverrides.push_back("forceFallbackFormat");
}
+ if (params.forceSubmitImmutableTextureUpdates == EGL_TRUE)
+ {
+ enabledFeatureOverrides.push_back("forceSubmitImmutableTextureUpdates");
+ }
+
const bool hasFeatureControlANGLE =
strstr(extensionString, "EGL_ANGLE_feature_control") != nullptr;