Looking for some testers

BlitzMax Forums/BlitzMax Programming/Looking for some testers

After seeing some performance numbers with MGEs test, I was unhappy with some cards not performing as I would expect.

So...

I completly rewrote the Dx9 Drivers render pipeline. Previously it was a buffered implementation which works real well if you batch your drawing commands and texture state changes. However it was blowing chunks on lots of state changes in example like MGE's sprite routines.
Bascially a render state as well as texture state per sprite drawn.

Max2dDx90.6.zip

Thanks to Gabriel for hosting.




DStastny

I am in processes of finding a new host so if someone wanted to host the zip.
Just a zip? Try www.filefront.com

I can host it. My email is in my profile, and you can send it as an attachment so long as it's no more than a few megs.

Thanks Gabriel you have mail.

Doug

Ok, uploaded it here.

www.glimmergames.com/downloads/Max2dDx90.6.zip

Thanks Gabriel.

For some reference numbers on my Vista Laptop with crappy Nvidia 7100

I see running Test(you can comment out various lines to select drivers)

Driver:Win/Full
Dx7:54/60
OGL:77/80
Dx9:100/102

Doug

RESPECT!!

I got
OGL: 4FPS
DX7: 20FPS
DX9: 30FPS
fullscreen

DStastny - Ofcourse. Anything else I can do to help, by all means please ask. :)

wow, this is the first time I've had any test beat the opengl version...(fullscreen anyway), I had to run these test about 4 times each just to make sure. it is kind of weird though because the test's fps doesn't seem to be very consistent for me between multiple runs using any of the drivers. I think this test chokes the advantage that opengl normally has in fps.

driver:win/full
dx9: 428/1115
dx7: 471/481
ogl: 497/563

What we need to do is start devloping a list of cpu/gpu combinations that this runs on "ok".

DX9 Results Only:

CPU:Intel Celeron 2.93ghz
GPU: Intel 82845G
Windowed: 34fps
Fullscreen: 44fps
Results: Ok

CPU: Intel 2300 1.66 Ghz
GPU: Intel Mobile 945GM
Windowed: 75fps
Fullscreen: 76fps
Results: Ok

CPU: Intel Core 2, Duo CPU T7520 @ 2 ghz
GPU: Nvidia Geforce 8400M GT
Windowed: 110fps
Fullscreen: 254fps
Results: Ok

Seriously. If it runs ok on the above 3 systems, there's a very good chance it's going to run ok on a wide variety of systems. But please, everyone needs to enter their CPU and GPU.

DStastny - Excellent work!! So far so good. :)

Too bad the thread is titled "Please Test This DX9 Max2D Driver". :)

Note: I did notice the timing differences between changing drivers. I also had to reboot one time to "reinit" directx because it started running very slow in all drivers.

For kicks, what's the steps needed to turn this into a mod, so you can select it just like the other drivers? Thanks.

@MGE yeah the title sucks cant change that :)

As for turning it into a Mod, I had tried long ago but there where issues with the version of D3D9.bmx in Pub.

The version I use is more complete as I needed a few more interfaces defined to do some stuff. I sent it to BRL years ago but ... well you know.

As for the testing thanks for the feedback. Not sure of issues regarding slowing drivers. As I developed against the Direct3d Debug drivers and it cleans up correctly. Cant say the Dx7 driver does or not, there use to be all sorts of issues with it not correctly tearing down. Vista doesnt care but XP might start acting flaky mixing Dx7/Dx9 etc.

Doug

test.exe, full screen, debug_off, BlitzMax SVN rev.131, FASM 1.67.26
Nvidia GeForce 6600GT/128Mb - Driver 175.19
CPU: Athlon64 3500+ / 1GB RAM
OS:WinXP SP2

OGL: 282/284
DX7: 191/194
DX9: 186/189

OGL: 336~347
DX7: 153~167
DX9: 153~154

test.exe, FS, debug off, rev.131

