Commit 77b2436e by Jamie Madill Committed by Commit Bot

Vulkan: Reduce PipelineDesc size.

This packs the desc into 288 bytes. Down from over 400. The hashing and memcmp functions are sped up considerably. Improves performance in the VulkanPipelineCachePerf test by 50% and also improves performance in the state changing draw call test by 20%. Bug: angleproject:2522 Change-Id: I72ed191a93721b875684f647f806c09be4e66821 Reviewed-on: https://chromium-review.googlesource.com/c/1308460Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 3d86e89b
...@@ -75,6 +75,8 @@ VertexArrayVk::VertexArrayVk(const gl::VertexArrayState &state, RendererVk *rend ...@@ -75,6 +75,8 @@ VertexArrayVk::VertexArrayVk(const gl::VertexArrayState &state, RendererVk *rend
mCurrentElementArrayBufferHandle(VK_NULL_HANDLE), mCurrentElementArrayBufferHandle(VK_NULL_HANDLE),
mCurrentElementArrayBufferOffset(0), mCurrentElementArrayBufferOffset(0),
mCurrentElementArrayBufferResource(nullptr), mCurrentElementArrayBufferResource(nullptr),
mPackedInputBindings{},
mPackedInputAttributes{},
mDynamicVertexData(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, kDynamicVertexDataSize), mDynamicVertexData(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, kDynamicVertexDataSize),
mDynamicIndexData(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, kDynamicIndexDataSize), mDynamicIndexData(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, kDynamicIndexDataSize),
mTranslatedByteIndexData(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, kDynamicIndexDataSize), mTranslatedByteIndexData(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, kDynamicIndexDataSize),
...@@ -85,9 +87,6 @@ VertexArrayVk::VertexArrayVk(const gl::VertexArrayState &state, RendererVk *rend ...@@ -85,9 +87,6 @@ VertexArrayVk::VertexArrayVk(const gl::VertexArrayState &state, RendererVk *rend
mCurrentArrayBufferOffsets.fill(0); mCurrentArrayBufferOffsets.fill(0);
mCurrentArrayBufferResources.fill(nullptr); mCurrentArrayBufferResources.fill(nullptr);
mPackedInputBindings.fill({0, 0});
mPackedInputAttributes.fill({0, 0, 0});
for (vk::DynamicBuffer &buffer : mCurrentArrayBufferConversion) for (vk::DynamicBuffer &buffer : mCurrentArrayBufferConversion)
{ {
buffer.init(kMaxVertexFormatAlignment, renderer); buffer.init(kMaxVertexFormatAlignment, renderer);
...@@ -397,10 +396,9 @@ void VertexArrayVk::updatePackedInputDescriptions() ...@@ -397,10 +396,9 @@ void VertexArrayVk::updatePackedInputDescriptions()
bindingDesc.stride = 0; bindingDesc.stride = 0;
bindingDesc.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; bindingDesc.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
vk::PackedVertexInputAttributeDesc &attribDesc = mPackedInputAttributes[attribIndex]; mPackedInputAttributes.formats[attribIndex] =
attribDesc.format = static_cast<uint16_t>(VK_FORMAT_R32G32B32A32_SFLOAT); static_cast<uint16_t>(VK_FORMAT_R32G32B32A32_SFLOAT);
attribDesc.location = static_cast<uint16_t>(attribIndex); mPackedInputAttributes.offsets[attribIndex] = 0;
attribDesc.offset = 0;
} }
} }
...@@ -424,10 +422,8 @@ void VertexArrayVk::updatePackedInputInfo(uint32_t attribIndex, ...@@ -424,10 +422,8 @@ void VertexArrayVk::updatePackedInputInfo(uint32_t attribIndex,
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
vk::PackedVertexInputAttributeDesc &attribDesc = mPackedInputAttributes[attribIndex]; mPackedInputAttributes.formats[attribIndex] = static_cast<uint8_t>(vkFormat);
attribDesc.format = static_cast<uint16_t>(vkFormat); mPackedInputAttributes.offsets[attribIndex] = static_cast<uint16_t>(attrib.relativeOffset);
attribDesc.location = static_cast<uint16_t>(attribIndex);
attribDesc.offset = static_cast<uint32_t>(attrib.relativeOffset);
} }
angle::Result VertexArrayVk::updateClientAttribs(const gl::Context *context, angle::Result VertexArrayVk::updateClientAttribs(const gl::Context *context,
......
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