PDA

View Full Version : Bindable uniforms and uniform uploading with ARB



Ilian Dinev
09-21-2008, 02:22 PM
I need to do two things, possible with GLSL, but not precompiled ARB asm shaders:

1) bindable uniforms:
glUniformBufferEXT is only for GLSL, is there an alternative for ARB?

2) uploading a range of program-local uniform data
Right now, what I have is this laggy implementation:


inline void __setUniforms(int target, int start, int numFloats,const float* data){
while(numFloats>=4){
glProgramLocalParameter4fvARB(target,start,data);
start++;
data+=4;
numFloats-=4;
}
if(numFloats<=0)return;
float tmp[4]={0,0,0,0};
float* p=&amp;tmp;
while(numFloats--)*p++ = *data++;
glProgramLocalParameter4fvARB(target,start,tmp);
}

void ilSetUniformsPS(int start,int numBytes,float* data){
__setUniforms(GL_FRAGMENT_PROGRAM_ARB,start,numByt es/4,data);
}

glProgramParametersXXX is marked as global, and is said in the specs to work only with GL_VERTEX_PROGRAM_NV

Ilian Dinev
09-21-2008, 02:41 PM
Ah, found the answer for bindable uniforms:
http://grmanet.sogang.ac.kr/seminar/nv_parameter_buffer_object%20&%20nv_transform_feedback.pdf

I swear I searched a lot beforehand >_<
Still, the second problem remains

Rob Barris
09-21-2008, 04:52 PM
http://www.opengl.org/registry/specs/EXT/gpu_program_parameters.txt

That extension allows for batch uploading of parameters (both env and local). We use it on OS X 10.4.8 and higher, it makes a lot of difference especially on multi threaded drivers which do command queuing - far fewer individual calls to queue and dequeue.

Ilian Dinev
09-21-2008, 06:43 PM
Thanks :)