Compute shader output to vertex buffer #2333
Replies: 3 comments 5 replies
-
Basic idea would be:
You'll have to manually take care of the vertex stride since there's no way to bind the buffer with a struct type. If you need a different type than |
Beta Was this translation helpful? Give feedback.
-
I have seen people use pixel in the past to get around apple not having
openCL / correct support for some open subdivision
the basic idea is each pixel is a location, and another buffer each is a
euler or a quat , index in the buffer is vert index
…On Wed, Dec 16, 2020 at 8:09 AM pezcode ***@***.***> wrote:
Basic idea would be:
- create vertex buffer with BGFX_BUFFER_COMPUTE_WRITE
- bind the buffer in your compute shader:
- in C++: setBuffer(..., handle, bgfx::Access::Write)
- in your shader:
#include "bgfx_compute.sh"
BUFFER_WR(vertexBuffer, vec4, ...);
- dispatch compute
- bind buffer with setVertexBuffer
- submit
You'll have to manually take care of the vertex stride since there's no
way to bind the buffer with a struct type. If you need a different type
than vec4, take a look at BGFX_BUFFER_COMPUTE_FORMAT_*** and
BGFX_BUFFER_COMPUTE_TYPE_***
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2333 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABW3SWPIIBQSXTNO6KOR2OLSVDLTVANCNFSM4U5VRJCA>
.
|
Beta Was this translation helpful? Give feedback.
-
24-nbody example generates positions for particles inside compute: |
Beta Was this translation helpful? Give feedback.
-
Hello and first of all let me just thank all of you for making this awesome library! Sorry for posting this in the wrong place before.
Now to my question. Is there a way to make a compute shader output to something like a vertex buffer for subsequent rendering? Is there some already available example perhaps, or would someone be willing to give me some pointers on how to achieve that?
Best regards.
Beta Was this translation helpful? Give feedback.
All reactions