decl block in FX

Started by
3 comments, last by SirKnight 17 years, 5 months ago
I can't find much about using a decl block in an effect and I'm wondering that if you have something like this:

vertexshader vshdr = 
decl
{
   stream 0;
   float v0[3]; //position
   float v3[3]; //normal
   float v7[3]; //uv 1
   float v8[3]; //uv 2
}
asm
{
   vs.1.1
   dcl_position v0
   dcl_normal v3
   dcl_texcoord0 v7
   dcl_texcoord1 v8

   ASM_CODE_HERE...
}
Would that decl block not be needed since the dcl_XXX were used in the shader asm? I read something a while back that you have to use the dcl_XXX stuff if you want a DX8 shader to run in DX9. Thanks.
Advertisement
Bumpity.


Yup.
Didn't reply earlier because I didn't have time to check my documentation. I thought something looked odd, and I can't see any mention in the documentation for this decl{ }asm{ } construct you're using - where did you find out about it?

Cheers,
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

It's one of those weird things in FX that MS doesn't document well or at all. I have come across a lot of these kinds of things recently.

This is used in some games and I found it a few times when googling. One page says it's basically a DX8 thing and in DX9 you should change to use the dcl_XXX things instead. I just wanted to be sure of this and I hoped someone here would be familiar with this weirdness.

I first came across it when working with developers at work. I can't remember what game it was that used it but it's out there (unfortuantly).
Here is a more complete example of its usage.

Foo.fx
---

vertexshader vs =
decl {
stream 0;
float v0[3];
etc...
}
asm {
vs.1.1
DoSomethingWithv0
etc...
};

pixelshader ps =
asm {
ps.1.1
etc...
};

technique t0 {
pass p0 {
VertexShader = <vs>;
PixelShader = <ps>;
}
}

This topic is closed to new replies.

Advertisement