ATI mobility Radeon X1600 /modded desktop-cataclyst (Thanx Toshiba for the GREAT support :( )
Driver Packaging Version 8.522-080731a-067975C-ATI
Catalyst® Version 08.8
Provider ATI Technologies Inc.
2D Driver Version 6.14.10.6844
Direct3D Version 6.14.10.0603
OpenGL Version 6.14.10.7873

CPU: Intel T2300 @ 2*1.66Ghz, 2.5GB RAM

WIN XP home SP3

OGL: 155-157 FPS
DX7: 131-133 FPS
DX9: 83-85 FPS

DX7:12
DX9:12
OGL:15

Pentium Dual Core @ 2x1.4GHz, Intel GMA965 X3100 graphics, 2GB RAM, Vista SP1.

Bug Found: DrawRect not drawing accurate alpha levels.

Verified on 2 different GPU's.

You can change a var at the top to change the driver in order to test the code.

SuperStrict
'
' Basic Blitzmax Noob Sprite Demo By "MGE"
'

'Import "Dx9Max2dDriver\Dx9Max2dGraphicsDriver0.5.bmx"

Import "Dx9Max2dDriver\Dx9Max2dGraphicsDriver.bmx"



'
' Just change this var to test the various drivers
'
Global testdriver:Int = 1  ' 1=dx9, 2=dx7, 3=opengl
'
'
'






Incbin "Media\tile.png"
'
Const howmany:Int = 100 ' <<<<<< Change this value for how many
'
Global sprites:TSprite[howmany]  ' Create an array of the type "TSprite"
Global MyImage:Timage = LoadAnimImage:TImage( "Incbin::Media\tile.png",32,32,0,64,FILTEREDIMAGE | MIPMAPPEDIMAGE)
Global fps:Int        ' used to display the frames per second
Global fpstotal:Int   ' counts how many frames rendered in 1000ms (1 second)
Global ms:Float       ' var to keep track if 1000ms (1 sec) has passed
Global ms_start:Float ' var holds the beginning ms value at top of loop
Global delta:Float    ' simple delta time var. Different between start and end in loop.
'
Type TSprite
 Field x:Float,y:Float
 Field xdir:Float,ydir:Float
 Field alfa:Float
 Field blendtype:Int
 Field tile:Int
 '
 Method init()
  x = Rand(100,700)
  y = Rand(100,500)
  xdir = Rnd(-.2,.2)
  ydir = Rnd(-.2,.2)
  tile=Rand(0,63)
  If Rand(0,100)>50
   blendtype = ALPHABLEND
  Else
   blendtype = LIGHTBLEND
  EndIf
  alfa = Rnd(.1,1)
 End Method
 '
 Method update()
  x=x+(xdir*delta)
  y=y+(ydir*delta)
  If x>800 Or x<0
   xdir=-xdir
   x=x+xdir
  EndIf
  If y>600 Or y<0
   ydir=-ydir
   y=y+ydir
  EndIf
  '
 End Method
 '
 Method render()
  SetAlpha alfa
  SetBlend blendtype
  DrawImage MyImage:Timage,x,y,tile
  'DrawRect x,y,32,32
 End Method
 '
End Type
'
Select testdriver
Case 1
 SetGraphicsDriver D3D9Max2DDriver()
Case 2
 SetGraphicsDriver D3D7Max2DDriver()
Case 3
 SetGraphicsDriver GLMax2DDriver()
End Select
'
FlushKeys()
FlushMouse()
'
If Confirm("FULL SCREEN?")= True
  Graphics(800,600,32,60) ' width, height, depth (16,32, 0=windowed), hz
Else
  Graphics(800,600,0,60) ' width, height, depth (16,32, 0=windowed), hz
EndIf
'
For Local c:Int = 0 To howmany-1 ' arrays start at 0 so we go to total - 1
 sprites[c] = New TSprite        ' fill our array with our object type
 sprites[c].init                 ' call the Object's init routine to set up the sprite
Next
'
HideMouse()
FlushKeys()
FlushMouse()
'
resetstates()                    ' reset render states
ms = MilliSecs()                 ' get the current 1000ms clock
'
Repeat
 ' 
 ms_start=MilliSecs()
 '
 Cls
 '
 SetColor(255,0,0)
 Local x1:Int=0,y1:Int=0,x2:Int=799,y2:Int=599
 For Local c:Int=1 To 10
  DrawLine x1,y1,x2,y1
  DrawLine x2,y1,x2,y2
  DrawLine x2,y2,x1,y2
  DrawLine x1,y2,x1,y1 
  x1=x1+20
  y1=y1+20
  x2=x2-20
  y2=y2-20
 Next  
 '
 SetColor(255,255,255)
 '
 For Local obj:TSprite = EachIn sprites ' cycle through all objects in array
  obj.update          ' Call the "update" method to update sprite's position.
  obj.render          ' Call the "render" method to display the sprite.
 Next
 '
 ' ---------------------------------------------------------
 ' Here's the bug
 ' 
 ' In DX7 and OpenGL mode, the rect is draw full alpha, over drawing everything.
 ' In DX9, the rect still has alpha in it, not over drawing everything.
 '
 SetTransform(0,1,1)
 SetColor(255,255,255)
 SetAlpha(1)
 SetBlend(ALPHABLEND)  
 DrawRect(300,200,200,200)
 '
 ' ---------------------------------------------------------
 '
 resetstates() 
 DrawText "FPS: "+fps,0,0           ' Display how fast the program is running.
 If KeyDown(KEY_V)
  Flip(1)                            ' Flip(1) for vsync, Flip(0) for full speed
 Else
  Flip(0)
 EndIf 
 delta = MilliSecs() - ms_start     ' Computer delta, start time - end time of loop
 '
 DoFPS()                            ' Keep track of how many frames per second
 ' 
Until KeyHit(KEY_ESCAPE)            ' Press ESC to exit
'
ShowMouse()
EndGraphics()                       ' Close down graphics device
End                                 ' Still need docs on this command.
'
Function resetstates()              ' Reset render states
 SetColor(255,255,255)
 SetAlpha(1)
 SetBlend(ALPHABLEND)
 SetTransform 0,1,1
End Function
'
Function DoFPS()                    ' Inc frames, and track if 1 sec has passed
 fpstotal = fpstotal + 1
 If MilliSecs()>ms
  fps = fpstotal
  fpstotal = 0
  ms = MilliSecs() + 1000
 EndIf
End Function


DrawLine, DrawRect are both not rendering the alpha correctly. Could have something to do with _Drawcolor ?

DrawOval(), DrawPoly() appear to be working correctly as far as alpha level goes.

After extensive testing (hours and hours) the only other problem I've found is on my 82845G Intel there is tearing once in a while even with vsync active. Tearing is when the render is drawing upon itself.

I don't use any of the collision routines so I can't test those, but so far the driver seems stable and I was able to add dx9 support to my engine, and the game that I've been working on works fine in DX9. :)

@MGE I will look into the draw Alpha, I will try and set up a test.

As for the tearing... hmmm The issue here might be trickier as it someone has to do with how DX9 controls VSYNC. Previously in DirctX it use to be a param when you flipped the buffers. Now its a param when you set up the device, so to allow for Flip true Flip false I had to implement a method to get monitor the vsync and invoke the flip when in vblank.

Not sure what I can do here, previously I had torn down the device and recreated it upon changing which I wasnt thrilled with.

Still some questionable speeds, If someone who was not seeing performance significantly faster on DX9 could try and I know this is painful. Reboot between each test it would be apprecicated.

Thanks for feedback
Doug

Hi Doug, yah I researched the vsync stuff and saw the same thing. What you could do is perhaps setup one more additional parameter on the Graphics() call, something like VsyncOn=1 or 0. And then add:

For vsync always on:
_PresentParams.PresentationInterval=D3DPRESENT_INTERVAL_ONE 

For vsync always off:
_PresentParams.PresentationInterval=D3DPRESENT_INTERVAL_IMMEDIATE

And then in the Flip command, you just call the swap chain without the additional timing handling you're doing. ;)

Awesome stuff Doug, thanks so much for your time on this! :)

