premunge_scene doesn't have effect with shader generator

Bug #1698451 reported by Yaio
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Panda3D
Fix Released
Undecided
rdb

Bug Description

Observed on Panda3D 1.9.4, Xenial 64 bits. In the following example, premunge_scene haven't an observable effect i.e. the first time a model is rendered there is a rendering hiccup. The rendering is smooth without the shader generator.

from panda3d.core import *
loadPrcFileData('', 'basic-shaders-only 0')
from direct.interval.LerpInterval import *
import direct.directbase.DirectStart
base.disableMouse()
base.camera.set_pos(-30, -10, 20)
base.camera.look_at(-30, 2, 2)
render.set_shader_auto()
cm = CardMaker('card')
card = render.attach_new_node(cm.generate())
card.set_texture(loader.loadTexture('maps/noise.rgb'))
card.set_pos(-50, -50, 0)
card.set_p(-90)
card.set_scale(100)
models = ['panda', 'smiley', 'box', 'frowney', 'jack', 'teapot']
textures = ['', '', 'maps/envir-bamboo.png', 'maps/envir-mountain2.png', 'maps/envir-reeds.png', 'maps/envir-tree1.png']
for i, model_info in enumerate(zip(models, textures)):
    model = loader.loadModel(model_info[0])
    model.reparent_to(render)
    model.set_x(i * 8)
    if model_info[1]:
        tex = loader.loadTexture(model_info[1])
     model.setTexture(tex, 1)
render.prepare_scene(base.win.getGsg())
render.premunge_scene(base.win.getGsg())
LerpFunc(lambda x: base.camera.set_x(x), 10, -30, 40).start()
base.run()

Yaio (yaio79)
description: updated
summary: - premunge_scene doesn't work with shader generator
+ prepare_scene doesn't work with shader generator
summary: - prepare_scene doesn't work with shader generator
+ premunge_scene doesn't work with shader generator
Yaio (yaio79)
description: updated
summary: - premunge_scene doesn't work with shader generator
+ premunge_scene haven't effects with shader generator
description: updated
Yaio (yaio79)
summary: - premunge_scene haven't effects with shader generator
+ premunge_scene doesn't have effect with shader generator
Revision history for this message
rdb (rdb) wrote :

This is now fixed in the following two changes.
* prepare_scene now properly calls the shader generator:
https://github.com/panda3d/panda3d/commit/b781995
premunge_scene is not necessary.

* Reduce the amount of shaders that need to be generated:
https://github.com/panda3d/panda3d/commit/af57c82
This should additionally benefit your game's load and run performance. Let me know how it works out.

Changed in panda3d:
assignee: nobody → rdb (rdb)
milestone: none → 1.10.0
status: New → Fix Committed
Revision history for this message
Yaio (yaio79) wrote :
Download full text (5.0 KiB)

Thanks! It works on Linux, but this happens on the following machine:

operative system: Windows 10 10.0.14393
architecture: 64bit
machine: AMD64
platform: Windows-10-10.0.14393
processor: AMD64 Family 21 Model 101 Stepping 1, AuthenticAMD
cores: 4
panda version: 1.10.0 9c4151cb0f167feea43e74ed003a8c1f98e09f5b
ATI Technologies Inc.
AMD Radeon(TM) R5 Graphics
shader: 4.40
4.5.13421 Compatibility Profile Context 16.101.1311.1001

