Shader and program ...

I have questions about the difference between Shader and Program :

    1. What is the difference between Vertex Shader and Vertex program ?
    1. Why ARB define two extensions (GL_ARB_vertex_shader and GL_ARB_vertex_program) to provide GPU vertex programming ?

Originally posted by Groovounet:
[b]I have questions about the difference between Shader and Program :

    1. What is the difference between Vertex Shader and Vertex program ?
    1. Why ARB define two extensions (GL_ARB_vertex_shader and GL_ARB_vertex_program) to provide GPU vertex programming ?[/b]
      Hi !

I have spend some time with reading books and articles about shaders. I think the answers for your questions are

  1. You can say “Vertex Shader” for the hardware-implemented shader (processor) or say “Vertex Shader” for the shader code (glSlang or GLSL).

“Vertex Program” means the compiled shader code which runs in GPU.

  1. GLSL is specified in OpenGL 2.0. But there are only few graphics adapter today which support 2.0. But many supports shader programming. Therefore the ARBs are used to extend the graphics adapter functionality.

There are some steps to load the shader code (doing with GL_ARB_vertex_shader) and some steps for create an “vertex program” (GL_ARB_vertex_program).

Hope this helps … and is correct !

Ask also the shaders or advanced forum.

Bye

Originally posted by Groovounet:
[b]I have questions about the difference between Shader and Program :

    1. What is the difference between Vertex Shader and Vertex program ? [/b]
      As far as I know, this two used to be the same thing, the first in DX-slang, the second in GL-slang, where “slang” is to be meant as “way of speaking”. More recently, “shaders” are meant to be high-level code, while “programs” are usually referred to ASM ARB extensions. I think those two are exchangeable without problem.

Originally posted by Groovounet:
- 2) Why ARB define two extensions (GL_ARB_vertex_shader and GL_ARB_vertex_program) to provide GPU vertex programming ?
Not sure but I think ARB_vertex_shader is the old programming thechinque (EXT_vertex_shader?) based on binary opcodes… or maybe it’s HLSL extension? Uh, I’ll check the extension registry, in the meanwhile, take my words with some salt.

EDIT: ok, ARB_vertex_shader is the ARB vertex programming extension for HLSL, so, ARB_vp -> low level, ASM like programming, ARB_vs -> high level shading language.

Originally posted by Groovounet:
[b]I have questions about the difference between Shader and Program :

    1. What is the difference between Vertex Shader and Vertex program ?
    1. Why ARB define two extensions (GL_ARB_vertex_shader and GL_ARB_vertex_program) to provide GPU vertex programming ?[/b]

They do the same thing. In GL, they were “programs” instead of “shaders” because shading doesn’t fully describe what it does.
Besides, a vertex is a mathematical concept and can’t be shaded.

GL_ARB_vertex_program was created before GL_ARB_vertex_shader.

GL_ARB_vertex_program served it’s purpose for a short time.

GL_ARB_vertex_shader is much more sophisticated and is a high level language. It’s part of GLSL along with GL_ARB_fragment_shader.

Notice how in GL, it’s called fragment and not “pixel”.

Thanks to all answers ! :slight_smile:

I find an other answers into the GLSL spec :

Note: Shader is used to denote a single independent compilation unit. Program is used to denote a set of shaders linked together.