PDA

View Full Version : can't understand one line of Cg



vivek vyas
07-24-2009, 11:15 PM
please reply to this

i am reading nVidia's Cg
i learned many thing but a line in that i can't understand

void AnyFun(float4 color :COLOR,float4 pos: POSITION) :COLOR{
/*defination*/}

the part is


POSITION) :COLOR
asfter ) the :COLOR what give meaning in function
is it affect POSITION binding semantics
this is really doubtful thing i stucked in that
but all are just ok

thanks for just readng the post and thinking on questions
thanks in advance

vivek vyas
07-25-2009, 03:44 AM
OK don't reply i read some thing
which says it give job to CPU instead of heart of Graphic card(GPU)

Dark Photon
07-27-2009, 05:33 AM
OK don't reply i read some thing
which says it give job to CPU instead of heart of Graphic card(GPU)
If you're saying this describes the logic in that shader, then no, that's not even close.


void AnyFun(float4 color :COLOR,float4 pos: POSITION) :COLOR
{ /*defination*/}

What this says is that AnyFun is a shader which accepts values from the POSITION and the COLOR registers as input, and returns a value in the COLOR register as output.

Since vertex shaders are typically required to generate POSITION outputs (for culling/rasterization/etc.), and fragment shaders typically generate COLOR outputs, this is most likely a fragment shader.