Search Issue Tracker

By Design

Votes

1

Found in

2019.4

2020.3

2020.3.3f1

2021.1

2021.2

Issue ID

1328335

Regression

No

Graphics.DrawMeshInstancedProcedural fails to render meshes when certain Graphics APIs are used

Graphics Device Features

-

How to reproduce:
1. Open the attached project named "Case_1328335"
2. Open the SampleScene
3. Enter Play mode
4. Observe that hexagon clouds are drawn in the Scene
5. Switch Graphics API to D3D11, D3D12 or Vulkan
6. Enter Play mode again

Expected results: Cloud meshes are drawn as previously
Actual results: No meshes are rendered on screen

Reproducible with: 2019.4.25f1, 2020.3.5f1, 2021.1.4f1, 2021.2.0a14
Could not test with: 2018.4.33f1(Graphics does not contain a definition for DrawMeshInstancedProcedural)

Notes:
1. Reproducible with Graphics APIs - D3D12, D3D12, Vulkan
2. Not reproducible with Graphics APIs - OpenGLCore, Metal
3. Occurs in Editor and Player

  1. Resolution Note (2021.2.X):

    StructuredBuffer instead of RWStructuredBuffer should be used in vertex shader. UAV's in vertex shaders are not always supported, even in Vulkan such a support is optional. If one only wants to read from a such a buffer then StructuredBuffer is the way to go.

    While an error from our part would be preferable unfortunately there are so many other unworkable bindings in various projects that then there would be bug reports about error spam. So we're forced to do silent errors for now.

    So to reiterate: When writing to a buffer use RWStructuredBuffer. When only reading from a buffer use StructuredBuffer.

Comments (1)

  1. AtheMathmo

    Apr 21, 2021 15:25

    Original reporter here.

    I managed to get the attached code to run, by replacing the `StructuredRWBuffer`with a `StructuredBuffer` in the `.cginc` file. So far as I'm aware, read-write buffer should be accessible from the vertex program in DirectX/Vulkan (and this works fine in OpenGL core).

    If this is expected behaviour, perhaps at least an error/warning should be added to indicate this when the shader is compiled?

    Thanks!

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.