Skip to main content
gamedev.net
🔒 Locked

Video Card problem???

Started by WebsiteWill 17 replies 1.1k views
Original Post
WebsiteWill
WebsiteWill
I made this test program.
	m_VB[0].x = 0;
	m_VB[0].y = 0;
	m_VB[0].z = 0.0f;
	m_VB[0].color = D3DCOLOR_ARGB(255,0,255,0);
	m_VB[0].u = 0.0;
	m_VB[0].v = 0.0;

	m_VB[1].x = 50;
	m_VB[1].y = 0;
	m_VB[1].z = 0.0f;
	m_VB[1].color = D3DCOLOR_ARGB(255,0,255,0);
	m_VB[1].u = 1.0;
	m_VB[1].v = 0.0;

	m_VB[2].x = 0;
	m_VB[2].y = 50;
	m_VB[2].z = 0.0f;
	m_VB[2].color = D3DCOLOR_ARGB(255,0,255,0);
	m_VB[2].u = 0.0;
	m_VB[2].v = 1.0;

	m_VB[3].x = 50;
	m_VB[3].y = 50;
	m_VB[3].z = 0.0f;
	m_VB[3].color = D3DCOLOR_ARGB(255,0,255,0);
	m_VB[3].u = 1.0;
	m_VB[3].v = 1.0;

	m_IB[0] = 0;
	m_IB[1] = 1;
	m_IB[2] = 2;
	m_IB[3] = 2;
	m_IB[4] = 1;
	m_IB[5] = 3;



	m_VB[4].x = 0;
	m_VB[4].y = 0;
	m_VB[4].z = 0.0f;
	m_VB[4].color = D3DCOLOR_ARGB(255,255,0,0);
	m_VB[4].u = 0.0;
	m_VB[4].v = 0.0;

	m_VB[5].x = 40;
	m_VB[5].y = 0;
	m_VB[5].z = 0.0f;
	m_VB[5].color = D3DCOLOR_ARGB(255,255,0,0);
	m_VB[5].u = 1.0;
	m_VB[5].v = 0.0;

	m_VB[6].x = 0;
	m_VB[6].y = 40;
	m_VB[6].z = 0.0f;
	m_VB[6].color = D3DCOLOR_ARGB(255,255,0,0);
	m_VB[6].u = 0.0;
	m_VB[6].v = 1.0;

	m_VB[7].x = 40;
	m_VB[7].y = 40;
	m_VB[7].z = 0.0f;
	m_VB[7].color = D3DCOLOR_ARGB(255,255,0,0);
	m_VB[7].u = 1.0;
	m_VB[7].v = 1.0;

	m_IB[6] = 4;
	m_IB[7] = 5;
	m_IB[8] = 6;
	m_IB[9] = 6;
	m_IB[10] = 5;
	m_IB[11] = 7;


	m_VB[8].x = 0;
	m_VB[8].y = 0;
	m_VB[8].z = 0.0f;
	m_VB[8].color = D3DCOLOR_ARGB(255,255,255,255);
	m_VB[8].u = 0.0;
	m_VB[8].v = 0.0;

	m_VB[9].x = 30;
	m_VB[9].y = 0;
	m_VB[9].z = 0.0f;
	m_VB[9].color = D3DCOLOR_ARGB(255,255,255,255);
	m_VB[9].u = 1.0;
	m_VB[9].v = 0.0;

	m_VB[10].x = 0;
	m_VB[10].y = 30;
	m_VB[10].z = 0.0f;
	m_VB[10].color = D3DCOLOR_ARGB(255,255,255,255);
	m_VB[10].u = 0.0;
	m_VB[10].v = 1.0;

	m_VB[11].x = 30;
	m_VB[11].y = 30;
	m_VB[11].z = 0.0f;
	m_VB[11].color = D3DCOLOR_ARGB(255,255,255,255);
	m_VB[11].u = 1.0;
	m_VB[11].v = 1.0;

	m_IB[12] = 8;
	m_IB[13] = 9;
	m_IB[14] = 10;
	m_IB[15] = 10;
	m_IB[16] = 9;
	m_IB[17] = 11;

	G_NUM_VERTS_IN_UI = 12;
	G_NUM_INDICES_IN_UI = 18;


	GetCurrentDisplayDevice()->CreateVertexBuffer
		( G_NUM_VERTS_IN_UI * sizeof(CUSTOMUIVERTEX), 0,
		  D3DFVF_CUSTOMUIVERTEX, D3DPOOL_DEFAULT, &m_pUIVB, NULL );

	CUSTOMUIVERTEX* pVertices;
	
	hr = m_pUIVB->Lock(0, G_NUM_VERTS_IN_UI * sizeof(CUSTOMUIVERTEX), (void**)&pVertices, 0);
	memcpy(pVertices, m_VB, G_NUM_VERTS_IN_UI * sizeof(CUSTOMUIVERTEX));
	m_pUIVB->Unlock();
	GetCurrentDisplayDevice()->CreateIndexBuffer
		( G_NUM_INDICES_IN_UI * sizeof(WORD), D3DUSAGE_WRITEONLY,
		  D3DFMT_INDEX16, D3DPOOL_DEFAULT, &m_pUIIB, NULL);

	WORD* pIndices;
	hr = m_pUIIB->Lock(0, G_NUM_INDICES_IN_UI * sizeof(WORD), (void**)&pIndices, 0);
	memcpy(pIndices, m_IB, G_NUM_INDICES_IN_UI * sizeof(WORD));
	m_pUIIB->Unlock();

