OpenGl with Geforce 8800. SM 4.0???

Started by
8 comments, last by Ingrater 16 years, 10 months ago
Hi! The Spec says that you can use 128 pixel textures on a Geforce 8 (http://www.nvidia.com/object/IO_37100.html) -> Pixel Shader Model 4.0 If I want to use a GLSL shader with more than 16 samplers, I will get the error message "Sampler limit exceeded; more than 16 samplers needed to compile program"... This limitation of 16 samplers comes from SM 3.0... Does someone know, how to compile the shader for SM 4.0???? Thanks, Tobi
Advertisement
You need to enable the sm 4.0 extensions with a perprocessor command
#extension GL_EXT_gpu_shader4 : enable
http://3d.benjamin-thaut.de
Also, there are 32 texture image units, serving 128 scalar processors (4 texture units for every group of 16 processors).
Hi,

thanks for your advise Ingrater, but it doesn't work.... :(

I have written a little test program.... it defines 17 sampler vars....
The compiler says
"error C6012: Sampler limit exceeded; more than 16 samplers needed to compile program"

Damn it! Other ideas....? it must be possible....

Tobi




#extension GL_EXT_gpu_shader4 : enable

uniform sampler2D test1;
uniform sampler2D test2;
uniform sampler2D test3;
uniform sampler2D test4;
uniform sampler2D test5;
uniform sampler2D test6;
uniform sampler2D test7;
uniform sampler2D test8;
uniform sampler2D test9;
uniform sampler2D test10;
uniform sampler2D test11;
uniform sampler2D test12;
uniform sampler2D test13;
uniform sampler2D test14;
uniform sampler2D test15;
uniform sampler2D test16;
uniform sampler2D test17;

void main(void)
{
gl_FragColor = texture2D(test1, vec2(0.5, 0.5)) +
texture2D(test2, vec2(0.5, 0.5)) +
texture2D(test3, vec2(0.5, 0.5)) +
texture2D(test4, vec2(0.5, 0.5)) +
texture2D(test5, vec2(0.5, 0.5)) +
texture2D(test6, vec2(0.5, 0.5)) +
texture2D(test7, vec2(0.5, 0.5)) +
texture2D(test8, vec2(0.5, 0.5)) +
texture2D(test9, vec2(0.5, 0.5)) +
texture2D(test10, vec2(0.5, 0.5)) +
texture2D(test11, vec2(0.5, 0.5)) +
texture2D(test12, vec2(0.5, 0.5)) +
texture2D(test13, vec2(0.5, 0.5)) +
texture2D(test14, vec2(0.5, 0.5)) +
texture2D(test15, vec2(0.5, 0.5)) +
texture2D(test16, vec2(0.5, 0.5)) +
texture2D(test17, vec2(0.5, 0.5));
}
If you realy need that much textures why don't you use the new texture object array extension? So you can use for example for every texture channel 16 1024x1024 Textures, that would make 16x16 Textures = 256 Textures, that should be enough :D
http://3d.benjamin-thaut.de
Yes but why doesn't #extension GL_EXT_gpu_shader4 : enable work?
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
did you specify the version 1.2 in the top of the shader files?
Hi,

this is a good suggestion.... I get a warning that I must add "#version 110" for using "ARB_texture_rectangle"....
I will swap "#version 110" with "#version 120".... I hope this will solve my problem....

I can't check it at the moment, because I don't have a gf 8 at home but I am looking forward to Monday.... :)

Have a nice weekend,

Tobi
Hello,

Damn it!
I have changed the shader but it still doesn't work.... :(

Can please somebody with a GeForce 8 verify the shader....
Do I need further GL commands (like glEnable(..))?
I have the latest driver from NVIDIA installed...

Cheers,
Tobi

-----------

#extension GL_EXT_gpu_shader4 : enable
#version 120


uniform sampler2D test1;
uniform sampler2D test2;
uniform sampler2D test3;
uniform sampler2D test4;
uniform sampler2D test5;
uniform sampler2D test6;
uniform sampler2D test7;
uniform sampler2D test8;
uniform sampler2D test9;
uniform sampler2D test10;
uniform sampler2D test11;
uniform sampler2D test12;
uniform sampler2D test13;
uniform sampler2D test14;
uniform sampler2D test15;
uniform sampler2D test16;
uniform sampler2D test17;

void main(void)
{
gl_FragColor = texture2D(test1, vec2(0.5, 0.5)) +
texture2D(test2, vec2(0.5, 0.5)) +
texture2D(test3, vec2(0.5, 0.5)) +
texture2D(test4, vec2(0.5, 0.5)) +
texture2D(test5, vec2(0.5, 0.5)) +
texture2D(test6, vec2(0.5, 0.5)) +
texture2D(test7, vec2(0.5, 0.5)) +
texture2D(test8, vec2(0.5, 0.5)) +
texture2D(test9, vec2(0.5, 0.5)) +
texture2D(test10, vec2(0.5, 0.5)) +
texture2D(test11, vec2(0.5, 0.5)) +
texture2D(test12, vec2(0.5, 0.5)) +
texture2D(test13, vec2(0.5, 0.5)) +
texture2D(test14, vec2(0.5, 0.5)) +
texture2D(test15, vec2(0.5, 0.5)) +
texture2D(test16, vec2(0.5, 0.5)) +
texture2D(test17, vec2(0.5, 0.5));
}
Doesn't work on my pc either. I don't think this is possible yet. Anyway why do you need 17 textures in a shader?
http://3d.benjamin-thaut.de

This topic is closed to new replies.

Advertisement