将查询与辅助命令缓冲区一起使用

时间:2019-02-16 13:34:32

标签: vulkan

我正在尝试使查询与辅助命令缓冲区一起使用,并且收到此警告:

  

验证层:称为vkCmdExecuteCommands(),带有无效的Cmd缓冲区0x1d0e4a08fe0,该缓冲区具有无效的活动查询池0xda。正在查询管道统计信息,因此命令缓冲区必须在queryPool上设置所有位。 Vulkan规范指出:如果commandBuffer的VK_QUERY_TYPE_PIPELINE_STATISTICS查询处于活动状态,则必须使用VkCommandBufferInheritanceInfo :: pipelineStatistics记录pCommandBuffers的每个元素,并设置查询使用的VkQueryPool中设置的所有位(https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkCmdExecuteCommands-commandBuffer-00104

我启用了pInheritanceInfo的pipelineStatistics中的所有位,所以我不明白为什么会收到此警告。

这是我的pInheritanceInfo:

VkCommandBufferInheritanceInfo commandBufferInheritanceInfo;
commandBufferInheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
commandBufferInheritanceInfo.pNext = nullptr;
commandBufferInheritanceInfo.renderPass = vulkanFramebuffer->getRenderPass();
commandBufferInheritanceInfo.subpass = 0;
commandBufferInheritanceInfo.framebuffer = vulkanFramebuffer->getFramebuffer(vulkanDevice->currentImageIndex);
commandBufferInheritanceInfo.occlusionQueryEnable = VK_TRUE;
commandBufferInheritanceInfo.queryFlags = 0;
commandBufferInheritanceInfo.pipelineStatistics = VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT |
                                                  VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT |
                                                  VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT |
                                                  VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT |
                                                  VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT |
                                                  VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT |
                                                  VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT |
                                                  VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT;

和查询池:

VkQueryPoolCreateInfo statisticsQueryPoolCreateInfo;
statisticsQueryPoolCreateInfo.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO;
statisticsQueryPoolCreateInfo.pNext = nullptr;
statisticsQueryPoolCreateInfo.flags = 0;
statisticsQueryPoolCreateInfo.queryType = VK_QUERY_TYPE_PIPELINE_STATISTICS;
statisticsQueryPoolCreateInfo.queryCount = vulkanDevice->imageCount;
statisticsQueryPoolCreateInfo.pipelineStatistics =
    VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT |
    VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT |
    VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT |
    VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT |
    VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT |
    VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT |
    VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT |
    VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT;

VK_ASSERT(vkCreateQueryPool(vulkanDevice->device, &statisticsQueryPoolCreateInfo, nullptr, &queryPool_));

0 个答案:

没有答案