//And I render each of the three quads like this

//GetCurrentDisplayDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 4, 0, 2);

GetCurrentDisplayDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 6, 4, 6, 2);
GetCurrentDisplayDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 12, 4, 12, 2);

I run the application from my desktop and I only see the white and gree quads, the first and third initialized and rendered. Second initialized does not show up. I run the application on my wife's computer and it works fine. All three quads show up nested. Now before I go pull this vid card out of my PC and exchange it, anyone know a reason for this? The card runs anything else flawlessly as far as I can tell and if there is still something else I can look for I'd rather do that than exchange the card (it's not exactly a short drive for me). Thanks Webby[/source] [edited by - websitewill on April 25, 2004 3:55:30 PM]
Trip99
Trip99
I have not read through your code but there are a few things to consider: are you running the app on both machines the same way, I mean are you running it in Viz on your machine with the DirectX SDK and in release on your wifes?
------------------------See my games programming site at: www.toymaker.info
tok_junior
tok_junior
Maybe it''s just me, but i didn''t see a SetIndices() inthere?
WebsiteWill
WebsiteWill
I didn''t show all the code as it would have been to long. I have other posts here that have the rest of the code on it.

For how I am runing it. I compiled it and put the .exe into MyDocuments. Copied it to same place on Wife''s and ran both.

Just exchanged the video card but the problem is still there
So it''s back to staring at the code.........

This is starting to suck.

Webby

PS for those willing to help. THANK YOU. The rest of the code is on another couple of posts here in the DirectX forum. Search under my name and you''ll find it. Or I can post it all again but I been cluttering the forums enough with this issue that I hesitate to post much more.

Thanks again,
Webby
WebsiteWill
WebsiteWill
All samples on the SDK run fine. Just test them one by one. The appropriate ones run on Wife''s machine but some won''t because it''s not powerful enough.

I think the problem might be way back in my device initialization code. Might not be detecting this device appropriately. Gonna go spend some time looking at that. I''ll post that code here as well if I don''t get if figured out first.

Webby
WebsiteWill
WebsiteWill
Initialization code is fine. Detects 1 adapter with 54 display modes. I checked in caps viewer and have exactly 54 modes. I iterate through them and store the best one (highest refresh rate for each screen size) and that's pretty much it. I then use an 800 x 600 resolution for my full screen. However, I'm running in windowed mode so the rest of the init is pretty much exactly what you see on the turorials here and in books on Direct X.

Now, through more playing around I have found that just increasing G_NUM_VERTS_IN_UI G_NUM_INDICES_IN_UI enough for a thrid quad (to 12 and 18 instead of 8 and 12) is enough to cause the problem. At 8 verts and 12 indices I get the two quads I expect (green covered by red). However, increasing to 12 and 18 and I lose the second quad. I then only have green covered by white instead of green, red then white.

So it is definitely something to do with the way these vertices are getting stored by this machine.

I did a reinstall of DirectX 9.0b and that hasn't helped. Same problem occurrs in fullscreen mode. Trying to think of any more info I can give that may help... Will edit if I think of something.

Webby

Edit** Set the exe to a couple friends and they both run it fine (all 3 quads visible). Nothing else it could be than some driver on my system or my DirectX files. Going to uninstall and reinstall what I can. It's got to be this..

[edited by - websitewill on April 25, 2004 9:11:14 PM]
WebsiteWill
WebsiteWill
Think part of the problem has been found. Uninstalled and reinstalled the vid card drivers. Using the original drivers from disk now. Reinstalled DirectX and now in debug mode I get this.
Problem is, what does this mean and where to start? Looks like it''s not referencing many of DirectX''s files but how do I go about correcting this stuff? Reinstall apparently. didn''t work.

Loaded ''ntdll.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\kernel32.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\dinput8.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\msvcrt.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\advapi32.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\rpcrt4.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\user32.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\gdi32.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\d3d9.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\d3d8thk.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\version.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\winmm.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\uxtheme.dll'', no matching symbolic information found.
Loaded ''C:\Program Files\ATI Technologies\ATI HydraVision\HydraDMH.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\hid.dll'', no matching symbolic information found.
Loaded ''C:\WINDOWS\system32\setupapi.dll'', no matching symbolic information found.
DrunkenHyena
DrunkenHyena
Those "errors" are not what you think. It''s looking for debug symbols for those DLLs and isn''t finding them because you don''t have them installed. This does not in any way affect how your app runs, the symbols are a debugging aid.

Have you set the CULL state?


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena</FON
WebsiteWill
WebsiteWill
Added it and nothing happens for any of the modes so I took it back out. I am being careful to wind my vertices clockwise when I set them up so I don''t have to worry about them not showing up because they are upside down. Nevertheless, thanks for something else to try.

I just played with my calls to DrawIndexedPrimitive and found some interesting things. (Reference the code above)

If I set the BaseVertexIndex and StartIndex values for the second two calls to DrawIndexedPrimitive I can confirm that the data for the red quad is in the buffer as it draws the bottom left triangle if I set these values to 3 above what it''s supposed to be. If I do the same for the last call (the white quad) it draws the top left triangle, when you''d expect it to draw to bottom left as in the previous call. Something is certainly fishy here and it''s not the fish I caught this weekend.

This is the most basic program. 3 quads, total of 12 verts and 18 indices and only quads 1 and 3 show up. Any one by itself (or any two for that matter) render perfectly fine.


Webby
Trip99
Trip99
The only other thing I can think of is some difference in render states. I have read elsewhere (I forget where) that not all drivers are set to use the correct default states. This is just clutching at straws though
------------------------See my games programming site at: www.toymaker.info
WebsiteWill
WebsiteWill
You may have something there. Today I was able to locate a guy at work who has an ATI All In Wonder 9800 which is pretty much the same card I have and it does the same on his machine as it does on mine. On an ATI 7000ish (Wife''s) it runs fine and on a Geforce 4MX it runs fine. I''m willing to bet that this is something pretty specific to this line of ATI cards that is the issue.

At this point the code is nothing but device initialization, stuffing a vertex buffer with 12 vertices and 18 indices and making 3 calls to DrawIndexedPrimitive.

I have also run some tests with just the vertex buffer and DrawPrimitive and I get similar results. 2 quads are ok and the third messes things up.

Pulling my hair out,
Webby
Alvarny
Alvarny
Probably is something with the ATI cards. Everquest put in a target indicator ring into the game some time ago. For about a month this didn''t display on the 9600/9800 ati cards. They finally did something to get it working so theres obviously something different in those cards.
WebsiteWill
WebsiteWill
Well I put in an email to ATI tonight. Now I guess it will become a waiting game to see if they are even going to respond. You would think that an issue as simple as this would be easy to resolve as it seems like something that would be pretty common, yet I seem to be the only person so far to have experienced this.

It is still bound to be something to do with my code. Something like a special way to initialize this card but you would think these things would be made readily available to developers...

In the mean time, would anyone care to write up a small application that uses vertex and index buffers to display 3 quads on the screen. I don't care where or what color I just want to test. Some code as simple as possible so I can maybe poke out the problem if the code runs correctly on my machine.

My FVF is
float x, y, z
DWORD color
float u,v

Just enough code to get it initialized in windowed or full screen mode (preferrably windowed so I can step through it in the debugger). I understand if noone has the time but it would be a GREAT BIG help. I've gone back to my initialization code which is basically from the tutorials here at GameDev and I can't see any differences in the way I am doing it aside from the fact that I have wrapped a lot of mine into different classes.

Please post any code here or let me know so I will be expecting email.

Thanks for any assistance,
Webby

[edited by - websitewill on April 26, 2004 11:01:30 PM]
Raloth
Raloth
Double, triple, and quadruple check your values for DrawIndexedPrimitive. ATI cards are picky that you get them just right, otherwise not everything is rendered.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
WebsiteWill
WebsiteWill
GetCurrentDisplayDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 4, 0, 2);
GetCurrentDisplayDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 6, 4, 6, 2);
GetCurrentDisplayDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 12, 4, 12, 2);

