PDA

View Full Version : Shader and program ...



Groovounet
01-09-2005, 10:56 PM
I have questions about the difference between Shader and Program :
- 1) What is the difference between Vertex Shader and Vertex program ?
- 2) Why ARB define two extensions (GL_ARB_vertex_shader and GL_ARB_vertex_program) to provide GPU vertex programming ?

jackmack
01-10-2005, 02:37 AM
Originally posted by Groovounet:
I have questions about the difference between Shader and Program :
- 1) What is the difference between Vertex Shader and Vertex program ?
- 2) Why ARB define two extensions (GL_ARB_vertex_shader and GL_ARB_vertex_program) to provide GPU vertex programming ?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.

2) 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

Obli
01-10-2005, 02:39 AM
Originally posted by Groovounet:
I have questions about the difference between Shader and Program :
- 1) What is the difference between Vertex Shader and Vertex program ? 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.

V-man
01-10-2005, 12:28 PM
Originally posted by Groovounet:
I have questions about the difference between Shader and Program :
- 1) What is the difference between Vertex Shader and Vertex program ?
- 2) Why ARB define two extensions (GL_ARB_vertex_shader and GL_ARB_vertex_program) to provide GPU vertex programming ?1)

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.

2)

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".

Groovounet
01-10-2005, 10:34 PM
Thanks to all answers ! :)

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.