Crash when automatic shadows and multithreading are both enabled

Bug #1212752 reported by Tober
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Panda3D
Fix Released
Undecided
rdb

Bug Description

Panda3d version: 1.9.0 devel
OS: Windows 7 64 bit

I've set up shadows using light.setShadowCaster(), but when I turn on multithreading with threading-model Cull/Draw in the config, panda3d freezes up before it draws anything to the screen.

I've narrowed it down to a simple example. If both the commented first line and second line exist, it doesn't work for me.

from panda3d.core import loadPrcFileData
#First line
loadPrcFileData('', 'threading-model Cull/Draw')

from panda3d.core import *

from direct.showbase.ShowBase import ShowBase

class Engine(ShowBase):
      def __init__(self):
            ShowBase.__init__(self)
            base.setBackgroundColor(1,0,0,1)

            model = loader.loadModel("models/environment")
            model.reparentTo(render)
            model.setScale(0.1)
            box = loader.loadModel("models/box")
            box.reparentTo(render)
            box.setZ(1)

            light=DirectionalLight("test")
            light.setColor((1,1,1,1))
            light.setSpecularColor((1,1,1,1))
            #Second line
            light.setShadowCaster(True, 1024, 1024)
            light.getLens().setFilmSize(20)

            base.disableMouse()
            base.camera.setPos(10,0,10)
            base.camera.lookAt(render)

            node = render.attachNewNode(light)
            node.setPos(-2,-2,2)
            node.lookAt(render)

            render.setLight(node)
            render.setShaderAuto()

            self.open = True
            while self.open:
                  print "updating..."
                  taskMgr.step()

Engine()

Tags: threading
Revision history for this message
rdb (rdb) wrote :

Problem is that the shader generator calls GraphicsEngine::make_output on the draw thread even though it's only supposed to be called on the app thread.

Changed in panda3d:
status: New → Triaged
Revision history for this message
rdb (rdb) wrote :

I'm afraid there may not be an easy way to solve this problem right now. However, I have plans to change the architecture of buffers so that they can live in the scene graph; that would alleviate the need for them to be registered with the GraphicsEngine.

A terrible, terrible hack around this problem would be to set the threading model only after a few frames of rendering, after the shadow buffers have been created.

Moguri (mogurijin)
tags: added: threading
Revision history for this message
rdb (rdb) wrote :
Changed in panda3d:
assignee: nobody → rdb (rdb)
milestone: none → 1.10.0
status: Triaged → Fix Committed
rdb (rdb)
Changed in panda3d:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.