Add ability to pass compute buffers to vertex/fragment shaders
### Describe the project you are working on Procedural mesh generation in compute shaders. ### Describe the problem or limitation you are having in your project The buffers containing the mesh data have to be read back and processed on the CPU into vertex buffers. ### Describe the feature / enhancement and how it helps to overcome the problem or limitation I think it would be really helpful to allow storage buffers to be bound to and also accessed in vertex/fragment shaders. This would greatly expand the potential uses for compute shaders as the current implementation requires CPU readback which can be a significant performance bottleneck. ### Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams A storage buffer can be bound to a vertex/fragment shader with a function similar to set_shader_parameter eg ```gdscript var buffer := rd.storage_buffer_create(input_bytes.size(), input_bytes) myShaderMaterial.set_shader_parameter("myBuffer", buffer) # something like this ``` Which could then be used in said shader to allow procedural drawing eg. ```glsl shader_type spatial; layout(set = 0, binding = 0, std430) restrict buffer bufferType { vec4 positions[]; } myBuffer; void vertex() { VERTEX += myBuffer.positions[VERTEX_ID]; } void fragment() { COLOR = vec4(0.4, 0.6, 0.9, 1.0); } ``` ### If this enhancement will not be used often, can it be worked around with a few lines of script? I don't believe it's possible to implement thi
Posted by jtsorlinis on May 31, 2023, 6:36 AM
Tags
Related issues
- struct's lifetime requirements can be bypassed via covariant field assignment
- Proposal to Reorganize the Moderation Team and Review Moderation Policies
- Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
- proposal: container/...: generic collection types
- Better Custom Endpoint BYOK
- A concrete policy for backward compatibility until Godot 5.0
Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments
github (Other)
struct's lifetime requirements can be bypassed via covariant field assignment
Proposal to Reorganize the Moderation Team and Review Moderation Policies
Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
proposal: container/...: generic collection types
Better Custom Endpoint BYOK
A concrete policy for backward compatibility until Godot 5.0
New MTP models not supported
Tracking: 429 / Capacity Issues
Add ability to pass compute buffers to vertex/fragment shaders
### Describe the project you are working on Procedural mesh generation in compute shaders. ### Describe the problem or limitation you are having in your project The buffers containing the mesh data have to be read back and processed on the CPU into vertex buffers. ### Describe the feature / enhancement and how it helps to overcome the problem or limitation I think it would be really helpful to allow storage buffers to be bound to and also accessed in vertex/fragment shaders. This would greatly expand the potential uses for compute shaders as the current implementation requires CPU readback which can be a significant performance bottleneck. ### Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams A storage buffer can be bound to a vertex/fragment shader with a function similar to set_shader_parameter eg ```gdscript var buffer := rd.storage_buffer_create(input_bytes.size(), input_bytes) myShaderMaterial.set_shader_parameter("myBuffer", buffer) # something like this ``` Which could then be used in said shader to allow procedural drawing eg. ```glsl shader_type spatial; layout(set = 0, binding = 0, std430) restrict buffer bufferType { vec4 positions[]; } myBuffer; void vertex() { VERTEX += myBuffer.positions[VERTEX_ID]; } void fragment() { COLOR = vec4(0.4, 0.6, 0.9, 1.0); } ``` ### If this enhancement will not be used often, can it be worked around with a few lines of script? I don't believe it's possible to implement thi
Comments (0)
No comments yet. Start the discussion.