Shader Model 3.0 semantic mapping

Nick 102 May 01, 2008 at 16:30

Hi all,

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

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

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

So how exactly do individual components map from the vertex shader to the pixel shader?

Any insights much appreciated. :worthy:

1 Reply

Please log in or register to post a reply.

Nick 102 May 04, 2008 at 12:36

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