Search Issue Tracker

By Design

Votes

0

Found in

6000.0.58f1

6000.2.6f1

6000.3.0b3

6000.4.0a1

Issue ID

UUM-119598

Regression

No

ComputeBuffer readback fails when Render Graph is enabled

-

Reproduction steps:
1. Open the attached “BugRepro” project
2. Open the “Assets/Scenes/SampleScene.unity“ Scene
3. Make sure that Compatibility Mode is disabled (Edit > Project Settings > Graphics > Render Graph > Compatibility Mode (Render Graph Disabled)
4. Enter the Play Mode
5. Observe the Game view

Expected result: Script reads back ComputeBuffer values: 1=24, 2=24, 3=6
Actual result: Script reads back zeros for all values: 1=0, 2=0, 3=0

Reproducible with: 6000.0.58f1, 6000.2.6f1, 6000.3.0b3, 6000.4.0a1

Reproducible on: Windows 11
Not reproducible on: No other environment tested

Note: Not reproducible when “Compatibility Mode (Render Graph Disabled)” is enabled

  1. Resolution Note:

    Graphics.SetRandomWriteTarget() is not supported with URP Render Graph. This lack of support is by design, because on some graphics API these buffers share the same binding slot-space with other type of buffers. So setting them globally can generate rendering issues in SRP.

    It is recommended to implement a URP Scriptable Renderer Feature (custom pass) with an async GPU readback instead. You can implement it within the render function of your Render Graph pass:

    using (var builder = renderGraph.AddUnsafePass<ReadbackPassData>("ReadbackPass", out var passData))
    {
    builder.AllowPassCulling(false);

    // Which buffer to read from
    passData.bufferHandle = m_OutputBuffer;
    builder.UseBuffer(passData.bufferHandle, AccessFlags.Read);
    builder.SetRenderFunc(static (ReadbackPassData data, UnsafeGraphContext ctx) =>
    {
    ctx.cmd.RequestAsyncReadback(data.bufferHandle, (AsyncGPUReadbackRequest request) =>
    {
    var result = request.GetData<int>();
    Debug.Log(string.Join(",", result));
    });
    });

    Check URP Render Graph documentation and URP Render Graph samples for more information. We are planning to include an async readback sample in the coming month.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.