Panda3D
|
00001 // Filename: config_dxgsg8.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_dxgsg8.h" 00016 #include "dxGraphicsStateGuardian8.h" 00017 #include "dxTextureContext8.h" 00018 #include "dxVertexBufferContext8.h" 00019 #include "dxIndexBufferContext8.h" 00020 #include "dxGeomMunger8.h" 00021 #include "graphicsPipeSelection.h" 00022 #include "wdxGraphicsWindow8.h" 00023 #include "wdxGraphicsPipe8.h" 00024 #include "pandaSystem.h" 00025 00026 #include "dconfig.h" 00027 00028 Configure(config_dxgsg8); 00029 NotifyCategoryDef(dxgsg8, ":display:gsg"); 00030 NotifyCategoryDef(wdxdisplay8, "display"); 00031 00032 // Configure this variable true to cause the DXGSG to show each 00033 // transform space it renders by drawing a little unit axis. This 00034 // cannot be enabled when the player is compiled in NDEBUG mode. 00035 ConfigVariableBool dx_show_transforms 00036 ("dx-show-transforms", false); 00037 00038 // Set Level of MultiSampling to be used, if HW supports it. Valid values are 2-16. 00039 ConfigVariableInt dx_multisample_antialiasing_level 00040 ("dx-multisample-antialiasing-level", 0); 00041 00042 // if true, if card only supports per-vertex fog, it will be treated as no-HW fog capability 00043 ConfigVariableBool dx_no_vertex_fog 00044 ("dx-no-vertex-fog", false); 00045 00046 // if true, overwrite cursor bitmap tip with "D3D" to distinguish it from GDI cursor 00047 ConfigVariableBool dx_show_cursor_watermark 00048 ("dx-show-cursor-watermark", 00049 #ifdef _DEBUG 00050 true 00051 #else 00052 false 00053 #endif 00054 ); 00055 00056 // if true, triangle filter will be used to generate mipmap levels instead of default box filter 00057 ConfigVariableBool dx_use_triangle_mipgen_filter 00058 ("dx-use-triangle-mipgen-filter", false); 00059 00060 ConfigVariableBool dx_broken_max_index 00061 ("dx-broken-max-index", false, 00062 PRC_DESC("Configure this true if you have a buggy graphics driver that " 00063 "doesn't correctly implement the third parameter, NumVertices, " 00064 "of DrawIndexedPrimitive(). In particular, the NVIDIA Quadro " 00065 "driver version 6.14.10.7184 seems to treat this as a maximum " 00066 "vertex index, rather than a delta between the maximum and " 00067 "minimum vertex index. Turn this on if you are seeing stray " 00068 "triangles, or you are not seeing all of your triangles. Enabling " 00069 "this should work around this bug, at the cost of some additional " 00070 "rendering overhead on the GPU.")); 00071 00072 #ifndef NDEBUG 00073 // debugging flag 00074 // values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW 00075 ConfigVariableInt dx_force_backface_culling 00076 ("dx-force-backface-culling", 0); 00077 #endif 00078 00079 ConfigVariableBool dx_mipmap_everything 00080 ("dx-mipmap-everything", false); 00081 ConfigVariableBool dx_ignore_mipmaps 00082 ("dx-ignore-mipmaps", false); 00083 00084 // if this is set, more accurate but more expensive fog computations are performed 00085 ConfigVariableBool dx_use_rangebased_fog 00086 ("dx-use-rangebased-fog", false); 00087 ConfigVariableBool dx_no_dithering 00088 ("dx-no-dithering", false); 00089 ConfigVariableBool dx_force_16bpp_zbuffer 00090 ("dx-force-16bpp-zbuffer", false); 00091 ConfigVariableBool dx_do_vidmemsize_check 00092 ("do-vidmemsize-check", true); 00093 // Setting this true theoretically hinders render performance, because 00094 // it forces the FPU to go through some extra work to clean itself up 00095 // after rendering a frame, but the performance cost seems to be 00096 // small. On the other hand, setting it false can force the 00097 // application to run in single-precision arithmetic mode, even if 00098 // it believes it is using double-precision variables. 00099 ConfigVariableBool dx_preserve_fpu_state 00100 ("dx-preserve-fpu-state", true); 00101 00102 ConfigVariableInt dx_preferred_device_id 00103 ("dx-preferred-device-id", -1); 00104 00105 #ifdef _DEBUG 00106 ConfigVariableDouble dx_global_miplevel_bias 00107 ("dx-global-miplevel-bias", 0.0); 00108 ConfigVariableBool dx_debug_view_mipmaps 00109 ("dx-debug-view-mipmaps", false); 00110 #endif 00111 00112 ConfigVariableBool dx_force_anisotropic_filtering 00113 ("dx-force-anisotropic-filtering", false); 00114 00115 // set 'retained-mode #t' and this to have prepare_geom concatenate all tristrips within a geom 00116 // together using degenerate tris 00117 ConfigVariableBool link_tristrips 00118 ("link-tristrips", false); 00119 00120 ConfigureFn(config_dxgsg8) { 00121 init_libdxgsg8(); 00122 } 00123 00124 //////////////////////////////////////////////////////////////////// 00125 // Function: init_libdxgsg 00126 // Description: Initializes the library. This must be called at 00127 // least once before any of the functions or classes in 00128 // this library can be used. Normally it will be 00129 // called by the static initializers and need not be 00130 // called explicitly, but special cases exist. 00131 //////////////////////////////////////////////////////////////////// 00132 void 00133 init_libdxgsg8() { 00134 static bool initialized = false; 00135 if (initialized) { 00136 return; 00137 } 00138 initialized = true; 00139 00140 DXGraphicsStateGuardian8::init_type(); 00141 DXTextureContext8::init_type(); 00142 DXVertexBufferContext8::init_type(); 00143 DXIndexBufferContext8::init_type(); 00144 DXGeomMunger8::init_type(); 00145 00146 wdxGraphicsPipe8::init_type(); 00147 wdxGraphicsWindow8::init_type(); 00148 00149 GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr(); 00150 selection->add_pipe_type(wdxGraphicsPipe8::get_class_type(), 00151 wdxGraphicsPipe8::pipe_constructor); 00152 00153 PandaSystem *ps = PandaSystem::get_global_ptr(); 00154 ps->add_system("DirectX8"); 00155 }