MGE I appreicate the resurgent interest in my driver.

Here is fix for the Alpha
	Method SetAlpha( alpha:Float )
		_Drawcolor=(Int(255*Max(Min(alpha,1),0)) Shl 24)|(_Drawcolor&$ffffff)
		' reset our values in our Vertices
		_VerticesColor[VERTD]=_DrawColor
		_VerticesColor[VERTD+6]=_DrawColor
		_VerticesColor[VERTD+12]=_DrawColor
		_VerticesColor[VERTD+18]=_DrawColor		
	End Method


Didnt work because I forgot to set it. If you set the Alpha then the Color it worked just not otherway around :)

Doug

@MGE does that clean up the issue you see with tearing?

Thanks for helping
Doug

Hi Doug - Alpha problem fixed! Thanks for the quick fix. ;)

The tearing problem is very strange to be honest. It's only happening visibly on my Intel 82845G board. Even with the Interval_One it's still the same way. So perhaps it's just something with that (older) driver.

I think for the DX9 driver it might be better to take out the timing in the flip command and just have an option somewhere for interval_one or interval_immediate when the device is made.

Perhaps a global var we can set? DX9VsyncOn = 1 or 0?

Except for test purposes, no serious developer is going to release a game with vsync off anyway. ;)

Again, you've made my day! Blitzmax now has room to grow well into the next few years. You should get a check from the head honchos. :)

Update: Window mode is a no go for interval_one it seems, animation was very choppy. Interval_One for full screen works wonderfully.

I edited the driver for DX9 specifics that work fine on 2 of my test machines. I havn't tested the 3rd yet, but it's a brand new machine and never gives me any problems.

We end up losing the dynamic vsync ability like we have in DX7, but that's no big deal to be honest.

I set a global var to set vsync on or off for the DX9 driver.

DX9VsyncOn = 1 or 0

In windowed mode, it only uses interval_immediate and uses your timing code to wait for the vblank in the flip command.

In full screen mode it uses interval_one and the flip doesn't do any timing, it just flips the chain and exits.

The dx9 flip command has a dummy parameter for the flip so any existing code or when switching drivers doesn't have to be changed. ;)

My modifications are available here:

http://jgoware.com/mge/Dx9Max2dDriver.zip

Lots of tests to do still to make sure it's reliable enough for deployment, but it's looking very promising. ;)

Doug, is there anyway to expose the D3DX object in this driver?

Again, thanks Doug for all of your hard work. :)

Neither link to the DX9 driver appear to be working. Any chance there is a new one available?

Check the blitzmax tweaks forum. It apparently is going through some final checks, etc, before becoming an official release.

Ok thanks, I'll wait patiently then.