PDA

View Full Version : [D3D] DrawIndexedPrimitive problem



chronozphere
23-10-2006, 10:00 AM
Hi all. 8)

I recently discovered a bug in my engine. It's about the DrawIndexedPrimitive routine.
Earlier versions of my engine worked fine, but after some major changes, something went wrong. :cry:

Fortunatly i was able to reproduce the bug. I used one of clooties D3D samples.
You can download the source here (http://www.freefilehosting.net/?id=rdn8k6zb9g==)

{It took some time to find free webspace..i hope the download works :) }

I created a triangle (3 Vertices) and an IndexBuffer with 3 Indices. And then i wanted to render it using the following call:


g_pd3dDevice.DrawIndexedPrimitive(D3DPT_TRIANGLELI ST, 0,3 ,0, 1);


Wich is a good call in this case, if i'am not mistaking. :?
Unfortunatly Nothing was rendered. :cry:

But i also tried this:


g_pd3dDevice.DrawIndexedPrimitive(D3DPT_TRIANGLELI ST, 0,2 ,0, 1);


Wich resulted in this:
http://www.techzine.nl/f/g/36261phpNjgOil.jpg

And when i Increased the primitivecount.... like this:


g_pd3dDevice.DrawIndexedPrimitive(D3DPT_TRIANGLELI ST, 0,3 ,0, 2);


The Triangle was rendered correctly like shown below:
http://www.techzine.nl/f/g/36261php5NgPV1.jpg

Can someone explain me, why the first call didn't work and the third did work??

Thanx for your help :)

grudzio
23-10-2006, 02:53 PM
I have run your app and I've got the third (correct) image.
I have GeForce 6600 GT 128MB (Forceware 84.21).

chronozphere
23-10-2006, 03:01 PM
hi.. which OS are you running??

I tested this code both on W98 and WXP. I noticed that Only Win98 had the problem.

The specs:
>Win98: DirectX 8.1b nVidia GeForce 2 MX/MX 400
>WinXP: DirectX 9.0c ATI Radeon X300

Do you guys think i should worry about this bug??
Yeah.. i know... its W98.. very old, and maybe unstable. On the other hand.. it can be my code's fault. :(

Do you guys think this can be fixed by changing some of the code, or is this a W98/DX8 bug?? :? :?

Edit: I have the latest drivers :D

grudzio
23-10-2006, 03:53 PM
which OS are you running??

WinXP + DirectX 9.0c.



On the other hand.. it can be my code's fault.

I know very little of D3D but your code looks good to me. Sorry I can't help you more :(

Clootie
23-10-2006, 07:37 PM
here this one works correctly:
g_pd3dDevice.DrawIndexedPrimitive(D3DPT_TRIANGLELI ST, 0, 3, 0, 1);

If i try to use:
g_pd3dDevice.DrawIndexedPrimitive(D3DPT_TRIANGLELI ST, 0, 3, 0, (2));

- DirectX debug runtime complains:

ODS: Direct3D8: (ERROR) :Index stream does not have required number of indices. DrawIndexedPrimitive failed.
Process Vertices.exe (2504)

-------
WinXP SP2, DX9.0c, GF6600.

chronozphere
24-10-2006, 07:27 AM
ah.. its working correctly on your machine. :)

I like to see a list of debug messages on my machine. Where do i get the DX debugger and how does it work???

Does anyone still have a W98 machine standing in some dusty corner?? can you test this app please??

Clootie
24-10-2006, 02:52 PM
You should find DirectX 8 or 9 SDK that installs on Win98...

chronozphere
24-10-2006, 04:06 PM
I have just installed the DX 8 SDK. :)
But i didnt figured out how to turn on the DX Debugger :( {I downloaded this SDK using P2P so i dont know wether everything works correctly or not}

i have read some pages about DX debugging, but everyone says i must click on the DX icon on my control panel, but i cant find any DX icon there.

Do you know an alternative way of enabling the debugger. Or do you have a link to a DX 9 SDK for W98???

tpascal
24-10-2006, 06:20 PM
I have windows Xp profesional; but i just have directX 8 instaled, When I run your program i get just an empty windows with blue background, but no any message error.

I checked your code and i dont found anything wrong; i was looking for any wrong declared data size, but i found none; i dont have the units for compile your code so I did not experiment any furter, but i sugest try to change your index data size from unsigned 32 bits to 16 bits and see how it runs.

chronozphere
24-10-2006, 07:04 PM
I use clooties headers: click here (http://www.clootie.ru/delphi/download_dx81.html) :)

I will try the 16bit Indices. I dont really understand why this could solve the problem... but its worth a try :razz:

Clootie
24-10-2006, 08:31 PM
While installing DirectX SDK - installer should ask you about installing developer version of DirectX runtime. You should check this option, and after that debug runtime will be installed.

One problem what may arise here: if you have recent version of DirectX already installed - older runtime installation could fail. The only official way to install DX SDK in this case is to install clean version of Win98. Unoffical way - you can try to use one of the available "DirectX uninstallers".

Clootie
24-10-2006, 08:38 PM
Btw: DirectX 8.0a Developer runtime download (from MS) (http://www.microsoft.com/downloads/details.aspx?familyid=746F9E61-98F4-491D-8335-27FAC7D46258&displaylang=en)

chronozphere
26-10-2006, 09:17 AM
It works.. :D Thank you very much.

I just messed a bit with various DX Developer installations... and now i have the DX9 Developer installed.. and finally the DX icon is visible on my control panel :razz: :razz:

And what's next?? :?
How can i see the debug output??

Clootie
26-10-2006, 01:25 PM
It's simple:
1) enable developer runtime in control panel applet
2) look in Output window while running your program from Delphi.

If you are running not from Delphi you can use any utility what can trap OutputDebugMessage() function messages. There is one on sysinternals.com for example (called something like DebugMon IIRC)

chronozphere
26-10-2006, 02:44 PM
Ah thanx it works. :)

Still I have two questions:

>>Can i write to this debug-log myself???
>>Where can i find an overview of all the debug messages D3D generates... and maybe a good D3D-Debug guide.

chronozphere
26-10-2006, 04:28 PM
Yaaahoow... Another bug killed :) :twisted:

My GFX card doesn't seem to support 32bit Indexbuffers. That's the reason why D3D acted weird.
I didn't know that some GFX cards didn't support 32bit Indices. That's also the reason why it worked on your PC. You just have a better Videocard. :)

I never ran into such a "hardware-limitation" bug, but i think its a good lesson for me :razz:

BTW: I still like to know the answers of the above questions about D3D debugging ;)

Clootie
26-10-2006, 08:43 PM
Ah thanx it works. :)
>>Can i write to this debug-log myself???
>>Where can i find an overview of all the debug messages D3D generates... and maybe a good D3D-Debug guide.
1) call OutputDebugString()
2) probably you will not find any complete list; but generally they are self-decriptive and if not just try to search phrase via Google and it will reveal many comments about it.

tpascal
27-10-2006, 03:44 PM
I never ran into such a "hardware-limitation" bug, but i think its a good lesson for me


There is a way to check in runtime the hardware capability availables.

http://externalweb.exhedra.com/DirectX4VB/Tutorials/DirectX8/GR_Lesson02.asp

I was told that in new directx 10 this is no longer required, coz it is mandatory that all dx10 harware videocard support all features included in the API;