Commit e18ff25d by Tobin Ehlis Committed by Commit Bot

Vulkan:Refactor SecondaryCommandBuffers

A bunch of changes to rework and improve SecondaryCommandBuffers. Inlined all of the command functions and moved them into the header. Created new specialized commands for updating Compute/Graphics DescriptorSets and setting a memoryBarrier. Updated all of the pointer storage to be inferred rather than explicitly stored in order to save space. Also removed various params that are fixed in ANGLE to save space. Bug: angleproject:3136 Change-Id: I994bb70d5e4db6d9e71d38ac62451aaec780a5e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1535704Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
parent 5fd08af4
......@@ -436,9 +436,9 @@ angle::Result ContextVk::handleDirtyDescriptorSets(const gl::Context *context,
ANGLE_TRY(mProgram->updateDescriptorSets(this, commandBuffer));
// Bind the graphics descriptor sets.
commandBuffer->bindDescriptorSets(
VK_PIPELINE_BIND_POINT_GRAPHICS, mProgram->getPipelineLayout(),
kDriverUniformsDescriptorSetIndex, 1, &mDriverUniformsDescriptorSet, 0, nullptr);
commandBuffer->bindGraphicsDescriptorSets(mProgram->getPipelineLayout(),
kDriverUniformsDescriptorSetIndex, 1,
&mDriverUniformsDescriptorSet, 0, nullptr);
return angle::Result::Continue;
}
......
......@@ -927,16 +927,15 @@ angle::Result ProgramVk::updateDescriptorSets(ContextVk *contextVk,
{
constexpr uint32_t kShaderTypeMin = static_cast<uint32_t>(gl::kGLES2ShaderTypeMin);
constexpr uint32_t kShaderTypeMax = static_cast<uint32_t>(gl::kGLES2ShaderTypeMax);
commandBuffer->bindDescriptorSets(
VK_PIPELINE_BIND_POINT_GRAPHICS, mPipelineLayout.get(), low,
mUsedDescriptorSetRange.length(), &mDescriptorSets[low],
commandBuffer->bindGraphicsDescriptorSets(
mPipelineLayout.get(), low, mUsedDescriptorSetRange.length(), &mDescriptorSets[low],
kShaderTypeMax - kShaderTypeMin + 1, mUniformBlocksOffsets.data() + kShaderTypeMin);
}
else
{
commandBuffer->bindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, mPipelineLayout.get(),
low, mUsedDescriptorSetRange.length(),
&mDescriptorSets[low], 0, nullptr);
commandBuffer->bindGraphicsDescriptorSets(mPipelineLayout.get(), low,
mUsedDescriptorSetRange.length(),
&mDescriptorSets[low], 0, nullptr);
}
return angle::Result::Continue;
......
......@@ -316,8 +316,6 @@ angle::Result UtilsVk::setupProgram(vk::Context *context,
RendererVk *renderer = context->getRenderer();
bool isCompute = function >= Function::ComputeStartIndex;
VkPipelineBindPoint bindPoint =
isCompute ? VK_PIPELINE_BIND_POINT_COMPUTE : VK_PIPELINE_BIND_POINT_GRAPHICS;
VkShaderStageFlags pushConstantsShaderStage =
isCompute ? VK_SHADER_STAGE_COMPUTE_BIT : VK_SHADER_STAGE_FRAGMENT_BIT;
......@@ -336,6 +334,10 @@ angle::Result UtilsVk::setupProgram(vk::Context *context,
ANGLE_TRY(program->getComputePipeline(context, pipelineLayout.get(), &pipelineAndSerial));
pipelineAndSerial->updateSerial(serial);
commandBuffer->bindComputePipeline(pipelineAndSerial->get());
if (descriptorSet != VK_NULL_HANDLE)
{
commandBuffer->bindComputeDescriptorSets(pipelineLayout.get(), &descriptorSet);
}
}
else
{
......@@ -351,12 +353,11 @@ angle::Result UtilsVk::setupProgram(vk::Context *context,
pipelineLayout.get(), *pipelineDesc, gl::AttributesMask(), &descPtr, &helper));
helper->updateSerial(serial);
commandBuffer->bindGraphicsPipeline(helper->getPipeline());
}
if (descriptorSet != VK_NULL_HANDLE)
{
commandBuffer->bindDescriptorSets(bindPoint, pipelineLayout.get(), 0, 1, &descriptorSet, 0,
nullptr);
if (descriptorSet != VK_NULL_HANDLE)
{
commandBuffer->bindGraphicsDescriptorSets(pipelineLayout.get(), 0, 1, &descriptorSet, 0,
nullptr);
}
}
commandBuffer->pushConstants(pipelineLayout.get(), pushConstantsShaderStage, 0,
......
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