• Advertisement
Sign in to follow this  

How to use shaders from psh & vsh files?

This topic is 4359 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

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
Advertisement
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
Here I use directx(dec 2005), the sample project can be installed from directx sample brower. After installation, the sample project can be compiled and run properly here.

Share this post


Link to post
Share on other sites
Hi, thanks supersonicstar, yeah, I can check out the code for hlsl with out effects, but I might have to ask on another forum about the COFF file problem?

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
Sign in to follow this  

  • Advertisement