From cb90d793d064236f4d048c132dc26fce97c04385 Mon Sep 17 00:00:00 2001 From: aignacio_sf <> Date: Tue, 28 Mar 2006 02:11:38 +0000 Subject: [PATCH] Fix shader issues on D3D Device Reset (resize window, ...) Do not create a new shader context, but reuse old context and just set the D3D device for Cg. --- panda/src/dxgsg9/config_dxgsg9.cxx | 2 ++ panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/panda/src/dxgsg9/config_dxgsg9.cxx b/panda/src/dxgsg9/config_dxgsg9.cxx index 74b0521c04..16f822112c 100755 --- a/panda/src/dxgsg9/config_dxgsg9.cxx +++ b/panda/src/dxgsg9/config_dxgsg9.cxx @@ -21,6 +21,7 @@ #include "dxTextureContext9.h" #include "dxVertexBufferContext9.h" #include "dxIndexBufferContext9.h" +#include "dxShaderContext9.h" #include "dxGeomMunger9.h" #include "graphicsPipeSelection.h" #include "wdxGraphicsWindow9.h" @@ -202,6 +203,7 @@ init_libdxgsg9() { DXTextureContext9::init_type(); DXVertexBufferContext9::init_type(); DXIndexBufferContext9::init_type(); + CLP(ShaderContext)::init_type(); DXGeomMunger9::init_type(); wdxGraphicsPipe9::init_type(); diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index 236f37042d..c2fe811ba3 100755 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -2432,15 +2432,13 @@ reset() { } #ifdef HAVE_CGDX9 - if (_cg_context) { - cgD3D9SetDevice (NULL); - cgDestroyContext (_cg_context); - _cg_context = 0; - } if (_cg_context == 0) { _cg_context = cgCreateContext ( ); cgD3D9SetDevice (_d3d_device); } + else { + cgD3D9SetDevice (_d3d_device); + } #endif _max_vertices_per_array = d3d_caps.MaxVertexIndex;