Commit beb669da by Frank Henigman Committed by Commit Bot

Vulkan: work around vkCmdCopyBuffer bug.

It seems that vkCmdCopyBuffer on Windows with Intel GPU neglects the last region when given more than one. Work around that in LineLoopHelper::getIndexBufferForElementArrayBuffer() by adding an unused region. Enable corresponding test. BUG=angleproject:2838 Change-Id: I8847c7b2cfdb94526d4d28ba5bf1f162da3a1ed4 Reviewed-on: https://chromium-review.googlesource.com/1238887Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
parent 74c179bb
...@@ -33,7 +33,11 @@ struct FeaturesVk ...@@ -33,7 +33,11 @@ struct FeaturesVk
// -Point sprites tests // -Point sprites tests
// -texStorage // -texStorage
bool flipViewportY = false; bool flipViewportY = false;
// Add an extra copy region when using vkCmdCopyBuffer as the Windows Intel driver seems
// to have a bug where the last region is ignored.
bool extraCopyBufferRegion = false;
}; };
} // namespace rx } // namespace rx
#endif // LIBANGLE_RENDERER_VULKAN_FEATURESVK_H_ #endif // LIBANGLE_RENDERER_VULKAN_FEATURESVK_H_
\ No newline at end of file
...@@ -689,6 +689,11 @@ void RendererVk::initFeatures() ...@@ -689,6 +689,11 @@ void RendererVk::initFeatures()
// TODO(lucferron): Currently disabled on Intel only since many tests are failing and need // TODO(lucferron): Currently disabled on Intel only since many tests are failing and need
// investigation. http://anglebug.com/2728 // investigation. http://anglebug.com/2728
mFeatures.flipViewportY = !IsIntel(mPhysicalDeviceProperties.vendorID); mFeatures.flipViewportY = !IsIntel(mPhysicalDeviceProperties.vendorID);
#ifdef ANGLE_PLATFORM_WINDOWS
// http://anglebug.com/2838
mFeatures.extraCopyBufferRegion = IsIntel(mPhysicalDeviceProperties.vendorID);
#endif
} }
void RendererVk::ensureCapsInitialized() const void RendererVk::ensureCapsInitialized() const
......
...@@ -429,7 +429,7 @@ angle::Result LineLoopHelper::getIndexBufferForElementArrayBuffer(ContextVk *con ...@@ -429,7 +429,7 @@ angle::Result LineLoopHelper::getIndexBufferForElementArrayBuffer(ContextVk *con
uint32_t *indices = nullptr; uint32_t *indices = nullptr;
auto unitSize = (indexType == VK_INDEX_TYPE_UINT16 ? sizeof(uint16_t) : sizeof(uint32_t)); auto unitSize = (indexType == VK_INDEX_TYPE_UINT16 ? sizeof(uint16_t) : sizeof(uint32_t));
size_t allocateBytes = unitSize * (indexCount + 1); size_t allocateBytes = unitSize * (indexCount + 1) + 1;
mDynamicIndexBuffer.releaseRetainedBuffers(context->getRenderer()); mDynamicIndexBuffer.releaseRetainedBuffers(context->getRenderer());
ANGLE_TRY(mDynamicIndexBuffer.allocate(context, allocateBytes, ANGLE_TRY(mDynamicIndexBuffer.allocate(context, allocateBytes,
...@@ -438,16 +438,19 @@ angle::Result LineLoopHelper::getIndexBufferForElementArrayBuffer(ContextVk *con ...@@ -438,16 +438,19 @@ angle::Result LineLoopHelper::getIndexBufferForElementArrayBuffer(ContextVk *con
VkDeviceSize sourceOffset = static_cast<VkDeviceSize>(elementArrayOffset); VkDeviceSize sourceOffset = static_cast<VkDeviceSize>(elementArrayOffset);
uint64_t unitCount = static_cast<VkDeviceSize>(indexCount); uint64_t unitCount = static_cast<VkDeviceSize>(indexCount);
VkBufferCopy copy1 = {sourceOffset, *bufferOffsetOut, unitCount * unitSize}; angle::FixedVector<VkBufferCopy, 3> copies = {
VkBufferCopy copy2 = {sourceOffset, *bufferOffsetOut + unitCount * unitSize, unitSize}; {sourceOffset, *bufferOffsetOut, unitCount * unitSize},
std::array<VkBufferCopy, 2> copies = {{copy1, copy2}}; {sourceOffset, *bufferOffsetOut + unitCount * unitSize, unitSize},
};
if (context->getRenderer()->getFeatures().extraCopyBufferRegion)
copies.push_back({sourceOffset, *bufferOffsetOut + (unitCount + 1) * unitSize, 1});
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(recordCommands(context, &commandBuffer)); ANGLE_TRY(recordCommands(context, &commandBuffer));
elementArrayBufferVk->addReadDependency(this); elementArrayBufferVk->addReadDependency(this);
commandBuffer->copyBuffer(elementArrayBufferVk->getVkBuffer().getHandle(), *bufferHandleOut, 2, commandBuffer->copyBuffer(elementArrayBufferVk->getVkBuffer().getHandle(), *bufferHandleOut,
copies.data()); copies.size(), copies.data());
ANGLE_TRY(mDynamicIndexBuffer.flush(context)); ANGLE_TRY(mDynamicIndexBuffer.flush(context));
return angle::Result::Continue(); return angle::Result::Continue();
......
...@@ -149,10 +149,6 @@ TEST_P(LineLoopTest, LineLoopUByteIndexBuffer) ...@@ -149,10 +149,6 @@ TEST_P(LineLoopTest, LineLoopUByteIndexBuffer)
TEST_P(LineLoopTest, LineLoopUShortIndexBuffer) TEST_P(LineLoopTest, LineLoopUShortIndexBuffer)
{ {
// TODO(fjhenigman): Probabe driver bug. Work around it and/or notify vendor.
// http://anglebug.com/2838
ANGLE_SKIP_TEST_IF(IsVulkan() && IsWindows() && IsIntel());
// Disable D3D11 SDK Layers warnings checks, see ANGLE issue 667 for details // Disable D3D11 SDK Layers warnings checks, see ANGLE issue 667 for details
ignoreD3D11SDKLayersWarnings(); ignoreD3D11SDKLayersWarnings();
......
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