Keep track of combined image samplers for quick bind

This commit is contained in:
Billy Laws 2022-09-29 21:14:28 +01:00
parent 040db37a28
commit 6bb2853ca0
2 changed files with 15 additions and 2 deletions

View File

@ -275,7 +275,18 @@ namespace skyline::gpu::interconnect::maxwell3d {
pushBindings(vk::DescriptorType::eStorageTexelBuffer, stage.info.image_buffer_descriptors, stageDescInfo.storageTexelBufferDescCount, [](const auto &, u32) {});
descriptorInfo.totalTexelBufferDescCount += stageDescInfo.uniformTexelBufferDescCount + stageDescInfo.storageTexelBufferDescCount;
pushBindings(vk::DescriptorType::eCombinedImageSampler, stage.info.texture_descriptors, stageDescInfo.combinedImageSamplerDescCount, [](const auto &, u32) {}, needsIndividualTextureBindingWrites);
pushBindings(vk::DescriptorType::eCombinedImageSampler, stage.info.texture_descriptors, stageDescInfo.combinedImageSamplerDescCount, [&](const Shader::TextureDescriptor &desc, u32 descIdx) {
auto addUsage{[&](auto idx) {
auto &usage{stageDescInfo.cbufUsages[desc.cbuf_index]};
usage.combinedImageSamplers.push_back({bindingIndex, descIdx});
usage.totalImageDescCount += desc.count;
usage.writeDescCount++;
}};
addUsage(desc.cbuf_index);
if (desc.has_secondary)
addUsage(desc.secondary_cbuf_index);
}, needsIndividualTextureBindingWrites);
pushBindings(vk::DescriptorType::eStorageImage, stage.info.image_descriptors, stageDescInfo.storageImageDescCount, [](const auto &, u32) {});
descriptorInfo.totalImageDescCount += stageDescInfo.combinedImageSamplerDescCount + stageDescInfo.storageImageDescCount;
}

View File

@ -63,13 +63,16 @@ namespace skyline::gpu::interconnect::maxwell3d {
boost::container::small_vector<Usage, 2> uniformBuffers;
boost::container::small_vector<Usage, 2> storageBuffers;
boost::container::small_vector<Usage, 2> combinedImageSamplers;
u32 totalBufferDescCount;
u32 totalImageDescCount;
u32 writeDescCount;
};
std::array<ConstantBufferDescriptorUsages, engine::ShaderStageConstantBufferCount> cbufUsages;
};
std::vector<vk::CopyDescriptorSet> copyDescs;
std::array<StageDescriptorInfo, 5> stages;
u32 totalStorageBufferCount;
@ -78,7 +81,6 @@ namespace skyline::gpu::interconnect::maxwell3d {
u32 totalBufferDescCount;
u32 totalTexelBufferDescCount;
u32 totalImageDescCount;
u32 totalElemCount;
};
private: