Commit 41a34d6b by Jamie Madill Committed by Commit Bot

Vulkan: Use constants for descriptor types.

This will make it easier to substitute in the future. Bug: angleproject:5736 Change-Id: I0686c4c396e9f12cfb71253ccd9aa491a7942826 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2804812Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent ad55bdbe
...@@ -85,6 +85,9 @@ bool ValidateTransformedSpirV(const gl::ShaderBitSet &linkedShaderStages, ...@@ -85,6 +85,9 @@ bool ValidateTransformedSpirV(const gl::ShaderBitSet &linkedShaderStages,
} }
return true; return true;
} }
constexpr VkDescriptorType kUniformBufferDescriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
constexpr VkDescriptorType kStorageBufferDescriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
} // namespace } // namespace
DefaultUniformBlock::DefaultUniformBlock() = default; DefaultUniformBlock::DefaultUniformBlock() = default;
...@@ -527,7 +530,7 @@ void ProgramExecutableVk::addAtomicCounterBufferDescriptorSetDesc( ...@@ -527,7 +530,7 @@ void ProgramExecutableVk::addAtomicCounterBufferDescriptorSetDesc(
} }
// A single storage buffer array is used for all stages for simplicity. // A single storage buffer array is used for all stages for simplicity.
descOut->update(info.binding, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, descOut->update(info.binding, kStorageBufferDescriptorType,
gl::IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, gl::IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS,
gl_vk::kShaderStageMap[shaderType], nullptr); gl_vk::kShaderStageMap[shaderType], nullptr);
} }
...@@ -840,7 +843,7 @@ angle::Result ProgramExecutableVk::initDynamicDescriptorPools( ...@@ -840,7 +843,7 @@ angle::Result ProgramExecutableVk::initDynamicDescriptorPools(
// index, so make sure their pools are initialized. // index, so make sure their pools are initialized.
VkDescriptorPoolSize poolSize = {}; VkDescriptorPoolSize poolSize = {};
// The type doesn't matter, since it's not actually used for anything. // The type doesn't matter, since it's not actually used for anything.
poolSize.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; poolSize.type = kUniformBufferDescriptorType;
poolSize.descriptorCount = 1; poolSize.descriptorCount = 1;
descriptorPoolSizes.emplace_back(poolSize); descriptorPoolSizes.emplace_back(poolSize);
} }
...@@ -917,9 +920,9 @@ angle::Result ProgramExecutableVk::createPipelineLayout( ...@@ -917,9 +920,9 @@ angle::Result ProgramExecutableVk::createPipelineLayout(
ASSERT(programState); ASSERT(programState);
addInterfaceBlockDescriptorSetDesc(programState->getUniformBlocks(), shaderType, addInterfaceBlockDescriptorSetDesc(programState->getUniformBlocks(), shaderType,
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, &resourcesSetDesc); kUniformBufferDescriptorType, &resourcesSetDesc);
addInterfaceBlockDescriptorSetDesc(programState->getShaderStorageBlocks(), shaderType, addInterfaceBlockDescriptorSetDesc(programState->getShaderStorageBlocks(), shaderType,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, &resourcesSetDesc); kStorageBufferDescriptorType, &resourcesSetDesc);
addAtomicCounterBufferDescriptorSetDesc(programState->getAtomicCounterBuffers(), shaderType, addAtomicCounterBufferDescriptorSetDesc(programState->getAtomicCounterBuffers(), shaderType,
&resourcesSetDesc); &resourcesSetDesc);
} }
...@@ -1095,9 +1098,9 @@ angle::Result ProgramExecutableVk::updateBuffersDescriptorSet( ...@@ -1095,9 +1098,9 @@ angle::Result ProgramExecutableVk::updateBuffersDescriptorSet(
return angle::Result::Continue; return angle::Result::Continue;
} }
ASSERT(descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER || ASSERT(descriptorType == kUniformBufferDescriptorType ||
descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER); descriptorType == kStorageBufferDescriptorType);
const bool isStorageBuffer = descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; const bool isStorageBuffer = descriptorType == kStorageBufferDescriptorType;
// Write uniform or storage buffers. // Write uniform or storage buffers.
const gl::State &glState = contextVk->getState(); const gl::State &glState = contextVk->getState();
...@@ -1221,9 +1224,8 @@ angle::Result ProgramExecutableVk::updateAtomicCounterBuffersDescriptorSet( ...@@ -1221,9 +1224,8 @@ angle::Result ProgramExecutableVk::updateAtomicCounterBuffersDescriptorSet(
VkDeviceSize size = gl::GetBoundBufferAvailableSize(bufferBinding); VkDeviceSize size = gl::GetBoundBufferAvailableSize(bufferBinding);
WriteBufferDescriptorSetBinding(bufferHelper, bufferBinding.getOffset(), size, WriteBufferDescriptorSetBinding(bufferHelper, bufferBinding.getOffset(), size,
descriptorSet, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, descriptorSet, kStorageBufferDescriptorType, info.binding,
info.binding, binding, requiredOffsetAlignment, &bufferInfo, binding, requiredOffsetAlignment, &bufferInfo, &writeInfo);
&writeInfo);
// We set SHADER_READ_BIT to be conservative. // We set SHADER_READ_BIT to be conservative.
commandBufferHelper->bufferWrite( commandBufferHelper->bufferWrite(
...@@ -1252,7 +1254,7 @@ angle::Result ProgramExecutableVk::updateAtomicCounterBuffersDescriptorSet( ...@@ -1252,7 +1254,7 @@ angle::Result ProgramExecutableVk::updateAtomicCounterBuffersDescriptorSet(
writeInfos[writeCount].dstBinding = info.binding; writeInfos[writeCount].dstBinding = info.binding;
writeInfos[writeCount].dstArrayElement = static_cast<uint32_t>(binding); writeInfos[writeCount].dstArrayElement = static_cast<uint32_t>(binding);
writeInfos[writeCount].descriptorCount = 1; writeInfos[writeCount].descriptorCount = 1;
writeInfos[writeCount].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; writeInfos[writeCount].descriptorType = kStorageBufferDescriptorType;
writeInfos[writeCount].pImageInfo = nullptr; writeInfos[writeCount].pImageInfo = nullptr;
writeInfos[writeCount].pBufferInfo = &bufferInfos[writeCount]; writeInfos[writeCount].pBufferInfo = &bufferInfos[writeCount];
writeInfos[writeCount].pTexelBufferView = nullptr; writeInfos[writeCount].pTexelBufferView = nullptr;
...@@ -1404,10 +1406,10 @@ angle::Result ProgramExecutableVk::updateShaderResourcesDescriptorSet( ...@@ -1404,10 +1406,10 @@ angle::Result ProgramExecutableVk::updateShaderResourcesDescriptorSet(
ANGLE_TRY(updateBuffersDescriptorSet(contextVk, shaderType, commandBufferHelper, ANGLE_TRY(updateBuffersDescriptorSet(contextVk, shaderType, commandBufferHelper,
programState->getUniformBlocks(), programState->getUniformBlocks(),
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER)); kUniformBufferDescriptorType));
ANGLE_TRY(updateBuffersDescriptorSet(contextVk, shaderType, commandBufferHelper, ANGLE_TRY(updateBuffersDescriptorSet(contextVk, shaderType, commandBufferHelper,
programState->getShaderStorageBlocks(), programState->getShaderStorageBlocks(),
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)); kStorageBufferDescriptorType));
ANGLE_TRY(updateAtomicCounterBuffersDescriptorSet(*programState, shaderType, contextVk, ANGLE_TRY(updateAtomicCounterBuffersDescriptorSet(*programState, shaderType, contextVk,
commandBufferHelper)); commandBufferHelper));
ANGLE_TRY(updateImagesDescriptorSet(contextVk, programState->getExecutable(), shaderType)); ANGLE_TRY(updateImagesDescriptorSet(contextVk, programState->getExecutable(), shaderType));
......
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