Potential Disaster Using Desktop As Default Res!

Archives Forums/BlitzMax Bug Reports/Potential Disaster Using Desktop As Default Res!

MGE(Posted 2008) [#1]
Disaster because it appears we can't trap for the error!

When creating a graphics resolution that is too large to create surface areas in VRAM, Blitzmax just exists. No trapping, or nothing. When working in the IDE with the console window up, the console window displays this message (in Dx mode):

DXERROR err=UNKNOWN:-2005531925 747

To replicate this error all you have to do is create a full screen resolution too high for your GPU to create vram surfaces. This means your monitor has to support it for normal desktop use, but when a game uses it for page flipping, etc, there's not enough vram available. Happens in both OpenGL and DirectX modes.

My desktop runs 1680x1050 no problem, but of course in a game situation, this requires a ton of Vram space which my crappy card does not have, that's how I found this bug.

Would be nice if we would trap for this, because alot of programmers are using desktop resolutions for their default game resolution and if desktop res requires too much vram, it will trigger this bug and the program will just exit. No bombs, no crashes, just stops running.

Can others please try to replicate the problem?

SetGraphicsDriver D3D7Max2DDriver()
'SetGraphicsDriver GLMax2DDriver()
Global Ok:Int
'
ok = GraphicsModeExists(1680,1050,32,0)
'
If ok
 If Graphics(1680,1050,32,0) = Null
  Print "Error creating Graphics Screen!" ' <<< never gets trapped!
  End
 EndIf
Else
 Print "Mode Not Available"
EndIf



MGE(Posted 2008) [#2]
This is a VERY serious bug. Can someone from the official BMax team please reply?


JoshK(Posted 2008) [#3]
You didn't even bother to list your hardware specs.


MGE(Posted 2008) [#4]
Hardware specs are irrelevant in this case. However, I found the bug while developing on:

Ram: 512mb
CPU: Intel Celeron 2.93 ghz
GPU: Intel 82845G/GL/GE/PE/GV Graphics Controller

Again, those defaulting to desktop resolution for their games are the ones this could affect. Granted, it might be rare, but the potential for problems exist.


plash(Posted 2008) [#5]
Works fine on my computer, no crashes or errors. It runs through without printing anything either.

I noticed you call graphics with the last parameter as -1, but check for it with the last parameter as 0, are they related?


MGE(Posted 2008) [#6]
Plash - I've updated the example source to be 0 in both sections for the hz parameter. This just causes the device to use a default setting.

The bug only shows up if you try to create a graphics screen larger than your VRAM will allow.


MGE(Posted 2008) [#7]
Bumpty bump bump....


Grey Alien(Posted 2008) [#8]
Don't hassle them, I don't think they like it ;-) Stay on their good side...


MGE(Posted 2008) [#9]
Ok..thanks.


MGE(Posted 2008) [#10]
Anyone have any ideas how to trap for this?


Grey Alien(Posted 2008) [#11]
Have you tried Try Catch round it? I suppose that doesn't work too?


MGE(Posted 2008) [#12]
This error happened again, this time on a Win 98 box. The game defaulted to desktop res, 1024x768x32 and there was not enough vram and the error occured. Still no way to trap the error.


GfK(Posted 2008) [#13]
Does the desktop window still exist when an app is running fullscreen?

Didn't think it did as you can see it redrawing after closing a fullscreen app on cruddy old systems.

I think you need to provide more information: Operating system, type of graphics hardware, vRam, DirectX version, and the like. Ultimately its probably nothing to do with Blitzmax, specifically.

One more thing; Try using CreateGraphics() instead of just Graphics().


SLotman(Posted 2008) [#14]
Can you read how much VRAM the system has?

If so, you can pre-calc how much width x height x bpp will use, double it (for page flipping) and if the video card can't cope with it, then reduce the resolution to something acceptable.


Grey Alien(Posted 2008) [#15]
Can you read how much VRAM the system has?
I had a function to do that but it turned out to return junk half the time.