Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit

Permalink
Vulkan: Reduce PipelineDesc size.
Browse files Browse the repository at this point in the history
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/1308460
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
  • Loading branch information
null77 authored and Commit Bot committed Nov 6, 2018
1 parent 3d86e89 commit 77b2436
Show file tree
Hide file tree
Showing 3 changed files with 301 additions and 224 deletions.
18 changes: 7 additions & 11 deletions src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ VertexArrayVk::VertexArrayVk(const gl::VertexArrayState &state, RendererVk *rend
mCurrentElementArrayBufferHandle(VK_NULL_HANDLE),
mCurrentElementArrayBufferOffset(0),
mCurrentElementArrayBufferResource(nullptr),
mPackedInputBindings{},
mPackedInputAttributes{},
mDynamicVertexData(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, kDynamicVertexDataSize),
mDynamicIndexData(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, kDynamicIndexDataSize),
mTranslatedByteIndexData(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, kDynamicIndexDataSize),
Expand All @@ -85,9 +87,6 @@ VertexArrayVk::VertexArrayVk(const gl::VertexArrayState &state, RendererVk *rend
mCurrentArrayBufferOffsets.fill(0);
mCurrentArrayBufferResources.fill(nullptr);

mPackedInputBindings.fill({0, 0});
mPackedInputAttributes.fill({0, 0, 0});

for (vk::DynamicBuffer &buffer : mCurrentArrayBufferConversion)
{
buffer.init(kMaxVertexFormatAlignment, renderer);
Expand Down Expand Up @@ -397,10 +396,9 @@ void VertexArrayVk::updatePackedInputDescriptions()
bindingDesc.stride = 0;
bindingDesc.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;

vk::PackedVertexInputAttributeDesc &attribDesc = mPackedInputAttributes[attribIndex];
attribDesc.format = static_cast<uint16_t>(VK_FORMAT_R32G32B32A32_SFLOAT);
attribDesc.location = static_cast<uint16_t>(attribIndex);
attribDesc.offset = 0;
mPackedInputAttributes.formats[attribIndex] =
static_cast<uint16_t>(VK_FORMAT_R32G32B32A32_SFLOAT);
mPackedInputAttributes.offsets[attribIndex] = 0;
}
}

Expand All @@ -424,10 +422,8 @@ void VertexArrayVk::updatePackedInputInfo(uint32_t attribIndex,
UNIMPLEMENTED();
}

vk::PackedVertexInputAttributeDesc &attribDesc = mPackedInputAttributes[attribIndex];
attribDesc.format = static_cast<uint16_t>(vkFormat);
attribDesc.location = static_cast<uint16_t>(attribIndex);
attribDesc.offset = static_cast<uint32_t>(attrib.relativeOffset);
mPackedInputAttributes.formats[attribIndex] = static_cast<uint8_t>(vkFormat);
mPackedInputAttributes.offsets[attribIndex] = static_cast<uint16_t>(attrib.relativeOffset);
}

angle::Result VertexArrayVk::updateClientAttribs(const gl::Context *context,
Expand Down
Loading

0 comments on commit 77b2436

Please sign in to comment.