DirectX9 code used on system with DX8=crash!

Archives Forums/BlitzMax Bug Reports/DirectX9 code used on system with DX8=crash!

therevills(Posted 2011) [#1]
System running Windows XP SP1 with DirectX8.1 installed (fresh installed).

When I run this code:
Graphics 800,600

Repeat
  For Local I=0 To 100
    Plot Rnd(800),Rnd(600)
  Next
  Flip
Until AppTerminate()


I get an error:
Unhanded Exception: Attempt to call uninitialized function pointer


This is on line 239 of d3d9max2d.bmx:
		If Not D3D9GraphicsDriver() Return Null


If I use the framework command to by pass DX9 it works fine (eg Framework BRL.GLMax2d or Framework BRL.D3D7Max2d)...

Please see:
http://www.blitzbasic.com/Community/posts.php?topic=96485


BlitzSupport(Posted 2011) [#2]
I don't have XP SP1, but I get the same error on Windows 2000 (in VirtualBox) using the same code.

Weirdly, the first time I tried it after turning on the debugger (first run was in release mode), the debugger highlighted this instead, at the very bottom of d3d9max2d.bmx:

Local driver:TD3D9Max2DDriver=D3D9Max2DDriver()
If driver SetGraphicsDriver driver


However, all subsequent runs, even after a reboot, highlight the same line as therevills.


therevills(Posted 2011) [#3]
Yes! Mine does the same, I forgot to mention that - ta James.

On the first run with no other files in BlitzIDE open, it points to the bottom of d3d9max2d.bmx, but then with the test code and d3d9max2d open the next run points to line 239...

OT: I tried to install WinXP on Virtual Box, but I couldnt get D3D working... only OpenGL - any tips James?

Last edited 2011


BlitzSupport(Posted 2011) [#4]
I take it you've enabled 3D acceleration for the machine, under Settings/Display, so OpenGL runs at native speed? I notice that the Help section says "4.4.1. Hardware 3D acceleration (OpenGL and Direct3D 8/9)", so it seems it won't do DX7 anyway, which might explain it.

Also (for Mark), adding this before Graphics still gives the same DX9 error, so something definitely needs sorting out there...

SetGraphicsDriver GLGraphicsDriver ()



col(Posted 2011) [#5]
Hiya,

To fix the problem :-

In file
/BlitzMax/mod/brl.mod/dxgraphics.mod/d3d9graphics.bmx
Line 298

You could it change it to :=
'create d3d9
If Not d3d9Lib Return Null      '<-------ADDED

_d3d=Direct3DCreate9( $900 ) '<- Officially this should be _d3d=Direct3DCreate9( 32 )
If Not _d3d Return Null


This will stop the call if d3d9 isnt installed.
This should work but I dont have the same spec machine to test it. If you could give it a go though....

Don't forget to 'Build Modules' ( CTRL + D ).

Last edited 2011


marksibly(Posted 2011) [#6]
Hi,

Yep, that fixes it on Win2K - just spent several hours installing it on vmware and came up with the same fix!

I guess I should change the $900 to 32 too...


therevills(Posted 2011) [#7]
Col's fix works fine on Windows XP SP1 with DirectX8.1 :)