Search Unity

Vulkan & Native Rendering Plugin

Discussion in 'General Graphics' started by PopcornFX, Sep 10, 2019.

  1. PopcornFX

    PopcornFX

    Joined:
    Mar 20, 2014
    Posts:
    32
    Hi,

    We are developing a native rendering plugins and encountering a few issues when implementing Vulkan render API.

    First of all, here how we proceed.
    1. We are using the unity mesh API to get Vertex and Index Buffers with
    GetNativeVertexBufferPtr
    and
     GetNativeIndexBufferPtr
    .
    2. Pass those to the native plugin.
    3. Map. Write Data. UnMap.
    We successfully implemented this pipeline on several different graphics API.

    Now for Vulkan :
    1. We correctly overload Initialization and load function symbols.
    2. We created the instance, get the
    m_UnityInterfaces->Get<IUnityGraphicsVulkan>()'

    3. Based on https://github.com/Unity-Technologi...ster/PluginSource/source/RenderAPI_Vulkan.cpp
    We tried to Begin Modify the buffer but the recording state send back by
    m_UnityVulkan->CommandRecordingState(&recordingState, kUnityVulkanGraphicsQueueAccess_DontCare)
    is uninitialized. and the subsequent
    m_UnityVulkan->AccessBuffer(buffer, 0, 0, kUnityVulkanResourceAccess_ObserveOnly, &bufferInfo)
    fail and return null.

    Notes :
    -
     IUnityGraphicsVulkan *m_UnityVulkan
    Has two member left to null when trying to map : AccessTexture and AccessRenderBufferTexture
    -
     Hook_vkCmdBeginRenderPass
    is working as intended and correctly overwrite clear color.
    - Unity Version 2019.1.8f1

    Thanks !
     
  2. BartPieters

    BartPieters

    Unity Technologies

    Joined:
    Apr 12, 2019
    Posts:
    25
    Hi,
    Can you get the sample you refer to to work on your system? In particular does the
    RenderAPI_Vulkan::BeginModifyVertexBuffer()
    method in the sample work as intended? Does the sample work after installing the latest drivers?
    Thanks!
     
  3. PopcornFX

    PopcornFX

    Joined:
    Mar 20, 2014
    Posts:
    32
    Hi,

    We managed to make it work, by having a function return the IUnityGraphicsVulkan instead of a IUnityGraphics that we then cast to a IUnityGraphicsVulkan.

    My bad and thanks for your answer !