Commit 67d8b63a by Tobin Ehlis Committed by Commit Bot

Vulkan:Update Vulkan Vertex Attribute Offsets

This fixes most of the test for dEQP 3.1 KHR-GLES31.core.vertex_attrib_binding.basic-input* The bug fixes is that we were not correctly setting the vertex attribute offset for vertex attribs that were converted into their own buffer. We kept the attrib offset from the frontend as if the converted attribs were in the original buffer, but converted vtx attrib buffers in the VK backend are tightly packed from the start of the buffer so when converting the actual offset should be 0. Also, in order to avoid a VK validation error, this change includes a tmp workaround to make sure transform feedback output buffer range is never 0, but sets VK_WHOLE_SIZE in that case. A follow-on fix that focuses on transform feedback fixes will address this validation error more fully. Bug: angleproject:4145 Bug: angleproject:4236 Change-Id: I8c218954725945414a8f18beb4f964b90da7062a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1980906 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 87607526
......@@ -268,6 +268,8 @@ void TransformFeedbackVk::updateDescriptorSet(ContextVk *contextVk,
bufferInfo.range = mTransformFeedbackBufferRange.sizes[bufferIndex] +
(mTransformFeedbackBufferRange.offsets[bufferIndex] -
mTransformFeedbackBufferRange.alignedOffsets[bufferIndex]);
// This is a tmp fix for VK validation error that will be improved in follow-on
bufferInfo.range = (bufferInfo.range == 0) ? VK_WHOLE_SIZE : bufferInfo.range;
}
writeDescriptorSet(contextVk, xfbBufferCount, descriptorBufferInfo.data(), descSet);
......
......@@ -114,6 +114,7 @@ VertexArrayVk::VertexArrayVk(ContextVk *contextVk, const gl::VertexArrayState &s
: VertexArrayImpl(state),
mCurrentArrayBufferHandles{},
mCurrentArrayBufferOffsets{},
mCurrentArrayBufferRelativeOffsets{},
mCurrentArrayBuffers{},
mCurrentElementArrayBufferOffset(0),
mCurrentElementArrayBuffer(nullptr),
......@@ -130,6 +131,7 @@ VertexArrayVk::VertexArrayVk(ContextVk *contextVk, const gl::VertexArrayState &s
mCurrentArrayBufferHandles.fill(mTheNullBuffer.getBuffer().getHandle());
mCurrentArrayBufferOffsets.fill(0);
mCurrentArrayBufferRelativeOffsets.fill(0);
mCurrentArrayBuffers.fill(&mTheNullBuffer);
mDynamicVertexData.init(renderer, vk::kVertexBufferUsageFlags, vk::kVertexBufferAlignment,
......@@ -552,7 +554,7 @@ void VertexArrayVk::updateActiveAttribInfo(ContextVk *contextVk)
contextVk->onVertexAttributeChange(attribIndex, mCurrentArrayBufferStrides[attribIndex],
binding.getDivisor(), attrib.format->id,
attrib.relativeOffset);
mCurrentArrayBufferRelativeOffsets[attribIndex]);
}
}
......@@ -568,8 +570,10 @@ angle::Result VertexArrayVk::syncDirtyAttrib(ContextVk *contextVk,
const vk::Format &vertexFormat = renderer->getFormat(attrib.format->id);
GLuint stride;
bool anyVertexBufferConvertedOnGpu = false;
gl::Buffer *bufferGL = binding.getBuffer().get();
// Init attribute offset to the front-end value
mCurrentArrayBufferRelativeOffsets[attribIndex] = attrib.relativeOffset;
bool anyVertexBufferConvertedOnGpu = false;
gl::Buffer *bufferGL = binding.getBuffer().get();
// Emulated and/or client-side attribs will be streamed
bool isStreamingVertexAttrib =
(binding.getDivisor() > renderer->getMaxVertexAttribDivisor()) || (bufferGL == nullptr);
......@@ -614,6 +618,8 @@ angle::Result VertexArrayVk::syncDirtyAttrib(ContextVk *contextVk,
mCurrentArrayBuffers[attribIndex] = bufferHelper;
mCurrentArrayBufferHandles[attribIndex] = bufferHelper->getBuffer().getHandle();
mCurrentArrayBufferOffsets[attribIndex] = conversion->lastAllocationOffset;
// Converted attribs are packed in their own VK buffer so offset is zero
mCurrentArrayBufferRelativeOffsets[attribIndex] = 0;
// Converted buffer is tightly packed
stride = vertexFormat.actualBufferFormat().pixelBytes;
......@@ -654,7 +660,8 @@ angle::Result VertexArrayVk::syncDirtyAttrib(ContextVk *contextVk,
else
{
contextVk->onVertexAttributeChange(attribIndex, stride, binding.getDivisor(),
attrib.format->id, attrib.relativeOffset);
attrib.format->id,
mCurrentArrayBufferRelativeOffsets[attribIndex]);
// Cache the stride of the attribute
mCurrentArrayBufferStrides[attribIndex] = stride;
}
......@@ -670,10 +677,11 @@ angle::Result VertexArrayVk::syncDirtyAttrib(ContextVk *contextVk,
contextVk->invalidateDefaultAttribute(attribIndex);
// These will be filled out by the ContextVk.
mCurrentArrayBuffers[attribIndex] = &mTheNullBuffer;
mCurrentArrayBufferHandles[attribIndex] = mTheNullBuffer.getBuffer().getHandle();
mCurrentArrayBufferOffsets[attribIndex] = 0;
mCurrentArrayBufferStrides[attribIndex] = 0;
mCurrentArrayBuffers[attribIndex] = &mTheNullBuffer;
mCurrentArrayBufferHandles[attribIndex] = mTheNullBuffer.getBuffer().getHandle();
mCurrentArrayBufferOffsets[attribIndex] = 0;
mCurrentArrayBufferStrides[attribIndex] = 0;
mCurrentArrayBufferRelativeOffsets[attribIndex] = 0;
setDefaultPackedInput(contextVk, attribIndex);
}
......
......@@ -140,6 +140,8 @@ class VertexArrayVk : public VertexArrayImpl
gl::AttribArray<VkBuffer> mCurrentArrayBufferHandles;
gl::AttribArray<VkDeviceSize> mCurrentArrayBufferOffsets;
// The offset into the buffer to the first attrib
gl::AttribArray<GLuint> mCurrentArrayBufferRelativeOffsets;
gl::AttribArray<vk::BufferHelper *> mCurrentArrayBuffers;
// Cache strides of attributes for a fast pipeline cache update when VAOs are changed
gl::AttribArray<GLuint> mCurrentArrayBufferStrides;
......
......@@ -58,6 +58,7 @@
// Program Pipeline Objects:
3570 VULKAN : KHR-GLES31.core.shader_atomic_counters.advanced-usage-many-draw-calls2 = FAIL
3570 VULKAN : KHR-GLES31.core.shader_atomic_counters.advanced-usage-many-dispatches = FAIL
3570 VULKAN : KHR-GLES31.core.vertex_attrib_binding.basic-usage = FAIL
// Separate shader objects:
3570 VULKAN : KHR-GLES31.core.sepshaderobjs* = FAIL
......@@ -73,7 +74,9 @@
3569 : KHR-GLES31.core.shader_bitfield_operation.imulExtended.* = SKIP
// Trigger Vulkan validation errors:
4145 VULKAN : KHR-GLES31.core.vertex_attrib_binding.basic-* = FAIL
4145 VULKAN : KHR-GLES31.core.vertex_attrib_binding.basic-input-case9 = FAIL
4145 VULKAN : KHR-GLES31.core.vertex_attrib_binding.basic-input-case11 = FAIL
4145 VULKAN : KHR-GLES31.core.vertex_attrib_binding.basic-inputI-case2 = FAIL
// Crashes in libnvidia-glvkspirv.so, fixed in newer drivers
4128 VULKAN NVIDIA : KHR-GLES31.core.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-*-matC* = 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