当前位置:网站首页>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 |
边栏推荐
- 透过开发抽奖小程序,体会创新与迭代
- Data Middle Office Construction (6): Data System Construction
- NowCoderTOP17-22 Binary search/sort - continuous update ing
- P5231 [JSOI2012]玄武密码(SAM 经典运用)
- Chapter Six
- Chapter VII
- sql力扣刷题八
- Detailed explanation of SQL stored procedures
- Business-(Course-Chapter-Subsection) + Course Publishing Some Business Ideas
- Creation of doubly linked list
猜你喜欢
随机推荐
金鱼哥RHCA回忆录:CL210管理OPENSTACK网络--开放虚拟网络(OVN)简介(课后练习)
Centos7 install mysql5.7
Windows安装mysql详细步骤(通俗易懂,简单上手)
Meikle Studio--Hongmeng 14-day development training notes (8)
Qt 编译错误:C2228: “.key”的左边必须有类/结构/联合
SQL存储过程详解
Redis缓存面临的缓存雪崩问题
掌握SSR
Solve rpc error: code = Unimplemented desc = method CheckLicense not implemented
Principle of Redis Sentinel
【LeetCode】242. 有效的字母异位词
Sql优化总结!详细!(2021最新面试必问)
透过开发抽奖小程序,体会创新与迭代
SQL力扣刷题七
Sql optimization summary!detailed!(Required for the latest interview in 2021)
Mybaits Frequently Asked Questions Explained
Redis缓存面临的缓存穿透问题
Day113. Shangyitong: user authentication, Alibaba Cloud OSS, patient management
【23提前批】北森云计算-测开面经
面试、工作中常用sql大全(建议收藏备用)









