Jump to content


Shader Model 3.0 semantic mapping


1 reply to this topic

#1 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1225 posts

Posted 01 May 2008 - 04:30 PM

Hi all,

I'm playing around a bit with sm 3.0 in RenderMonkey and noticed something odd. I'm using the following shaders:

vs_3_0

def c10, 0, 0.5, 1, 0

dcl_position v0

dcl_position o0

dcl_color0 o1.xz

dcl_color1 o1.yw

m4x4 o0, v0, c0

mov o1, c10


ps_3_0

dcl_color0 v0.xz

dcl_color1 v0.yw

mov oC0, v0
As expected, I get a light blue object: RGB = (0, 0.5, 1). But the odd thing is that the pixel shader input declaration has no effect on the color. The following two declarations give me the same light blue:

dcl_color1 v0.xz

dcl_color0 v0.yw


dcl_color0 v0.xy

dcl_color1 v0.zw
So how exactly do individual components map from the vertex shader to the pixel shader?

Any insights much appreciated. :worthy:

#2 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1225 posts

Posted 04 May 2008 - 12:36 PM

I think I figured it out. The semantics just define a mapping between the o# and v# registers (vertex shader output registers to pixel shader input registers). They don't map specific components, just whole registers. So the 'light blue shader' above even works with just "dcl_color0 v0", the rest is redundant (but might make it easier to understand the shader).





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users