Discussion:
BSOD using tiny code
(too old to reply)
Manuel Klein
2007-10-09 02:14:03 UTC
Permalink
Hi,

I managed to narrow the problem down to a very very basic application.
Whenever I start it, the computer locks or shows a BSOD in nv4_disp.dll
after max 2 seconds. So, be careful if you intend to reproduce it!
This is very strange because it almost does nothing. I can play recent
games or do whatever else without any problem, so believe me, the machine is
fine. Latest graphics driver installed (and the one before tested either).
Using a Geforce 6800.

We could discuss about details in this sample code, but IMO that's not
important, because in the end it never should crash the machine! Without
"dev.clear" the crash does /not/ occur. (haven't tested w/o
BeginScene/EndScene yet)

Then I switched to the reference rasterizer (of course using the initial
code that includes dev.clear). Maximum checks, maximum debug output and
unmanaged debugging is enabled. Result: No problem occurs. No warning or
error in the debug output, only debug information (so, debug output for sure
does work). But, this doesn't say very much because I get 2,000 FPS using
HAL device and 80 FPS using the ref rasterizer, so it takes much longer
to wait for the problem - if it occurs at all. I waited 2 minutes, but
it didn't crash.

How can this code cause such a problem? IMO it must not in any case! Can you
repro it? Add the class to a new Winforms application and set Sub Main as
the startup object. You might please adjust 1280x1024 in the code to your
screen size.

Thanks in advance.


Manuel


'========= Code ===========

Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D

Friend Class Main

Shared Sub Main()

Dim f As Form1
Dim dev As Device
Dim pp As PresentParameters

f = New Form1

With f
.FormBorderStyle = Windows.Forms.FormBorderStyle.None
.ControlBox = False
.Text = String.Empty
.Size = New Size(1280, 1024)
.Location = Point.Empty
.WindowState = FormWindowState.Maximized
.Show()
.Refresh()
End With

pp = New PresentParameters

With pp
.Windowed = True
.PresentationInterval = PresentInterval.Immediate
.SwapEffect = SwapEffect.Flip
.BackBufferCount = 1
End With

dev = New Device(0, DeviceType.Hardware, f,
CreateFlags.HardwareVertexProcessing, pp)

Do
dev.BeginScene()
dev.Clear(ClearFlags.Target, &HFF2080E0, 1, 0)
dev.EndScene()
'dev.Present()
Application.DoEvents()
Loop While f.IsHandleCreated
dev.Dispose()

End Sub

End Class
Armin Zingler
2007-10-09 03:32:34 UTC
Permalink
BTW, same crash with Tutorial

Samples\Managed\Direct3D\Tutorials\Tutorial1\

if SwapEffect.Flip is used instead of SwapEffect.Discard.

Though, even though if I accidently use Flip instead of Discard, this should
not crash my machine, IMO.


Manuel
Armin Zingler
2007-10-09 03:42:06 UTC
Permalink
Post by Armin Zingler
BTW, same crash with Tutorial
Samples\Managed\Direct3D\Tutorials\Tutorial1\
if SwapEffect.Flip is used instead of SwapEffect.Discard.
Though, even though if I accidently use Flip instead of Discard,
this should not crash my machine, IMO.
Manuel
Sorry Manuel, didn't want to steel your signature. :-) (little late here...)
Just wanted to say I can repro the problem. Though, I don't have a solution
either. Will do some testing and let you know.


Armin
Manuel Klein
2007-10-09 18:20:02 UTC
Permalink
Did you find somethig? This is terrible!! I did no remember that last year
in march I already
asked this question.

http://groups.google.com/group/microsoft.public.win32.programmer.directx.managed/browse_frm/thread/1aee3516913cf213/ed182d9d09d4dbf6

Meanwhile newer drivers and machine reinstalled. The problem is still there.
Please, anybody can help?

Manuel
Post by Armin Zingler
Post by Armin Zingler
BTW, same crash with Tutorial
Samples\Managed\Direct3D\Tutorials\Tutorial1\
if SwapEffect.Flip is used instead of SwapEffect.Discard.
Though, even though if I accidently use Flip instead of Discard,
this should not crash my machine, IMO.
Manuel
Sorry Manuel, didn't want to steel your signature. :-) (little late here...)
Just wanted to say I can repro the problem. Though, I don't have a
solution either. Will do some testing and let you know.
Armin
Armin Zingler
2007-10-09 23:56:10 UTC
Permalink
Post by Manuel Klein
Did you find somethig? This is terrible!! I did no remember that
last year in march I already
asked this question.
http://groups.google.com/group/microsoft.public.win32.programmer.directx.managed/browse_frm/thread/1aee3516913cf213/ed182d9d09d4dbf6
Meanwhile newer drivers and machine reinstalled. The problem is
still there. Please, anybody can help?
You wrote in the other thread that you inserted GC.Collect in order to force
garbage collection. The only thing I found out is that is only works if
PresentationInterval is set to One, which also causes a kind of "delay".
PresentationInterval Immediate causes a crash. Of course, this only works if
you use device.present (not like commented in your example code). Another
way is inserting Thread.Sleep to limit the FPS. You're assumption that it is
a managed issue, might be right. As MDX won't be continued, I think we have
to live with it.


Armin
Manuel Klein
2007-10-19 23:40:25 UTC
Permalink
Sorry for answering so late! I use your solution now.
(PresentationInterval.One) If you find something new please tell me.

Thank you

Manuel
Post by Armin Zingler
Post by Manuel Klein
Did you find somethig? This is terrible!! I did no remember that
last year in march I already
asked this question.
http://groups.google.com/group/microsoft.public.win32.programmer.directx.managed/browse_frm/thread/1aee3516913cf213/ed182d9d09d4dbf6
Meanwhile newer drivers and machine reinstalled. The problem is
still there. Please, anybody can help?
You wrote in the other thread that you inserted GC.Collect in order to force
garbage collection. The only thing I found out is that is only works if
PresentationInterval is set to One, which also causes a kind of "delay".
PresentationInterval Immediate causes a crash. Of course, this only works
if you use device.present (not like commented in your example code).
Another way is inserting Thread.Sleep to limit the FPS. You're assumption
that it is a managed issue, might be right. As MDX won't be continued, I
think we have to live with it.
Armin
Loading...