Sign in to follow this  
Stevieboy

How to use shaders from psh & vsh files?

Recommended Posts

Hi, so far I've been able to use a shader from an fx file, but I'd like to use psh & vsh files as I think this is the proper way to learn them (so theres no surprises later on or anything). So whats needed, can you still use HLSL with them? Are they written the same as an fx file but just loaded as vsh & psh, also what function is used to load them. At the moment I'm using D3DXCreateEffectFromFile to load my fx file. Thanks in advance for any help & replys.

Share this post


Link to post
Share on other sites
Thanks for that I'll take a look.

Um, One other thing, for some reason I've never been able to get any of the sample programs to work, I keep getting COFF & Manifest file errors, does any one know of a solution to this?

Share this post


Link to post
Share on other sites
Usually they contain assembly language vertex and pixel shaders (vsh=vertex shader, psh=pixel shader).

Depending on when you want to create your shaders, they can either be assembled into binary shaders at build time using vsa.exe and psa.exe or passed to functions such as D3DXAssembleShaderFromFile().

Apart from the above traditional uses of those types of files, really .vsh and .psh are nothing more arbitrary filename extensions - they're just text files. In their traditional guise, the first line of the file usually has the shader version number that the code targets, e.g. ps.1.4 or ps_1_4


One sneaky thing you /can/ do is load a psh or vsh file from inside an effect file, using something like:


// myEffect.fx

technique Blah
{
pass P0
{
VertexShader = compile vs_2_0 VS();
PixelShader = asm {
#include "C:\myPixelShader.psh"
};
}
}

Share this post


Link to post
Share on other sites
<shameless-plug>

The HDRPipeline sample (in both the Dec'05 and Feb'05 SDK's) use HLSL shaders directly from a number of vsh and psh files. Could be another useful example if you want to see how it can be done...

</shameless-plug>

hth
Jack

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this