Search Issue Tracker
By Design
By Design in 6000.4.X
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
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
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.
Resolution Note (6000.4.X):
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.