diff options
Diffstat (limited to 'stream-servers/vulkan/VkDecoderGlobalState.cpp')
-rw-r--r-- | stream-servers/vulkan/VkDecoderGlobalState.cpp | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/stream-servers/vulkan/VkDecoderGlobalState.cpp b/stream-servers/vulkan/VkDecoderGlobalState.cpp index 477a4d3c..da07609c 100644 --- a/stream-servers/vulkan/VkDecoderGlobalState.cpp +++ b/stream-servers/vulkan/VkDecoderGlobalState.cpp @@ -4145,6 +4145,34 @@ class VkDecoderGlobalState::Impl { info->data.data()); } + void on_vkUpdateDescriptorSetWithTemplateSized2GOOGLE( + android::base::BumpPool* pool, VkDevice boxed_device, VkDescriptorSet descriptorSet, + VkDescriptorUpdateTemplate descriptorUpdateTemplate, uint32_t imageInfoCount, + uint32_t bufferInfoCount, uint32_t bufferViewCount, uint32_t inlineUniformBlockCount, + const uint32_t* pImageInfoEntryIndices, const uint32_t* pBufferInfoEntryIndices, + const uint32_t* pBufferViewEntryIndices, const VkDescriptorImageInfo* pImageInfos, + const VkDescriptorBufferInfo* pBufferInfos, const VkBufferView* pBufferViews, + const uint8_t* pInlineUniformBlockData) { + auto device = unbox_VkDevice(boxed_device); + auto vk = dispatch_VkDevice(boxed_device); + + std::lock_guard<std::recursive_mutex> lock(mLock); + auto* info = android::base::find(mDescriptorUpdateTemplateInfo, descriptorUpdateTemplate); + if (!info) return; + + memcpy(info->data.data() + info->imageInfoStart, pImageInfos, + imageInfoCount * sizeof(VkDescriptorImageInfo)); + memcpy(info->data.data() + info->bufferInfoStart, pBufferInfos, + bufferInfoCount * sizeof(VkDescriptorBufferInfo)); + memcpy(info->data.data() + info->bufferViewStart, pBufferViews, + bufferViewCount * sizeof(VkBufferView)); + memcpy(info->data.data() + info->inlineUniformBlockStart, pInlineUniformBlockData, + inlineUniformBlockCount); + + vk->vkUpdateDescriptorSetWithTemplate(device, descriptorSet, descriptorUpdateTemplate, + info->data.data()); + } + void hostSyncCommandBuffer(const char* tag, VkCommandBuffer boxed_commandBuffer, uint32_t needHostSync, uint32_t sequenceNumber) { auto nextDeadline = []() { @@ -5852,6 +5880,7 @@ class VkDecoderGlobalState::Impl { size_t imageInfoStart; size_t bufferInfoStart; size_t bufferViewStart; + size_t inlineUniformBlockStart; }; DescriptorUpdateTemplateInfo calcLinearizedDescriptorUpdateTemplateInfo( @@ -5862,6 +5891,7 @@ class VkDecoderGlobalState::Impl { size_t numImageInfos = 0; size_t numBufferInfos = 0; size_t numBufferViews = 0; + size_t numInlineUniformBlocks = 0; for (uint32_t i = 0; i < pCreateInfo->descriptorUpdateEntryCount; ++i) { const auto& entry = pCreateInfo->pDescriptorUpdateEntries[i]; @@ -5873,6 +5903,8 @@ class VkDecoderGlobalState::Impl { numBufferInfos += count; } else if (isDescriptorTypeBufferView(type)) { numBufferViews += count; + } else if (type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT) { + numInlineUniformBlocks += count; } else { GFXSTREAM_ABORT(FatalError(ABORT_REASON_OTHER)) << "unknown descriptor type 0x" << std::hex << type; @@ -5882,15 +5914,19 @@ class VkDecoderGlobalState::Impl { size_t imageInfoBytes = numImageInfos * sizeof(VkDescriptorImageInfo); size_t bufferInfoBytes = numBufferInfos * sizeof(VkDescriptorBufferInfo); size_t bufferViewBytes = numBufferViews * sizeof(VkBufferView); + size_t inlineUniformBlockBytes = numInlineUniformBlocks; - res.data.resize(imageInfoBytes + bufferInfoBytes + bufferViewBytes); + res.data.resize(imageInfoBytes + bufferInfoBytes + bufferViewBytes + + inlineUniformBlockBytes); res.imageInfoStart = 0; res.bufferInfoStart = imageInfoBytes; res.bufferViewStart = imageInfoBytes + bufferInfoBytes; + res.inlineUniformBlockStart = imageInfoBytes + bufferInfoBytes + bufferViewBytes; size_t imageInfoCount = 0; size_t bufferInfoCount = 0; size_t bufferViewCount = 0; + size_t inlineUniformBlockCount = 0; for (uint32_t i = 0; i < pCreateInfo->descriptorUpdateEntryCount; ++i) { const auto& entry = pCreateInfo->pDescriptorUpdateEntries[i]; @@ -5912,6 +5948,10 @@ class VkDecoderGlobalState::Impl { entryForHost.offset = res.bufferViewStart + bufferViewCount * sizeof(VkBufferView); entryForHost.stride = sizeof(VkBufferView); ++bufferViewCount; + } else if (type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT) { + entryForHost.offset = res.inlineUniformBlockStart + inlineUniformBlockCount; + entryForHost.stride = 0; + inlineUniformBlockCount += entryForHost.descriptorCount; } else { GFXSTREAM_ABORT(FatalError(ABORT_REASON_OTHER)) << "unknown descriptor type 0x" << std::hex << type; @@ -7086,6 +7126,21 @@ void VkDecoderGlobalState::on_vkUpdateDescriptorSetWithTemplateSizedGOOGLE( pBufferViewEntryIndices, pImageInfos, pBufferInfos, pBufferViews); } +void VkDecoderGlobalState::on_vkUpdateDescriptorSetWithTemplateSized2GOOGLE( + android::base::BumpPool* pool, VkDevice boxed_device, VkDescriptorSet descriptorSet, + VkDescriptorUpdateTemplate descriptorUpdateTemplate, uint32_t imageInfoCount, + uint32_t bufferInfoCount, uint32_t bufferViewCount, uint32_t inlineUniformBlockCount, + const uint32_t* pImageInfoEntryIndices, const uint32_t* pBufferInfoEntryIndices, + const uint32_t* pBufferViewEntryIndices, const VkDescriptorImageInfo* pImageInfos, + const VkDescriptorBufferInfo* pBufferInfos, const VkBufferView* pBufferViews, + const uint8_t* pInlineUniformBlockData) { + mImpl->on_vkUpdateDescriptorSetWithTemplateSized2GOOGLE( + pool, boxed_device, descriptorSet, descriptorUpdateTemplate, imageInfoCount, + bufferInfoCount, bufferViewCount, inlineUniformBlockCount, pImageInfoEntryIndices, + pBufferInfoEntryIndices, pBufferViewEntryIndices, pImageInfos, pBufferInfos, pBufferViews, + pInlineUniformBlockData); +} + VkResult VkDecoderGlobalState::on_vkBeginCommandBuffer(android::base::BumpPool* pool, VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo, |