Archived

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

Directx 8.1, index/vertex buffer size limit on Radeon 9700?

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

I've just decided to transfer a terrain rendering project I've been working on from OGL to DX. Here's the problem, though. When I set my vertex buffer size to upwards of 128x128, I get a hard crash on my Radeon 9700. On my Geforce3 machine, however, I've had no such problems. Am I forgetting a parameter of some sort, or is this a graphics card issue? Anyone have any suggestions? Below I have what code is actually going into this process.
  

#define SIZEX 128
#define SIZEY 128

typedef struct
{
	FLOAT x,y,z;
	D3DCOLOR diffuse;
}sVertex;

sVertex HeightMap[SIZEX][SIZEY];

	for(x=0;x<SIZEX;x++)
		for(y=0;y<SIZEY;y++)
		{
			temp=rand()%100/100.0;

			HeightMap[x][y].x=x-SIZEX/2;
			HeightMap[x][y].y=temp;
			HeightMap[x][y].z=y-SIZEY/2;
			
			HeightMap[x][y].diffuse=D3DCOLOR_RGBA(int(temp*255),255-int(temp*255),128+int(temp*127),255);
		}
		if (FAILED(g_pd3dDevice->CreateVertexBuffer(sizeof(sVertex)*(SIZEX)*(SIZEY), 
													0, VertexFVF, D3DPOOL_DEFAULT, &g_pD3DVB)))
		{
		
		}
					
		BYTE *ptr;
					
		if (SUCCEEDED(g_pD3DVB->Lock(0, sizeof(sVertex)*(SIZEX)*(SIZEY), (BYTE**)&ptr, 0)))
		{
			memcpy(ptr, HeightMap, sizeof(sVertex)*(SIZEX)*(SIZEY));
			g_pD3DVB->Unlock();
		}
					
					
		
		
		if (FAILED(g_pd3dDevice->SetStreamSource(0,g_pD3DVB,sizeof(sVertex))))
		{
		    exit(1);
		}      
[edited by - meathelix on March 24, 2003 11:18:57 PM]

Share this post


Link to post
Share on other sites
Hey,

I''m working on a similar project. I''m using the same method you use (create an array first and set the values), but I think it''s better to set the vertexbuffer to a certain size, lock it, and then set the coordinates. I''m going to try that now because my vertexbuffersize also seems to be limited.

Share this post


Link to post
Share on other sites
Check the device caps!

In particular caps.MaxPrimitiveCount and caps.MaxVertexIndex.

Also make sure you''ve got up to date drivers. 16384 vertices does sound kinda low for the limit though, and you shouldn''t ever really get a "hard" crash (if by that you mean blue screen, total lock up or reset), definately not with WHQL certified drivers.


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Ok, I checked the caps and it tells me I''ve got a Max Index Buffer size of 16Mb. Much larger than 640x640 times my vertex size. This clearly makes no bloody sense. I''ve got to be doing something horribly wrong here. I''m trying new drivers to see if this remedies something, but I can imagine a lot of the games I''ve run with this thing since I''ve gotten it use vertex and index buffers.

Rich Wilson
Starving artist, graphics programmer, aspiring game developer
http://mywebpages.comcast.net/Rich_wilson

Share this post


Link to post
Share on other sites
Ok, for anyone following this post, or remotely interested, I think I fixed my problem. For some reason, my 2nd parameter in CreateVertexBuffer was a 0, when in fact, it should have been D3DUSAGE_WRITEONLY.
Now I''ve got my wonderful, 7fps 640x640 brute force terrain.

Rich Wilson
Starving artist, graphics programmer, aspiring game developer
http://mywebpages.comcast.net/Rich_wilson

Share this post


Link to post
Share on other sites