Sign in to follow this  
gjaegy

[SOLVED] Vertex attributes limits (nvidia) ?

Recommended Posts

gjaegy    126
Hi everybody, I'm currently implementing a PRT solution using sperical harmonics (without the help of the D3DX lib). Currently I don't compress my coefficients, and store them per vertex for each color channel (R,G,B). I'm using a 4-bands approximations, i.e. I've to store: 16 * 3 = 48 floats per vertex I know it's not optimal, but compression may come later on. My problem is, everything goes allright with my old Radeon 9600 mobility card. But with a NVidia 6800 (with latest drivers installed) the screen is black, and the framerate quite low (13fps compared to >100fps on the ATI). I've debbuged in and it seems that all the D3D calls successfully complete. Now my question, is there a limitation on the size of a vertex with NVidia cards ? As a hints, I successfully managed to launch a monochrome version of the scene (i.e. 16 coefficients only) on both cards. The vertex declaration I use is the following (the coefficients are store in the BLENDWEIGHT fields):
const D3DVERTEXELEMENT9 g_Declaration_POS_NOR_COL_TEX1_SHRGB[] = 
{ 
	{0, 0,	D3DDECLTYPE_FLOAT3,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
	{0, 12, D3DDECLTYPE_FLOAT3,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 },
	{0, 24, D3DDECLTYPE_D3DCOLOR,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0},
	{0, 28, D3DDECLTYPE_FLOAT2,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
	{0, 36, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 0},
	{0, 52, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 1},
	{0, 68, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 2},
	{0, 84, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 3},

	{0, 100, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 4},
	{0, 116, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 5},
	{0, 132, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 6},
	{0, 148, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 7},

	{0, 164, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 8},
	{0, 180, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 9},
	{0, 196, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 10},
	{0, 212, D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 11},

	{0, 228,D3DDECLTYPE_FLOAT4,	D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0 },
	D3DDECL_END()
};
It is created without any problem on both cards. Does anybody has an idea, what the problem could be ? I'm using DirectX 9.0c and Cg 1.4 for the shaders, which also compiles without any problem. Thanks very much, Greg [Edited by - gjaegy on December 5, 2005 9:00:41 AM]

Share this post


Link to post
Share on other sites
jollyjeffers    1570
Might be worth checking the D3DCAPS9::MaxStreamStride field for the current device. My Radeon 9800 reports 508 yet the reference rasterizer report 256. I would hazard a guess that if your NV6800 reports less than 232 then you've found your problem [smile]

I'd really look into that compression - 232 bytes per vertex is crazy [grin]

Jack

Share this post


Link to post
Share on other sites
neneboricua19    634
That is strange indeed. Do you get any weird warnings in the debug spew? What happens if you try to run it using the reference rasterizer?

At the moment, I would be more concerened about the image coming out all black than the performance difference. You can debug the performance issue later using PIX or something else. As far as I know, the size of your vertex will only limit your performance, not break your code all-together.

neneboricua

Share this post


Link to post
Share on other sites
gjaegy    126
Thanks to you guys for having answered. I get a little bit more informations, as I installed the DX SDK on this "NVidia powered" computer.

So first I checked the caps, I get 255 for the D3DCAPS9::MaxStreamStride field, so it should be ok (my structure stride is 244).

First thing to note, when using the Reference Rasterizer, the scene is displayed correctly, and no error are displayed in the debug information window.

But when running with the normal HAL rasterizer and the DX debug runtime, I get no error in the debug output window, until I call the Present() method, which sends a:

Direct3D9: (ERROR) :Driver returned error: DDERR_INVALIDPARAMS

and cause a call to the Reset() method (that's why the low framerate = 1 Reset() per frame).

Anyway I'm not sure if it's not a driver bug ??

Share this post


Link to post
Share on other sites
gjaegy    126
Actually I managed to solve the problem.

The problem didn't come from the size of the vertex, but from the number of attributes, which is limited to 16 (ie. the vertex declaration is limited to 16 entries).

By removing the unsused attributes I could stay under the limit.

The only question remaining open is why does my ATI card managed to render the scene anyway ? It seems that the limit they have is not the standard one...

Anyway thanks to you all guys!

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