Remove unnessary uniform barriers in Vulkan.
Also added a fix to descriptor set allocation. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1914053004 Review URL: https://codereview.chromium.org/1914053004
This commit is contained in:
parent
6234006727
commit
b1b59576ba
@ -1602,7 +1602,6 @@ void GrVkGpu::onDraw(const GrPipeline& pipeline,
|
||||
const GrVkRenderPass* renderPass = vkRT->simpleRenderPass();
|
||||
SkASSERT(renderPass);
|
||||
|
||||
|
||||
GrPrimitiveType primitiveType = meshes[0].primitiveType();
|
||||
sk_sp<GrVkPipelineState> pipelineState = this->prepareDrawState(pipeline,
|
||||
primProc,
|
||||
@ -1659,10 +1658,6 @@ void GrVkGpu::onDraw(const GrPipeline& pipeline,
|
||||
pipelineState->freeTempResources(this);
|
||||
SkDEBUGCODE(pipelineState = nullptr);
|
||||
primitiveType = nonIdxMesh->primitiveType();
|
||||
// It is illegal for us to have the necessary memory barriers for when we write and
|
||||
// update the uniform buffers in prepareDrawState while in an active render pass.
|
||||
// Thus we must end the current one and then start it up again.
|
||||
fCurrentCmdBuffer->endRenderPass(this);
|
||||
pipelineState = this->prepareDrawState(pipeline,
|
||||
primProc,
|
||||
primitiveType,
|
||||
@ -1670,7 +1665,6 @@ void GrVkGpu::onDraw(const GrPipeline& pipeline,
|
||||
if (!pipelineState) {
|
||||
return;
|
||||
}
|
||||
fCurrentCmdBuffer->beginRenderPass(this, renderPass, *vkRT);
|
||||
}
|
||||
SkASSERT(pipelineState);
|
||||
this->bindGeometry(primProc, *nonIdxMesh);
|
||||
|
@ -238,13 +238,6 @@ void GrVkPipelineState::writeUniformBuffers(const GrVkGpu* gpu) {
|
||||
descriptorWrites[0].pImageInfo = nullptr;
|
||||
descriptorWrites[0].pBufferInfo = &vertBufferInfo;
|
||||
descriptorWrites[0].pTexelBufferView = nullptr;
|
||||
|
||||
fVertexUniformBuffer->addMemoryBarrier(gpu,
|
||||
VK_ACCESS_HOST_WRITE_BIT,
|
||||
VK_ACCESS_UNIFORM_READ_BIT,
|
||||
VK_PIPELINE_STAGE_HOST_BIT,
|
||||
VK_PIPELINE_STAGE_VERTEX_SHADER_BIT,
|
||||
false);
|
||||
}
|
||||
|
||||
VkDescriptorBufferInfo fragBufferInfo;
|
||||
@ -269,13 +262,6 @@ void GrVkPipelineState::writeUniformBuffers(const GrVkGpu* gpu) {
|
||||
descriptorWrites[1].pImageInfo = nullptr;
|
||||
descriptorWrites[1].pBufferInfo = &fragBufferInfo;
|
||||
descriptorWrites[1].pTexelBufferView = nullptr;
|
||||
|
||||
fFragmentUniformBuffer->addMemoryBarrier(gpu,
|
||||
VK_ACCESS_HOST_WRITE_BIT,
|
||||
VK_ACCESS_UNIFORM_READ_BIT,
|
||||
VK_PIPELINE_STAGE_HOST_BIT,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
|
||||
false);
|
||||
}
|
||||
|
||||
if (uniformBindingUpdateCount) {
|
||||
@ -436,11 +422,11 @@ void GrVkPipelineState::DescriptorPoolManager::getNewDescriptorSet(GrVkGpu* gpu,
|
||||
if (!fMaxDescriptors) {
|
||||
return;
|
||||
}
|
||||
if (fCurrentDescriptorCount == fMaxDescriptors) {
|
||||
this->getNewPool(gpu);
|
||||
fCurrentDescriptorCount = 0;
|
||||
}
|
||||
fCurrentDescriptorCount += fDescCountPerSet;
|
||||
if (fCurrentDescriptorCount > fMaxDescriptors) {
|
||||
this->getNewPool(gpu);
|
||||
fCurrentDescriptorCount = fDescCountPerSet;
|
||||
}
|
||||
|
||||
VkDescriptorSetAllocateInfo dsAllocateInfo;
|
||||
memset(&dsAllocateInfo, 0, sizeof(VkDescriptorSetAllocateInfo));
|
||||
|
@ -248,24 +248,12 @@ bool GrVkPipelineStateDataManager::uploadUniformBuffers(const GrVkGpu* gpu,
|
||||
GrVkUniformBuffer* fragmentBuffer) const {
|
||||
bool updatedBuffer = false;
|
||||
if (vertexBuffer && fVertexUniformsDirty) {
|
||||
vertexBuffer->addMemoryBarrier(gpu,
|
||||
VK_ACCESS_UNIFORM_READ_BIT,
|
||||
VK_ACCESS_HOST_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_VERTEX_SHADER_BIT,
|
||||
VK_PIPELINE_STAGE_HOST_BIT,
|
||||
false);
|
||||
SkAssertResult(vertexBuffer->updateData(gpu, fVertexUniformData.get(), fVertexUniformSize,
|
||||
&updatedBuffer));
|
||||
fVertexUniformsDirty = false;
|
||||
}
|
||||
|
||||
if (fragmentBuffer && fFragmentUniformsDirty) {
|
||||
fragmentBuffer->addMemoryBarrier(gpu,
|
||||
VK_ACCESS_UNIFORM_READ_BIT,
|
||||
VK_ACCESS_HOST_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
|
||||
VK_PIPELINE_STAGE_HOST_BIT,
|
||||
false);
|
||||
SkAssertResult(fragmentBuffer->updateData(gpu, fFragmentUniformData.get(),
|
||||
fFragmentUniformSize, &updatedBuffer));
|
||||
fFragmentUniformsDirty = false;
|
||||
|
Loading…
Reference in New Issue
Block a user