How to Use NV_vertex_program3 in GLSL

Started by
5 comments, last by skyman_cn 15 years, 12 months ago
Hi all, I want to use NV_vertex_program3 in GLSL. The spec says that one should add OPTION NV_vertex_program3; at the begin of the vertex program. But when I added it to my GLSL vertex shader code, the program generated errors as follows: (1) : error C0000: syntax error, unexpected ';' at token ";" (1) : error C0501: type name expected at token ";" (1) : warning C7022: unrecognized profile specifier "NV_vertex_program3" (1) : warning C7022: unrecognized profile specifier "OPTION" (3) : warning C7537: OpenGL does not allow 'varying' after a type specifier (3) : warning C7514: OpenGL does not allow varying of type error (10) : error C0000: syntax error, unexpected identifier at token "vec4" (10) : error C0501: type name expected at token "vec4" ... My video card is NV Geforce 7300 GT, and the driver is Forceware 169.21. Can anyone tell me how to use NV_vertex_program3 in GLSL? Thanks in advance.
Advertisement
Quote:
I want to use NV_vertex_program3 in GLSL.

You can't. NV_vertex_program3 is for ASM shaders, not for GLSL.
And what you need from NV_vertex_program_3? Most features of it are already supported by GLSL, such as Vertex Texture Fetch, and texture sampling with lod, bias and projective ones.
The nvidia driver can decide the most optimal binary to generate so there isn't much of a need for the asm extensions.

*** actually, nvidia converts the GLSL to one of those asm targets and from there it optimizes and generates a binary which goes to the GPU.
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);
Thanks, everyone.
I use Vertex Texture Fetch of NV_vertex_program3.
When I run my program in my notebook PC, it runs OK, its video card is NV GeForce 8300. But when I run the program in my desktop PC, it runs Error, its video card is NV GeForce 7300. The Error is:

Vertex info
-----------
Internal error: assembly compile error for vertex shader at offset 11149:
-- error message --
line 468, column 27: error: too many instructions
-- internal assembly text --
!!ARBvp1.0
OPTION NV_vertex_program3;
# cgc version 2.0.0018, build date Dec 5 2007
# command line args:
#vendor NVIDIA Corporation
#version 2.0.1.18
#profile vp40
#program main

...

It saids: "too many instructions", and it seems that the driver compiles the GLSL in VP4.0. Is the max instructions count of GeForce 8300 more than GeForce 7300 for VP4.0?

By the way, see "!!ARBvp1.0" , does it mean using vp1.0? Why not ""!!ARBvp2.0"? :)

Thanks a lot!
Gf 7300 is a SM 3 GPU and the VS instruction limit is 512.
Gf 8 is 64K

There is no !!ARBvp2.0 so NV uses ARBvp1.0 and inserts their custom instructions that's why there is a OPTION NV_vertex_program3; in there.
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);
Quote:Original post by V-man
Gf 7300 is a SM 3 GPU and the VS instruction limit is 512.
Gf 8 is 64K

There is no !!ARBvp2.0 so NV uses ARBvp1.0 and inserts their custom instructions that's why there is a OPTION NV_vertex_program3; in there.


Oh, I c. Thank you very much.

This topic is closed to new replies.

Advertisement