I have a custom vertex structure


FLOAT x, y, z, w;
DWORD color;

I create a vertex buffer for a single red triangle.
Then I render the primitive with vertex shader set to:
g_pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
Everything works fine.
But when I try to create my own vertex shader like this
DWORD dwDecl[] =
g_pd3dDevice->CreateVertexShader( dwDecl, NULL, &m_hVertexShader, 0 );

My app crashes as it tryes to create vertex shader.
What do I do wrong? (same result with the D3DUSAGE_SOFTWAREPROCESSING).

And another question...
Where does vertex shader assembler come from?
What is this language? Does it produce code that my video card processor anderstand, or is it just microsoft invention and has nothing to do with hardware?
Please don't be mad for the C code. I swear I'll try to code it in asm as soon as it works in C.
Posted on 2002-12-05 04:32:31 by Vaxon
Afternoon, Vaxon.

Do a search of the DolphinVS example of Microsofts'. Use the words "D3DXAssembleShader" or "CreateVertexShader".

In that example, it uses vertex shaders for manipulating the Dolphin object.

One thing that you've got to remember is that, even though you're creating your own vertex shader, you still require the :

FLOAT x, y, z, w;
DWORD color;


Depending upon your vid card, you will probably find that a programmable vertex shader can only be used in Hardware mode.

I have an example on my site called "Vertex-Shader.asm" (in the DX8.1 examples page) which uses programmable vertex shaders.

The language of the shader code is a form of RISC (IIRC "reduced instruction set cumthing").
Nothing like using two forms of assembly in the same proggy :grin: :alright:

Posted on 2002-12-05 05:49:34 by Scronty
You should go to the vendor site of your graphic card.
There you will find a devkit which more than likely contains a shader compiler.
If you're lucky there will be a shader development application.

Note- You can load shaders from text files !!!

Posted on 2002-12-09 00:00:17 by Homer