pntriangles-vk2 vulkan demo corruptions

Started by Dorian, July 15, 2020, 09:53:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dorian

Hi,

I think I found an issue in "Vulkan2 - Tesselation" test available in GPU Caps Viewer 1.45.1.0
Parts of the sphere are missing (sorry, I'm having troubles uploading attachments)

To simplify test, I used GeeXLab_0.33.2.0 with geexlab-demopack-vulkan-2020.05-08.
Command line after dropping demopack:
GeeXLab.exe  /no_menubar /glinfo /demofile="demopack-vk/Vulkan2-plugin/08-tessellation/pntriangles-vk2/main.xml"

After forcing vkQueueWaitIdle after each vkQueueSubmit issue is not seen.
When I pause under debugger every frame: no issue.
When I pause under debugger every two frames: issue is seen.

Looking at apidump, it seems that submits, presents and semaphores are used correctly.

But looking at command buffer updated in each frame, I see single vkCmdBindDescriptorSets called once with the same VkDescriptorSet:
Quote
Thread 0, Frame 7, Time 2816142 us:
vkCmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets) returns void:
    commandBuffer:                  VkCommandBuffer = 000001B273CF7F70
    pipelineBindPoint:              VkPipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS (0)
    layout:                         VkPipelineLayout = 000001B273E702D0
    firstSet:                       uint32_t = 0
    descriptorSetCount:             uint32_t = 1
    pDescriptorSets:                const VkDescriptorSet* = 000001B273E0E2C0
        pDescriptorSets[0]:             const VkDescriptorSet = 000001B273F23E2C
    dynamicOffsetCount:             uint32_t = 0
    pDynamicOffsets:                const uint32_t* = NULL
...
Quote
Thread 0, Frame 8, Time 3249852 us:
vkCmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets) returns void:
    commandBuffer:                  VkCommandBuffer = 000001B273D0AC80
    pipelineBindPoint:              VkPipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS (0)
    layout:                         VkPipelineLayout = 000001B273E702D0
    firstSet:                       uint32_t = 0
    descriptorSetCount:             uint32_t = 1
    pDescriptorSets:                const VkDescriptorSet* = 000001B273E0E2C0
        pDescriptorSets[0]:             const VkDescriptorSet = 000001B273F23E2C
    dynamicOffsetCount:             uint32_t = 0
    pDynamicOffsets:                const uint32_t* = NULL

I assume it holds uniform data (of rotation):
Quote
Thread 0, Frame 0, Time 279820 us:
vkUpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies) returns void:
    device:                         VkDevice = 000001B26E9EEDA0
    descriptorWriteCount:           uint32_t = 4
    pDescriptorWrites:              const VkWriteDescriptorSet* = 000001B273E247C0
        pDescriptorWrites[0]:           const VkWriteDescriptorSet = 000001B273E247C0:
            sType:                          VkStructureType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET (35)
            pNext:                          const void* = NULL
            dstSet:                         VkDescriptorSet = 000001B273F23E2C
            dstBinding:                     uint32_t = 0
            dstArrayElement:                uint32_t = 0
            descriptorCount:                uint32_t = 1
            descriptorType:                 VkDescriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER (6)
            pImageInfo:                     const VkDescriptorImageInfo* = UNUSED
            pBufferInfo:                    const VkDescriptorBufferInfo* = 000001B273EB06C0
                pBufferInfo[0]:                 const VkDescriptorBufferInfo = 000001B273EB06C0:
                    buffer:                         VkBuffer = 000001B273E30E00
                    offset:                         VkDeviceSize = 0
                    range:                          VkDeviceSize = 512
            pTexelBufferView:               const VkBufferView* = UNUSED

Rotation is updated every frame
Quote
gh_object.set_euler_angles(mesh, 90 + 10*math.cos(elapsed_time), 20*math.sin(elapsed_time),  10*math.sin(elapsed_time))
UpdateObjectTransform(ub1, mesh)

Uniforms should not be modified if they can still be used by previously submitted but unfinished frame.

Suggested solutions:
a). Use fence to make sure it is no longer used in previous frame before updating. (not good for performance)
b). Use N uniform buffers where N is number of swapchain images.
c). Use single larger buffer (N*size) and use different dynamic offsets to it's contents in each frame.



JeGX

Thanks Dorian for your feedback.

I will test with N uniform buffers (like I do for command buffers), that should indeed improve the rendering code.

For posting images, just use an image hosting service like https://www.techpowerup.org/upload.

Dorian


JeGX

You're right, there is a problem!
What is your GPU?

JeGX

Dorian, I uploaded a new demo in the Vulkan demopack for GeeXLab that uses N uniform buffers (and N descriptor sets + N command buffers).

The VK demopack can be downloaded from this link:
https://www.geeks3d.com/dl/show/50102

The new demo can be found here: geexlab-demopack-vulkan/vk2/08-tessellation/pntriangles-vk2-02/

Dorian

Sorry for late response.
I checked demopack you provided geexlab-demopack-vulkan-2020.07-17\geexlab-demopack-vulkan\vk2\08-tessellation\pntriangles-vk2-02
and issue is not occurring anymore. Thanks!

I was testing it on Intel Skylake GPU (VEN_8086&DEV_1926)
It was mostly visible on high tesselation and wireframe.