Browse Source

migrate more code to prc interface

David Rose 21 years ago
parent
commit
a9f7756ba6
35 changed files with 378 additions and 1336 deletions
  1. 6 3
      direct/src/showbase/showBase.cxx
  2. 2 1
      direct/src/showbase/showBase.h
  3. 0 1
      panda/src/downloader/config_downloader.cxx
  4. 44 53
      panda/src/dxgsg7/config_dxgsg7.cxx
  5. 24 31
      panda/src/dxgsg7/config_dxgsg7.h
  6. 0 33
      panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx
  7. 50 76
      panda/src/dxgsg8/config_dxgsg8.cxx
  8. 29 41
      panda/src/dxgsg8/config_dxgsg8.h
  9. 0 321
      panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx
  10. 0 9
      panda/src/dxgsg8/dxGraphicsStateGuardian8.h
  11. 3 6
      panda/src/dxgsg8/wdxGraphicsWindow8.cxx
  12. 50 76
      panda/src/dxgsg9/config_dxgsg9.cxx
  13. 29 41
      panda/src/dxgsg9/config_dxgsg9.h
  14. 0 336
      panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx
  15. 0 12
      panda/src/dxgsg9/dxGraphicsStateGuardian9.h
  16. 3 6
      panda/src/dxgsg9/wdxGraphicsWindow9.cxx
  17. 0 1
      panda/src/egg/config_egg.cxx
  18. 0 1
      panda/src/egg2pg/config_egg2pg.cxx
  19. 1 3
      panda/src/express/Sources.pp
  20. 0 1
      panda/src/express/express_composite1.cxx
  21. 0 75
      panda/src/express/get_config_path.cxx
  22. 0 47
      panda/src/express/get_config_path.h
  23. 0 8
      panda/src/parametrics/config_parametrics.cxx
  24. 6 1
      panda/src/pgraph/config_pgraph.cxx
  25. 1 0
      panda/src/pgraph/config_pgraph.h
  26. 3 5
      panda/src/pgraph/cullBinManager.cxx
  27. 12 44
      panda/src/pstatclient/config_pstats.cxx
  28. 4 4
      panda/src/pstatclient/config_pstats.h
  29. 3 5
      panda/src/pstatclient/pStatClientImpl.cxx
  30. 11 5
      panda/src/putil/config_util.cxx
  31. 15 10
      panda/src/wgldisplay/config_wgldisplay.cxx
  32. 6 4
      panda/src/wgldisplay/config_wgldisplay.h
  33. 57 57
      panda/src/windisplay/config_windisplay.cxx
  34. 17 17
      panda/src/windisplay/config_windisplay.h
  35. 2 2
      panda/src/windisplay/winGraphicsWindow.cxx

+ 6 - 3
direct/src/showbase/showBase.cxx

@@ -30,10 +30,13 @@ ConfigureDef(config_showbase);
 ConfigureFn(config_showbase) {
 }
 
-DSearchPath &
+ConfigVariableSearchPath particle_path
+("particle-path", 
+ PRC_DESC("The directories to search for particle files to be loaded."));
+
+ConfigVariableSearchPath &
 get_particle_path() {
-  static DSearchPath *particle_path = NULL;
-  return get_config_path("particle-path", particle_path);
+  return particle_path;
 }
 
 // Throw the "NewFrame" event in the C++ world.  Some of the lerp code

+ 2 - 1
direct/src/showbase/showBase.h

@@ -28,6 +28,7 @@
 #include "pointerTo.h"
 #include "dconfig.h"
 #include "dSearchPath.h"
+#include "configVariableSearchPath.h"
 #include "nodePath.h"
 
 ConfigureDecl(config_showbase, EXPCL_DIRECT, EXPTP_DIRECT);
@@ -39,7 +40,7 @@ class GraphicsEngine;
 
 BEGIN_PUBLISH
 
-EXPCL_DIRECT DSearchPath &get_particle_path();
+EXPCL_DIRECT ConfigVariableSearchPath &get_particle_path();
 
 EXPCL_DIRECT void throw_new_frame();
 

+ 0 - 1
panda/src/downloader/config_downloader.cxx

@@ -17,7 +17,6 @@
 ////////////////////////////////////////////////////////////////////
 
 #include "dconfig.h"
-#include "get_config_path.h"
 #include "config_downloader.h"
 #include "httpChannel.h"
 

+ 44 - 53
panda/src/dxgsg7/config_dxgsg7.cxx

@@ -30,31 +30,25 @@ Configure(config_dxgsg7);
 NotifyCategoryDef(dxgsg7, ":display:gsg");
 NotifyCategoryDef(wdxdisplay7, "windisplay");
 
-// Configure this variable true to cause the DXGSG to show each
-// transform space it renders by drawing a little unit axis.  This
-// cannot be enabled when the player is compiled in NDEBUG mode.
-bool dx_show_transforms = config_dxgsg7.GetBool("dx-show-transforms", false);
-
 //  Configure this to TRUE if you want DirectX to control the entire screen,
 //  If false, it will just blit into a window.
-bool dx_full_screen = config_dxgsg7.GetBool("dx-full-screen", false);
+ConfigVariableBool dx_full_screen
+("dx-full-screen", false);
 
 //  Configure this true to force the rendering to sync to the video
 //  refresh, or false to let your frame rate go as high as it can,
 //  irrespective of the video refresh.
-bool dx_sync_video = config_dxgsg7.GetBool("sync-video", true);
+ConfigVariableBool dx_sync_video
+("sync-video", true);
 
 // enable this to turn on full-screen anti-aliasing, if the HW supports it
 // this var is also used in wdxGraphicsWindows.cxx
-bool dx_full_screen_antialiasing = config_dxgsg7.GetBool("dx-antialias", false);
-
-// Configure this true to perform a cull traversal over the geometry
-// by default, false otherwise.  The cull traversal provides support
-// for state-sorting, z-sorting, and binning.
-bool dx_cull_traversal = config_dxgsg7.GetBool("dx-cull-traversal", true);
+ConfigVariableBool dx_full_screen_antialiasing
+("dx-antialias", false);
 
 // if true, if card only supports per-vertex fog, it will be treated as no-HW fog capability
-bool dx_no_vertex_fog = config_dxgsg7.GetBool("dx-no-vertex-fog", false);
+ConfigVariableBool dx_no_vertex_fog
+("dx-no-vertex-fog", false);
 
 // Configure this true to cause all lighting normals to automatically
 // be normalized by the CPU before rendering.  This is
@@ -62,65 +56,67 @@ bool dx_no_vertex_fog = config_dxgsg7.GetBool("dx-no-vertex-fog", false);
 // expect lighting to work correctly.  Maybe one day there will be
 // another way to set this at runtime, instead of only as a configure
 // variable
-bool dx_auto_normalize_lighting = config_dxgsg7.GetBool("auto-normalize-lighting", true);
+ConfigVariableBool dx_auto_normalize_lighting
+("auto-normalize-lighting", true);
 
-bool dx_allow_software_renderer = config_dxgsg7.GetBool("dx-allow-software-renderer", false);
-bool dx_force_software_renderer = config_dxgsg7.GetBool("dx-force-software-renderer", false);
+ConfigVariableBool dx_allow_software_renderer
+("dx-allow-software-renderer", false);
+ConfigVariableBool dx_force_software_renderer
+("dx-force-software-renderer", false);
 
 #ifndef NDEBUG
 // debugging flag
 // values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW
-int dx_force_backface_culling = config_dxgsg7.GetInt("dx-force-backface-culling", 0);
+ConfigVariableInt dx_force_backface_culling
+("dx-force-backface-culling", 0);
 #endif
 
-bool dx_mipmap_everything = config_dxgsg7.GetBool("dx-mipmap-everything", false);
-bool dx_ignore_mipmaps = config_dxgsg7.GetBool("dx-ignore-mipmaps", false);
+ConfigVariableBool dx_mipmap_everything
+("dx-mipmap-everything", false);
+ConfigVariableBool dx_ignore_mipmaps
+("dx-ignore-mipmaps", false);
 
 // if this is set, more accurate but more expensive fog computations are performed
-bool dx_use_rangebased_fog = config_dxgsg7.GetBool("dx-use-rangebased-fog", false);
-bool dx_force_16bpptextures = config_dxgsg7.GetBool("dx-force-16bpptextures", false);
-bool dx_no_dithering = config_dxgsg7.GetBool("dx-no-dithering", false);
-bool dx_force_16bpp_zbuffer = config_dxgsg7.GetBool("dx-force-16bpp-zbuffer", false);
-bool dx_do_vidmemsize_check = config_dxgsg7.GetBool("do-vidmemsize-check", true);
+ConfigVariableBool dx_use_rangebased_fog
+("dx-use-rangebased-fog", false);
+ConfigVariableBool dx_force_16bpptextures
+("dx-force-16bpptextures", false);
+ConfigVariableBool dx_no_dithering
+("dx-no-dithering", false);
+ConfigVariableBool dx_force_16bpp_zbuffer
+("dx-force-16bpp-zbuffer", false);
+ConfigVariableBool dx_do_vidmemsize_check
+("do-vidmemsize-check", true);
 // Setting this true theoretically hinders render performance, because
 // it forces the FPU to go through some extra work to clean itself up
 // after rendering a frame, but the performance cost seems to be
 // small.  On the other hand, setting it false can force the
 // application to run in single-precision arithmetic mode, even if
 // it believes it is using double-precision variables.
-bool dx_preserve_fpu_state = config_dxgsg7.GetBool("dx-preserve-fpu-state", true);
+ConfigVariableBool dx_preserve_fpu_state
+("dx-preserve-fpu-state", true);
 
 // Configure this true to try to implement decals using a
 // DepthOffsetAttrib, false to do them with the more reliable 3-pass
 // rendering method instead.
-bool dx_depth_offset_decals = config_dxgsg7.GetBool("depth-offset-decals", false);
+ConfigVariableBool dx_depth_offset_decals
+("depth-offset-decals", false);
 
 #ifdef _DEBUG
-float dx_global_miplevel_bias = config_dxgsg7.GetFloat("dx-global-miplevel-bias", 0.0);
-bool dx_debug_view_mipmaps = config_dxgsg7.GetBool("dx-debug-view-mipmaps", false);
-bool dx_force_anisotropic_filtering = config_dxgsg7.GetBool("dx-force-anisotropic-filtering", false);
-//int dx_print_texstats = config_dxgsg7.GetBool("dx-print-texstats", 0);
+ConfigVariableDouble dx_global_miplevel_bias
+("dx-global-miplevel-bias", 0.0);
+ConfigVariableBool dx_debug_view_mipmaps
+("dx-debug-view-mipmaps", false);
+ConfigVariableBool dx_force_anisotropic_filtering
+("dx-force-anisotropic-filtering", false);
+//int dx_print_texstats
+("dx-print-texstats", 0);
 #endif
 
 // set 'retained-mode #t' and this to have prepare_geom concatenate all tristrips within a geom 
 // together using degenerate tris
