Dx9 Max2d(Please Test)

BlitzMax Forums/BlitzMax Programming/Dx9 Max2d(Please Test)

DStastny(Posted 2006) [#1]
After a few months of off and on work, I think I finally have a stable Dx9 Max2d driver. Unfortunately I don’t have much access to various graphic cards and although I coded carefully I am sure there might be some bugs, as I had to read/reverse engineer the BRL code to determine what it what it was doing in many cases.

The driver as tested by me is a 100% complete implementation and works under MAXGUI as well as BMAX graphics commands. Depending on coding style I am seeing performance on par and better than OpenGL. Now be sure to test with DEBUG off when quoting performance differences.

What I am looking for is definitive rendering differences between opengl and directx7 so simple samples that demonstrate any problems is greatly appreciated and will make improving of this driver much easier. Issues such as tearing in window mode and driver lag hacks that have been used with DX7 driver should not be necessary. The driver uses a fixed pipeline and was designed to be compatible with DirectX7 device drivers. What this means is if your video card supports DirectX7 you just need to install the DirectX 9 interfaces and it will work correctly. You don’t need to have a Dx9 card to use DirectX9 API.

http://smokenmirrors.com/Downloads/Dx9Max2d.zip

Contains the driver and some simple programs to demonstrate usage.

Note the driver is not currently a Mod as I had to implement additional parts of the DX9 interfaces and that would require rebuild of pub.directx.

I am eager to see how this goes so thanks for any feedback in advance.

The code is provided as is and subject to appropriate license of BRL since it is derived work of there rendering API

Doug Stastny


TartanTangerine (was Indiepath)(Posted 2006) [#2]
Bah, I need to install one of those stupid DX9 runtimes - to me, and to my potential customers, that means it's completely useless.


ozak(Posted 2006) [#3]
Damn Indiepath. That's some nice and constructive criticism right there :)


klepto2(Posted 2006) [#4]
@Indiepath: I would say its just one more option to you customers.

@Budman: Very, Very nice. it works very well. Just tested the demos, but will test it with some of my projects as soon as possibly. The demos runs really smooth and without errors.


H&K(Posted 2006) [#5]
HAHAHAHA @ indiepath,

its an option. For example I use the GL driver all the time. It doesnt really mean that the dx7 drivers are useless. Well I suppose it does really, but it still made me laugh.


degac(Posted 2006) [#6]
Here my result:
Example: CLOCK
Driver DX9: 11958-11988
OpenGL : 9254-9259
BufferedDX: 6733-6789

Example: MaxApplication

Fullscreen:
DirectX 9
static (no particle emitted) 2934
0 free particle 548-586

OpenGL
static: 1138-1139
0 free particle: 541-586

System: Athlon64 3500+ 1gb Ram nvidia Ge6600gt


Gabriel(Posted 2006) [#7]
Clock

DX9 - 11820
OGL - 9140
DX7 - 3880

Very nice stuff.


TartanTangerine (was Indiepath)(Posted 2006) [#8]
Um yeah - sorry really nice stuff, I did not mean to be so negative - apologies :)


kfprimm(Posted 2006) [#9]
Budman, why don't you submit your d3d9 modification to the module tweaks forum...maybe mark will update pub.directx


H&K(Posted 2006) [#10]
@Khomy, maybe he wants to charge for it


kfprimm(Posted 2006) [#11]
maybe...but from what i see this is complety done and he's releasing for free. I may be wrong though.


Dreamora(Posted 2006) [#12]
Very nice indeed :-)

Similar results as above with OpenGL en par with DX9.
System: Core Duo T2500 with GeForce 7600Go


DStastny(Posted 2006) [#13]
Thanks for the feedback so far.

Just to be clear its free. Although the license is I believe subject to BRL license since the code is my code, it is derivative work of BRL's driver.

I had done it about 5 months ago but never quite finished it, real job, family and stuff got in way. Spent a couple of days debugging little issues with boring stuff like the way BMX uses the FPU and minor memory leak as well as implementing support of MAXGUI.

I did as mostly as "fun" project.

@Khomy - I intend to post the extended DX9 interfaces however there are a couple more I still need to do, I want it as complete as possible for what I am planning next.

Thanks to everyone for feedback. Even you Inide :)

Doug Stastny


BlitzSupport(Posted 2006) [#14]
Nice work Budman! Little bug report...

After flipping back and forth (average about 8-10 times) between windowed and full-screen, I get a crash, with "Unhandled Exception:Unhandled Memory Exception Error" (even in Debug, I'm afraid). This only happens when going back into full-screen mode. I'm also getting some corruption in the System Tray when going into windowed mode from full-screen (all black around the icons).

I've found a Null 'paste' Pixmap, which I see is used in TDx9DeviceTexture.OnDeviceReset -- could this be relevant? See contents of IDE Debug tab. (I've no idea, since this is all too low-level for my tiny brain.)

However, a quick test showed RockOut (in BlitzMax samples) ran with no changes other than adding this to the top:

Import "Maxapplication.bmx"
Import "Dx9Max2dDriver\Dx9Max2dGraphicsDriver.bmx"
SetGraphicsDriver D3D9Max2DDriver()


Very impressive!


DStastny(Posted 2006) [#15]
Nice one James!

The null field is the source field thats ok. However I was able to duplicate and find the problem. Seems i got bit by the Garbage Collector causing a nice little problem destroying a texture from the devicelist while I was reseting the texture.

Should have fix in place tommorrow, found a couple other issues to address with resetting of device, while using the DirectX debug library.

Oh FYI to use in any program you only need these two lines
Import "Dx9Max2dDriver\Dx9Max2dGraphicsDriver.bmx"
SetGraphicsDriver D3D9Max2DDriver()


The other maxapplication.bmx is my framework :)

Thanks
Doug Stastny


BlitzSupport(Posted 2006) [#16]

The other maxapplication.bmx is my framework :)


Oops! I just copied and pasted for a quick test...


Grisu(Posted 2006) [#17]
Clock:
DX9 - 13000
OGL - 17000
DX7 - 8000

x24600+ and x850xt-pe


gweedo767(Posted 2007) [#18]
Should we expect to see an update to work with 1.24?


DStastny(Posted 2007) [#19]
Yes, Mark changed some of the underlying Max2d. To better work with Dx7, so i needed to handle those changes I also reworked the Dx9 interface to better handle the intgration with MaxGUI as well as provide a simlar interface to the raw DirectX9 interfaces.

I have it working but want to complete a couple of tests and add some CAPs checking to fail more gracefully on unsupported cards. Should be next day or so I will post up a newer version.

Doug Stastny


Who was John Galt?(Posted 2007) [#20]
Wow this sounds excellent, Budman. The free release is very much appreciated.


Dreamora(Posted 2007) [#21]
Sounds excellent. Thanks for letting us know about that.


xlsior(Posted 2007) [#22]
Old version:

DX9 - 6500
OGL - 5000
DX7 - 6000


Derron(Posted 2007) [#23]
Using DX9 made my game not to draw vertical lines

my command:
DrawLine(x+i*2,y+18+18*(Genres),x+i*2,y+32+18*(Genres))


In DX7 and OGL there's no problem, but with DX9 only one pixel is drawn ( the last one - so the one at y+32+18*(Genres) ).



Also if used in fullscreen, one of my test-pcs with an old sis651 (dx7 hardware) had problems with grabpixmap - it colorized everything in purple. On my Radeon 9600Pro the command works without garbaged colors.

Another thing is that on the old sis651 one of my sprites has a graphics distortion from frame-top-left to frame-top-right for an height of 2 pixels (also only with DX9).

Both - DX9 (last edition from november or so) and driver are as up-to-date as possible.



bye
MB


DStastny(Posted 2007) [#24]
@MichaelB,

Thanks, The next release probably wont fix it however I am adding a utility to dump the CAPs of the cards so I can see what I might be able to change.

Thanks
Doug


Derron(Posted 2007) [#25]
Ok, your DX9-mod seems to have also problems with rectangles... some rectangles like

DrawRect(10,15,100,70)

are not drawn

but from the rectangles below (there's no code left out between the drawrects...), only the first is not drawn, the other three ones are drawn the way I excepted it:
DrawRect(20,10,380-(20-fadecount)*19,190-(20-fadecount)*19)
DrawRect(400+(20-fadecount)*19,10,380-(20-fadecount)*19,190-(20-fadecount)*19)
DrawRect(20,195+(20-fadecount)*19,380-(20-fadecount)*19,190-(20-fadecount)*19)
DrawRect(400+(20-fadecount)*19,195+(20-fadecount)*19,380-(20-fadecount)*19,190-(20-fadecount)*19)



I don't know why this happens, but it shouldn't...


bye
MB


DStastny(Posted 2007) [#26]
@MichaelB, sorry for delay in reply I have been sick last few days.

SuperStrict
Import "Dx9Max2dDriver\Dx9Max2dGraphicsDriver.bmx"
SetGraphicsDriver D3D9Max2DDriver()
Graphics 800,600
Cls
DrawRect(10,15,100,70)
Flip
WaitKey
EndGraphics


Seems to work fine on my ATI and Nvidia Cards, is this specific to the Sis Card?

Other example fragment is not really testable by me as I cant determine what fadecount is doing in your logic.

There might be possiblility that I am overrunning vertexbuffer which could cause first rect to fail, although I tested the heck out that possibility.

If you could get smallest working example that causes render anomaliy that would be easist to locate a problem.

Thanks for feedback.

Doug Stastny


Derron(Posted 2007) [#27]
hope you got well Budman.


I tried to reproduce the bug within a small example... no success. I removed everything from my draw and update-routine except the drawrect-commands and the bug still exists.

So I think the problem has to do something with other things happening before (loading routines etc.). I hope to find the time to make some additional tests to find the bug.


bye
MB