Panda3D

config_dxgsg9.cxx

00001 // Filename: config_dxgsg9.cxx
00002 // Created by:  drose (06Oct99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "config_dxgsg9.h"
00016 #include "dxGraphicsStateGuardian9.h"
00017 #include "dxTextureContext9.h"
00018 #include "dxVertexBufferContext9.h"
00019 #include "dxIndexBufferContext9.h"
00020 #include "dxOcclusionQueryContext9.h"
00021 #include "dxShaderContext9.h"
00022 #include "dxGeomMunger9.h"
00023 #include "graphicsPipeSelection.h"
00024 #include "wdxGraphicsWindow9.h"
00025 #include "wdxGraphicsPipe9.h"
00026 #include "wdxGraphicsBuffer9.h"
00027 #include "pandaSystem.h"
00028 
00029 #include "dconfig.h"
00030 
00031 DToolConfigure(config_dxgsg9);
00032 NotifyCategoryDef(dxgsg9, ":display:gsg");
00033 NotifyCategoryDef(wdxdisplay9, "display");
00034 
00035 // Configure this variable true to cause the DXGSG to show each
00036 // transform space it renders by drawing a little unit axis.  This
00037 // cannot be enabled when the player is compiled in NDEBUG mode.
00038 ConfigVariableBool dx_show_transforms
00039 ("dx-show-transforms", false);
00040 
00041 // if true, if card only supports per-vertex fog, it will be treated as no-HW fog capability
00042 ConfigVariableBool dx_no_vertex_fog
00043 ("dx-no-vertex-fog", false);
00044 
00045 // if true, overwrite cursor bitmap tip with "D3D" to distinguish it from GDI cursor
00046 ConfigVariableBool dx_show_cursor_watermark
00047 ("dx-show-cursor-watermark",
00048 #ifdef _DEBUG
00049     true
00050 #else
00051     false
00052 #endif
00053     );
00054 
00055 // if true, triangle filter will be used to generate mipmap levels instead of default box filter
00056 ConfigVariableBool dx_use_triangle_mipgen_filter
00057 ("dx-use-triangle-mipgen-filter", false);
00058 
00059 ConfigVariableBool dx_broken_max_index
00060 ("dx-broken-max-index", false,
00061  PRC_DESC("Configure this true if you have a buggy graphics driver that "
00062           "doesn't correctly implement the third parameter, NumVertices, "
00063           "of DrawIndexedPrimitive().  In particular, the NVIDIA Quadro "
00064           "driver version 6.14.10.7184 seems to treat this as a maximum "
00065           "vertex index, rather than a delta between the maximum and "
00066           "minimum vertex index.  Turn this on if you are seeing stray "
00067           "triangles, or you are not seeing all of your triangles.  Enabling "
00068           "this should work around this bug, at the cost of some additional "
00069           "rendering overhead on the GPU."));
00070 
00071 ConfigVariableBool dx_broken_depth_bias
00072 ("dx-broken-depth-bias", true,
00073  PRC_DESC("Configure this true if your graphics driver claims to support "
00074           "D3DPRASTERCAPS_DEPTHBIAS, but doesn't appear to do anything "
00075           "useful when you set it.  In fact, there's not much reason not "
00076           "to just leave this set, since the workaround seems to be "
00077           "sufficient for all cases."));
00078 
00079 ConfigVariableDouble dx_depth_bias_scale
00080 ("dx-depth-bias-scale", 0.000001,
00081  PRC_DESC("If depth bias is not directly supported by the graphics driver "
00082           "(or if dx-broken-depth-bias is set true), this configures the "
00083           "amount by which we slide the viewport back to achieve the effect "
00084           "of a depth bias.  It should generally be a small number."));
00085 
00086 ConfigVariableBool dx_count_all_cards_memory
00087 ("dx-count-all-cards-memory", true,
00088  PRC_DESC("Set this to false to skip the counting of extra cards memory "
00089           "via DX7 calls."));
00090 
00091 #ifndef NDEBUG
00092 // debugging flag
00093 // values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW
00094 ConfigVariableInt dx_force_backface_culling
00095 ("dx-force-backface-culling", 0);
00096 #endif
00097 
00098 ConfigVariableBool dx_mipmap_everything
00099 ("dx-mipmap-everything", false);
00100 ConfigVariableBool dx_ignore_mipmaps
00101 ("dx-ignore-mipmaps", false);
00102 
00103 // if this is set, more accurate but more expensive fog computations are performed
00104 ConfigVariableBool dx_use_rangebased_fog
00105 ("dx-use-rangebased-fog", false);
00106 ConfigVariableBool dx_no_dithering
00107 ("dx-no-dithering", false);
00108 ConfigVariableBool dx_force_16bpp_zbuffer
00109 ("dx-force-16bpp-zbuffer", false);
00110 ConfigVariableBool dx_do_vidmemsize_check
00111 ("do-vidmemsize-check", true);
00112 // Setting this true theoretically hinders render performance, because
00113 // it forces the FPU to go through some extra work to clean itself up
00114 // after rendering a frame, but the performance cost seems to be
00115 // small.  On the other hand, setting it false can force the
00116 // application to run in single-precision arithmetic mode, even if
00117 // it believes it is using double-precision variables.
00118 ConfigVariableBool dx_preserve_fpu_state
00119 ("dx-preserve-fpu-state", true);
00120 
00121 ConfigVariableInt dx_preferred_device_id
00122 ("dx-preferred-device-id", -1);
00123 
00124 ConfigVariableBool dx_intel_compressed_texture_bug
00125 ("dx-intel-compressed-texture-bug", true,
00126  PRC_DESC("Set this true to work around a bug in the Intel driver "
00127           "igdumd32.dll, for at least the 965 Express chipset family, "
00128           "which breaks compressed texture images smaller "
00129           "than about 256x256 (even mipmap levels).  The workaround is "
00130           "simply to disable compressed texture support when this "
00131           "driver is detected."));
00132 
00133 #ifdef _DEBUG
00134 ConfigVariableDouble dx_global_miplevel_bias
00135 ("dx-global-miplevel-bias", 0.0);
00136 ConfigVariableBool dx_debug_view_mipmaps
00137 ("dx-debug-view-mipmaps", false);
00138 #endif
00139 
00140 ConfigVariableBool dx_force_anisotropic_filtering
00141 ("dx-force-anisotropic-filtering", false);
00142 
00143 // set 'retained-mode #t' and this to have prepare_geom concatenate all tristrips within a geom
00144 // together using degenerate tris
00145 ConfigVariableBool link_tristrips
00146 ("link-tristrips", false);
00147 
00148 // true = use DirectX management of video memory
00149 // false = see dx_lru_management config variable below
00150 ConfigVariableBool dx_management
00151 ("dx-management", false);
00152 
00153 // valid only if dx_management == false
00154 // true = use DirectX management of texture memory
00155 // false = lru will manage texture memory
00156 ConfigVariableBool dx_texture_management
00157 ("dx-texture-management", true);
00158 
00159 // valid only if dx_management == false
00160 // true = enable LRU management of video memory
00161 // false = no video memory management
00162 ConfigVariableBool dx_lru_management
00163 ("dx-lru-management", true);
00164 
00165 // number of LRU pages to pre-allocate
00166 // if the maximum number of pages is used up,
00167 // then LRU pages will be dynamically allocated/freed
00168 ConfigVariableInt dx_lru_maximum_pages
00169 ("dx-lru-maximum-pages", 8192);
00170 
00171 // the amount of video memory the LRU will try not to use
00172 // this will allow DirectX some space in case of memory fragmentation, ...
00173 // this does not apply if dx_lru_minimum_memory_requirement is not met
00174 ConfigVariableInt dx_lru_free_memory_requirement
00175 ("dx-lru-free-memory-requirement", 12000000);
00176 
00177 // this is like the minimum recommended amount of video memory
00178 ConfigVariableInt dx_lru_minimum_memory_requirement
00179 ("dx-lru-minimum-memory-requirement", 64000000);
00180 
00181 // used to cap the amount of video memory used
00182 // 0 = use all available DirectX video memory
00183 ConfigVariableInt dx_lru_maximum_memory_requirement
00184 ("dx-lru-maximum-memory-requirement", 0);
00185 
00186 // the number of LRU pages the LRU will update per frame
00187 // do not set this too high or it will degrade performance
00188 ConfigVariableInt dx_lru_maximum_page_updates_per_frame
00189 ("dx-lru-maximum-page-updates-per-frame", 40);
00190 
00191 // lru debug on/off
00192 ConfigVariableBool dx_lru_debug
00193 ("dx-lru-debug", false);
00194 
00195 // valid only if dx_lru_debug == true 
00196 // number of frames to wait until printing out the LRU status
00197 ConfigVariableInt dx_lru_debug_frames_til_output
00198 ("dx-lru-debug-frames-til-output", 500);
00199 
00200 // valid only if dx_lru_debug == true 
00201 ConfigVariableBool dx_lru_debug_textures
00202 ("dx-lru-debug-textures", false);
00203 
00204 // valid only if dx_lru_debug == true 
00205 ConfigVariableBool dx_lru_debug_vertex_buffers
00206 ("dx-lru-debug-vertex-buffers", false);
00207 
00208 ConfigVariableBool dx_use_dynamic_textures
00209 ("dx-use-dynamic-textures", true);
00210 
00211 // DX device option
00212 ConfigVariableBool dx_use_multithread
00213 ("dx-use-multithread", false);
00214 
00215 // DX device option
00216 ConfigVariableBool dx_use_puredevice
00217 ("dx-use-puredevice", false);
00218 
00219 // DX device option
00220 ConfigVariableBool dx_disable_driver_management
00221 ("dx-disable-driver-management", false);
00222 
00223 // DX device option
00224 ConfigVariableBool dx_disable_driver_management_ex
00225 ("dx-disable-driver-management-ex", false);
00226 
00227 // nVidia's performace heads up display
00228 ConfigVariableBool dx_use_nvperfhud
00229 ("dx-use-nvperfhud", false);
00230 
00231 ConfigureFn(config_dxgsg9) {
00232   init_libdxgsg9();
00233 }
00234 
00235 ////////////////////////////////////////////////////////////////////
00236 //     Function: init_libdxgsg
00237 //  Description: Initializes the library.  This must be called at
00238 //               least once before any of the functions or classes in
00239 //               this library can be used.  Normally it will be
00240 //               called by the static initializers and need not be
00241 //               called explicitly, but special cases exist.
00242 ////////////////////////////////////////////////////////////////////
00243 void
00244 init_libdxgsg9() {
00245   static bool initialized = false;
00246   if (initialized) {
00247     return;
00248   }
00249   initialized = true;
00250 
00251   DXGraphicsStateGuardian9::init_type();
00252   DXTextureContext9::init_type();
00253   DXVertexBufferContext9::init_type();
00254   DXIndexBufferContext9::init_type();
00255   DXOcclusionQueryContext9::init_type();
00256   DXShaderContext9::init_type();
00257   DXGeomMunger9::init_type();
00258 
00259   wdxGraphicsPipe9::init_type();
00260   wdxGraphicsWindow9::init_type();
00261   wdxGraphicsBuffer9::init_type();
00262 
00263   GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr();
00264   selection->add_pipe_type(wdxGraphicsPipe9::get_class_type(),
00265                            wdxGraphicsPipe9::pipe_constructor);
00266 
00267   PandaSystem *ps = PandaSystem::get_global_ptr();
00268   ps->add_system("DirectX9");
00269 }
 All Classes Functions Variables Enumerations