Archived

This topic is now archived and is closed to further replies.

Wierdness in DX8 (vertex shaders)

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

Ok, heres the deal: I made a simple vertex shader app, that could switch between a programmable vertex shader, and a standard rendering of a polygon. I got it up, but the vertex shader fails... Heres the wierd part, I tried a simple enumeration of the vertex shader capabilities... In my app, along with the DX caps viewer my GeForce2 MX 200 does not support vertex shaders... but it does. I know it does, partially because nVidia says so, and also because the vertex shader sample app works with the HAL... Do any of you guys have a clue what could be going on here? I''m stumped... so any ideas would be greatly appreciated. -Lonely

Share this post


Link to post
Share on other sites
I''m not completely sure I understand your question, but here goes...

You can use vertex shaders, but you should specify SOFTWARE_VERTEX_PROCESSING if you want to use the shaders on nonGF3 cards.

Does that solve your problem?

Share this post


Link to post
Share on other sites
I''m pretty sure that won''t help... I''ll try it, but the dx sample app (the one that ripples the square) runs in hardware... so I shouldn''t have to resort to the refrence drivers

Anybody have any other ideas?

I''m still not sure why it works in the sample app and not mine...

btw - in my earlier post when I said I tried simple enumeration of the vertex shader, I ment I was filling a D3DCAPS8 structure and queried (sp?) for the suggested variables in the documentation... VertexShaderVersion comes up as 0.0 even though I''ve SEEN working vertex shaders on MY system... in my opinion thats very odd!!!

-Lonely

Share this post


Link to post
Share on other sites
No - SOFTWARE_VERTEX_PROCESSING is not the same as DEVTYPE_REF!!!

On GF2 cards, vertex shaders run quickly, but not in hardware, the software implementations are pretty fast and they run with the HAL, it''s just that the processing is done in software. read the SDK...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
So why the heck are the reference drivers so much slower than the HAL using software vertex processing?

-andy

Share this post


Link to post
Share on other sites
You sort of answered your own question. Vertex shaders are not supported on any hardware other than NV20 chips. The card still rasterizes and displays the final image in hardware, but it does not process any geometry in hardware. My old Voodoo 5, and my GeForce 2MX support vertex shaders but did all the processing in software. The shaders will work fine in software, and they provide an interface to some seriously fast SIMD instructions. I''d still use them because hardware that takes advantage of them will become more prevalent pretty quickly I think.

Share this post


Link to post
Share on other sites
One thing still puzzles me: why do pixel shaders run so slow? Shouldn''t they be able to take advantage of the same processing?

My sample works now though... so I owe you all thanks...

-Lonely

Share this post


Link to post
Share on other sites
Some very quick definitions:

HAL - use the hardware (vendor) driver to do as much as possible

REF - use the reference driver, which is written to serve as a 100% DX8 compatible *reference* implementation. Meaning - the focus is more on completeness and correctness rather than speed. Everything is done in software, from geometry to rasterizing

HARDWARE_VERTEX_PROCESSING - do all vertex manipulation in hardware. If you have this set and you try to use shaders on an older card, it will fail.

SOFTWARE_VERTEX_PROCESSING - do the vertex manipulation on the CPU, but everything else on the card. Usually, the shaders are pretty darn fast because there are MMX, 3DNow, etc. optimizations built into them. Once the vertices are processed, the card does most of the rest. Note that this is very different from REF.

About pixel shaders. There is no SOFTWARE_PIXEL_PROCESSING, so if you want to use pixel shaders on older hardware, you have to specify REF, which slows down everything. Hence, the slowness...

Share this post


Link to post
Share on other sites
This is what I found in MSDN site. It is for d3dapp sample.

To Check Caps for Vertex shader:

  
//-----------------------------------------------------------------------------

// Name: ConfirmDevice()

// Desc: Called during device intialization, this code checks the device

// for some minimum set of capabilities

//-----------------------------------------------------------------------------

HRESULT CMyD3DApplication::ConfirmDevice( D3DCAPS8* pCaps, DWORD dwBehavior,
D3DFORMAT Format )
{
if( (dwBehavior & D3DCREATE_HARDWARE_VERTEXPROCESSING ) ||
(dwBehavior & D3DCREATE_MIXED_VERTEXPROCESSING ) )
{
if( pCaps->VertexShaderVersion < D3DVS_VERSION(1,0) )
return E_FAIL;
}

return S_OK;
}

Share this post


Link to post
Share on other sites