[SOLVED] crash in Panda

hello,

I was inactive for a while and missed the launch of Panda 1.8.

I had a running project before but after rebuilding code from the repository I get now a crash in the Panda code when trying to build a panda window.

If I run with directx I get a crash here

////////////////////////////////////////////////////////////////////
//     Function: DXGraphicsStateGuardian9::set_cg_device
//       Access: Protected, Static
//  Description: Sets the global Cg device pointer.  TODO: make this
//               thread-safe somehow.  Maybe Cg is inherently not
//               thread-safe.
////////////////////////////////////////////////////////////////////
void DXGraphicsStateGuardian9::
set_cg_device(LPDIRECT3DDEVICE9 cg_device) {
#ifdef HAVE_CG
  if (_cg_device != cg_device) {
CRASH-->   cgD3D9SetDevice(cg_device);
    _cg_device = cg_device;
  }
#endif // HAVE_CG
}

in dxGraphicsStateGuardian9.cxx around line 5693

while if I try run in openGL it crashes here


#if defined(HAVE_CG) && !defined(OPENGLES)
CRASH-->   if (cgGLIsProfileSupported(CG_PROFILE_ARBFP1) &&     cgGLIsProfileSupported(CG_PROFILE_ARBVP1)) {
    _supports_basic_shaders = true;
    if (basic_shaders_only) {
      _shader_caps._active_vprofile = (int)CG_PROFILE_ARBVP1;
      _shader_caps._active_fprofile = (int)CG_PROFILE_ARBFP1;
      _shader_caps._active_gprofile = (int)CG_PROFILE_UNKNOWN; // No geometry shader if only using basic
    } else { 

in glGraphicsStateGuardian_src.cxx around line 922

any idea what is wrong here ?

Can you show the stack trace at the time of the crash?

Thanks,
David

As a wild guess, based purely on the one commonality between your two logs, I’d suggest taking a look at the Cg version you’re building against. Are you using a thirdparty/win-libs-vc9 directory for 1.8 from panda3d.org, or something left over from 1.7 or previous builds?

–jonah

ok here the callstack for when I run in openGL

>	libpandagl_d.dll!GLGraphicsStateGuardian::reset()  Line 924	C++
 	libpandagl_d.dll!wglGraphicsStateGuardian::reset()  Line 458	C++
 	libpanda_d.dll!GraphicsStateGuardian::reset_if_new()  Line 867 + 0x12 bytes	C++
 	libpandagl_d.dll!wglGraphicsWindow::open_window()  Line 309 + 0xb bytes	C++
 	libpanda_d.dll!GraphicsWindow::set_properties_now(WindowProperties & properties={...})  Line 644 + 0x12 bytes	C++
 	libp3windisplay_d.dll!WinGraphicsWindow::set_properties_now(WindowProperties & properties={...})  Line 273 + 0xf bytes	C++
 	libpanda_d.dll!GraphicsWindow::process_events()  Line 604 + 0x19 bytes	C++
 	libp3windisplay_d.dll!WinGraphicsWindow::process_events()  Line 224 + 0xb bytes	C++
 	libpanda_d.dll!GraphicsEngine::process_events(const ov_set<PointerTo<GraphicsOutput>,IndirectLess<GraphicsOutput> > & wlist={...}, Thread * current_thread=0x00d9b0fc)  Line 1616 + 0x25 bytes	C++
 	libpanda_d.dll!GraphicsEngine::WindowRenderer::do_windows(GraphicsEngine * engine=0x040b7834, Thread * current_thread=0x00d9b0fc)  Line 2564	C++
 	libpanda_d.dll!GraphicsEngine::open_windows()  Line 955	C++
 	libpanda_d.dll!GraphicsEngine::make_output(GraphicsPipe * pipe=0x040b6774, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & name="window1", int sort=0, const FrameBufferProperties & fb_prop={...}, const WindowProperties & win_prop={...}, int flags=0, GraphicsStateGuardian * gsg=0x00000000, GraphicsOutput * host=0x00000000)  Line 425	C++
 	libp3framework_d.dll!WindowFramework::open_window(const WindowProperties & props={...}, int flags=0, GraphicsEngine * engine=0x040b7834, GraphicsPipe * pipe=0x040b6774, GraphicsStateGuardian * gsg=0x00000000)  Line 161 + 0x36 bytes	C++
 	libp3framework_d.dll!PandaFramework::open_window(const WindowProperties & props={...}, int flags=0, GraphicsPipe * pipe=0x040b6774, GraphicsStateGuardian * gsg=0x00000000)  Line 453 + 0x28 bytes	C++
 	AWEditor.exe!main(int argc=1, char * * argv=0x00e38fc0)  Line 52 + 0x18 bytes	C++
 	AWEditor.exe!WinMain(HINSTANCE__ * instance=0x01290000, HINSTANCE__ * prevInstance=0x00000000, char * __formal=0x002b65ff, int cmdShow=1)  Line 131 + 0x12 bytes	C++
 	AWEditor.exe!__tmainCRTStartup()  Line 578 + 0x35 bytes	C
 	AWEditor.exe!WinMainCRTStartup()  Line 403	C
 	kernel32.dll!75dc33aa() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
 	ntdll.dll!77ca9ef2() 	
 	ntdll.dll!77ca9ec5() 	

and here for when I run with directX

>	libpandadx9_d.dll!DXGraphicsStateGuardian9::set_cg_device(IDirect3DDevice9 * cg_device=0x045f6ea0)  Line 5693	C++
 	libpandadx9_d.dll!DXGraphicsStateGuardian9::set_context(DXScreenData * new_context=0x040ca070)  Line 4411 + 0xf bytes	C++
 	libpandadx9_d.dll!wdxGraphicsWindow9::make_current()  Line 81	C++
 	libpandadx9_d.dll!wdxGraphicsWindow9::init_resized_window()  Line 1280	C++
 	libpandadx9_d.dll!wdxGraphicsWindow9::create_screen_buffers_and_device(DXScreenData & display={...}, bool force_16bpp_zbuffer=false)  Line 859	C++
 	libpandadx9_d.dll!wdxGraphicsWindow9::open_window()  Line 330 + 0x29 bytes	C++
 	libpanda_d.dll!GraphicsWindow::set_properties_now(WindowProperties & properties={...})  Line 644 + 0x12 bytes	C++
 	libp3windisplay_d.dll!WinGraphicsWindow::set_properties_now(WindowProperties & properties={...})  Line 273 + 0xf bytes	C++
 	libpanda_d.dll!GraphicsWindow::process_events()  Line 604 + 0x19 bytes	C++
 	libp3windisplay_d.dll!WinGraphicsWindow::process_events()  Line 224 + 0xb bytes	C++
 	libpanda_d.dll!GraphicsEngine::process_events(const ov_set<PointerTo<GraphicsOutput>,IndirectLess<GraphicsOutput> > & wlist={...}, Thread * current_thread=0x00e0b0fc)  Line 1616 + 0x25 bytes	C++
 	libpanda_d.dll!GraphicsEngine::WindowRenderer::do_windows(GraphicsEngine * engine=0x040c856c, Thread * current_thread=0x00e0b0fc)  Line 2564	C++
 	libpanda_d.dll!GraphicsEngine::open_windows()  Line 955	C++
 	libpanda_d.dll!GraphicsEngine::make_output(GraphicsPipe * pipe=0x040c742c, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & name="window1", int sort=0, const FrameBufferProperties & fb_prop={...}, const WindowProperties & win_prop={...}, int flags=0, GraphicsStateGuardian * gsg=0x00000000, GraphicsOutput * host=0x00000000)  Line 425	C++
 	libp3framework_d.dll!WindowFramework::open_window(const WindowProperties & props={...}, int flags=0, GraphicsEngine * engine=0x040c856c, GraphicsPipe * pipe=0x040c742c, GraphicsStateGuardian * gsg=0x00000000)  Line 161 + 0x36 bytes	C++
 	libp3framework_d.dll!PandaFramework::open_window(const WindowProperties & props={...}, int flags=0, GraphicsPipe * pipe=0x040c742c, GraphicsStateGuardian * gsg=0x00000000)  Line 453 + 0x28 bytes	C++
 	AWEditor.exe!main(int argc=1, char * * argv=0x00ea8fc0)  Line 52 + 0x18 bytes	C++
 	AWEditor.exe!WinMain(HINSTANCE__ * instance=0x01290000, HINSTANCE__ * prevInstance=0x00000000, char * __formal=0x005f65ff, int cmdShow=1)  Line 131 + 0x12 bytes	C++
 	AWEditor.exe!__tmainCRTStartup()  Line 578 + 0x35 bytes	C
 	AWEditor.exe!WinMainCRTStartup()  Line 403	C
 	kernel32.dll!75dc33aa() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
 	ntdll.dll!77ca9ef2() 	
 	ntdll.dll!77ca9ec5() 	

hope that helps

I have actually installed the latest CG SDK on my computer , which I believe is April 2012 version of Cg 3.1 downloaded from here https://developer.nvidia.com/cg-toolkit

and my environment variable points at this

C:\Program Files (x86)\NVIDIA Corporation\Cg\bin;C:\Program Files (x86)\NVIDIA Corporation\Cg\bin.x64;

maybe the panda build process doesnt like that ?

as I mentioned above I get panda3d directly from the CVS repository and build a debug and release version myself.

Using the usual Panda build process the Panda dlls are going to be linked against the copy of the Cg libs in the thirdparty directory local to Panda, not the ones in your system install of the Cg SDK.

Since you’re building a C++ app, at a guess I’d suggest that the build process for your C++ code is referencing the system install of the Cg SDK, and that having both versions linked in to the final executable is a Bad Thing™.

Try copying the appropriate files from the Cg SDK into Panda’s thirdparty/win-libs-vc9/nvidiacg directory, doing a clean rebuild of Panda, and then of your app.

–jonah

hey you were right! I just changed the CG files in thirdparty with my version of Cg and rebuilt panda. Now I dont get any crash… wicked!
:slight_smile: