Sign in to follow this  
mjolson

Linux: NV_vertex_program3 is neither fast nor functional?

Recommended Posts

I'm trying to get displacement mapping working in my terrain renderer, but I'm having trouble with my vertex program (using ARB_vertex_program, as NVidia's 61.11 drivers apparently don't support vertex-shader texture sampling in GLSL). The shader seems to compile without problems -- at least, glProgramStringARB doesn't complain about it -- but when running with the vp bound, my framerate drops from about 75fps to 0.5fps, no displacement of the vertices happens, and all of the triangles render in black. Is this a vertex_program3 issue, or is it just a result of my lack of experience with ARB_vertex_program? I'm running on Linux 2.4.18, with a GF6800 Ultra and 61.11 drivers. As far as glxinfo's concerned, the card and drivers combo supports GL_NV_vertex_program3. Here's my shader code:
char* dmap_vert_shader = 
    "!!ARBvp1.0\n"                                      /* 1 */ 
    "OPTION NV_vertex_program3;\n"                      /* 2 */
    "PARAM mvp[4] = {state.matrix.mvp};\n"              /* 3 */
    "PARAM texmat[4] = {state.matrix.texture};\n"       /* 4 */
    "TEMP pos, displace;\n"                             /* 5 */
    /* vertex texture lookup */
    "TEX displace, vertex.texcoord, texture[1], 2D;\n"  /* 6 */ 
    /* do funky stuff here; TEX has latency */
    "MOV result.texcoord[0], vertex.texcoord;\n"        /* 7 */ 
    "MOV pos.w, 1.0;\n"                                 /* 8 */
    /* scale vertex */
    "ADD pos.z, displace.x, vertex.position.z;\n"       /* 9 */
    "MOV pos.x, vertex.position.x;\n"                   /* 10 */
    "MOV pos.y, vertex.position.y;\n"                   /* 11 */
    /* transform to clip space */
    "DP4 result.position.x, mvp[0], pos;\n"             /* 12 */
    "DP4 result.position.y, mvp[1], pos;\n"             /* 13 */
    "DP4 result.position.z, mvp[2], pos;\n"             /* 14 */
    "DP4 result.position.w, mvp[3], pos;\n"             /* 15 */
    "END";  

Share this post


Link to post
Share on other sites
what type of textures are you using in the vertex program?

I've heard that you can only use GL_RGBA_FLOAT32_ATI type textures(that would be the internal format). If you use any other type of texture, it emulates the vertex program in software. That would explain the drastic frame decrease.

Try to fool around with the texture type, and see if you can get it to run faster.

I have an Nvidia card. I have to set the texture target as GL_TEXTURE_RECTANGLE_NV instead of GL_TEXTURE_2D when using 32-bit float textures. This also means that your texture coordinates will be [0-w,0-h] instead of [0-1,0-1].

Let us know if you get it working.

Robbie

Share this post


Link to post
Share on other sites
Quote:
Original post by mrrolf810p
what type of textures are you using in the vertex program?

I've heard that you can only use GL_RGBA_FLOAT32_ATI type textures(that would be the internal format). If you use any other type of texture, it emulates the vertex program in software. That would explain the drastic frame decrease.

Try to fool around with the texture type, and see if you can get it to run faster.


Damn, you're right!

Quote:
NVidia whitepaper
Currently only the GL_LUMINANCE_FLOAT32_ATI and GL_RGBA_FLOAT32_ATI formats are supported for vertex textures.


I guess I'd focused too much on the vertex program itself, and forgotten to read the whole document... :-(

Good catch; I'll give that a go.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this