Assertion failed: texture != NULL at line 1002 of c:\buildslave\sdk-windows-amd64\build\panda\src\pgraph\textureAttrib.cxx
Traceback (most recent call last):
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\engine\enginefacade.py", line 27, in <lambda>
    return taskMgr.doMethodLater(time, lambda tsk: meth(*args),
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\observer.py", line 26, in notify
    obs[0](*args, **kwargs)
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\gameobject.py", line 101, in on_comp_blt
    self.__process_lst(obj.mdt, self.pending[obj.__class__.__name__])
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\gameobject.py", line 93, in __process_lst
    self.end_lst(idx)
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\gameobject.py", line 107, in end_lst
    self.callback()
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\racing\race\logic.py", line 47, in load_other_cars
    return self.mdt.fsm.demand('Countdown')
  File "C:\Python27\lib\site-packages\direct\fsm\FSM.py", line 278, in demand
    if not self.request(request, *args):
  File "C:\Python27\lib\site-packages\direct\fsm\FSM.py", line 321, in request
    self.__setState(*result)
  File "C:\Python27\lib\site-packages\direct\fsm\FSM.py", line 456, in __setState
    self.__callEnterFunc(self.newState, *args)
  File "C:\Python27\lib\site-packages\direct\fsm\FSM.py", line 492, in __callEnterFunc
    func(*args)
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\racing\race\fsm.py", line 50, in enterCountdown
    self.mdt.logic.enter_play()
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\racing\race\logic.py", line 178, in enter_play
    RaceLogic.enter_play(self)
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\racing\race\logic.py", line 117, in enter_play
    self.player_car.gfx.reparent()
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\racing\car\gfx.py", line 48, in reparent
    model.prepare_scene(base.win.getGsg())
AssertionError: texture != NULL at line 1002 of c:\buildslave\sdk-windows-amd64\build\panda\src\pgraph\textureAttrib.cxx
:task(error): Exception occurred in PythonTask notify
Traceback (most recent call last):
  File "main.py", line 29, in <module>
    Yorg()
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yorg\yorg.py", line 79, in __init__
    Game.__init__(self, init_lst, conf)
  File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\game.py", line 40, in __init__
    eng.base.run()
  File "C:\Python27\lib\site-packages\direct\showbase\ShowBase.py", line 3025, in run
    self.taskMgr.run()
  File "C:\Python27\lib\site-packages\direct\task\Task.py", line 517, in run
    self.step()
  File "C:\Python27\lib\site-packages\direct\task\Task.py", line 471, in step
    self.mgr.poll()
  File "C:\Users\fcalv\Dropbox\yorg_t...

Read more...

Revision history for this message
rdb (rdb) wrote : Re: [Bug 1698451] Re: premunge_scene doesn't have effect with shader generator
Download full text (7.2 KiB)

Yeah, I ran into that one too. I'm close to checking in a big overhaul of
the shader generator that should much more greatly reduce the amount of
shaders it needs to generate and fix this bug in the process.

On 8 July 2017 at 00:00, Yaio <email address hidden> wrote:

> Thanks! It works on Linux, but this happens on the following machine:
>
> operative system: Windows 10 10.0.14393
> architecture: 64bit
> machine: AMD64
> platform: Windows-10-10.0.14393
> processor: AMD64 Family 21 Model 101 Stepping 1, AuthenticAMD
> cores: 4
> panda version: 1.10.0 9c4151cb0f167feea43e74ed003a8c1f98e09f5b
> ATI Technologies Inc.
> AMD Radeon(TM) R5 Graphics
> shader: 4.40
> 4.5.13421 Compatibility Profile Context 16.101.1311.1001
>
> Assertion failed: texture != NULL at line 1002 of
> c:\buildslave\sdk-windows-amd64\build\panda\src\pgraph\textureAttrib.cxx
> Traceback (most recent call last):
> File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\engine\enginefacade.py",
> line 27, in <lambda>
> return taskMgr.doMethodLater(time, lambda tsk: meth(*args),
> File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\observer.py", line 26,
> in notify
> obs[0](*args, **kwargs)
> File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\gameobject.py", line
> 101, in on_comp_blt
> self.__process_lst(obj.mdt, self.pending[obj.__class__.__name__])
> File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\gameobject.py", line
> 93, in __process_lst
> self.end_lst(idx)
> File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\gameobject.py", line
> 107, in end_lst
> self.callback()
> File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\racing\race\logic.py",
> line 47, in load_other_cars
> return self.mdt.fsm.demand('Countdown')
> File "C:\Python27\lib\site-packages\direct\fsm\FSM.py", line 278, in
> demand
> if not self.request(request, *args):
> File "C:\Python27\lib\site-packages\direct\fsm\FSM.py", line 321, in
> request
> self.__setState(*result)
> File "C:\Python27\lib\site-packages\direct\fsm\FSM.py", line 456, in
> __setState
> self.__callEnterFunc(self.newState, *args)
> File "C:\Python27\lib\site-packages\direct\fsm\FSM.py", line 492, in
> __callEnterFunc
> func(*args)
> File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\racing\race\fsm.py",
> line 50, in enterCountdown
> self.mdt.logic.enter_play()
> File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\racing\race\logic.py",
> line 178, in enter_play
> RaceLogic.enter_play(self)
> File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\racing\race\logic.py",
> line 117, in enter_play
> self.player_car.gfx.reparent()
> File "C:\Users\fcalv\Dropbox\yorg_test_win\yyagl\racing\car\gfx.py",
> line 48, in reparent
> model.prepare_scene(base.win.getGsg())
> AssertionError: texture != NULL at line 1002 of c:\buildslave\sdk-windows-
> amd64\build\panda\src\pgraph\textureAttrib.cxx
> :task(error): Exception occurred in PythonTask notify
> Traceback (most recent call last):
> File "main.py", line 29, in <module>
> Yorg()
> File "C:\Users\fcalv\Dropbox\yorg_test_win\yorg\yorg.py", line 79, in
> __init__
> Game.__init__(self, init_lst, conf)
> File "C:\Users\fcalv\Dropbox\yo...

Read more...

Revision history for this message
rdb (rdb) wrote :

By the way, that issue should now also be fixed in the latest master version of Panda.

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.