• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by DoctorDanga · Aug 12, 2020 at 11:43 PM · optimizationprocedural meshcompute shader

Sharing Compute Buffers between multiple Compute Shader instances

I am currently working on some voxel generation using Compute Shaders, but am having a performance issue when it comes to multiple compute shaders sharing a buffer. Essentially I have a compute shader instance for each chunk, but would like to share data between chunks.

Given two chunks, I would like for each chunk to have a reference to the other chunks primary compute buffer in order to perform culling on which faces to draw. I've tried creating a second compute buffer of the same type in each shader, and then assigning that to the neighboring chunk's primary buffer using shader.SetBuffer(handle, name, buffer). When I do this I get huge slowdowns from Gfx.GetComputeBufferData_Request, and within is Semaphore.WaitForSignal. This happens when rendering using Graphics.DrawProceduralNow() in the OnRenderObject() function.

I could probably create separate compute buffers for each neighboring chunk but I'd really like to save the memory by using the same buffer.


EDIT I tried the using a separate compute buffer instance for each neighboring chunk, and it seems that the slowdown is still present so it must not come from sharing the buffers. Is there a limit to how many compute buffers you can have? I could potentially collapse all the neighbor buffers into a single one but then writing to it becomes a huge pain.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

140 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

So what's Mesh.UploadMeshData do exactly? 3 Answers

How can I generate procedural 3D geometry faster? 2 Answers

,Drawing 100 000+ cubes 1 Answer

How Would I Find Out if a Player can See a Certain Face of a Mesh? 1 Answer

Procedural mesh redrawing textures causes in game fps drop. Is there a way to optimise this? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges