Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Using RenderPass API On Quest With Vulkan (2019.3.0f6)

Discussion in 'General Graphics' started by Dragnipurake97, Jan 29, 2020.

  1. Dragnipurake97

    Dragnipurake97

    Joined:
    Sep 28, 2019
    Posts:
    39
    I'm trying to write a basic forward renderer using the RenderPass API with Vulkan but the only example of it is a PoC deferred renderer on the BeginRenderPass() page.

    It seems to run fine in the editor game view, but when I run it on Quest the error "Error vulkan: dequeueBuffer returned unrecognized buffer" gets spammed.

    Here is the render pass part of the code I am using:



    // ================= CAMERA RENDER PASS ========================

    // target camera backbuffer, shadow map is discarded at end of render pass so is transient
    framebufferAttachment.ConfigureTarget(BuiltinRenderTextureType.CameraTarget, false, true);


    var attachments = new Unity.Collections.NativeArray<AttachmentDescriptor>(2, Unity.Collections.Allocator.Temp);
    const int depthIndex = 0, framebufferIndex = 1;

    attachments[depthIndex] = depthAttachment;
    attachments[framebufferIndex] = framebufferAttachment;

    context.BeginRenderPass(camera.pixelWidth, camera.pixelHeight, QualitySettings.antiAliasing, attachments, depthIndex);


    attachments.Dispose();

    // ============== OPAQUES SUBPASS =================
    var cameraColours = new Unity.Collections.NativeArray<int>(1, Unity.Collections.Allocator.Temp);
    cameraColours[0] = framebufferIndex;

    var cameraInputs = new Unity.Collections.NativeArray<int>(1, Unity.Collections.Allocator.Temp);
    cameraInputs[0] = depthIndex;

    context.BeginSubPass(cameraColours, cameraInputs, false);

    cameraColours.Dispose();
    cameraInputs.Dispose();

    // Setup render criteria (Opaque)
    SortingSettings sortSettings = new SortingSettings(camera);
    sortSettings.criteria = SortingCriteria.CommonOpaque; // Sort front-to-back for opqaue

    DrawingSettings drawSettings = new DrawingSettings(new ShaderTagId("SRPDefaultUnlit"), sortSettings);
    drawSettings.enableDynamicBatching = useDynamicBatching;
    drawSettings.enableInstancing = useInstancing;

    // Assign PerObjectData
    drawSettings.perObjectData = PerObjectData.ReflectionProbes | PerObjectData.Lightmaps | PerObjectData.LightProbe | PerObjectData.OcclusionProbe | PerObjectData.OcclusionProbeProxyVolume;

    drawSettings.perObjectData |= PerObjectData.LightData | PerObjectData.LightIndices;

    // DRAW OPAQUES
    FilteringSettings filterSettings = new FilteringSettings(RenderQueueRange.opaque);
    context.DrawRenderers(cullResults, ref drawSettings, ref filterSettings);

    context.ExecuteCommandBuffer(cameraBuffer);
    cameraBuffer.Clear();

    // DRAW SKYBOX
    context.DrawSkybox(camera);

    context.ExecuteCommandBuffer(cameraBuffer);
    cameraBuffer.Clear();


    context.Submit();

    context.EndSubPass();

    context.EndRenderPass();
     
  2. equalsequals

    equalsequals

    Joined:
    Sep 27, 2010
    Posts:
    132
    Have you had any success with the RenderPass API and XR on any platform? I've doodled but never had a successful frame render once I enabled XR.

    Personally I don't trust that API at all, seeing as neither of the official Unity SRPs use it.
     
  3. Dragnipurake97

    Dragnipurake97

    Joined:
    Sep 28, 2019
    Posts:
    39
    I've tried it on both Vulkan and OpenGL for the new XR Plugin system and the old legacy XR system I can't get it to work, the closest being loading into a black screen. It works in editor (albeit with an error message in the scene view) so it's probably just not mean for XR.
     
unityunity