当前位置:网站首页>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); // unbind
shader中使用
layout(std430, binding = 2) buffer anotherLayoutName
{
int some_int;
float fixed_array[42];
float variable_array[];
};
对应的dx12的概念是
Structured Buffer | SSBO |
UAV Buffer,RWBuffer | SSBO |
边栏推荐
- SQLSERVER merges subquery data into one field
- Insertion and deletion of doubly linked list
- The big-eyed Google Chrome has also betrayed, teach you a trick to quickly clear its own ads
- 【Go事】一眼看穿 Go 的集合和切片
- 透过开发抽奖小程序,体会创新与迭代
- Experience innovation and iteration through the development of a lucky draw applet
- [Part 1 of Cloud Native Monitoring Series] A detailed explanation of Prometheus monitoring system
- 半个月时间把MySQL重新巩固了一遍,梳理了一篇几万字 “超硬核” 文章!
- SQL如何从字符串截取指定字符(LEFT、MID、RIGHT三大函数)
- 【LeetCode】118.杨辉三角
猜你喜欢
Source code analysis of GZIPInputStream class
Usage of JOIN in MySQL
细讲DDD领域驱动设计
Web系统常见安全漏洞介绍及解决方案-XSS攻击
KVM virtualization job
Burndown chart of project management tools: Dynamic assessment of team work ability
Redis缓存面临的缓存穿透问题
sql力扣刷题八
Hospital management system database, course design, SQLserver, pure code design
odoo14 | 附件上传功能及实际使用
随机推荐
医院管理系统数据库,课程设计,SQLserver,纯代码设计
一种用于保证多方子系统数据一致性的方法
Redis缓存面临的缓存雪崩问题
可以用聚酯树脂将接线板密封接线盒吗?(接线盒灌封胶用哪种树脂)
GZIPInputStream 类源码分析
In half a month, MySQL has been consolidated again, and a tens of thousands of words "super hard core" article has been sorted out!
MySQL中JOIN的用法
Build finished with errors/Executable Not Found
面试、工作中常用sql大全(建议收藏备用)
IBM SPSS Statistics 28软件安装包下载及安装教程
Add a shuffling effect to every pie
Module eight
darknet 硬件软件环境的设置和检测
Inversion problem - key point
掌握SSR
Dart Log tool class
redis-企业级使用
nodeJs--url模块
【LeetCode】Day108-和为 K 的子数组
Emotional crisis, my friend's online dating girlfriend wants to break up with him, ask me what to do