This is what I have been using. the 6''s and 12''s correspond to the first index of the quad. It always seemed strange that the same parameter would be used twice in a single call but that''s what was required to get things to display on the Geforce. I''m playing around with these values but so far, nada.

Webby
WebsiteWill
WebsiteWill
Got a response from ATI today. Pretty much canned "See our FAQs on our website..." Go to the web links the provide and they address all of these issues that affect other video games and the solution for them all is to download the latest driver...

Go figure.
Webby
Alvarny
Alvarny
I just started playing around with indexes myself having never done it. I couldn''t get it to work using your parameters. What I had to use was

DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,4,0,2);
DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,4,4,6,2);

The parameter names are actually confusing. The 2nd and 3rd infact refer not to indexes at all they refer to how far into the vertex buffer to start.

Found a link in another thread see page 17 and 18.

http://www.ati.com/developer/gdc/D3DTutorial0_Intro_And_Features.pdf
WebsiteWill
WebsiteWill
Alvarny...
YOU DA MAN!

That worked. Pretty wacked up since it still works the other way on my other machines. Here''s what the SDK docs say:

BaseVertexIndex
[in] Offset from the start of the index buffer to the first vertex index. //This definitely sounds like an index buffer index
MinIndex
[in] Minimum vertex index for vertices used during this call.
NumVertices //This is the one I had wrong. I need to find a site but there is one out there that same this is for the INDEX buffer and not the VERTEX buffer. I guess the must have had a Geforce or an older card.

The rest of these I had correct and they are pretty clear when you read them. Not to mention, if you get one wrong you WILL know it.
[in] Number of vertices used during this call, starting from BaseVertexIndex + MinIndex
StartIndex
[in] Location in the index array to start reading vertices.
PrimitiveCount
[in] Number of primitives to render. The number of vertices used is a function of the primitive count and the primitive type. The maximum number of primitives allowed is determined by checking the MaxPrimitiveCount member of the D3DCAPS9 structure.


THANK YOU THANK YOU THANK YOU THANK YOU!!!
Webby

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.