当前位置:网站首页>unity computeshader的可读写buffer
unity computeshader的可读写buffer
2022-07-31 10:32:00 【VT LI】
可读写buffer:
computeshader中的读写的buffer,在opengl上是用ssbo实现的。
KernelState中的inBuffers,outBuffers这些buffer,会走到GfxDeviceGLES::SetComputeBuffer,如果索引0x7FFFFF表示GLE中实际上不存在缓冲区,但仍然需要计数器。则用BindShaderStorageBuffer来绑定ssbo,

ssbo的特点
1.如果用ubo,他的大小只能在16kb以内,但是ssbo可以达到128mb。
2.ssbo是可写的
3.ssbo具有可变存储,最多可达为该特定缓冲区绑定的任何缓冲区范围
4.在所有条件相同的情况下,SSBO访问可能会比UBO访问慢。
绑定方式
GLuint ssbo;
glGenBuffers(1, &ssbo);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo);
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(data), data, GLenum usage); //sizeof(data) only works for statically sized C/C++ arrays.
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 3, ssbo);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); // unbindshader中使用
layout(std430, binding = 2) buffer anotherLayoutName
{
int some_int;
float fixed_array[42];
float variable_array[];
};对应的dx12的概念是
Structured Buffer | SSBO |
UAV Buffer,RWBuffer | SSBO |
边栏推荐
- 梅科尔工作室--鸿蒙十四天开发培训笔记(八)
- 前序、后序及层次遍历实现二叉树的序列化与反序列化
- redis-企业级使用
- 尚医通【预约挂号系统】总结
- “chmod 777-R 文件名”什么意思?
- How SQL intercepts specified characters from strings (three functions of LEFT, MID, RIGHT)
- SQL存储过程详解
- The big-eyed Google Chrome has also betrayed, teach you a trick to quickly clear its own ads
- Inversion problem - key point
- Day113.尚医通:用户认证、阿里云OSS、就诊人管理
猜你喜欢
随机推荐
Redis Cluster - Sentinel Mode Principle (Sentinel)
(C language) program environment and preprocessing
NowCoderTOP17-22 Binary search/sort - continuous update ing
SQL学习笔记——REGEXP运算符
Web系统常见安全漏洞介绍及解决方案-sql注入
Burndown chart of project management tools: Dynamic assessment of team work ability
WEB核心【记录网站登录人数,记录用户名案例】Cookie技术实现
NowCoderTOP23-27 Binary tree traversal - continuous update ing
Dart Log工具类
Simple understanding of GCD
强大的SQL计算利器-SPL
双链表的创建
The big-eyed Google Chrome has also betrayed, teach you a trick to quickly clear its own ads
unity-shader-2
ASP.NET 身份认证框架 Identity(一)
Mybaits Frequently Asked Questions Explained
Data Middle Office Construction (6): Data System Construction
Redis-基础
乐观锁和悲观锁
Mybaits 常用问题详解
![AtCoder—E - Σ[k=0..10^100]floor(X/10^k](/img/be/82cfab00950c1f28d426e76a792906.png)








