Jump to content
  • Advertisement
Sign in to follow this  
SirKnight

decl block in FX

This topic is 4238 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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>;
}
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!