-const bool link_tristrips = config_dxgsg7.GetBool("link-tristrips", false);
-
-// note:  offset currently disabled since it wasnt working properly
-DXDecalType dx_decal_type = GDT_blend;
-
-static DXDecalType
-parse_decal_type(const string &type) {
-  if (type == "mask") {
-    return GDT_mask;
-  } else if (type == "blend") {
-    return GDT_blend;
-  } else if (type == "offset") {
-    return GDT_offset;
-  }
-  dxgsg7_cat.error() << "Invalid dx-decal-type: " << type << "\n";
-  return GDT_blend;
-}
+ConfigVariableBool link_tristrips
+("link-tristrips", false);
 
 ConfigureFn(config_dxgsg7) {
   init_libdxgsg7();
@@ -142,11 +138,6 @@ init_libdxgsg7() {
   }
   initialized = true;
 
-  string decal_type = config_dxgsg7.GetString("dx-decal-type", "");
-  if (!decal_type.empty()) {
-    dx_decal_type = parse_decal_type(decal_type);
-  }
-
   DXGraphicsStateGuardian7::init_type();
   DXSavedFrameBuffer7::init_type();
   DXTextureContext7::init_type();

+ 24 - 31
panda/src/dxgsg7/config_dxgsg7.h

@@ -21,51 +21,44 @@
 
 #include "pandabase.h"
 #include "notifyCategoryProxy.h"
+#include "configVariableBool.h"
+#include "configVariableInt.h"
+#include "configVariableDouble.h"
 
 NotifyCategoryDecl(dxgsg7, EXPCL_PANDADX, EXPTP_PANDADX);
 NotifyCategoryDecl(wdxdisplay7, EXPCL_PANDADX, EXPTP_PANDADX);
 
-extern bool dx_full_screen;
-extern bool dx_sync_video;
-extern bool dx_cull_traversal;
-extern bool dx_no_vertex_fog;
-extern bool dx_full_screen_antialiasing;
-extern bool dx_auto_normalize_lighting;
-extern bool dx_use_rangebased_fog;
-extern bool dx_allow_software_renderer;
-extern bool dx_force_software_renderer;
-extern const bool link_tristrips;
+extern ConfigVariableBool dx_full_screen;
+extern ConfigVariableBool dx_sync_video;
+extern ConfigVariableBool dx_no_vertex_fog;
+extern ConfigVariableBool dx_full_screen_antialiasing;
+extern ConfigVariableBool dx_auto_normalize_lighting;
+extern ConfigVariableBool dx_use_rangebased_fog;
+extern ConfigVariableBool dx_allow_software_renderer;
+extern ConfigVariableBool dx_force_software_renderer;
+extern ConfigVariableBool link_tristrips;
 
 // debug flags we might want to use in full optimized build
-extern bool dx_ignore_mipmaps;
-extern bool dx_mipmap_everything;
-extern bool dx_show_transforms;
-extern bool dx_force_16bpptextures;
-extern bool dx_no_dithering;
-extern bool dx_force_16bpp_zbuffer;
-extern bool dx_do_vidmemsize_check;
-extern bool dx_preserve_fpu_state;
+extern ConfigVariableBool dx_ignore_mipmaps;
+extern ConfigVariableBool dx_mipmap_everything;
+extern ConfigVariableBool dx_force_16bpptextures;
+extern ConfigVariableBool dx_no_dithering;
+extern ConfigVariableBool dx_force_16bpp_zbuffer;
+extern ConfigVariableBool dx_do_vidmemsize_check;
+extern ConfigVariableBool dx_preserve_fpu_state;
 
-extern bool dx_depth_offset_decals;
+extern ConfigVariableBool dx_depth_offset_decals;
 
 #ifndef NDEBUG
-extern int dx_force_backface_culling;
+extern ConfigVariableInt dx_force_backface_culling;
 #endif
 
 #ifdef _DEBUG
-extern float dx_global_miplevel_bias;
-extern bool dx_debug_view_mipmaps;
-extern bool dx_force_anisotropic_filtering;
+extern ConfigVariableDouble dx_global_miplevel_bias;
+extern ConfigVariableBool dx_debug_view_mipmaps;
+extern ConfigVariableBool dx_force_anisotropic_filtering;
 #endif
 
-// Ways to implement decals.
-enum DXDecalType {
-  GDT_mask,   // GL 1.0 style, involving three steps and double-draw of polygon
-  GDT_blend,  // As above, but slower; use blending to disable colorbuffer writes
-  GDT_offset  // The fastest, using GL 1.1 style glPolygonOffset
-};
-extern DXDecalType dx_decal_type;
-
 extern EXPCL_PANDADX void init_libdxgsg7();
 
 #endif

+ 0 - 33
panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx

@@ -499,44 +499,11 @@ dx_init( void) {
 //  shouldve already been set
 //    sc_bIsTNLDevice = (IsEqualGUID(_pScrn->D3DDevDesc.deviceGUID,IID_IDirect3DTnLHalDevice)!=0);
 
-    if ((dx_decal_type==GDT_offset) && !(_pScrn->D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ZBIAS)) {
-#ifdef _DEBUG
-        // dx7 doesnt support PLANEMASK renderstate
-#if(DIRECT3D_VERSION < 0x700)
-        dxgsg7_cat.debug() << "dx-decal-type 'offset' not supported by hardware, switching to decal masking\n";
-#else
-        dxgsg7_cat.debug() << "dx-decal-type 'offset' not supported by hardware, switching to decal double-draw blend-based masking\n";
-#endif
-#endif
-#if(DIRECT3D_VERSION < 0x700)
-        dx_decal_type = GDT_mask;
-#else
-        dx_decal_type = GDT_blend;
-#endif
-    }
-
 #ifdef DISABLE_POLYGON_OFFSET_DECALING
 #ifdef _DEBUG
     dxgsg7_cat.spam() << "polygon-offset decaling disabled in dxgsg7, switching to double-draw decaling\n";
 #endif
-
-#if(DIRECT3D_VERSION < 0x700)
-    dx_decal_type = GDT_mask;
-#else
-    dx_decal_type = GDT_blend;
-#endif
-#endif
-
-    if ((dx_decal_type==GDT_mask) && !(_pScrn->D3DDevDesc.dpcTriCaps.dwMiscCaps & D3DPMISCCAPS_MASKPLANES)) {
-#ifdef _DEBUG
-        dxgsg7_cat.debug() << "No hardware support for colorwrite disabling, switching to dx-decal-type 'mask' to 'blend'\n";
 #endif
-        dx_decal_type = GDT_blend;
-    }
-
-    if (((dx_decal_type==GDT_blend)||(dx_decal_type==GDT_mask)) && !(_pScrn->D3DDevDesc.dpcTriCaps.dwMiscCaps & D3DPMISCCAPS_MASKZ)) {
-        dxgsg7_cat.error() << "dx-decal-type mask impossible to implement, no hardware support for Z-masking, decals will not appear correctly!\n";
-    }
 
 //#define REQUIRED_BLENDCAPS (D3DPBLENDCAPS_ZERO|D3DPBLENDCAPS_ONE|D3DPBLENDCAPS_SRCCOLOR|D3DPBLENDCAPS_INVSRCCOLOR| \
 //                            D3DPBLENDCAPS_SRCALPHA|D3DPBLENDCAPS_INVSRCALPHA | D3DPBLENDCAPS_DESTALPHA|D3DPBLENDCAPS_INVDESTALPHA|D3DPBLENDCAPS_DESTCOLOR|D3DPBLENDCAPS_INVDESTCOLOR)

+ 50 - 76
panda/src/dxgsg8/config_dxgsg8.cxx

@@ -34,30 +34,37 @@ NotifyCategoryDef(wdxdisplay8, "windisplay");
 // Configure this variable true to cause the DXGSG to show each
 // transform space it renders by drawing a little unit axis.  This
 // cannot be enabled when the player is compiled in NDEBUG mode.
-bool dx_show_transforms = config_dxgsg8.GetBool("dx-show-transforms", false);
+ConfigVariableBool dx_show_transforms
+("dx-show-transforms", false);
 
 //  Configure this to TRUE if you want DirectX to control the entire screen,
 //  If false, it will just blit into a window.
-bool dx_full_screen = config_dxgsg8.GetBool("dx-full-screen", false);
+ConfigVariableBool dx_full_screen
+("dx-full-screen", false);
 
 //  Configure this true to force the rendering to sync to the video
 //  refresh, or false to let your frame rate go as high as it can,
 //  irrespective of the video refresh.
-bool dx_sync_video = config_dxgsg8.GetBool("sync-video", true);
+ConfigVariableBool dx_sync_video
+("sync-video", true);
 
 // Set Level of MultiSampling to be used, if HW supports it.  Valid values are 2-16.
-DWORD dx_multisample_antialiasing_level = (DWORD) config_dxgsg8.GetInt("dx-multisample-antialiasing-level", 0);
+ConfigVariableInt dx_multisample_antialiasing_level
+("dx-multisample-antialiasing-level", 0);
 
 // Configure this true to perform a cull traversal over the geometry
 // by default, false otherwise.  The cull traversal provides support
 // for state-sorting, z-sorting, and binning.
-bool dx_cull_traversal = config_dxgsg8.GetBool("dx-cull-traversal", true);
+ConfigVariableBool dx_cull_traversal
+("dx-cull-traversal", true);
 
 // if true, if card only supports per-vertex fog, it will be treated as no-HW fog capability
-bool dx_no_vertex_fog = config_dxgsg8.GetBool("dx-no-vertex-fog", false);
+ConfigVariableBool dx_no_vertex_fog
+("dx-no-vertex-fog", false);
 
 // if true, overwrite cursor bitmap tip with "D3D" to distinguish it from GDI cursor 
-bool dx_show_cursor_watermark = config_dxgsg8.GetBool("dx-show-cursor-watermark", 
+ConfigVariableBool dx_show_cursor_watermark
+("dx-show-cursor-watermark", 
 #ifdef _DEBUG
     true
 #else
@@ -66,7 +73,8 @@ bool dx_show_cursor_watermark = config_dxgsg8.GetBool("dx-show-cursor-watermark"
     );
 
 // if true, triangle filter will be used to generate mipmap levels instead of default box filter
-bool dx_use_triangle_mipgen_filter = config_dxgsg8.GetBool("dx-use-triangle-mipgen-filter", false);
+ConfigVariableBool dx_use_triangle_mipgen_filter
+("dx-use-triangle-mipgen-filter", false);
 
 // Configure this true to cause all lighting normals to automatically
 // be normalized by the CPU before rendering.  This is
@@ -74,99 +82,74 @@ bool dx_use_triangle_mipgen_filter = config_dxgsg8.GetBool("dx-use-triangle-mipg
 // expect lighting to work correctly.  Maybe one day there will be
 // another way to set this at runtime, instead of only as a configure
 // variable
-bool dx_auto_normalize_lighting = config_dxgsg8.GetBool("auto-normalize-lighting", true);
-
-bool dx_show_fps_meter = config_dxgsg8.GetBool("show-fps-meter", false);
-float dx_fps_meter_update_interval = max(0.5,config_dxgsg8.GetFloat("fps-meter-update-interval", 1.7));
+ConfigVariableBool dx_auto_normalize_lighting
+("auto-normalize-lighting", true);
 
 #ifndef NDEBUG
 // debugging flag
 // values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW
-int dx_force_backface_culling = config_dxgsg8.GetInt("dx-force-backface-culling", 0);
+ConfigVariableInt dx_force_backface_culling
+("dx-force-backface-culling", 0);
 #endif
 
-bool dx_mipmap_everything = config_dxgsg8.GetBool("dx-mipmap-everything", false);
-bool dx_ignore_mipmaps = config_dxgsg8.GetBool("dx-ignore-mipmaps", false);
+ConfigVariableBool dx_mipmap_everything
+("dx-mipmap-everything", false);
+ConfigVariableBool dx_ignore_mipmaps
+("dx-ignore-mipmaps", false);
 
 // if this is set, more accurate but more expensive fog computations are performed
-bool dx_use_rangebased_fog = config_dxgsg8.GetBool("dx-use-rangebased-fog", false);
-bool dx_force_16bpptextures = config_dxgsg8.GetBool("dx-force-16bpptextures", false);
-bool dx_no_dithering = config_dxgsg8.GetBool("dx-no-dithering", false);
-bool dx_force_16bpp_zbuffer = config_dxgsg8.GetBool("dx-force-16bpp-zbuffer", false);
-bool dx_do_vidmemsize_check = config_dxgsg8.GetBool("do-vidmemsize-check", true);
+ConfigVariableBool dx_use_rangebased_fog
+("dx-use-rangebased-fog", false);
+ConfigVariableBool dx_force_16bpptextures
+("dx-force-16bpptextures", false);
+ConfigVariableBool dx_no_dithering
+("dx-no-dithering", false);
+ConfigVariableBool dx_force_16bpp_zbuffer
+("dx-force-16bpp-zbuffer", false);
+ConfigVariableBool dx_do_vidmemsize_check
+("do-vidmemsize-check", true);
 // Setting this true theoretically hinders render performance, because
 // it forces the FPU to go through some extra work to clean itself up
 // after rendering a frame, but the performance cost seems to be
 // small.  On the other hand, setting it false can force the
 // application to run in single-precision arithmetic mode, even if
 // it believes it is using double-precision variables.
-bool dx_preserve_fpu_state = config_dxgsg8.GetBool("dx-preserve-fpu-state", true);
+ConfigVariableBool dx_preserve_fpu_state
+("dx-preserve-fpu-state", true);
 
 // if true, override win-width/height and use driver vidmem info to
 // pick what will be a fullscreen window size close to the best perf
 // capability of card, based on a heuristic
-bool dx_pick_best_screenres = config_dxgsg8.GetBool("pick-best-screenres", false);
+ConfigVariableBool dx_pick_best_screenres
+("pick-best-screenres", false);
 
-int dx_preferred_device_id = config_dxgsg8.GetInt("dx-preferred-device-id", -1);
+ConfigVariableInt dx_preferred_device_id
+("dx-preferred-device-id", -1);
 
 #ifdef _DEBUG
-float dx_global_miplevel_bias = config_dxgsg8.GetFloat("dx-global-miplevel-bias", 0.0);
-bool dx_debug_view_mipmaps = config_dxgsg8.GetBool("dx-debug-view-mipmaps", false);
-//int dx_print_texstats = config_dxgsg8.GetBool("dx-print-texstats", 0);
+float dx_global_miplevel_bias
+("dx-global-miplevel-bias", 0.0);
+ConfigVariableBool dx_debug_view_mipmaps
+("dx-debug-view-mipmaps", false);
 #endif
 
 // use dx8 or GDI mouse cursor in fullscreen mode?
 // Nvidia dx8 cursor is invisible as of 28.32 drivers, so using GDI in fullscrn by default for now
-bool dx_use_dx_cursor = config_dxgsg8.GetBool("dx-use-dx-cursor", false);
+ConfigVariableBool dx_use_dx_cursor
+("dx-use-dx-cursor", false);
 
-bool dx_force_anisotropic_filtering = config_dxgsg8.GetBool("dx-force-anisotropic-filtering", false);
+ConfigVariableBool dx_force_anisotropic_filtering
+("dx-force-anisotropic-filtering", false);
 
 // set 'retained-mode #t' and this to have prepare_geom concatenate all tristrips within a geom 
 // together using degenerate tris
-const bool link_tristrips = config_dxgsg8.GetBool("link-tristrips", false);
-
-// note:  offset currently disabled since it wasnt working properly
-DXDecalType dx_decal_type = GDT_mask;
-
-// Note: must be a ptr not a regular string because the init-string constructor for
-// a global/static string variable will run AFTER the dll static init fn
-// init_libdxgsg8(), which means the string will be reset to "" after we read it in
-string *pdx_vertexshader_filename=NULL;
-string *pdx_pixelshader_filename=NULL;
-
-// texture file to be set globally, usually for special FX
-string *pdx_globaltexture_filename=NULL;
-// tex stagenum to set the global tex to
-UINT dx_globaltexture_stagenum = (UINT) config_dxgsg8.GetInt("dx-globaltexture-stagenum", 0);
-
-static DXDecalType
-parse_decal_type(const string &type) {
-  if (type == "mask") {
-    return GDT_mask;
-  } else if (type == "blend") {
-    return GDT_blend;
-  } else if (type == "offset") {
-    return GDT_offset;
-  }
-  dxgsg8_cat.error() << "Invalid dx-decal-type: " << type << "\n";
-  return GDT_mask;
-}
+ConfigVariableBool link_tristrips
+("link-tristrips", false);
 
 ConfigureFn(config_dxgsg8) {
   init_libdxgsg8();
 }
 
-void init_config_string(string *&pFname,const char *ConfigrcVarname) {
-  // pFname is reference to string ptr
-
-  // dont try to take the & of a soon-to-be-gone stack var string, this must be on the heap!
-  pFname = new string(config_dxgsg8.GetString(ConfigrcVarname, ""));
-  if(pFname->empty()) {
-      delete pFname;
-      pFname=NULL;
-  }
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libdxgsg
 //  Description: Initializes the library.  This must be called at
@@ -183,15 +166,6 @@ init_libdxgsg8() {
   }
   initialized = true;
 
-  string decal_type = config_dxgsg8.GetString("dx-decal-type", "");
-  if (!decal_type.empty()) {
-    dx_decal_type = parse_decal_type(decal_type);
-  }
-
-  init_config_string(pdx_vertexshader_filename,"dx-vertexshader-filename");
-  init_config_string(pdx_pixelshader_filename,"dx-pixelshader-filename");
-  init_config_string(pdx_globaltexture_filename,"dx-globaltexture-filename");
-
   DXGraphicsStateGuardian8::init_type();
   DXSavedFrameBuffer8::init_type();
   DXTextureContext8::init_type();

+ 29 - 41
panda/src/dxgsg8/config_dxgsg8.h

@@ -22,61 +22,49 @@
 #include "pandabase.h"
 #include "notifyCategoryProxy.h"
 #include "dxgsg8base.h"
+#include "configVariableBool.h"
+#include "configVariableInt.h"
+#include "configVariableDouble.h"
 
 NotifyCategoryDecl(dxgsg8, EXPCL_PANDADX, EXPTP_PANDADX);
 NotifyCategoryDecl(wdxdisplay8, EXPCL_PANDADX, EXPTP_PANDADX);
 
-extern bool dx_full_screen;
-extern bool dx_sync_video;
-extern bool dx_cull_traversal;
-extern bool dx_show_fps_meter;
-extern bool dx_no_vertex_fog;
-extern bool dx_show_cursor_watermark;
-extern bool dx_full_screen_antialiasing;
-extern float dx_fps_meter_update_interval;
-extern bool dx_auto_normalize_lighting;
-extern bool dx_use_rangebased_fog;
-extern const bool link_tristrips;
-extern DWORD dx_multisample_antialiasing_level;
-extern bool dx_use_triangle_mipgen_filter;
-extern bool dx_use_dx_cursor;
+extern ConfigVariableBool dx_full_screen;
+extern ConfigVariableBool dx_sync_video;
+extern ConfigVariableBool dx_cull_traversal;
+extern ConfigVariableBool dx_no_vertex_fog;
+extern ConfigVariableBool dx_show_cursor_watermark;
+extern ConfigVariableBool dx_full_screen_antialiasing;
+extern ConfigVariableBool dx_auto_normalize_lighting;
+extern ConfigVariableBool dx_use_rangebased_fog;
+extern ConfigVariableBool link_tristrips;
+extern ConfigVariableInt dx_multisample_antialiasing_level;
+extern ConfigVariableBool dx_use_triangle_mipgen_filter;
+extern ConfigVariableBool dx_use_dx_cursor;
 
 
 // debug flags we might want to use in full optimized build
-extern bool dx_ignore_mipmaps;
-extern bool dx_mipmap_everything;
-extern bool dx_show_transforms;
-extern bool dx_force_16bpptextures;
-extern bool dx_no_dithering;
-extern bool dx_force_anisotropic_filtering;
-extern bool dx_force_16bpp_zbuffer;
-extern bool dx_do_vidmemsize_check;
-extern bool dx_preserve_fpu_state;
-extern bool dx_pick_best_screenres;
-extern int dx_preferred_device_id;
-
-extern string *pdx_vertexshader_filename;
-extern string *pdx_pixelshader_filename;
-extern string *pdx_globaltexture_filename;
-extern UINT   dx_globaltexture_stagenum;
+extern ConfigVariableBool dx_ignore_mipmaps;
+extern ConfigVariableBool dx_mipmap_everything;
+extern ConfigVariableBool dx_show_transforms;
+extern ConfigVariableBool dx_force_16bpptextures;
+extern ConfigVariableBool dx_no_dithering;
+extern ConfigVariableBool dx_force_anisotropic_filtering;
+extern ConfigVariableBool dx_force_16bpp_zbuffer;
+extern ConfigVariableBool dx_do_vidmemsize_check;
+extern ConfigVariableBool dx_preserve_fpu_state;
+extern ConfigVariableBool dx_pick_best_screenres;
+extern ConfigVariableInt dx_preferred_device_id;
 
 #ifndef NDEBUG
-extern int dx_force_backface_culling;
+extern ConfigVariableInt dx_force_backface_culling;
 #endif
 
 #ifdef _DEBUG
-extern float dx_global_miplevel_bias;
-extern bool dx_debug_view_mipmaps;
+extern ConfigVariableDouble dx_global_miplevel_bias;
+extern ConfigVariableBool dx_debug_view_mipmaps;
 #endif
 
-// Ways to implement decals.
-enum DXDecalType {
-  GDT_mask,   // GL 1.0 style, involving three steps and double-draw of polygon
-  GDT_blend,  // As above, but slower; use blending to disable colorbuffer writes
-  GDT_offset  // The fastest, using GL 1.1 style glPolygonOffset
-};
-extern DXDecalType dx_decal_type;
-
 extern EXPCL_PANDADX void init_libdxgsg8();
 
 #endif

+ 0 - 321
panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx

@@ -90,9 +90,6 @@ typedef enum { NothingSet=0,NormalOnly,ColorOnly,Normal_Color,TexCoordOnly,
 #define PER_COLOR    ColorOnly
 #define PER_TEXCOORD TexCoordOnly
 
-// xform mat for vshader will usually be loaded at constant regs c4-c7
-#define VSHADER_XFORMMATRIX_CONSTANTREGNUMSTART 4
-
 static D3DMATRIX matIdentity;
 
 #define __D3DLIGHT_RANGE_MAX ((float)sqrt(FLT_MAX))  //for some reason this is missing in dx8 hdrs
@@ -155,192 +152,6 @@ void INLINE TestDrawPrimFailure(DP_Type dptype,HRESULT hr,IDirect3DDevice8 *pD3D
 #define TestDrawPrimFailure(a,b,c,nVerts,nTris) CountDPs(nVerts,nTris);
 #endif
 
-DXShaderHandle DXGraphicsStateGuardian8::
-read_pixel_shader(string &filename) {
-    HRESULT hr;
-    DXShaderHandle hShader=NULL;
-    HANDLE hFile=NULL;
-    BYTE *pShaderBytes=NULL;
-    LPD3DXBUFFER pD3DXBuf_Constants=NULL,pD3DXBuf_CompiledShader=NULL,pD3DXBuf_CompilationErrors=NULL;
-
-    assert(_pD3DDevice!=NULL);
-    assert(_pScrn->bCanUsePixelShaders);
-    bool bIsCompiledShader=(filename.find(".pso")!=string::npos);
-
-    if(bIsCompiledShader) {
-        hFile = CreateFile(filename.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
-        if(hFile == INVALID_HANDLE_VALUE) {
-            dxgsg8_cat.error() << "Could not find shader file '"<< filename << "'\n";
-            return NULL;
-        }
-
-        UINT BytesRead,FileSize = GetFileSize(hFile, NULL);
-
-        pShaderBytes = new BYTE[FileSize];
-        if (pShaderBytes==NULL) {
-            dxgsg8_cat.error() << "MemAlloc failed for shader file '"<< filename << "'\n";
-            goto exit_create_pshader;
-        }
-
-        ReadFile(hFile, (void*)pShaderBytes, FileSize, (LPDWORD)&BytesRead, NULL);
-        assert(BytesRead==FileSize);
-    } else {
-        #if defined(NDEBUG) && !defined(COMPILE_TEXT_SHADERFILES)
-            // want to keep bulky d3dx shader assembler stuff out of publish build
-            dxgsg8_cat.error() << "publish build only reads .vso compiled shaders!\n";
-            exit(1);
-        #else
-           // check for file existence
-           WIN32_FIND_DATA Junk;
-           HANDLE FindFileHandle = FindFirstFile(filename.c_str(),&Junk);
-           if ( FindFileHandle == INVALID_HANDLE_VALUE ) {
-                dxgsg8_cat.error() << "Could not find shader file '"<< filename << "'\n";
-                return NULL;
-           }
-           FindClose(FindFileHandle);
-
-           hr = D3DXAssembleShaderFromFile(filename.c_str(),D3DXASM_DEBUG,NULL,&pD3DXBuf_CompiledShader,&pD3DXBuf_CompilationErrors);
-           if(FAILED(hr)) {
-               dxgsg8_cat.error() << "D3DXAssembleShader failed for '"<< filename << "' " << D3DERRORSTRING(hr);
-               if(pD3DXBuf_CompilationErrors!=NULL) {
-                   dxgsg8_cat.error() << "Compilation Errors: " << (char*) pD3DXBuf_CompilationErrors->GetBufferPointer() << endl;
-               }
-               exit(1);
-           }
-           assert(pD3DXBuf_CompilationErrors==NULL);
-        #endif
-   }
-
-   hr = _pD3DDevice->CreatePixelShader((DWORD*) ((pD3DXBuf_CompiledShader!=NULL) ? pD3DXBuf_CompiledShader->GetBufferPointer() : pShaderBytes),
-                                     &hShader);
-   if (FAILED(hr)) {
-        dxgsg8_cat.error() << "CreatePixelShader failed for '"<< filename << "' " << D3DERRORSTRING(hr);
-        hShader=NULL;
-   }
-
-   assert(hShader!=NULL);   // NULL is invalid I hope
-
-   #ifdef _DEBUG
-      dxgsg8_cat.debug() <<  "CreatePixelShader succeeded for "<< filename << endl;
-   #endif
-
- exit_create_pshader:
-   SAFE_RELEASE(pD3DXBuf_CompiledShader);
-   if(hFile!=NULL)
-     CloseHandle(hFile);
-   SAFE_DELETE(pShaderBytes);
-   return hShader;
-}
-
-
-DXShaderHandle DXGraphicsStateGuardian8::
-read_vertex_shader(string &filename) {
-#ifndef USE_VERTEX_SHADERS
-    return NULL;
-#else
-    HRESULT hr;
-    DXShaderHandle hShader=NULL;
-    HANDLE hFile=NULL;
-    BYTE *pShaderBytes=NULL;
-    LPD3DXBUFFER pD3DXBuf_Constants=NULL,pD3DXBuf_CompiledShader=NULL,pD3DXBuf_CompilationErrors=NULL;
-    #define VSDDECL_BUFSIZE 1024
-    UINT ShaderDeclHeader[VSDDECL_BUFSIZE];
-
-    // simple decl for posn + color
-    // need way to encode header decl with vsh files (stick in comment?)  (use ID3DXEffect files?)
-    UINT Predefined_DeclArray[] = {
-        D3DVSD_STREAM(0),
-        D3DVSD_REG(D3DVSDE_POSITION, D3DVSDT_FLOAT3 ),      // input register v0
-        D3DVSD_REG(D3DVSDE_DIFFUSE, D3DVSDT_D3DCOLOR ),     // input Register v5
-      //  D3DVSD_CONST(0,1),*(DWORD*)&c[0],*(DWORD*)&c[1],*(DWORD*)&c[2],*(DWORD*)&c[3],
-    };
-
-    memcpy(ShaderDeclHeader,Predefined_DeclArray,sizeof(Predefined_DeclArray));
-
-    // need to append any compiled constants to instr array
-    UINT ShaderDeclHeader_UINTSize=sizeof(Predefined_DeclArray)/sizeof(UINT);
-
-    assert(_pD3DDevice!=NULL);
-    bool bIsCompiledShader=(filename.find(".vso")!=string::npos);
-
-    if(bIsCompiledShader) {
-        hFile = CreateFile(filename.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
-        if(hFile == INVALID_HANDLE_VALUE) {
-            dxgsg8_cat.error() << "Could not find shader file '"<< filename << "'\n";
-            return NULL;
-        }
-
-        UINT BytesRead,FileSize = GetFileSize(hFile, NULL);
-
-        pShaderBytes = new BYTE[FileSize];
-        if (pShaderBytes==NULL) {
-            dxgsg8_cat.error() << "MemAlloc failed for shader file '"<< filename << "'\n";
-            goto exit_create_vshader;
-        }
-
-        ReadFile(hFile, (void*)pShaderBytes, FileSize, (LPDWORD)&BytesRead, NULL);
-        assert(BytesRead==FileSize);
-    } else {
-        #if defined(NDEBUG) && !defined(COMPILE_TEXT_SHADERFILES)
-            // want to keep bulky d3dx shader assembler stuff out of publish build
-            dxgsg8_cat.error() << "publish build only reads .vso compiled shaders!\n";
-            exit(1);
-        #else
-           // check for file existence
-           WIN32_FIND_DATA Junk;
-           HANDLE FindFileHandle = FindFirstFile(filename.c_str(),&Junk);
-           if ( FindFileHandle == INVALID_HANDLE_VALUE ) {
-                dxgsg8_cat.error() << "Could not find shader file '"<< filename << "'\n";
-                return NULL;
-           }
-           FindClose(FindFileHandle);
-
-           hr = D3DXAssembleShaderFromFile(filename.c_str(),D3DXASM_DEBUG,&pD3DXBuf_Constants,&pD3DXBuf_CompiledShader,&pD3DXBuf_CompilationErrors);
-           if(FAILED(hr)) {
-               dxgsg8_cat.error() << "D3DXAssembleShader failed for '"<< filename << "' " << D3DERRORSTRING(hr);
-               if(pD3DXBuf_CompilationErrors!=NULL) {
-                   dxgsg8_cat.error() << "Compilation Errors: " << (char*) pD3DXBuf_CompilationErrors->GetBufferPointer() << endl;
-               }
-               exit(1);
-           }
-           assert(pD3DXBuf_CompilationErrors==NULL);
-
-           if(pD3DXBuf_Constants!=NULL) {
-               // need to insert defined constants after shader decl
-               memcpy(&ShaderDeclHeader[ShaderDeclHeader_UINTSize],pD3DXBuf_Constants->GetBufferPointer(),pD3DXBuf_Constants->GetBufferSize());
-               ShaderDeclHeader_UINTSize+=pD3DXBuf_Constants->GetBufferSize()/sizeof(UINT);
-               pD3DXBuf_Constants->Release();
-           }
-        #endif
-   }
-
-   assert(VSDDECL_BUFSIZE >= (ShaderDeclHeader_UINTSize+1));
-   ShaderDeclHeader[ShaderDeclHeader_UINTSize]=D3DVSD_END();
-
-   UINT UsageFlags = (_pScrn->bCanUseHWVertexShaders ? 0x0 : D3DUSAGE_SOFTWAREPROCESSING);
-   hr = _pD3DDevice->CreateVertexShader((DWORD*)ShaderDeclHeader,
-                                     (DWORD*) ((pD3DXBuf_CompiledShader!=NULL) ? pD3DXBuf_CompiledShader->GetBufferPointer() : pShaderBytes),
-                                     &hShader, UsageFlags);
-   if(FAILED(hr)) {
-        dxgsg8_cat.error() << "CreateVertexShader failed for '"<< filename << "' " << D3DERRORSTRING(hr);
-        hShader=NULL;
-   }
-
-   assert(hShader!=NULL);   // NULL is invalid I hope
-
-   #ifdef _DEBUG
-      dxgsg8_cat.debug() <<  "CreateVertexShader succeeded for "<< filename << endl;
-   #endif
-
- exit_create_vshader:
-   SAFE_RELEASE(pD3DXBuf_CompiledShader);
-   if(hFile!=NULL)
-     CloseHandle(hFile);
-   SAFE_DELETE(pShaderBytes);
-   return hShader;
-#endif
-}
-
 void DXGraphicsStateGuardian8::
 reset_panda_gsg(void) {
     GraphicsStateGuardian::reset();
@@ -381,10 +192,6 @@ DXGraphicsStateGuardian8(const FrameBufferProperties &properties) :
     _pFvfBufBasePtr = NULL;
     _index_buf=NULL;
 
-    // may persist across dx_init's?  (for dx8.1 but not dx8.0?)
-    _CurVertexShader = _CurPixelShader = NULL;
-    _pGlobalTexture = NULL;
-
     //    _max_light_range = __D3DLIGHT_RANGE_MAX;
 
     // non-dx obj values inited here should not change if resize is
@@ -509,7 +316,6 @@ dx_init(void) {
 
     // these both reflect d3d defaults
     _color_writemask = 0xFFFFFFFF;
-    _CurFVFType = 0x0;  // guards SetVertexShader fmt
 
     _bGouraudShadingOn = false;
     _pD3DDevice->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_FLAT);
@@ -580,39 +386,6 @@ dx_init(void) {
     if(_pScrn->d3dcaps.MaxTextureHeight==0)
        _pScrn->d3dcaps.MaxTextureHeight=256;
 
-    if ((dx_decal_type==GDT_offset) && !(_pScrn->d3dcaps.RasterCaps & D3DPRASTERCAPS_ZBIAS)) {
-       if(_pScrn->d3dcaps.PrimitiveMiscCaps & D3DPMISCCAPS_COLORWRITEENABLE) {
-         if(dxgsg8_cat.is_debug())
-            dxgsg8_cat.debug() << "dx-decal-type 'offset' not supported by hardware, switching to mask-type decals\n";
-         dx_decal_type = GDT_mask;
-       } else {
-         if(dxgsg8_cat.is_debug())
-            dxgsg8_cat.debug() << "dx-decal-type 'offset' and color-writemasking not supported by hardware, switching to decal double-draw blend-based masking\n";
-         dx_decal_type = GDT_blend;
-       }
-    }
-
-#ifdef DISABLE_POLYGON_OFFSET_DECALING
-    if(dx_decal_type==GDT_offset) {
-        if(dxgsg8_cat.is_spam())
-           dxgsg8_cat.spam() << "polygon-offset decaling disabled in dxgsg, switching to double-draw decaling\n";
-
-        if(_pScrn->d3dcaps.PrimitiveMiscCaps & D3DPMISCCAPS_COLORWRITEENABLE) {
-         if(dxgsg8_cat.is_debug())
-            dxgsg8_cat.debug() << "using dx-decal-type 'GDT_mask'\n";
-         dx_decal_type = GDT_mask;
-        } else {
-         if(dxgsg8_cat.is_debug())
-            dxgsg8_cat.debug() << "dx-decal-type 'mask' not supported by hardware, switching to GDT_blend\n";
-         dx_decal_type = GDT_blend;
-        }
-    }
-#endif
-
-    if (((dx_decal_type==GDT_blend)||(dx_decal_type==GDT_mask)) && !(_pScrn->d3dcaps.PrimitiveMiscCaps & D3DPMISCCAPS_MASKZ)) {
-        dxgsg8_cat.error() << "dx-decal-types mask&blend impossible to implement, no hardware support for Z-masking, decals will not appear correctly!\n";
-    }
-
 #define REQUIRED_DESTBLENDCAPS (D3DPBLENDCAPS_ZERO|D3DPBLENDCAPS_ONE| D3DPBLENDCAPS_SRCALPHA)
 #define REQUIRED_SRCBLENDCAPS  (D3DPBLENDCAPS_ZERO|D3DPBLENDCAPS_ONE| D3DPBLENDCAPS_INVSRCALPHA)
 
@@ -782,75 +555,9 @@ dx_init(void) {
     dwa->issue(this);
     cfa->issue(this);
 
-    // this is all prelim hacked in testing stuff
-    init_shader(VertexShader,_CurVertexShader,pdx_vertexshader_filename);
-    init_shader(PixelShader,_CurPixelShader,pdx_pixelshader_filename);
-
-    if(pdx_globaltexture_filename!=NULL) {
-        // bypasses panda tex mechanism
-        hr = D3DXCreateTextureFromFile(_pD3DDevice,pdx_globaltexture_filename->c_str(),&_pGlobalTexture);
-        if(FAILED(hr)) {
-            dxgsg8_cat.fatal() << "CreateTexFromFile failed" << D3DERRORSTRING(hr);
-            exit(1);
-        }
-
-        hr=_pD3DDevice->SetTexture(dx_globaltexture_stagenum,_pGlobalTexture);
-        if(FAILED(hr)) {
-               dxgsg8_cat.fatal() << "SetTexture failed" << D3DERRORSTRING(hr);
-               exit(1);
-        }
-    }
-
     PRINT_REFCNT(dxgsg8,_pD3DDevice);
 }
 
-void DXGraphicsStateGuardian8::
-init_shader(ShaderType stype,DXShaderHandle &hShader,string *pFname) {
-
-    if((pFname==NULL) || pFname->empty()) {
-      hShader=NULL;
-      return;
-    }
-
-    HRESULT hr;
-
-    char *sh_typename;
-    if(stype==VertexShader)
-      sh_typename="Vertex";
-    else sh_typename="Pixel";
-
-    if((stype==PixelShader) && (!_pScrn->bCanUsePixelShaders)) {
-            dxgsg8_cat.error() << "HW doesnt support pixel shaders!\n";
-            exit(1);
-    }
-
-    if((hShader!=NULL)&&(!_pScrn->bIsDX81)) {
-        // for dx8.0, need to release and recreate shaders after Reset() has been called
-        if(stype==VertexShader)
-            hr = _pD3DDevice->DeleteVertexShader(hShader);
-          else hr = _pD3DDevice->DeletePixelShader(hShader);
-        if(FAILED(hr))
-            dxgsg8_cat.error() << "Delete"<< sh_typename<<"Shader failed!" << D3DERRORSTRING(hr);
-        hShader=NULL;
-    }
-
-    if(hShader==NULL) {
-      // doing SetShader globally for testing purps.  this really should be an object attribute
-      // like current-texture is so it gets set and unset during traversal
-
-      if(stype==VertexShader) {
-          hShader=read_vertex_shader(*pFname);
-          hr = _pD3DDevice->SetVertexShader(hShader);
-      } else {
-          hShader=read_pixel_shader(*pFname);
-          hr = _pD3DDevice->SetPixelShader(hShader);
-      }
-
-      if(FAILED(hr))
-         dxgsg8_cat.error() << "Set"<<sh_typename<<"Shader failed!" << D3DERRORSTRING(hr);
-    }
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: DXGraphicsStateGuardian8::support_overlay_window
 //       Access: Public
@@ -3519,20 +3226,6 @@ issue_transform(const TransformState *transform) {
   // if we're using ONLY vertex shaders, could get avoid calling SetTrans
   D3DMATRIX *pMat = (D3DMATRIX*)transform->get_mat().get_data();
   _pD3DDevice->SetTransform(D3DTS_WORLD,pMat);
-
-#ifdef USE_VERTEX_SHADERS
-  if(_CurVertexShader!=NULL) {
-    // vertex shaders need access to the current xform matrix,
-    // so need to reset this vshader 'constant' every time view matrix changes
-      HRESULT hr =  _pD3DDevice->SetVertexShaderConstant(VSHADER_XFORMMATRIX_CONSTANTREGNUMSTART, pMat, 4);
-      #ifdef _DEBUG
-      if(FAILED(hr)) {
-        dxgsg8_cat.error() << "SetVertexShader failed" << D3DERRORSTRING(hr);
-        exit(1);
-      }
-      #endif
-  }
-#endif
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -4429,11 +4122,6 @@ dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled) {
     wdxdisplay8_cat.debug() << "device : " << _pD3DDevice << endl;
     PRINT_REFCNT(dxgsg8,_pD3DDevice);
 
-    // delete non-panda-texture/geom DX objects (VBs/textures/shaders)
-    SAFE_DELSHADER(Vertex,_CurVertexShader,_pD3DDevice);
-    SAFE_DELSHADER(Pixel,_CurPixelShader,_pD3DDevice);
-    SAFE_RELEASE(_pGlobalTexture);
-
     PRINT_REFCNT(dxgsg8,_pD3DDevice);
 
     // Do a safe check for releasing the D3DDEVICE. RefCount should be zero.
@@ -4532,17 +4220,8 @@ HRESULT DXGraphicsStateGuardian8::DeleteAllDeviceObjects(void) {
   if(dxgsg8_cat.is_debug())
       dxgsg8_cat.debug() << "release of all textures complete\n";
 
-  // delete non-panda-texture/geom DX objects (VBs/textures/shaders)
-  SAFE_DELSHADER(Vertex,_CurVertexShader,_pD3DDevice);
-  SAFE_DELSHADER(Pixel,_CurPixelShader,_pD3DDevice);
-  SAFE_RELEASE(_pGlobalTexture);
-
   assert(_pD3DDevice);
 
-  SAFE_DELSHADER(Vertex,_CurVertexShader,_pD3DDevice);
-  SAFE_DELSHADER(Pixel,_CurPixelShader,_pD3DDevice);
-  SAFE_RELEASE(_pGlobalTexture);
-
   return S_OK;
 }
 

+ 0 - 9
panda/src/dxgsg8/dxGraphicsStateGuardian8.h

@@ -38,8 +38,6 @@
 #include "fog.h"
 #include "pointerToArray.h"
 
-//#define USE_VERTEX_SHADERS
-
 class Light;
 
 //#if defined(NOTIFY_DEBUG) || defined(DO_PSTATS)
@@ -343,13 +341,6 @@ public:
   INLINE bool GetDXReady(void)  { return _bDXisReady;}
   void DXGraphicsStateGuardian8::SetTextureBlendMode(TextureApplyAttrib::Mode TexBlendMode,bool bJustEnable);
 
-  // Shader Stuff
-  DXShaderHandle read_vertex_shader(string &filename);
-  DXShaderHandle read_pixel_shader(string &filename);
-  void init_shader(ShaderType stype,DXShaderHandle &hShader,string *pFname);
-  IDirect3DTexture8 *_pGlobalTexture;  // used for FX
-  DXShaderHandle _CurVertexShader,_CurPixelShader;
-
   void  dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled);
   void reset_panda_gsg(void);
   HRESULT reset_d3d_device(D3DPRESENT_PARAMETERS *pPresParams, DXScreenData **pScrn=NULL);

+ 3 - 6
panda/src/dxgsg8/wdxGraphicsWindow8.cxx

@@ -734,7 +734,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
   if (dx_multisample_antialiasing_level>1) {
     // need to check both rendertarget and zbuffer fmts
     hr = pD3D8->CheckDeviceMultiSampleType(Display.CardIDNum, D3DDEVTYPE_HAL, Display.DisplayMode.Format,
-                                           is_fullscreen(), D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level));
+                                           is_fullscreen(), D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level.get_value()));
     if (FAILED(hr)) {
       wdxdisplay8_cat.fatal() << "device #"<<Display.CardIDNum<< " doesnt support multisample level "<<dx_multisample_antialiasing_level <<"surface fmt "<< D3DFormatStr(Display.DisplayMode.Format) <<endl;
       //exit(1);
@@ -743,7 +743,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
 
     if (Display.PresParams.EnableAutoDepthStencil) {
       hr = pD3D8->CheckDeviceMultiSampleType(Display.CardIDNum, D3DDEVTYPE_HAL, Display.PresParams.AutoDepthStencilFormat,
-                                             is_fullscreen(), D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level));
+                                             is_fullscreen(), D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level.get_value()));
       if (FAILED(hr)) {
         wdxdisplay8_cat.fatal() << "device #"<<Display.CardIDNum<< " doesnt support multisample level "<<dx_multisample_antialiasing_level <<"surface fmt "<< D3DFormatStr(Display.PresParams.AutoDepthStencilFormat) <<endl;
         //exit(1);
@@ -751,7 +751,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
       }
     }
 
-    pPresParams->MultiSampleType = D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level);
+    pPresParams->MultiSampleType = D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level.get_value());
 
     if (wdxdisplay8_cat.is_info())
       wdxdisplay8_cat.info() << "device #"<<Display.CardIDNum<< " using multisample antialiasing level "<<dx_multisample_antialiasing_level <<endl;
@@ -1195,9 +1195,6 @@ void wdxGraphicsWindow8Group::initWindowGroup(void) {
 
 //    SetCoopLevelsAndDisplayModes();
 
-    if(dx_show_fps_meter)
-       _windows[0]->_dxgsg->_bShowFPSMeter = true;  // just show fps on 1st mon
-
     for(UINT i=0;i<num_windows;i++) {
         _windows[i]->CreateScreenBuffersAndDevice(_windows[i]->_wcontext);
     }

+ 50 - 76
panda/src/dxgsg9/config_dxgsg9.cxx

@@ -34,30 +34,37 @@ NotifyCategoryDef(wdxdisplay9, "windisplay");
 // Configure this variable true to cause the DXGSG to show each
 // transform space it renders by drawing a little unit axis.  This
 // cannot be enabled when the player is compiled in NDEBUG mode.
-bool dx_show_transforms = config_dxgsg9.GetBool("dx-show-transforms", false);
+ConfigVariableBool dx_show_transforms
+("dx-show-transforms", false);
 
 //  Configure this to TRUE if you want DirectX to control the entire screen,
 //  If false, it will just blit into a window.
-bool dx_full_screen = config_dxgsg9.GetBool("dx-full-screen", false);
+ConfigVariableBool dx_full_screen
+("dx-full-screen", false);
 
 //  Configure this true to force the rendering to sync to the video
 //  refresh, or false to let your frame rate go as high as it can,
 //  irrespective of the video refresh.
-bool dx_sync_video = config_dxgsg9.GetBool("sync-video", true);
+ConfigVariableBool dx_sync_video
+("sync-video", true);
 
 // Set Level of MultiSampling to be used, if HW supports it.  Valid values are 2-16.
-DWORD dx_multisample_antialiasing_level = (DWORD) config_dxgsg9.GetInt("dx-multisample-antialiasing-level", 0);
+ConfigVariableInt dx_multisample_antialiasing_level
+("dx-multisample-antialiasing-level", 0);
 
 // Configure this true to perform a cull traversal over the geometry
 // by default, false otherwise.  The cull traversal provides support
 // for state-sorting, z-sorting, and binning.
-bool dx_cull_traversal = config_dxgsg9.GetBool("dx-cull-traversal", true);
+ConfigVariableBool dx_cull_traversal
+("dx-cull-traversal", true);
 
 // if true, if card only supports per-vertex fog, it will be treated as no-HW fog capability
-bool dx_no_vertex_fog = config_dxgsg9.GetBool("dx-no-vertex-fog", false);
+ConfigVariableBool dx_no_vertex_fog
+("dx-no-vertex-fog", false);
 
 // if true, overwrite cursor bitmap tip with "D3D" to distinguish it from GDI cursor 
-bool dx_show_cursor_watermark = config_dxgsg9.GetBool("dx-show-cursor-watermark", 
+ConfigVariableBool dx_show_cursor_watermark
+("dx-show-cursor-watermark", 
 #ifdef _DEBUG
     true
 #else
@@ -66,7 +73,8 @@ bool dx_show_cursor_watermark = config_dxgsg9.GetBool("dx-show-cursor-watermark"
     );
 
 // if true, triangle filter will be used to generate mipmap levels instead of default box filter
-bool dx_use_triangle_mipgen_filter = config_dxgsg9.GetBool("dx-use-triangle-mipgen-filter", false);
+ConfigVariableBool dx_use_triangle_mipgen_filter
+("dx-use-triangle-mipgen-filter", false);
 
 // Configure this true to cause all lighting normals to automatically
 // be normalized by the CPU before rendering.  This is
@@ -74,99 +82,74 @@ bool dx_use_triangle_mipgen_filter = config_dxgsg9.GetBool("dx-use-triangle-mipg
 // expect lighting to work correctly.  Maybe one day there will be
 // another way to set this at runtime, instead of only as a configure
 // variable
-bool dx_auto_normalize_lighting = config_dxgsg9.GetBool("auto-normalize-lighting", true);
-
-bool dx_show_fps_meter = config_dxgsg9.GetBool("show-fps-meter", false);
-float dx_fps_meter_update_interval = max(0.5,config_dxgsg9.GetFloat("fps-meter-update-interval", 1.7));
+ConfigVariableBool dx_auto_normalize_lighting
+("auto-normalize-lighting", true);
 
 #ifndef NDEBUG
 // debugging flag
 // values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW
-int dx_force_backface_culling = config_dxgsg9.GetInt("dx-force-backface-culling", 0);
+ConfigVariableInt dx_force_backface_culling
+("dx-force-backface-culling", 0);
 #endif
 
-bool dx_mipmap_everything = config_dxgsg9.GetBool("dx-mipmap-everything", false);
-bool dx_ignore_mipmaps = config_dxgsg9.GetBool("dx-ignore-mipmaps", false);
+ConfigVariableBool dx_mipmap_everything
+("dx-mipmap-everything", false);
+ConfigVariableBool dx_ignore_mipmaps
+("dx-ignore-mipmaps", false);
 
 // if this is set, more accurate but more expensive fog computations are performed
-bool dx_use_rangebased_fog = config_dxgsg9.GetBool("dx-use-rangebased-fog", false);
-bool dx_force_16bpptextures = config_dxgsg9.GetBool("dx-force-16bpptextures", false);
-bool dx_no_dithering = config_dxgsg9.GetBool("dx-no-dithering", false);
-bool dx_force_16bpp_zbuffer = config_dxgsg9.GetBool("dx-force-16bpp-zbuffer", false);
-bool dx_do_vidmemsize_check = config_dxgsg9.GetBool("do-vidmemsize-check", true);
+ConfigVariableBool dx_use_rangebased_fog
+("dx-use-rangebased-fog", false);
+ConfigVariableBool dx_force_16bpptextures
+("dx-force-16bpptextures", false);
+ConfigVariableBool dx_no_dithering
+("dx-no-dithering", false);
+ConfigVariableBool dx_force_16bpp_zbuffer
+("dx-force-16bpp-zbuffer", false);
+ConfigVariableBool dx_do_vidmemsize_check
+("do-vidmemsize-check", true);
 // Setting this true theoretically hinders render performance, because
 // it forces the FPU to go through some extra work to clean itself up
 // after rendering a frame, but the performance cost seems to be
 // small.  On the other hand, setting it false can force the
 // application to run in single-precision arithmetic mode, even if
 // it believes it is using double-precision variables.
-bool dx_preserve_fpu_state = config_dxgsg9.GetBool("dx-preserve-fpu-state", true);
+ConfigVariableBool dx_preserve_fpu_state
+("dx-preserve-fpu-state", true);
 
 // if true, override win-width/height and use driver vidmem info to
 // pick what will be a fullscreen window size close to the best perf
 // capability of card, based on a heuristic
-bool dx_pick_best_screenres = config_dxgsg9.GetBool("pick-best-screenres", false);
+ConfigVariableBool dx_pick_best_screenres
+("pick-best-screenres", false);
 
-int dx_preferred_device_id = config_dxgsg9.GetInt("dx-preferred-device-id", -1);
+ConfigVariableInt dx_preferred_device_id
+("dx-preferred-device-id", -1);
 
 #ifdef _DEBUG
-float dx_global_miplevel_bias = config_dxgsg9.GetFloat("dx-global-miplevel-bias", 0.0);
-bool dx_debug_view_mipmaps = config_dxgsg9.GetBool("dx-debug-view-mipmaps", false);
-//int dx_print_texstats = config_dxgsg9.GetBool("dx-print-texstats", 0);
+float dx_global_miplevel_bias
+("dx-global-miplevel-bias", 0.0);
+ConfigVariableBool dx_debug_view_mipmaps
+("dx-debug-view-mipmaps", false);
 #endif
 
 // use dx9 or GDI mouse cursor in fullscreen mode?
 // Nvidia dx9 cursor is invisible as of 28.32 drivers, so using GDI in fullscrn by default for now
-bool dx_use_dx_cursor = config_dxgsg9.GetBool("dx-use-dx-cursor", false);
+ConfigVariableBool dx_use_dx_cursor
+("dx-use-dx-cursor", false);
 
-bool dx_force_anisotropic_filtering = config_dxgsg9.GetBool("dx-force-anisotropic-filtering", false);
+ConfigVariableBool dx_force_anisotropic_filtering
+("dx-force-anisotropic-filtering", false);
 
 // set 'retained-mode #t' and this to have prepare_geom concatenate all tristrips within a geom 
 // together using degenerate tris
-const bool link_tristrips = config_dxgsg9.GetBool("link-tristrips", false);
-
-// note:  offset currently disabled since it wasnt working properly
-DXDecalType dx_decal_type = GDT_mask;
-
-// Note: must be a ptr not a regular string because the init-string constructor for
-// a global/static string variable will run AFTER the dll static init fn
-// init_libdxgsg9(), which means the string will be reset to "" after we read it in
-string *pdx_vertexshader_filename=NULL;
-string *pdx_pixelshader_filename=NULL;
-
-// texture file to be set globally, usually for special FX
-string *pdx_globaltexture_filename=NULL;
-// tex stagenum to set the global tex to
-UINT dx_globaltexture_stagenum = (UINT) config_dxgsg9.GetInt("dx-globaltexture-stagenum", 0);
-
-static DXDecalType
-parse_decal_type(const string &type) {
-  if (type == "mask") {
-    return GDT_mask;
-  } else if (type == "blend") {
-    return GDT_blend;
-  } else if (type == "offset") {
-    return GDT_offset;
-  }
-  dxgsg9_cat.error() << "Invalid dx-decal-type: " << type << "\n";
-  return GDT_mask;
-}
+ConfigVariableBool link_tristrips
+("link-tristrips", false);
 
 ConfigureFn(config_dxgsg9) {
   init_libdxgsg9();
 }
 
-void init_config_string(string *&pFname,const char *ConfigrcVarname) {
-  // pFname is reference to string ptr
-
-  // dont try to take the & of a soon-to-be-gone stack var string, this must be on the heap!
-  pFname = new string(config_dxgsg9.GetString(ConfigrcVarname, ""));
-  if(pFname->empty()) {
-      delete pFname;
-      pFname=NULL;
-  }
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libdxgsg
 //  Description: Initializes the library.  This must be called at
@@ -183,15 +166,6 @@ init_libdxgsg9() {
   }
   initialized = true;
 
-  string decal_type = config_dxgsg9.GetString("dx-decal-type", "");
-  if (!decal_type.empty()) {
-    dx_decal_type = parse_decal_type(decal_type);
-  }
-
-  init_config_string(pdx_vertexshader_filename,"dx-vertexshader-filename");
-  init_config_string(pdx_pixelshader_filename,"dx-pixelshader-filename");
-  init_config_string(pdx_globaltexture_filename,"dx-globaltexture-filename");
-
   DXGraphicsStateGuardian9::init_type();
   DXSavedFrameBuffer9::init_type();
   DXTextureContext9::init_type();

+ 29 - 41
panda/src/dxgsg9/config_dxgsg9.h

@@ -22,61 +22,49 @@
 #include "pandabase.h"
 #include "notifyCategoryProxy.h"
 #include "dxgsg9base.h"
+#include "configVariableBool.h"
+#include "configVariableInt.h"
+#include "configVariableDouble.h"
 
 NotifyCategoryDecl(dxgsg9, EXPCL_PANDADX, EXPTP_PANDADX);
 NotifyCategoryDecl(wdxdisplay9, EXPCL_PANDADX, EXPTP_PANDADX);
 
-extern bool dx_full_screen;
-extern bool dx_sync_video;
-extern bool dx_cull_traversal;
-extern bool dx_show_fps_meter;
-extern bool dx_no_vertex_fog;
-extern bool dx_show_cursor_watermark;
-extern bool dx_full_screen_antialiasing;
-extern float dx_fps_meter_update_interval;
-extern bool dx_auto_normalize_lighting;
-extern bool dx_use_rangebased_fog;
-extern const bool link_tristrips;
-extern DWORD dx_multisample_antialiasing_level;
-extern bool dx_use_triangle_mipgen_filter;
-extern bool dx_use_dx_cursor;
+extern ConfigVariableBool dx_full_screen;
+extern ConfigVariableBool dx_sync_video;
+extern ConfigVariableBool dx_cull_traversal;
+extern ConfigVariableBool dx_no_vertex_fog;
+extern ConfigVariableBool dx_show_cursor_watermark;
+extern ConfigVariableBool dx_full_screen_antialiasing;
+extern ConfigVariableBool dx_auto_normalize_lighting;
+extern ConfigVariableBool dx_use_rangebased_fog;
+extern ConfigVariableBool link_tristrips;
+extern ConfigVariableInt dx_multisample_antialiasing_level;
+extern ConfigVariableBool dx_use_triangle_mipgen_filter;
+extern ConfigVariableBool dx_use_dx_cursor;
 
 
 // debug flags we might want to use in full optimized build
-extern bool dx_ignore_mipmaps;
-extern bool dx_mipmap_everything;
-extern bool dx_show_transforms;
-extern bool dx_force_16bpptextures;
-extern bool dx_no_dithering;
-extern bool dx_force_anisotropic_filtering;
-extern bool dx_force_16bpp_zbuffer;
-extern bool dx_do_vidmemsize_check;
-extern bool dx_preserve_fpu_state;
-extern bool dx_pick_best_screenres;
-extern int dx_preferred_device_id;
-
-extern string *pdx_vertexshader_filename;
-extern string *pdx_pixelshader_filename;
-extern string *pdx_globaltexture_filename;
-extern UINT   dx_globaltexture_stagenum;
+extern ConfigVariableBool dx_ignore_mipmaps;
+extern ConfigVariableBool dx_mipmap_everything;
+extern ConfigVariableBool dx_show_transforms;
+extern ConfigVariableBool dx_force_16bpptextures;
+extern ConfigVariableBool dx_no_dithering;
+extern ConfigVariableBool dx_force_anisotropic_filtering;
+extern ConfigVariableBool dx_force_16bpp_zbuffer;
+extern ConfigVariableBool dx_do_vidmemsize_check;
+extern ConfigVariableBool dx_preserve_fpu_state;
+extern ConfigVariableBool dx_pick_best_screenres;
+extern ConfigVariableInt dx_preferred_device_id;
 
 #ifndef NDEBUG
-extern int dx_force_backface_culling;
+extern ConfigVariableInt dx_force_backface_culling;
 #endif
 
 #ifdef _DEBUG
-extern float dx_global_miplevel_bias;
-extern bool dx_debug_view_mipmaps;
+extern ConfigVariableDouble dx_global_miplevel_bias;
+extern ConfigVariableBool dx_debug_view_mipmaps;
 #endif
 
-// Ways to implement decals.
-enum DXDecalType {
-  GDT_mask,   // GL 1.0 style, involving three steps and double-draw of polygon
-  GDT_blend,  // As above, but slower; use blending to disable colorbuffer writes
-  GDT_offset  // The fastest, using GL 1.1 style glPolygonOffset
-};
-extern DXDecalType dx_decal_type;
-
 extern EXPCL_PANDADX void init_libdxgsg9();
 
 #endif

+ 0 - 336
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -89,9 +89,6 @@ typedef enum { NothingSet=0,NormalOnly,ColorOnly,Normal_Color,TexCoordOnly,
 #define PER_COLOR    ColorOnly
 #define PER_TEXCOORD TexCoordOnly
 
-// xform mat for vshader will usually be loaded at constant regs c4-c7
-#define VSHADER_XFORMMATRIX_CONSTANTREGNUMSTART 4
-
 static D3DMATRIX matIdentity;
 
 #define __D3DLIGHT_RANGE_MAX ((float)sqrt(FLT_MAX))  //for some reason this is missing in dx9 hdrs
@@ -154,192 +151,6 @@ void INLINE TestDrawPrimFailure(DP_Type dptype,HRESULT hr,IDirect3DDevice9 *pD3D
 #define TestDrawPrimFailure(a,b,c,nVerts,nTris) CountDPs(nVerts,nTris);
 #endif
 
-IDirect3DPixelShader9* DXGraphicsStateGuardian9::
-read_pixel_shader(string &filename) {
-    HRESULT hr;
-    IDirect3DPixelShader9* hShader=NULL;
-    HANDLE hFile=NULL;
-    BYTE *pShaderBytes=NULL;
-    LPD3DXBUFFER pD3DXBuf_Constants=NULL,pD3DXBuf_CompiledShader=NULL,pD3DXBuf_CompilationErrors=NULL;
-
-    assert(_pD3DDevice!=NULL);
-    assert(_pScrn->bCanUsePixelShaders);
-    bool bIsCompiledShader=(filename.find(".pso")!=string::npos);
-
-    if(bIsCompiledShader) {
-        hFile = CreateFile(filename.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
-        if(hFile == INVALID_HANDLE_VALUE) {
-            dxgsg9_cat.error() << "Could not find shader file '"<< filename << "'\n";
-            return NULL;
-        }
-
-        UINT BytesRead,FileSize = GetFileSize(hFile, NULL);
-
-        pShaderBytes = new BYTE[FileSize];
-        if (pShaderBytes==NULL) {
-            dxgsg9_cat.error() << "MemAlloc failed for shader file '"<< filename << "'\n";
-            goto exit_create_pshader;
-        }
-
-        ReadFile(hFile, (void*)pShaderBytes, FileSize, (LPDWORD)&BytesRead, NULL);
-        assert(BytesRead==FileSize);
-    } else {
-        #if defined(NDEBUG) && !defined(COMPILE_TEXT_SHADERFILES)
-            // want to keep bulky d3dx shader assembler stuff out of publish build
-            dxgsg9_cat.error() << "publish build only reads .vso compiled shaders!\n";
-            exit(1);
-        #else
-           // check for file existence
-           WIN32_FIND_DATA Junk;
-           HANDLE FindFileHandle = FindFirstFile(filename.c_str(),&Junk);
-           if ( FindFileHandle == INVALID_HANDLE_VALUE ) {
-                dxgsg9_cat.error() << "Could not find shader file '"<< filename << "'\n";
-                return NULL;
-           }
-           FindClose(FindFileHandle);
-
-           hr = D3DXAssembleShaderFromFile(filename.c_str(),NULL,NULL,D3DXSHADER_DEBUG,&pD3DXBuf_CompiledShader,&pD3DXBuf_CompilationErrors);
-           if(FAILED(hr)) {
-               dxgsg9_cat.error() << "D3DXAssembleShader failed for '"<< filename << "' " << D3DERRORSTRING(hr);
-               if(pD3DXBuf_CompilationErrors!=NULL) {
-                   dxgsg9_cat.error() << "Compilation Errors: " << (char*) pD3DXBuf_CompilationErrors->GetBufferPointer() << endl;
-               }
-               exit(1);
-           }
-           assert(pD3DXBuf_CompilationErrors==NULL);
-        #endif
-   }
-
-   hr = _pD3DDevice->CreatePixelShader((DWORD*) ((pD3DXBuf_CompiledShader!=NULL) ? pD3DXBuf_CompiledShader->GetBufferPointer() : pShaderBytes),
-                                     &hShader);
-   if (FAILED(hr)) {
-        dxgsg9_cat.error() << "CreatePixelShader failed for '"<< filename << "' " << D3DERRORSTRING(hr);
-        hShader=NULL;
-   }
-
-   assert(hShader!=NULL);   // NULL is invalid I hope
-
-   #ifdef _DEBUG
-      dxgsg9_cat.debug() <<  "CreatePixelShader succeeded for "<< filename << endl;
-   #endif
-
- exit_create_pshader:
-   SAFE_RELEASE(pD3DXBuf_CompiledShader);
-   if(hFile!=NULL)
-     CloseHandle(hFile);
-   SAFE_DELETE(pShaderBytes);
-   return hShader;
-}
-
-
-IDirect3DVertexShader9* DXGraphicsStateGuardian9::
-read_vertex_shader(string &filename) {
-#ifndef USE_VERTEX_SHADERS
-    return NULL;
-#else
-    HRESULT hr;
-    IDirect3DVertexShader9* hShader=NULL;
-    HANDLE hFile=NULL;
-    BYTE *pShaderBytes=NULL;
-    LPD3DXBUFFER pD3DXBuf_Constants=NULL,pD3DXBuf_CompiledShader=NULL,pD3DXBuf_CompilationErrors=NULL;
-    #define VSDDECL_BUFSIZE 1024
-    UINT ShaderDeclHeader[VSDDECL_BUFSIZE];
-
-    // simple decl for posn + color
-    // need way to encode header decl with vsh files (stick in comment?)  (use ID3DXEffect files?)
-    UINT Predefined_DeclArray[] = {
-        D3DVSD_STREAM(0),
-        D3DVSD_REG(D3DVSDE_POSITION, D3DVSDT_FLOAT3 ),      // input register v0
-        D3DVSD_REG(D3DVSDE_DIFFUSE, D3DVSDT_D3DCOLOR ),     // input Register v5
-      //  D3DVSD_CONST(0,1),*(DWORD*)&c[0],*(DWORD*)&c[1],*(DWORD*)&c[2],*(DWORD*)&c[3],
-    };
-
-    memcpy(ShaderDeclHeader,Predefined_DeclArray,sizeof(Predefined_DeclArray));
-
-    // need to append any compiled constants to instr array
-    UINT ShaderDeclHeader_UINTSize=sizeof(Predefined_DeclArray)/sizeof(UINT);
-
-    assert(_pD3DDevice!=NULL);
-    bool bIsCompiledShader=(filename.find(".vso")!=string::npos);
-
-    if(bIsCompiledShader) {
-        hFile = CreateFile(filename.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
-        if(hFile == INVALID_HANDLE_VALUE) {
-            dxgsg9_cat.error() << "Could not find shader file '"<< filename << "'\n";
-            return NULL;
-        }
-
-        UINT BytesRead,FileSize = GetFileSize(hFile, NULL);
-
-        pShaderBytes = new BYTE[FileSize];
-        if (pShaderBytes==NULL) {
-            dxgsg9_cat.error() << "MemAlloc failed for shader file '"<< filename << "'\n";
-            goto exit_create_vshader;
-        }
-
-        ReadFile(hFile, (void*)pShaderBytes, FileSize, (LPDWORD)&BytesRead, NULL);
-        assert(BytesRead==FileSize);
-    } else {
-        #if defined(NDEBUG) && !defined(COMPILE_TEXT_SHADERFILES)
-            // want to keep bulky d3dx shader assembler stuff out of publish build
-            dxgsg9_cat.error() << "publish build only reads .vso compiled shaders!\n";
-            exit(1);
-        #else
-           // check for file existence
-           WIN32_FIND_DATA Junk;
-           HANDLE FindFileHandle = FindFirstFile(filename.c_str(),&Junk);
-           if ( FindFileHandle == INVALID_HANDLE_VALUE ) {
-                dxgsg9_cat.error() << "Could not find shader file '"<< filename << "'\n";
-                return NULL;
-           }
-           FindClose(FindFileHandle);
-
-           hr = D3DXAssembleShaderFromFile(filename.c_str(),D3DXASM_DEBUG,&pD3DXBuf_Constants,&pD3DXBuf_CompiledShader,&pD3DXBuf_CompilationErrors);
-           if(FAILED(hr)) {
-               dxgsg9_cat.error() << "D3DXAssembleShader failed for '"<< filename << "' " << D3DERRORSTRING(hr);
-               if(pD3DXBuf_CompilationErrors!=NULL) {
-                   dxgsg9_cat.error() << "Compilation Errors: " << (char*) pD3DXBuf_CompilationErrors->GetBufferPointer() << endl;
-               }
-               exit(1);
-           }
-           assert(pD3DXBuf_CompilationErrors==NULL);
-
-           if(pD3DXBuf_Constants!=NULL) {
-               // need to insert defined constants after shader decl
-               memcpy(&ShaderDeclHeader[ShaderDeclHeader_UINTSize],pD3DXBuf_Constants->GetBufferPointer(),pD3DXBuf_Constants->GetBufferSize());
-               ShaderDeclHeader_UINTSize+=pD3DXBuf_Constants->GetBufferSize()/sizeof(UINT);
-               pD3DXBuf_Constants->Release();
-           }
-        #endif
-   }
-
-   assert(VSDDECL_BUFSIZE >= (ShaderDeclHeader_UINTSize+1));
-   ShaderDeclHeader[ShaderDeclHeader_UINTSize]=D3DVSD_END();
-
-   UINT UsageFlags = (_pScrn->bCanUseHWVertexShaders ? 0x0 : D3DUSAGE_SOFTWAREPROCESSING);
-   hr = _pD3DDevice->CreateVertexShader((DWORD*)ShaderDeclHeader,
-                                     (DWORD*) ((pD3DXBuf_CompiledShader!=NULL) ? pD3DXBuf_CompiledShader->GetBufferPointer() : pShaderBytes),
-                                     &hShader, UsageFlags);
-   if(FAILED(hr)) {
-        dxgsg9_cat.error() << "CreateVertexShader failed for '"<< filename << "' " << D3DERRORSTRING(hr);
-        hShader=NULL;
-   }
-
-   assert(hShader!=NULL);   // NULL is invalid I hope
-
-   #ifdef _DEBUG
-      dxgsg9_cat.debug() <<  "CreateVertexShader succeeded for "<< filename << endl;
-   #endif
-
- exit_create_vshader:
-   SAFE_RELEASE(pD3DXBuf_CompiledShader);
-   if(hFile!=NULL)
-     CloseHandle(hFile);
-   SAFE_DELETE(pShaderBytes);
-   return hShader;
-#endif
-}
-
 void DXGraphicsStateGuardian9::
 reset_panda_gsg(void) {
     GraphicsStateGuardian::reset();
@@ -380,11 +191,6 @@ DXGraphicsStateGuardian9(const FrameBufferProperties &properties) :
     _pFvfBufBasePtr = NULL;
     _index_buf=NULL;
 
-    // may persist across dx_init's?  (for dx8.1 but not dx8.0?)
-    _CurVertexShader = NULL;
-    _CurPixelShader = NULL;
-    _pGlobalTexture = NULL;
-
     //    _max_light_range = __D3DLIGHT_RANGE_MAX;
 
     // non-dx obj values inited here should not change if resize is
@@ -509,7 +315,6 @@ dx_init(void) {
 
     // these both reflect d3d defaults
     _color_writemask = 0xFFFFFFFF;
-    _CurFVFType = 0x0;  // guards SetVertexShader fmt
 
     _bGouraudShadingOn = false;
     _pD3DDevice->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_FLAT);
@@ -580,39 +385,6 @@ dx_init(void) {
     if(_pScrn->d3dcaps.MaxTextureHeight==0)
        _pScrn->d3dcaps.MaxTextureHeight=256;
 
-    if ((dx_decal_type==GDT_offset) && !(_pScrn->d3dcaps.RasterCaps & D3DPRASTERCAPS_DEPTHBIAS)) {
-       if(_pScrn->d3dcaps.PrimitiveMiscCaps & D3DPMISCCAPS_COLORWRITEENABLE) {
-         if(dxgsg9_cat.is_debug())
-            dxgsg9_cat.debug() << "dx-decal-type 'offset' not supported by hardware, switching to mask-type decals\n";
-         dx_decal_type = GDT_mask;
-       } else {
-         if(dxgsg9_cat.is_debug())
-            dxgsg9_cat.debug() << "dx-decal-type 'offset' and color-writemasking not supported by hardware, switching to decal double-draw blend-based masking\n";
-         dx_decal_type = GDT_blend;
-       }
-    }
-
-#ifdef DISABLE_POLYGON_OFFSET_DECALING
-    if(dx_decal_type==GDT_offset) {
-        if(dxgsg9_cat.is_spam())
-           dxgsg9_cat.spam() << "polygon-offset decaling disabled in dxgsg, switching to double-draw decaling\n";
-
-        if(_pScrn->d3dcaps.PrimitiveMiscCaps & D3DPMISCCAPS_COLORWRITEENABLE) {
-         if(dxgsg9_cat.is_debug())
-            dxgsg9_cat.debug() << "using dx-decal-type 'GDT_mask'\n";
-         dx_decal_type = GDT_mask;
-        } else {
-         if(dxgsg9_cat.is_debug())
-            dxgsg9_cat.debug() << "dx-decal-type 'mask' not supported by hardware, switching to GDT_blend\n";
-         dx_decal_type = GDT_blend;
-        }
-    }
-#endif
-
-    if (((dx_decal_type==GDT_blend)||(dx_decal_type==GDT_mask)) && !(_pScrn->d3dcaps.PrimitiveMiscCaps & D3DPMISCCAPS_MASKZ)) {
-        dxgsg9_cat.error() << "dx-decal-types mask&blend impossible to implement, no hardware support for Z-masking, decals will not appear correctly!\n";
-    }
-
 #define REQUIRED_DESTBLENDCAPS (D3DPBLENDCAPS_ZERO|D3DPBLENDCAPS_ONE| D3DPBLENDCAPS_SRCALPHA)
 #define REQUIRED_SRCBLENDCAPS  (D3DPBLENDCAPS_ZERO|D3DPBLENDCAPS_ONE| D3DPBLENDCAPS_INVSRCALPHA)
 
@@ -781,89 +553,9 @@ dx_init(void) {
     dwa->issue(this);
     cfa->issue(this);
 
-    // this is all prelim hacked in testing stuff
-    init_vertex_shader(_CurVertexShader,pdx_vertexshader_filename);
-    init_pixel_shader(_CurPixelShader,pdx_pixelshader_filename);
-
-    if(pdx_globaltexture_filename!=NULL) {
-        // bypasses panda tex mechanism
-        hr = D3DXCreateTextureFromFile(_pD3DDevice,pdx_globaltexture_filename->c_str(),&_pGlobalTexture);
-        if(FAILED(hr)) {
-            dxgsg9_cat.fatal() << "CreateTexFromFile failed" << D3DERRORSTRING(hr);
-            exit(1);
-        }
-
-        hr=_pD3DDevice->SetTexture(dx_globaltexture_stagenum,_pGlobalTexture);
-        if(FAILED(hr)) {
-               dxgsg9_cat.fatal() << "SetTexture failed" << D3DERRORSTRING(hr);
-               exit(1);
-        }
-    }
-
     PRINT_REFCNT(dxgsg9,_pD3DDevice);
 }
 
-void DXGraphicsStateGuardian9::
-init_vertex_shader(IDirect3DVertexShader9* &hShader,string *pFname) {
-
-  if((pFname==NULL) || pFname->empty()) {
-    hShader=NULL;
-    return;
-  }
-  
-  HRESULT hr;
-  
-  if((hShader!=NULL)&&(!_pScrn->bIsDX9)) {
-    // for dx9.0, need to release and recreate shaders after Reset() has been called
-    hr = _pD3DDevice->SetVertexShader(NULL);
-    if(FAILED(hr))
-      dxgsg9_cat.error() << "Delete Vertex Shader failed!" << D3DERRORSTRING(hr);
-    hShader=NULL;
-  }
-  
-  if(hShader==NULL) {
-    // doing SetShader globally for testing purps.  this really should be an object attribute
-    // like current-texture is so it gets set and unset during traversal
-    
-    hShader=read_vertex_shader(*pFname);
-    hr = _pD3DDevice->SetVertexShader(hShader);
-    
-    if(FAILED(hr))
-      dxgsg9_cat.error() << "Set Vertex Shader failed!" << D3DERRORSTRING(hr);
-  }
-}
-
-void DXGraphicsStateGuardian9::
-init_pixel_shader(IDirect3DPixelShader9* &hShader,string *pFname) {
-
-  if((pFname==NULL) || pFname->empty()) {
-    hShader=NULL;
-    return;
-  }
-  
-  HRESULT hr;
-  
-  if(!_pScrn->bCanUsePixelShaders) {
-    // for dx9.0, need to release and recreate shaders after Reset() has been called
-    dxgsg9_cat.error() << "HW doesnt support pixel shaders!\n";
-    exit(1);
-  }
-  if((hShader!=NULL)&&(!_pScrn->bIsDX9)) {
-    hr = _pD3DDevice->SetPixelShader(NULL);
-    if(FAILED(hr))
-      dxgsg9_cat.error() << "Delete Pixel Shader failed!" << D3DERRORSTRING(hr);
-    hShader=NULL;
-  }
-
-  if(hShader==NULL) {
-    // doing SetShader globally for testing purps.  this really should be an object attribute
-    // like current-texture is so it gets set and unset during traversal
-    hShader=read_pixel_shader(*pFname);
-    hr = _pD3DDevice->SetPixelShader(hShader);
-    if(FAILED(hr))
-      dxgsg9_cat.error() << "Set Pixel Shader failed!" << D3DERRORSTRING(hr);
-  }
-}
 ////////////////////////////////////////////////////////////////////
 //     Function: DXGraphicsStateGuardian9::support_overlay_window
 //       Access: Public
@@ -3521,20 +3213,6 @@ issue_transform(const TransformState *transform) {
   // if we're using ONLY vertex shaders, could get avoid calling SetTrans
   D3DMATRIX *pMat = (D3DMATRIX*)transform->get_mat().get_data();
   _pD3DDevice->SetTransform(D3DTS_WORLD,pMat);
-
-#ifdef USE_VERTEX_SHADERS
-  if(_CurVertexShader!=NULL) {
-    // vertex shaders need access to the current xform matrix,
-    // so need to reset this vshader 'constant' every time view matrix changes
-      HRESULT hr =  _pD3DDevice->SetVertexShaderConstant(VSHADER_XFORMMATRIX_CONSTANTREGNUMSTART, pMat, 4);
-      #ifdef _DEBUG
-      if(FAILED(hr)) {
-        dxgsg9_cat.error() << "SetVertexShader failed" << D3DERRORSTRING(hr);
-        exit(1);
-      }
-      #endif
-  }
-#endif
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -4432,11 +4110,6 @@ dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled) {
     wdxdisplay9_cat.debug() << "device : " << _pD3DDevice << endl;
     PRINT_REFCNT(dxgsg9,_pD3DDevice);
 
-    // delete non-panda-texture/geom DX objects (VBs/textures/shaders)
-    //SAFE_DELSHADER(Vertex,_CurVertexShader,_pD3DDevice);
-    //SAFE_DELSHADER(Pixel,_CurPixelShader,_pD3DDevice);
-    SAFE_RELEASE(_pGlobalTexture);
-
     PRINT_REFCNT(dxgsg9,_pD3DDevice);
 
     // Do a safe check for releasing the D3DDEVICE. RefCount should be zero.
@@ -4537,17 +4210,8 @@ HRESULT DXGraphicsStateGuardian9::DeleteAllDeviceObjects(void) {
   if(dxgsg9_cat.is_debug())
       dxgsg9_cat.debug() << "release of all textures complete\n";
 
-  // delete non-panda-texture/geom DX objects (VBs/textures/shaders)
-  //SAFE_DELSHADER(Vertex,_CurVertexShader,_pD3DDevice);
-  //SAFE_DELSHADER(Pixel,_CurPixelShader,_pD3DDevice);
-  SAFE_RELEASE(_pGlobalTexture);
-
   assert(_pD3DDevice);
 
-  //SAFE_DELSHADER(Vertex,_CurVertexShader,_pD3DDevice);
-  //SAFE_DELSHADER(Pixel,_CurPixelShader,_pD3DDevice);
-  SAFE_RELEASE(_pGlobalTexture);
-
   return S_OK;
 }
 

+ 0 - 12
panda/src/dxgsg9/dxGraphicsStateGuardian9.h

@@ -39,8 +39,6 @@
 #include "fog.h"
 #include "pointerToArray.h"
 
-//#define USE_VERTEX_SHADERS
-
 class Light;
 
 //#if defined(NOTIFY_DEBUG) || defined(DO_PSTATS)
@@ -344,16 +342,6 @@ public:
   INLINE bool GetDXReady(void)  { return _bDXisReady;}
   void DXGraphicsStateGuardian9::SetTextureBlendMode(TextureApplyAttrib::Mode TexBlendMode,bool bJustEnable);
 
-  // Shader Stuff
-  IDirect3DVertexShader9* read_vertex_shader(string &filename);
-  IDirect3DPixelShader9* read_pixel_shader(string &filename);
-  void init_vertex_shader(IDirect3DVertexShader9* &hShader,string *pFname);
-  void init_pixel_shader(IDirect3DPixelShader9* &hShader,string *pFname);
-  IDirect3DTexture9 *_pGlobalTexture;  // used for FX
-  //DXShaderHandle _CurVertexShader,_CurPixelShader;
-  IDirect3DVertexShader9* _CurVertexShader;
-  IDirect3DPixelShader9* _CurPixelShader;
-
   void  dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled);
   void reset_panda_gsg(void);
   HRESULT reset_d3d_device(D3DPRESENT_PARAMETERS *pPresParams, DXScreenData **pScrn=NULL);

+ 3 - 6
panda/src/dxgsg9/wdxGraphicsWindow9.cxx

@@ -721,7 +721,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
   if (dx_multisample_antialiasing_level>1) {
     // need to check both rendertarget and zbuffer fmts
     hr = pD3D9->CheckDeviceMultiSampleType(Display.CardIDNum, D3DDEVTYPE_HAL, Display.DisplayMode.Format,
-                                           is_fullscreen(), D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level), NULL);
+                                           is_fullscreen(), D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level.get_value()), NULL);
     if (FAILED(hr)) {
       wdxdisplay9_cat.fatal() << "device #"<<Display.CardIDNum<< " doesnt support multisample level "<<dx_multisample_antialiasing_level <<"surface fmt "<< D3DFormatStr(Display.DisplayMode.Format) <<endl;
       //exit(1);
@@ -730,7 +730,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
 
     if (Display.PresParams.EnableAutoDepthStencil) {
       hr = pD3D9->CheckDeviceMultiSampleType(Display.CardIDNum, D3DDEVTYPE_HAL, Display.PresParams.AutoDepthStencilFormat,
-                                             is_fullscreen(), D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level), NULL);
+                                             is_fullscreen(), D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level.get_value()), NULL);
       if (FAILED(hr)) {
         wdxdisplay9_cat.fatal() << "device #"<<Display.CardIDNum<< " doesnt support multisample level "<<dx_multisample_antialiasing_level <<"surface fmt "<< D3DFormatStr(Display.PresParams.AutoDepthStencilFormat) <<endl;
         //exit(1);
@@ -738,7 +738,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
       }
     }
 
-    pPresParams->MultiSampleType = D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level);
+    pPresParams->MultiSampleType = D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level.get_value());
 
     if (wdxdisplay9_cat.is_info())
       wdxdisplay9_cat.info() << "device #"<<Display.CardIDNum<< " using multisample antialiasing level "<<dx_multisample_antialiasing_level <<endl;
@@ -1182,9 +1182,6 @@ void wdxGraphicsWindow9Group::initWindowGroup(void) {
 
 //    SetCoopLevelsAndDisplayModes();
 
-    if(dx_show_fps_meter)
-       _windows[0]->_dxgsg->_bShowFPSMeter = true;  // just show fps on 1st mon
-
     for(UINT i=0;i<num_windows;i++) {
         _windows[i]->CreateScreenBuffersAndDevice(_windows[i]->_wcontext);
     }

+ 0 - 1
panda/src/egg/config_egg.cxx

@@ -54,7 +54,6 @@
 #include "eggXfmSAnim.h"
 
 #include "dconfig.h"
-#include "get_config_path.h"
 
 Configure(config_egg);
 NotifyCategoryDef(egg, "");

+ 0 - 1
panda/src/egg2pg/config_egg2pg.cxx

@@ -19,7 +19,6 @@
 #include "config_egg2pg.h"
 
 #include "dconfig.h"
-#include "get_config_path.h"
 #include "loaderFileTypeEgg.h"
 #include "loaderFileTypeRegistry.h"
 #include "configVariableManager.h"

+ 1 - 3
panda/src/express/Sources.pp

@@ -25,7 +25,6 @@
     dcast.T dcast.h \
     encryptStreamBuf.h encryptStreamBuf.I encryptStream.h encryptStream.I \
     error_utils.h \
-    get_config_path.h \
     hashGeneratorBase.I hashGeneratorBase.h \
     hashVal.I hashVal.h indent.I indent.h \
     indirectLess.I indirectLess.h \
@@ -90,7 +89,6 @@
     datagramSink.cxx dcast.cxx \
     encryptStreamBuf.cxx encryptStream.cxx \
     error_utils.cxx \
-    get_config_path.cxx \
     hashGeneratorBase.cxx hashVal.cxx indent.cxx \
     memoryInfo.cxx memoryUsage.cxx memoryUsagePointerCounts.cxx \
     memoryUsagePointers.cxx multifile.cxx \
@@ -145,7 +143,7 @@
     datagramIterator.I datagramIterator.h \
     datagramSink.I datagramSink.h dcast.T dcast.h \
     encryptStreamBuf.h encryptStreamBuf.I encryptStream.h encryptStream.I \
-    error_utils.h get_config_path.h \
+    error_utils.h  \
     hashGeneratorBase.I \
     hashGeneratorBase.h hashVal.I hashVal.h \
     indent.I indent.h \

+ 0 - 1
panda/src/express/express_composite1.cxx

@@ -16,7 +16,6 @@
 #include "error_utils.cxx"
 #include "encryptStreamBuf.cxx"
 #include "encryptStream.cxx"
-#include "get_config_path.cxx"
 #include "hashGeneratorBase.cxx"
 #include "hashVal.cxx"
 #include "indent.cxx"

+ 0 - 75
panda/src/express/get_config_path.cxx

@@ -1,75 +0,0 @@
-// Filename: get_config_path.cxx
-// Created by:  drose (01Jul00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-
-
-#include "config_express.h"
-
-#include "executionEnvironment.h"
-#include "get_config_path.h"
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: get_config_path
-//  Description: A generic function for reading path strings
-//               (e.g. model-path, texture-path, etc.) from the Config
-//               database.  It automatically handles concatenating
-//               together multiple appearances of the indicated
-//               variable name as a single long path string.
-//
-//               static_ptr must be a statically-defined string
-//               pointer, unique to each different config_var_name.
-//               It should be initialized to NULL.  This will
-//               automatically be allocated and filled with the string
-//               path the first time this function is called;
-//               thereafter, the same string value will be returned.
-//               This allows the function to work during static init
-//               time when we can't be sure what has or hasn't been
-//               already initialized.
-////////////////////////////////////////////////////////////////////
-DSearchPath &
-get_config_path(const string &config_var_name, DSearchPath *&static_ptr) {
-  if (static_ptr == (DSearchPath *)NULL) {
-    static_ptr = new DSearchPath;
-
-    Config::ConfigTable::Symbol all_defs;
-    config_express.GetAll(config_var_name, all_defs);
-    if (all_defs.empty()) {
-      // If the path is undefined, it is implicitly ".".
-      (*static_ptr).append_path(".");
-
-    } else {
-      Config::ConfigTable::Symbol::reverse_iterator si =
-        all_defs.rbegin();
-      string filename = ExecutionEnvironment::expand_string((*si).Val());
-      (*static_ptr).append_path(Filename::from_os_specific(filename), "");
-      ++si;
-      while (si != all_defs.rend()) {
-        string filename = ExecutionEnvironment::expand_string((*si).Val());
-        (*static_ptr).append_path(Filename::from_os_specific(filename), "");
-        ++si;
-      }
-    }
-    if (express_cat.is_debug()) {
-      express_cat.debug()
-        << config_var_name << " is " << *static_ptr << "\n";
-    }
-  }
-
-  return *static_ptr;
-}

+ 0 - 47
panda/src/express/get_config_path.h

@@ -1,47 +0,0 @@
-// Filename: get_config_path.h
-// Created by:  drose (01Jul00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef GET_CONFIG_PATH_H
-#define GET_CONFIG_PATH_H
-
-#include "pandabase.h"
-
-#include "dSearchPath.h"
-
-////////////////////////////////////////////////////////////////////
-//     Function: get_config_path
-//  Description: A generic function for reading path strings
-//               (e.g. model-path, texture-path, etc.) from the Config
-//               database.  It automatically handles concatenating
-//               together multiple appearances of the indicated
-//               variable name as a single long path string.
-//
-//               static_ptr must be a statically-defined string
-//               pointer, unique to each different config_var_name.
-//               It should be initialized to NULL.  This will
-//               automatically be allocated and filled with the string
-//               path the first time this function is called;
-//               thereafter, the same string value will be returned.
-//               This allows the function to work during static init
-//               time when we can't be sure what has or hasn't been
-//               already initialized.
-////////////////////////////////////////////////////////////////////
-EXPCL_PANDAEXPRESS DSearchPath &
-get_config_path(const string &config_var_name, DSearchPath *&static_ptr);
-
-#endif

+ 0 - 8
panda/src/parametrics/config_parametrics.cxx

@@ -33,8 +33,6 @@
 #include "nurbsPPCurve.h"
 #endif
 
-#include "get_config_path.h"
-
 Configure(config_parametrics);
 NotifyCategoryDef(parametrics, "");
 
@@ -62,9 +60,3 @@ ConfigureFn(config_parametrics) {
   RopeNode::register_with_read_factory();
   SheetNode::register_with_read_factory();
 }
-
-const DSearchPath &
-get_parametrics_path() {
-  static DSearchPath *parametrics_path = NULL;
-  return get_config_path("parametrics-path", parametrics_path);
-}

+ 6 - 1
panda/src/pgraph/config_pgraph.cxx

@@ -87,7 +87,6 @@
 #include "transformState.h"
 #include "transparencyAttrib.h"
 #include "nodePathLerps.h"
-#include "get_config_path.h"
 
 #include "dconfig.h"
 
@@ -187,6 +186,12 @@ ConfigVariableList load_file_type
           "either the name of a module, or a space-separate list of filename "
           "extensions, followed by the name of the module."));
 
+ConfigVariableList cull_bin
+("cull-bin", 
+ PRC_DESC("Creates a new cull bin by name, with the specified properties.  "
+          "This is a string in three tokens, separated by whitespace: "
+          "'bin_name sort type'."));
+
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libpgraph
 //  Description: Initializes the library.  This must be called at

+ 1 - 0
panda/src/pgraph/config_pgraph.h

@@ -51,6 +51,7 @@ extern ConfigVariableBool m_dual_flash;
 extern ConfigVariableBool asynchronous_loads;
 
 extern ConfigVariableList load_file_type;
+extern ConfigVariableList cull_bin;
 
 extern EXPCL_PANDA void init_libpgraph();
 

+ 3 - 5
panda/src/pgraph/cullBinManager.cxx

@@ -239,12 +239,10 @@ do_sort_bins() {
 void CullBinManager::
 setup_initial_bins() {
   // First, add all of the bins specified in the Configrc file.
-  Config::ConfigTable::Symbol cull_bins;
-  config_pgraph.GetAll("cull-bin", cull_bins);
+  int num_bins = cull_bin.get_num_unique_values();
 
-  Config::ConfigTable::Symbol::iterator bi;
-  for (bi = cull_bins.begin(); bi != cull_bins.end(); ++bi) {
-    ConfigString def = (*bi).Val();
+  for (int bi = 0; bi < num_bins; bi++) {
+    string def = cull_bin.get_unique_value(bi);
 
     // This is a string in three tokens, separated by whitespace:
     //    bin_name sort type

+ 12 - 44
panda/src/pstatclient/config_pstats.cxx

@@ -27,53 +27,21 @@ ConfigureFn(config_pstats) {
   init_libpstatclient();
 }
 
-string get_pstats_name() {
-  static ConfigVariableString *pstats_name = NULL;
+ConfigVariableString pstats_name
+("pstats-name", "Panda Stats");
 
-  if (pstats_name == (ConfigVariableString *)NULL) {
-    pstats_name = new ConfigVariableString
-      ("pstats-name", "Panda Stats");
-  }
-
-  return pstats_name->get_value();
-}
-
-float get_pstats_max_rate() {
-  static ConfigVariableDouble *pstats_max_rate = NULL;
-
-  if (pstats_max_rate == (ConfigVariableDouble *)NULL) {
-    pstats_max_rate = new ConfigVariableDouble
-      ("pstats-max-rate", 30.0);
-  }
-
-  return *pstats_max_rate;
-}
+ConfigVariableDouble pstats_max_rate
+("pstats-max-rate", 30.0);
 
-bool get_pstats_threaded_write() {
-  static ConfigVariableBool *pstats_threaded_write = NULL;
+ConfigVariableBool pstats_threaded_write
+("pstats-threaded-write", false);
 
-  if (pstats_threaded_write == (ConfigVariableBool *)NULL) {
-    pstats_threaded_write = new ConfigVariableBool
-      ("pstats-threaded-write", false);
-  }
-
-  return *pstats_threaded_write;
-}
-
-double get_pstats_tcp_ratio() {
-  static ConfigVariableDouble *pstats_tcp_ratio = NULL;
-
-  if (pstats_tcp_ratio == (ConfigVariableDouble *)NULL) {
-    pstats_tcp_ratio = new ConfigVariableDouble
-      ("pstats-tcp-ratio", 0.01,
-       PRC_DESC("This specifies the ratio of frame update messages that are eligible "
-                "for UDP that are sent via TCP instead.  It does not count messages "
-                "that are too large for UDP and must be sent via TCP anyway.  1.0 "
-                "means all messages are sent TCP; 0.0 means all are sent UDP."));
-  }
-
-  return *pstats_tcp_ratio;
-}
+ConfigVariableDouble pstats_tcp_ratio
+("pstats-tcp-ratio", 0.01,
+ PRC_DESC("This specifies the ratio of frame update messages that are eligible "
+          "for UDP that are sent via TCP instead.  It does not count messages "
+          "that are too large for UDP and must be sent via TCP anyway.  1.0 "
+          "means all messages are sent TCP; 0.0 means all are sent UDP."));
 
 ConfigVariableString pstats_host
 ("pstats-host", "localhost");

+ 4 - 4
panda/src/pstatclient/config_pstats.h

@@ -33,10 +33,10 @@
 ConfigureDecl(config_pstats, EXPCL_PANDA, EXPTP_PANDA);
 NotifyCategoryDecl(pstats, EXPCL_PANDA, EXPTP_PANDA);
 
-extern EXPCL_PANDA string get_pstats_name();
-extern EXPCL_PANDA float get_pstats_max_rate();
-extern EXPCL_PANDA bool get_pstats_threaded_write();
-extern EXPCL_PANDA double get_pstats_tcp_ratio();
+extern EXPCL_PANDA ConfigVariableString pstats_name;
+extern EXPCL_PANDA ConfigVariableDouble pstats_max_rate;
+extern EXPCL_PANDA ConfigVariableBool pstats_threaded_write;
+extern EXPCL_PANDA ConfigVariableDouble pstats_tcp_ratio;
 
 extern EXPCL_PANDA ConfigVariableString pstats_host;
 extern EXPCL_PANDA ConfigVariableInt pstats_port;

+ 3 - 5
panda/src/pstatclient/pStatClientImpl.cxx

@@ -46,7 +46,7 @@ PStatClientImpl::
 PStatClientImpl(PStatClient *client) :
   _client(client),
   _reader(this, 0),
-  _writer(this, get_pstats_threaded_write() ? 1 : 0)
+  _writer(this, pstats_threaded_write ? 1 : 0)
 {
   _is_connected = false;
   _got_udp_port = false;
@@ -56,14 +56,12 @@ PStatClientImpl(PStatClient *client) :
   // Make sure our clock is in "normal" mode.
   _clock.set_mode(ClockObject::M_normal);
 
-  _client_name = get_pstats_name();
-  _max_rate = get_pstats_max_rate();
+  _client_name = pstats_name;
+  _max_rate = pstats_max_rate;
 
   _tcp_count = 1;
   _udp_count = 1;
 
-  double pstats_tcp_ratio = get_pstats_tcp_ratio();
-
   if (pstats_tcp_ratio >= 1.0f) {
     _tcp_count_factor = 0.0f;
     _udp_count_factor = 1.0f;

+ 11 - 5
panda/src/putil/config_util.cxx

@@ -32,7 +32,6 @@
 #include "writableParam.h"
 #include "keyboardButton.h"
 #include "mouseButton.h"
-#include "get_config_path.h"
 
 #include "dconfig.h"
 
@@ -41,13 +40,20 @@ NotifyCategoryDef(util, "");
 NotifyCategoryDef(bam, util_cat);
 
 ConfigVariableSearchPath model_path
-("model-path", "The default directories to search for all models and general files loaded into Panda.");
+("model-path", 
+ PRC_DESC("The default directories to search for all models and general "
+          "files loaded into Panda."));
 
 ConfigVariableSearchPath texture_path
-("texture-path", "A special directory path to search for textures only.  Textures are also searched for along the model-path, so the use of texture-path is only useful if you have special directories that only contain textures.");
+("texture-path", 
+ PRC_DESC("A special directory path to search for textures only.  "
+          "Textures are also searched for along the model-path, so the "
+          "use of texture-path is only useful if you have special "
+          "directories that only contain textures."));
 
 ConfigVariableSearchPath sound_path
-("sound-path", "The directories to search for loaded sound and music files.");
+("sound-path", 
+ PRC_DESC("The directories to search for sound and music files to be loaded."));
 
 ConfigureFn(config_util) {
   BamReaderParam::init_type();
@@ -78,7 +84,7 @@ ConfigureFn(config_util) {
 // This variable is no longer defined here; instead, it's a member of
 // MemoryUsage.
 //
-//const bool track_memory_usage = config_util.GetBool("track-memory-usage", false);
+// ConfigVariableBool track_memory_usage("track-memory-usage", false);
 
 // There is no longer any need for C++ code to call these functions to
 // access the various path variables; instead, new C++ code should

+ 15 - 10
panda/src/wgldisplay/config_wgldisplay.cxx

@@ -31,6 +31,21 @@ ConfigureFn(config_wgldisplay) {
   init_libwgldisplay();
 }
 
+ConfigVariableInt gl_force_pixfmt
+("gl-force-pixfmt", 0);
+
+ConfigVariableBool gl_force_invalid
+("gl-force-invalid", false,
+ PRC_DESC("Set this true to force all GL windows to fail to open "
+          "correctly (for debugging)."));
+
+ConfigVariableBool gl_do_vidmemsize_check
+("gl-do-vidmemsize-check", true,
+ PRC_DESC("This is true to insist that low-memory cards open only 640x480 "
+          "fullscreen windows, no matter what resolution of window was "
+          "requested.  It only affects fullscreen windows."));
+
+
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libwgldisplay
 //  Description: Initializes the library.  This must be called at
@@ -56,13 +71,3 @@ init_libwgldisplay() {
   selection->add_pipe_type(wglGraphicsPipe::get_class_type(),
                            wglGraphicsPipe::pipe_constructor);
 }
-
-int gl_force_pixfmt = config_wgldisplay.GetInt("gl-force-pixfmt", 0);
-
-// Set this true to force all GL windows to fail to open correctly.
-bool gl_force_invalid = config_wgldisplay.GetBool("gl-force-invalid", false);
-
-// This is true to insist that low-memory cards open only 640x480
-// fullscreen windows, no matter what resolution of window was
-// requested.  It only affects fullscreen windows.
-bool gl_do_vidmemsize_check = config_wgldisplay.GetBool("gl-do-vidmemsize-check", true);

+ 6 - 4
panda/src/wgldisplay/config_wgldisplay.h

@@ -21,13 +21,15 @@
 
 #include "pandabase.h"
 #include "notifyCategoryProxy.h"
+#include "configVariableInt.h"
+#include "configVariableBool.h"
 
 NotifyCategoryDecl(wgldisplay, EXPCL_PANDAGL, EXPTP_PANDAGL);
 
-extern EXPCL_PANDAGL void init_libwgldisplay();
+extern ConfigVariableInt gl_force_pixfmt;
+extern ConfigVariableBool gl_force_invalid;
+extern ConfigVariableBool gl_do_vidmemsize_check;
 
-extern int gl_force_pixfmt;
-extern bool gl_force_invalid;
-extern bool gl_do_vidmemsize_check;
+extern EXPCL_PANDAGL void init_libwgldisplay();
 
 #endif

+ 57 - 57
panda/src/windisplay/config_windisplay.cxx

@@ -28,33 +28,63 @@ ConfigureFn(config_windisplay) {
   init_libwindisplay();
 }
 
-bool show_fps_meter = config_windisplay.GetBool("show-fps-meter", false);
-float fps_meter_update_interval = max(0.5,config_windisplay.GetFloat("fps-meter-update-interval", 1.7));
-
-bool responsive_minimized_fullscreen_window = config_windisplay.GetBool("responsive-minimized-fullscreen-window",false);
-
-// Set this true to remember the current state of the keyboard while
-// the window focus is lost, or false to pretend the user is not
-// holding down any keys while the window focus is lost.  In either
-// case it should accurately restore the correct keyboard state when
-// the window focus is regained.
-bool hold_keys_across_windows = config_windisplay.GetBool("hold-keys-across-windows", false);
-
-// if true, use ddraw's GetAvailVidMem to fail if driver says it has too little video mem
-bool do_vidmemsize_check = config_windisplay.GetBool("do-vidmemsize-check", true);
-
-// For now, set this true to use the IME correctly on Win2000, or
-// false on Win98.  This is temporary; once we have been able to
-// verify that this distinction is actually necessary, we can replace
-// this config variable with an actual OS detection.
-bool ime_composition_w = config_windisplay.GetBool("ime-composition-w", true);
-
-// Set this true to show ime texts on the chat panel and hide the 
-// IME default windows. This is a mechanism to work around DX8/9 interface
-bool ime_aware = config_windisplay.GetBool("ime-aware", false);
-
-// Set this true to hide ime windows
-bool ime_hide = config_windisplay.GetBool("ime-hide", false);
+ConfigVariableFilename icon_filename
+("win32-window-icon", "");
+
+ConfigVariableFilename color_cursor_filename
+("win32-color-cursor", "");
+
+ConfigVariableFilename mono_cursor_filename
+("win32-mono-cursor", "");
+
+ConfigVariableBool responsive_minimized_fullscreen_window
+("responsive-minimized-fullscreen-window",false);
+
+ConfigVariableBool hold_keys_across_windows
+("hold-keys-across-windows", false,
+ PRC_DESC("Set this true to remember the current state of the keyboard while "
+          "the window focus is lost, or false to pretend the user is not "
+          "holding down any keys while the window focus is lost.  In either "
+          "case it should accurately restore the correct keyboard state when "
+          "the window focus is regained."));
+
+ConfigVariableBool do_vidmemsize_check
+("do-vidmemsize-check", true,
+ PRC_DESC("if true, use ddraw's GetAvailVidMem to fail if driver says "
+          "it has too little video mem"));
+
+ConfigVariableBool ime_composition_w
+("ime-composition-w", true,
+ PRC_DESC("For now, set this true to use the IME correctly on Win2000, or "
+          "false on Win98.  This is temporary; once we have been able to "
+          "verify that this distinction is actually necessary, we can replace "
+          "this config variable with an actual OS detection."));
+
+ConfigVariableBool ime_aware
+("ime-aware", false,
+ PRC_DESC("Set this true to show ime texts on the chat panel and hide the "
+          "IME default windows. This is a mechanism to work around DX8/9 "
+          "interface."));
+
+ConfigVariableBool ime_hide
+("ime-hide", false,
+ PRC_DESC("Set this true to hide ime windows."));
+
+ConfigVariableBool sync_video
+("sync-video", true,
+ PRC_DESC("Configure this true to force the rendering to sync to the video "
+          "refresh, or false to let your frame rate go as high as it can, "
+          "irrespective of the video refresh (if this capability is "
+          "available in the ICD)."));
+
+ConfigVariableBool swapbuffer_framelock
+("swapbuffer-framelock", false,
+ PRC_DESC("Set this true to enable HW swapbuffer frame-lock on 3dlabs cards"));
+
+ConfigVariableBool force_software_renderer
+("force-software-renderer", false);
+ConfigVariableBool allow_software_renderer
+("allow-software-renderer", false);
 
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libwindisplay
@@ -75,33 +105,3 @@ init_libwindisplay() {
   WinGraphicsPipe::init_type();
   WinGraphicsWindow::init_type();
 }
-
-// cant use global var cleanly because global var static init executed
-// after init_libwin(), incorrectly reiniting var
-Filename get_icon_filename() {
-  string iconname = config_windisplay.GetString("win32-window-icon","");
-  return ExecutionEnvironment::expand_string(iconname);
-}
-
-Filename get_color_cursor_filename() {
-  string cursorname = config_windisplay.GetString("win32-color-cursor","");
-  return ExecutionEnvironment::expand_string(cursorname);
-}
-
-Filename get_mono_cursor_filename() {
-  string cursorname = config_windisplay.GetString("win32-mono-cursor","");
-  return ExecutionEnvironment::expand_string(cursorname);
-}
-
-
-//  Configure this true to force the rendering to sync to the video
-//  refresh, or false to let your frame rate go as high as it can,
-//  irrespective of the video refresh.  (if this capability is
-//  available in the ICD)
-bool sync_video = config_windisplay.GetBool("sync-video", true);
-
-// Set this true to enable HW swapbuffer frame-lock on 3dlabs cards
-bool swapbuffer_framelock = config_windisplay.GetBool("swapbuffer-framelock", false);
-
-bool force_software_renderer = config_windisplay.GetBool("force-software-renderer", false);
-bool allow_software_renderer = config_windisplay.GetBool("allow-software-renderer", false);

+ 17 - 17
panda/src/windisplay/config_windisplay.h

@@ -22,26 +22,26 @@
 #include "pandabase.h"
 #include "filename.h"
 #include "notifyCategoryProxy.h"
+#include "configVariableFilename.h"
+#include "configVariableBool.h"
 
 NotifyCategoryDecl(windisplay, EXPCL_PANDAWIN, EXPTP_PANDAWIN);
 
-extern Filename get_icon_filename();
-extern Filename get_color_cursor_filename();
-extern Filename get_mono_cursor_filename();
-
-extern bool show_fps_meter;
-extern float fps_meter_update_interval;
-extern bool responsive_minimized_fullscreen_window;
-extern bool hold_keys_across_windows;
-extern bool do_vidmemsize_check;
-extern bool ime_composition_w;
-extern bool ime_aware;
-extern bool ime_hide;
-
-extern EXPCL_PANDAWIN bool sync_video;
-extern EXPCL_PANDAWIN bool swapbuffer_framelock;
-extern EXPCL_PANDAWIN bool force_software_renderer;
-extern EXPCL_PANDAWIN bool allow_software_renderer;
+extern ConfigVariableFilename icon_filename;
+extern ConfigVariableFilename color_cursor_filename;
+extern ConfigVariableFilename mono_cursor_filename;
+
+extern ConfigVariableBool responsive_minimized_fullscreen_window;
+extern ConfigVariableBool hold_keys_across_windows;
+extern ConfigVariableBool do_vidmemsize_check;
+extern ConfigVariableBool ime_composition_w;
+extern ConfigVariableBool ime_aware;
+extern ConfigVariableBool ime_hide;
+
+extern EXPCL_PANDAWIN ConfigVariableBool sync_video;
+extern EXPCL_PANDAWIN ConfigVariableBool swapbuffer_framelock;
+extern EXPCL_PANDAWIN ConfigVariableBool force_software_renderer;
+extern EXPCL_PANDAWIN ConfigVariableBool allow_software_renderer;
 
 extern EXPCL_PANDAWIN void init_libwindisplay();
 

+ 2 - 2
panda/src/windisplay/winGraphicsWindow.cxx

@@ -1654,8 +1654,8 @@ register_window_class() {
 
   // Might be nice to move these properties into the WindowProperties
   // structure, so they don't have to be global for all windows.
-  string windows_icon_filename = get_icon_filename().to_os_specific();
-  string windows_mono_cursor_filename = get_mono_cursor_filename().to_os_specific();
+  string windows_icon_filename = icon_filename.get_value().to_os_specific();
+  string windows_mono_cursor_filename = mono_cursor_filename.get_value().to_os_specific();
 
   if (!windows_icon_filename.empty()) {
     // Note: LoadImage seems to cause win2k internal heap corruption