Is there a simple way to test a DX9 driver in BMax
BlitzMax Forums/BlitzMax Programming/Is there a simple way to test a DX9 driver in BMax
| ||
? I gather there is no office DX9 support in BMax, but I found a driver by DStastny but the link is broken: http://www.blitzbasic.com/Community/posts.php?topic=67633 Does anyone know anything else about this? Thx. |
| ||
Found it on internet archive. If it's okay with Doug I have mirrored his Dx9 Max2d driver v 0.2 and 0.5 zips here: http://www.blitzmax.com/logs/userlog.php?user=8652&log=1737 |
| ||
Found it on internet archive. If it's okay with Doug I have mirrored his Dx9 Max2d driver v 0.2 and 0.5 zips here: http://www.blitzmax.com/logs/userlog.php?user=8652&log=1737 |
| ||
Great thanks, downloading now. Hope I can get it to work OK. Anyone used it before? |
| ||
OK the examples won't compile in BMax 1.30. They fail on this linewc.hInstance=GetModuleHandleA(0) in the Create() function in DX9Graphics.bmx: Function Create:TD3D9Graphics( width:Int,height:Int,depth:Int,hertz:Int,flags:Int ) Global _reg : Int If Not _reg : Int Local wc:WNDCLASS=New WNDCLASS wc.hInstance=GetModuleHandleA(0) wc.lpfnWndProc=WndProc wc.hCursor=LoadCursorA( Null,Byte Ptr IDC_ARROW ) wc.lpszClassName=_DX9GRAPHICSEXWINDOWCLASS RegisterClassA( wc ) _reg=True EndIf Local hinst:Int=GetModuleHandleA(0) Local title:Byte Ptr=AppTitle.ToCString() Local hwnd:Int If depth hwnd=CreateWindowExA( 0,_DX9GRAPHICSEXWINDOWCLASS,title,WS_VISIBLE|WS_POPUP,0,0,width,height,0,0,hinst,Null ) Else Local style:Int=WS_VISIBLE|WS_CAPTION|WS_SYSMENU |WS_SIZEBOX Local rect :TRect = TRect.Create(32,32,width+32,height+32) AdjustWindowRect Int Ptr Byte Ptr rect,style,0 width=rect.Width() height=rect.Height() hwnd=CreateWindowExA( 0,_DX9GRAPHICSEXWINDOWCLASS,title,style,rect._Left,rect._Top,width,height,0,0,hinst,Null ) EndIf MemFree title If Not hwnd Return Null Return New TD3D9Graphics._Create(hwnd ,width,height,depth,hertz,flags) End Function with this error: Compile Error: Unable to convert from 'Int' to 'Byte Ptr' Does anyone know how to resolve this please? thanks. |
| ||
Well I wrote it :) but have looked at BMAX 1.30 try changing the Local hinst:Int=GetModuleHandleA(0) to hinst:BYTE PTR I will have to update my MAX something must have changed with the declaration of GetModuleHandle??? |
| ||
That's a funny looking line, what does it mean?AdjustWindowRect Int Ptr Byte Ptr rect,style,0 |
| ||
DStastny - Have you considered adding support for the "DX9 Sprite Object"? We could all just adapt our own routines based around that object. It has parameters for texture, scaling, alpha, RGB modulation, etc. |
| ||
Hi Doug, that line's not the problem (although if the other line worked it probably would be.) The problem is this line:wc.hInstance=GetModuleHandleA(0) and wc is declared on the line above. It's a WNDCLASS type which is not in your bmx file so I can't change the field type. Perhaps there's a way to convert a Byte Ptr to an Int safely? |
| ||
Dont know what happened I typed in a post and it just disappeared :(wc.hInstance=GetModuleHandleA(0) wc.hInstance=GetModuleHandleA(NULL) Seems they changed GetModuleHandleA. Let me know how it works out with your Framework or and if you have any other issues I might be able to help you wiht. Doug |
| ||
GA, are you at a point where you need faster rendering for your games? |
| ||
DStastny: Great that works thx! MGE: I just want to test DX9 with my new video card which is extremely bad at DX7 but which is great at GL to see if it's bad at ALL DX or just DX 7... |
| ||
Does it just work or do you see also measurable improvements? |
| ||
Just tested and there's a huge improvement in speed. My new graphics card is very poor at DX7 it seems and fine at GL and DX9. My old card ran DX7 very fast. |
| ||
Thanks for linking the download. |
| ||
Tested this briefly last night on an Intel GMA965 X3100. Works fine, apart from nothing appears when I use DrawLine, and DrawRect sometimes only renders the lower-right tri of the quad (I'm using DrawRect to add borders for widescreen, so this is quite serious). |
| ||
I tested a DX9 driver a while back and I think one of the problems was the drawrect stuff. I can't recall if it was the same driver though. |
| ||
@GFK do you have a simple sample that demonstrates the problem? Thanks Doug |
| ||
Not on that PC right now - will sort something out by tonight. |
| ||
Quick example but it demonstrates the problem perfectly. With DX7 I get a rotating line at the centre of the screen, and a white square floating across the top. With DX9 the line isn't drawn, and I only see the lower right tri that makes up half of the rect. If I uncomment 'SetLineWidth 20', I can see the rotating 'line' again but its a triangle with one point extending from the centre. Strict Import "Dx9Max2dDriver\Dx9Max2dGraphicsDriver.bmx" SetGraphicsDriver D3D9Max2DDriver() Local lineAngle:Float Local rect:Int Graphics 800,600 'SetLineWidth 20 While Not KeyDown(key_escape) Cls SetColor 255,255,255 lineAngle:+1 DrawLine 400,300,Cos(lineAngle) * 100 + 400, Sin(lineAngle) * 100 + 300 rect:+1 DrawRect rect,0,100,100 Flip Wend |
| ||
Just to confirm, this works perfectly on my crap Radeon 2600XT :-) Anyway, based on your test results, I'm in no hurry to use this DX9 driver. Would love an "official" one. Please add your weight to my request thread: http://www.blitzbasic.com/Community/posts.php?topic=80499 |
| ||
Hmmm, thanks I will figure that out something simple I suspect. People just have to point out rendering glitches and I will fix them DStastny |
| ||
DStastny - Just to clarify, are you saying you're willing to "see it through" and get everything working based on bug reports, glitches, etc, etc? Because if that's true, then we need to create a new thread just for you and your driver and start doing massive compatibility testing with various gpu's, code examples, etc, etc. If so...that would be so awesome. :) Do you have a stable place to host the downloads? If not I can help in that matter. |
| ||
I have always been willing to do it. Very few people where willing to help find compatibility issues or didnt care because its not Open GL. For my personal usage patterns its fine, but even I know there are nuiances to the patterns and how people use Max2d. Cant fix whats not reported and if the people dont reply to me I cant make changes to help. BTW, I duped the problem, very strange its dropping the first non textured tri. Just need to figure out whats what. DStastny |
| ||
Well, you should keep doing it. Ignore people who are hellbent on using OpenGL - in my experience it might be faster but has way more problems than DX ever did. I'd rather stick with DX for Windows, simply due to stability. Obviously I'd like DX9 to be faster, too. But that's probably out of your hands. :) |
| ||
Hi DStastny! Excellent. I personally only use DX for Windows, so this is great that you would like to support this project. :) Can you create a new thread "DX9 Driver" (or whatever) and with the initial post, provide a link to the download and instructions how to actually use it (in detail) so everyone can properly test it? Also, it would be great to provide instructions on how to change drivers in realtime if that's possible? Thanks again, I look forward to testing this driver and also trying to work with you to add support for the DX9 Sprite Object. ;) :) :) |
| ||
Yeah it would be great to have this support, you've done a great job so far. |
| ||
Ok I found the stupid stupid problem. Sorry about this. I made a real junior programming mistake. To allocate vertex buffers I use. _PrimativeSolidBuffer= MemAlloc(SOLIDVBBUFFERSIZE) _PrimativeTextureBuffer= MemAlloc(TEXTVBBUFFERSIZE) To allocate temporary buffer for the vertex data while I buffer drawing commands. I never set the z component of the vertex data for Solid Vertexs since well it was zero. Only if you init to zero. DOOH! Until I can make arrangments for new place to upload updated driver if someone could change Dx9Max2dGraphicsDriver and find above lines change to _PrimativeSolidBuffer= MemAlloc(SOLIDVBBUFFERSIZE) _PrimativeTextureBuffer= MemAlloc(TEXTVBBUFFERSIZE) ' Init buffers MemClear(_PrimativeSolidBuffer,SOLIDVBBUFFERSIZE) MemClear(_PrimativeTextureBuffer,TEXTVBBUFFERSIZE) And confirm if it fixes the bizzare random glitches it would be appreciated. I guess I got burned with most of my testing with textured quads not enough with untextured. Man that was stupid. Let me know. DStastny |
| ||
Don't worry about it! :-) It's cool you found a possible fix. We need GfK to test on his PC again. |
| ||
Gimme ten mins... |
| ||
Works perfectly now. Don't forget (if you haven't done it already), the version from MarkCW's post contains two other errors that Grey Alien mentioned (two 0's that should be Null). |
| ||
Thanks |