How to use shaders from psh & vsh files?

Started by
5 comments, last by jollyjeffers 18 years, 1 month ago
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.
Advertisement
I just search "vsh" in dx docs, and I find this one, HLSLwithoutEffects Sample.
Have you tried it?
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?
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.
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?
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.fxtechnique Blah{    pass P0    {           VertexShader = compile vs_2_0 VS();        PixelShader  = asm {            #include "C:\myPixelShader.psh"        };    }}

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

<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

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

This topic is closed to new replies.

Advertisement