OpenGL EXT: shader_buffer_load
http://www.opengl.org/registry/specs/NV/shader_buffer_load.txt
Overview At a very coarse level, GL has evolved in a way that allows
applications to replace many of the original state machine variables
with blocks of user-defined data. For example, the current vertex
state has been augmented by vertex buffer objects, fixed-function
shading state and parameters have been replaced by shaders/programs
and constant buffers, etc.. Applications switch between coarse sets
of state by binding objects to the context or to other container
objects (e.g. vertex array objects) instead of manipulating state
variables of the context. In terms of the number of GL commands
required to draw an object, modern applications are orders of
magnitude more efficient than legacy applications, but this explosion
of objects bound to other objects has led to a new bottleneck -
pointer chasing and CPU L2 cache misses in the driver, and general
L2 cache pollution. This extension provides a mechanism to read from a flat, 64-bit GPU
address space from programs/shaders, to query GPU addresses of buffer
objects at the API level, and to bind buffer objects to the context in
such a way that they can be accessed via their GPU addresses in any
shader stage. The intent is that applications can avoid re-binding buffer objects
or updating constants between each Draw call and instead simply use
a VertexAttrib (or TexCoord, or InstanceID, or...) to "point" to the
new object's state. In this way, one of the cheapest "state" updates
(from the CPU's point of view) can be used to effect a significant
state change in the shader similarly to how a pointer change may on
the CPU. At the same time, this relieves the limits on how many
buffer objects can be accessed at once by shaders, and allows these
buffer object accesses to be exposed as C-style pointer dereferences
in the shading language. As a very simple example, imagine packing a group of similar objects'
constants into a single buffer object and pointing your program
at object <i> by setting "glVertexAttribI1iEXT(attrLoc, i);"
and using a shader as such: struct MyObjectType {
mat4x4 modelView;
vec4 materialPropertyX;
// etc.
};
uniform MyObjectType *allObjects;
in int objectID; // bound to attrLoc ... mat4x4 thisObjectsMatrix = allObjects[objectID].modelView;
// do transform, shading, etc. This is beneficial in much the same way that texture arrays allow
choosing between similar, but independent, texture maps with a single
coordinate identifying which slice of the texture to use. It also
resembles instancing, where a lightweight change (incrementing the
instance ID) can be used to generate a different and interesting
result, but with additional flexibility over instancing because the
values are app-controlled and not a single incrementing counter. Dependent pointer fetches are allowed, so more complex scene graph
structures can be built into buffer objects providing significant new
flexibility in the use of shaders. Another simple example, showing
something you can't do with existing functionality, is to do dependent
fetches into many buffer objects: GenBuffers(N, dataBuffers);
GenBuffers(1, &pointerBuffer); GLuint64EXT gpuAddrs[N];
for (i = 0; i < N; ++i) {
BindBuffer(target, dataBuffers[i]);
BufferData(target, size[i], myData[i], STATIC_DRAW); // get the address of this buffer and make it resident.
GetBufferParameterui64vNV(target, BUFFER_GPU_ADDRESS,
gpuaddrs[i]);
MakeBufferResidentNV(target, READ_ONLY);
} GLuint64EXT pointerBufferAddr;
BindBuffer(target, pointerBuffer);
BufferData(target, sizeof(GLuint64EXT)*N, gpuAddrs, STATIC_DRAW);
GetBufferParameterui64vNV(target, BUFFER_GPU_ADDRESS,
&pointerBufferAddr);
MakeBufferResidentNV(target, READ_ONLY); // now in the shader, we can use a double indirection
vec4 **ptrToBuffers = pointerBufferAddr;
vec4 *ptrToBufferI = ptrToBuffers[i]; This allows simultaneous access to more buffers than
EXT_bindable_uniform (MAX_VERTEX_BINDABLE_UNIFORMS, etc.) and each
can be larger than MAX_BINDABLE_UNIFORM_SIZE.
OpenGL EXT: shader_buffer_load的更多相关文章
- three.js 相关概念
1.什么是three.js? Three.js 是一个 3D JavaScript 库.Three.js 封装了底层的图形接口,使得程序员能够在无需掌握繁冗的图形学知识的情况下,也能用简单的代码实现三 ...
- opengl入门学习
OpenGL入门学习 说起编程作图,大概还有很多人想起TC的#include <graphics.h>吧? 但是各位是否想过,那些画面绚丽的PC游戏是如何编写出来的?就靠TC那可怜的640 ...
- [翻译]opengl扩展教程1
[翻译]opengl扩展教程1 原文地址https://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/extensions.php [翻译]ope ...
- OpenGL开发环境配置-Windows/MinGW/Clion/CMake
因为某些原因,不想用过于臃肿的VS了,转而使用常用的jetbrains的CLion,Clion沿袭了jetbrans的优良传统,基本代码提示功能还是比较好的,不过就是对于windows不熟悉cmake ...
- OpenGL extension specification (from openGL.org)
Shader read/write/atomic into UAV global memory (need manual sync) http://www.opengl.org/registry/sp ...
- [工作积累] OpenGL ES3.0: glInvalidateFramebuffer
https://www.khronos.org/opengles/sdk/docs/man3/html/glInvalidateFramebuffer.xhtml 这个在GLES2.0上只有Exten ...
- Android OpenGL 学习笔记 --开始篇
转自: http://www.cnblogs.com/TerryBlog/archive/2010/07/09/1774475.html 1.什么是 OpenGL? OpenGL 是个专业的3D程序接 ...
- OpenGL入门学习(转)
OpenGL入门学习 http://www.cppblog.com/doing5552/archive/2009/01/08/71532.html 说起编程作图,大概还有很多人想起TC的#includ ...
- 【OpenGL游戏开发之二】OpenGL常用API
OpenGL常用API 开发基于OpenGL的应用程序,必须先了解OpenGL的库函数.它采用C语言风格,提供大量的函数来进行图形的处理和显示.OpenGL库函数的命名方式非常有规律.所有OpenGL ...
随机推荐
- Catch That Cow(poj 3278)
给定两个整数n和k 通过 n+1或n-1 或n*2 这3种操作,使得n==k 输出最少的操作次数 //广搜,a是队列,step记录步数,vis记录哪些数被搜到过 #include<cstdio& ...
- jquery.validate.unobtrusive.js插件作用
在 ASP.NET MVC 中启用 Unobtrusive JavaScript 功能,可以在运行时由服务器端根据Model中设置的验证规则,自动生成客户端验证js代码(结合jquery.valida ...
- .net学习笔记----Asp.net的生命周期之一应用程序生命周期
Http请求刚刚到达服务器的时候 当服务器接收到一个 Http请求的时候,IIS (Internet Information Services,互联网信息服务)首先需要决定如何去处理这个请求. 什么是 ...
- IBM V7000
IBM_V7000 http://www.tuicool.com/articles/7vI7ja http://www.ibm.com/support/knowledgecenter/en/ST3FR ...
- [杂] 一些常用的SQL归类之一
整理了一大坨的常用SQL语句,以方便自己需要用的时候查找. 查看锁 SELECT [request_session_id] , c.[program_name] , DB_NAME(c.[dbid]) ...
- oracle 共享池( shared pool )
Oracle共享池 Oracle共享池(Share Pool)属于SGA,由库高速缓存(library cache)和数据字典高速缓存(data dictionary cache)组成. 库高速缓存 ...
- 利用phpexcel把excel导入数据库和数据库导出excel实现
<?php ); ini_set(,,,date(,date(,,,date(,,,date(,date(,,,date() ->setCellValue();); $objPHP ...
- poj 1753
翻转棋,注意是翻转周围四个的,不是整行列的 汗-_-! 哥的代码风还是不错的 二进制储存状态 Sample Input bwwb bbwb bwwb bwww Sample Output 4 #in ...
- MATLAB学习笔记(六)——MATLAB数据分析与多项式计算
(一)数据处理统计 一.最大值和最小值 1.求向量的最大值和最小值 y=max(X); %返回向量X的最大值存入y,如果X中含有复数则按模最大的存入y [y,I]=max(X);%返回向量X的最大值存 ...
- LoadRunner字符串与参数的操作及转换技巧
刚开始学LR时,经常搞不清楚变量和参数的区别与用法,最近在一次脚本编写中,整理出来的一些小技巧,与大家一起分享. //字符串复制 strcpy(str,"Hello ") ; // ...