Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

GraphicsBuffer and Mesh

Discussion in '2019.1 Beta' started by kavaari, Feb 28, 2019.

  1. kavaari

    kavaari

    Joined:
    Nov 17, 2015
    Posts:
    4
    I see that 2019 added new API for GraphicsBuffer and specifically an ability to create index buffer manually. Is it possible to use it with Mesh object, especially I would like to SetIndices() method to support it :). Or maybe add a Graphics.DrawBuffer API taking both vertex and index buffer. Or is it some how possible with current API?

    My issue is that I have multiple procedural runtime meshes created using the Mesh object that share the same indices but many different permutations of vertices. Currently I have to set same indices to each Mesh object which I think creates a new index buffer for every Mesh object (unless under the hood Unity maps the managed index array to native index buffer avoiding the unnecessary duplication?).
     
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,742
    Hey,

    Right now it's only supported with the new Graphics.DrawProcedural API's that support an index buffer parameter.
    In the future we hope to extend it to cover more use cases!
     
    kavaari likes this.
  3. r_eckert

    r_eckert

    Joined:
    Dec 11, 2017
    Posts:
    3
    Will you support using a GraphicsBuffer with Compute Shaders in the foreseeable future? Right now we are using native rendering plugins to use a ComputeBuffer as an index buffer but that has its own problems due to how the plugin API works. It would be great if we could have a solution that works reliably on all platforms and to be honest I don't really see why that distinction between ComputeBuffer and GraphicsBuffer exists in the first place.
     
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,742
    GraphicsBuffer is a new type intended to encapsulate all types of buffers. ComputeBuffer was a bad idea, because it restricts usage to a certain type of binding in shaders. A GraphicsBuffer can, in theory, have multiple views (e.g. compute + index, so you can populate via compute, then use as an index buffer with no extra effort) on platforms that support it. But none of that work has been done yet.

    It is planned. Can't say a version yet though.
     
    npatch, landonth, Egad_McDad and 2 others like this.
  5. recursive

    recursive

    Joined:
    Jul 12, 2012
    Posts:
    667
    This is exactly what I need for a particular use case. Is there a timeframe for getting a graphics buffer from a Mesh that links to its VBO at least?
     
    unity_AOKj7uK4VjvdWw likes this.
unityunity