diff --git a/panda/src/dxgsg/config_dxgsg.cxx b/panda/src/dxgsg/config_dxgsg.cxx index caf2fccdaf..6917badb5c 100644 --- a/panda/src/dxgsg/config_dxgsg.cxx +++ b/panda/src/dxgsg/config_dxgsg.cxx @@ -55,12 +55,15 @@ bool dx_force_16bpp_screenbuffers = config_dxgsg.GetBool("dx-force-16bpp-screenb bool dx_show_fps_meter = config_dxgsg.GetBool("show-fps-meter", false); float dx_fps_meter_update_interval = max(0.5,config_dxgsg.GetFloat("fps-meter-update-interval", 1.7)); +// 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_dxgsg.GetInt("dx-force-backface-culling", 0); + #ifdef _DEBUG bool dx_debug_view_mipmaps = config_dxgsg.GetBool("dx-debug-view-mipmaps", false); bool dx_force_16bpptextures = config_dxgsg.GetBool("dx-force-16bpptextures", false); bool dx_mipmap_everything = config_dxgsg.GetBool("dx-mipmap-everything", false); bool dx_force_anisotropic_filtering = config_dxgsg.GetBool("dx-force-anisotropic-filtering", false); - #endif // note: offset currently disabled since it wasnt working properly diff --git a/panda/src/dxgsg/config_dxgsg.h b/panda/src/dxgsg/config_dxgsg.h index 5723426cc5..479024dedf 100644 --- a/panda/src/dxgsg/config_dxgsg.h +++ b/panda/src/dxgsg/config_dxgsg.h @@ -35,6 +35,9 @@ extern bool dx_no_vertex_fog; extern bool dx_full_screen_antialiasing; extern float dx_fps_meter_update_interval; +// this is really a debug flag, but I need at Opt4 for perf-measurement +extern int dx_force_backface_culling; + #ifdef _DEBUG extern float dx_global_miplevel_bias; extern bool dx_debug_view_mipmaps; diff --git a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx index 5cfac45e4a..1d488f552c 100644 --- a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx +++ b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx @@ -431,6 +431,10 @@ init_dx( LPDIRECTDRAW7 context, dxgsg_cat.debug() << "device doesnt support full-screen anti-aliasing\n"; } } + + if(dx_force_backface_culling!=0) { + _d3dDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, dx_force_backface_culling); + } } //////////////////////////////////////////////////////////////////// @@ -4519,6 +4523,9 @@ issue_stencil(const StencilAttribute *attrib) { void DXGraphicsStateGuardian:: issue_cull_face(const CullFaceAttribute *attrib) { + if(dx_force_backface_culling!=0) { + return; // leave as initially set + } CullFaceProperty::Mode mode = attrib->get_mode();