Commit ceb7190b by Luc Ferron Committed by Commit Bot

Vulkan: Fix bug in reuse of vertex input bindings

Fix bug that used previously used vertex bindings. Now we use the current program mask to only initialize the vulkan pipeline with the active vertex input bindings. + adjust dEQP expectations Bug: angleproject:2334 Change-Id: Ie6176eee99f87dc7a95f664d28e8312b9cb274bc Reviewed-on: https://chromium-review.googlesource.com/902434Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
parent ca5c1059
...@@ -132,6 +132,8 @@ gl::Error ContextVk::initPipeline(const gl::Context *context) ...@@ -132,6 +132,8 @@ gl::Error ContextVk::initPipeline(const gl::Context *context)
VertexArrayVk *vertexArrayVk = vk::GetImpl(state.getVertexArray()); VertexArrayVk *vertexArrayVk = vk::GetImpl(state.getVertexArray());
FramebufferVk *framebufferVk = vk::GetImpl(state.getDrawFramebuffer()); FramebufferVk *framebufferVk = vk::GetImpl(state.getDrawFramebuffer());
ProgramVk *programVk = vk::GetImpl(state.getProgram()); ProgramVk *programVk = vk::GetImpl(state.getProgram());
const gl::AttributesMask activeAttribLocationsMask =
state.getProgram()->getActiveAttribLocationsMask();
// Ensure the topology of the pipeline description is updated. // Ensure the topology of the pipeline description is updated.
mPipelineDesc->updateTopology(mCurrentDrawMode); mPipelineDesc->updateTopology(mCurrentDrawMode);
...@@ -143,7 +145,8 @@ gl::Error ContextVk::initPipeline(const gl::Context *context) ...@@ -143,7 +145,8 @@ gl::Error ContextVk::initPipeline(const gl::Context *context)
mPipelineDesc->updateRenderPassDesc(framebufferVk->getRenderPassDesc(context)); mPipelineDesc->updateRenderPassDesc(framebufferVk->getRenderPassDesc(context));
// TODO(jmadill): Validate with ASSERT against physical device limits/caps? // TODO(jmadill): Validate with ASSERT against physical device limits/caps?
ANGLE_TRY(mRenderer->getPipeline(programVk, *mPipelineDesc, &mCurrentPipeline)); ANGLE_TRY(mRenderer->getPipeline(programVk, *mPipelineDesc, activeAttribLocationsMask,
&mCurrentPipeline));
return gl::NoError(); return gl::NoError();
} }
......
...@@ -979,6 +979,7 @@ Serial RendererVk::issueProgramSerial() ...@@ -979,6 +979,7 @@ Serial RendererVk::issueProgramSerial()
vk::Error RendererVk::getPipeline(const ProgramVk *programVk, vk::Error RendererVk::getPipeline(const ProgramVk *programVk,
const vk::PipelineDesc &desc, const vk::PipelineDesc &desc,
const gl::AttributesMask &activeAttribLocationsMask,
vk::PipelineAndSerial **pipelineOut) vk::PipelineAndSerial **pipelineOut)
{ {
ASSERT(programVk->getVertexModuleSerial() == desc.getShaderStageInfo()[0].moduleSerial); ASSERT(programVk->getVertexModuleSerial() == desc.getShaderStageInfo()[0].moduleSerial);
...@@ -989,7 +990,7 @@ vk::Error RendererVk::getPipeline(const ProgramVk *programVk, ...@@ -989,7 +990,7 @@ vk::Error RendererVk::getPipeline(const ProgramVk *programVk,
ANGLE_TRY(getCompatibleRenderPass(desc.getRenderPassDesc(), &compatibleRenderPass)); ANGLE_TRY(getCompatibleRenderPass(desc.getRenderPassDesc(), &compatibleRenderPass));
return mPipelineCache.getPipeline(mDevice, *compatibleRenderPass, mGraphicsPipelineLayout, return mPipelineCache.getPipeline(mDevice, *compatibleRenderPass, mGraphicsPipelineLayout,
programVk->getLinkedVertexModule(), activeAttribLocationsMask, programVk->getLinkedVertexModule(),
programVk->getLinkedFragmentModule(), desc, pipelineOut); programVk->getLinkedFragmentModule(), desc, pipelineOut);
} }
......
...@@ -114,6 +114,7 @@ class RendererVk : angle::NonCopyable ...@@ -114,6 +114,7 @@ class RendererVk : angle::NonCopyable
vk::Error getPipeline(const ProgramVk *programVk, vk::Error getPipeline(const ProgramVk *programVk,
const vk::PipelineDesc &desc, const vk::PipelineDesc &desc,
const gl::AttributesMask &activeAttribLocationsMask,
vk::PipelineAndSerial **pipelineOut); vk::PipelineAndSerial **pipelineOut);
// This should only be called from ResourceVk. // This should only be called from ResourceVk.
......
...@@ -353,6 +353,7 @@ void PipelineDesc::initDefaults() ...@@ -353,6 +353,7 @@ void PipelineDesc::initDefaults()
Error PipelineDesc::initializePipeline(VkDevice device, Error PipelineDesc::initializePipeline(VkDevice device,
const RenderPass &compatibleRenderPass, const RenderPass &compatibleRenderPass,
const PipelineLayout &pipelineLayout, const PipelineLayout &pipelineLayout,
const gl::AttributesMask &activeAttribLocationsMask,
const ShaderModule &vertexModule, const ShaderModule &vertexModule,
const ShaderModule &fragmentModule, const ShaderModule &fragmentModule,
Pipeline *pipelineOut) const Pipeline *pipelineOut) const
...@@ -391,17 +392,16 @@ Error PipelineDesc::initializePipeline(VkDevice device, ...@@ -391,17 +392,16 @@ Error PipelineDesc::initializePipeline(VkDevice device,
uint32_t vertexAttribCount = 0; uint32_t vertexAttribCount = 0;
for (uint32_t attribIndex = 0; attribIndex < gl::MAX_VERTEX_ATTRIBS; ++attribIndex) for (size_t attribIndexSizeT : activeAttribLocationsMask)
{ {
const auto attribIndex = static_cast<uint32_t>(attribIndexSizeT);
VkVertexInputBindingDescription &bindingDesc = bindingDescs[attribIndex]; VkVertexInputBindingDescription &bindingDesc = bindingDescs[attribIndex];
VkVertexInputAttributeDescription &attribDesc = attributeDescs[attribIndex]; VkVertexInputAttributeDescription &attribDesc = attributeDescs[attribIndex];
const PackedVertexInputBindingDesc &packedBinding = mVertexInputBindings[attribIndex]; const PackedVertexInputBindingDesc &packedBinding = mVertexInputBindings[attribIndex];
const PackedVertexInputAttributeDesc &packedAttrib = mVertexInputAttribs[attribIndex]; const PackedVertexInputAttributeDesc &packedAttrib = mVertexInputAttribs[attribIndex];
// TODO(jmadill): Support for gaps in vertex attribute specification. // TODO(jmadill): Support for gaps in vertex attribute specification.
if (packedAttrib.format == 0)
continue;
vertexAttribCount = attribIndex + 1; vertexAttribCount = attribIndex + 1;
bindingDesc.binding = attribIndex; bindingDesc.binding = attribIndex;
...@@ -780,6 +780,7 @@ void PipelineCache::destroy(VkDevice device) ...@@ -780,6 +780,7 @@ void PipelineCache::destroy(VkDevice device)
vk::Error PipelineCache::getPipeline(VkDevice device, vk::Error PipelineCache::getPipeline(VkDevice device,
const vk::RenderPass &compatibleRenderPass, const vk::RenderPass &compatibleRenderPass,
const vk::PipelineLayout &pipelineLayout, const vk::PipelineLayout &pipelineLayout,
const gl::AttributesMask &activeAttribLocationsMask,
const vk::ShaderModule &vertexModule, const vk::ShaderModule &vertexModule,
const vk::ShaderModule &fragmentModule, const vk::ShaderModule &fragmentModule,
const vk::PipelineDesc &desc, const vk::PipelineDesc &desc,
...@@ -798,7 +799,8 @@ vk::Error PipelineCache::getPipeline(VkDevice device, ...@@ -798,7 +799,8 @@ vk::Error PipelineCache::getPipeline(VkDevice device,
if (device != VK_NULL_HANDLE) if (device != VK_NULL_HANDLE)
{ {
ANGLE_TRY(desc.initializePipeline(device, compatibleRenderPass, pipelineLayout, ANGLE_TRY(desc.initializePipeline(device, compatibleRenderPass, pipelineLayout,
vertexModule, fragmentModule, &newPipeline)); activeAttribLocationsMask, vertexModule, fragmentModule,
&newPipeline));
} }
// The Serial will be updated outside of this query. // The Serial will be updated outside of this query.
......
...@@ -260,6 +260,7 @@ class PipelineDesc final ...@@ -260,6 +260,7 @@ class PipelineDesc final
Error initializePipeline(VkDevice device, Error initializePipeline(VkDevice device,
const RenderPass &compatibleRenderPass, const RenderPass &compatibleRenderPass,
const PipelineLayout &pipelineLayout, const PipelineLayout &pipelineLayout,
const gl::AttributesMask &activeAttribLocationsMask,
const ShaderModule &vertexModule, const ShaderModule &vertexModule,
const ShaderModule &fragmentModule, const ShaderModule &fragmentModule,
Pipeline *pipelineOut) const; Pipeline *pipelineOut) const;
...@@ -388,6 +389,7 @@ class PipelineCache final : angle::NonCopyable ...@@ -388,6 +389,7 @@ class PipelineCache final : angle::NonCopyable
vk::Error getPipeline(VkDevice device, vk::Error getPipeline(VkDevice device,
const vk::RenderPass &compatibleRenderPass, const vk::RenderPass &compatibleRenderPass,
const vk::PipelineLayout &pipelineLayout, const vk::PipelineLayout &pipelineLayout,
const gl::AttributesMask &activeAttribLocationsMask,
const vk::ShaderModule &vertexModule, const vk::ShaderModule &vertexModule,
const vk::ShaderModule &fragmentModule, const vk::ShaderModule &fragmentModule,
const vk::PipelineDesc &desc, const vk::PipelineDesc &desc,
......
...@@ -194,13 +194,12 @@ ...@@ -194,13 +194,12 @@
2161 VULKAN : dEQP-GLES2.functional.state_query.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.state_query.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.clipping.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.clipping.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.polygon_offset.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.polygon_offset.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.points.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.points.default_attribute = SKIP
2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.first.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.triangles.default_attribute = SKIP
2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.triangles.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.triangle_fan.default_attribute = SKIP
2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.triangle_fan.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.triangle_strip.default_attribute = SKIP
2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.triangle_strip.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.lines.default_attribute = SKIP 2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.lines.default_attribute = SKIP
2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.line_strip.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.line_strip.default_attribute = SKIP
2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.line_loop.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.draw.draw_arrays.line_loop.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.draw.draw_elements.indices.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.draw.draw_elements.indices.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.draw.draw_elements.points.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.draw.draw_elements.points.* = SKIP
......
...@@ -82,12 +82,13 @@ void VulkanPipelineCachePerfTest::step() ...@@ -82,12 +82,13 @@ void VulkanPipelineCachePerfTest::step()
vk::PipelineLayout pl; vk::PipelineLayout pl;
vk::ShaderModule sm; vk::ShaderModule sm;
vk::PipelineAndSerial *result = nullptr; vk::PipelineAndSerial *result = nullptr;
gl::AttributesMask am;
for (int iteration = 0; iteration < 100; ++iteration) for (int iteration = 0; iteration < 100; ++iteration)
{ {
for (const auto &hit : mCacheHits) for (const auto &hit : mCacheHits)
{ {
(void)mCache.getPipeline(VK_NULL_HANDLE, rp, pl, sm, sm, hit, &result); (void)mCache.getPipeline(VK_NULL_HANDLE, rp, pl, am, sm, sm, hit, &result);
} }
} }
...@@ -95,7 +96,7 @@ void VulkanPipelineCachePerfTest::step() ...@@ -95,7 +96,7 @@ void VulkanPipelineCachePerfTest::step()
++missCount, ++mMissIndex) ++missCount, ++mMissIndex)
{ {
const auto &miss = mCacheMisses[mMissIndex]; const auto &miss = mCacheMisses[mMissIndex];
(void)mCache.getPipeline(VK_NULL_HANDLE, rp, pl, sm, sm, miss, &result); (void)mCache.getPipeline(VK_NULL_HANDLE, rp, pl, am, sm, sm, miss, &result);
} }
} }
......
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