Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

DrawMeshInstancedIndirect doesn't work on WebGL

Discussion in 'General Graphics' started by gregume, Oct 4, 2018.

  1. gregume

    gregume

    Joined:
    Mar 3, 2018
    Posts:
    6
    Is DrawMeshInstancedIndirect supposed to work on WebGL? I am using WebGL 2.0, and instancing is supported, however the object doesn't show up, and I can't get DrawMeshInstancedIndirect to work at all on this platform.

    I have attached a minimal project with a scene that demonstrates the issue. If you select "graphics emulation": "no emulation", or any platform other than WebGL, it works and the square appears. However, if you switch to the WebGL platform and select "Graphics emulation": "WebGL 2.0", it doesn't appear.

    I would appreciate any help. Thanks!
     

    Attached Files:

  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,235
    If you report a bug, the webgl team can either fix it or add a good error message
     
  3. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,836
    I don't think so. This is OpenGL ES 3.1 level functionality, and WebGL 2.0 is based on OpenGL ES 3.0.
     
    WonkeeKim and richardkettlewell like this.
  4. Trindenberg

    Trindenberg

    Joined:
    Dec 3, 2017
    Posts:
    377
    I'm using just MeshInstanceRenderer and the MeshInstanceRendererSystem with Entities. I'm getting a no show in any build that involves IL2CPP eg. Windows, WebGL2.0. Mono works absolutely fine. I have tried everything, I cannot get an instanced MIR to show in anything built with IL2CPP. I heard maybe it is something to do with byte stripping, so added the below to a link.xml file (no idea if it is working)

    -<linker>
    -<assembly fullname="Unity">
    <type fullname="Unity.Entities.Hybrid" preserve="all"/>
    <type fullname="Unity.Rendering.Hybrid" preserve="all"/>
    </assembly>
    </linker>

    I have disabled shader variant stripping. I have tried preserve. I have Instancing on in the materials. Tried different shaders. Tried adding a GameObjectEntity, MeshInstanceRendererComponent.

    Do you have any advice how to get the instanced meshes to show on IL2CPP builds, or is this currently not working with ECS? Is it my code or is it because it's preview? I'm using 2018.3 (I was using 2018.2 but though that might fix it!)
     
  5. Trindenberg

    Trindenberg

    Joined:
    Dec 3, 2017
    Posts:
    377
    If I build using Mono, and set the Managed Stripping Level to Low, this also makes the MIRs no show. So it is something to do with this, which is automatic with IL2CPP.
     
  6. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,836
    Please report a bug then.
     
    richardkettlewell likes this.