Browse Source

pandify some more

David Rose 20 years ago
parent
commit
c7df854f7a

+ 2 - 2
panda/src/dxgsg8/dxGraphicsDevice8.cxx

@@ -30,8 +30,8 @@ DXGraphicsDevice8(wdxGraphicsPipe8 *pipe) :
   GraphicsDevice(pipe) {
 
   ZeroMemory(&_Scrn,sizeof(_Scrn));
-  _pD3DDevice = NULL;
-  _pSwapChain = NULL;
+  _d3d_device = NULL;
+  _swap_chain = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 2 - 2
panda/src/dxgsg8/dxGraphicsDevice8.h

@@ -39,8 +39,8 @@ public:
   ~DXGraphicsDevice8();
 
   DXScreenData _Scrn;
-  LPDIRECT3DDEVICE8 _pD3DDevice;  // same as Scrn._pD3DDevice, cached for spd
-  IDirect3DSwapChain8 *_pSwapChain;
+  LPDIRECT3DDEVICE8 _d3d_device;  // same as Scrn._d3d_device, cached for spd
+  IDirect3DSwapChain8 *_swap_chain;
 
 #if 0
 protected:

+ 16 - 16
panda/src/dxgsg8/dxGraphicsStateGuardian8.I

@@ -95,9 +95,9 @@ enable_color_material(bool val) {
 ////////////////////////////////////////////////////////////////////
 INLINE void DXGraphicsStateGuardian8::
 enable_fog(bool val) {
-  if ((_fog_enabled != val) && (_doFogType!=None)) {
+  if ((_fog_enabled != val) && (_do_fog_type!=None)) {
     _fog_enabled = val;
-    _pD3DDevice->SetRenderState(D3DRS_FOGENABLE, (DWORD)val);
+    _d3d_device->SetRenderState(D3DRS_FOGENABLE, (DWORD)val);
   }
 }
 
@@ -110,7 +110,7 @@ INLINE void DXGraphicsStateGuardian8::
 enable_zwritemask(bool val) {
   if (_depth_write_enabled != val) {
     _depth_write_enabled = val;
-    _pD3DDevice->SetRenderState(D3DRS_ZWRITEENABLE, val);
+    _d3d_device->SetRenderState(D3DRS_ZWRITEENABLE, val);
   }
 }
 
@@ -123,9 +123,9 @@ INLINE void DXGraphicsStateGuardian8::
 set_color_writemask(UINT color_writemask) {
   if (_color_writemask != color_writemask) {
     _color_writemask = color_writemask;
-    if(_pScrn->bCanDirectDisableColorWrites) {
+    if(_screen->_can_direct_disable_color_writes) {
       // only newer HW supports this rstate
-      _pD3DDevice->SetRenderState(D3DRS_COLORWRITEENABLE, (DWORD)color_writemask);
+      _d3d_device->SetRenderState(D3DRS_COLORWRITEENABLE, (DWORD)color_writemask);
     } else {
       // blending can only handle on/off
       assert((color_writemask==0x0)||(color_writemask==0xFFFFFFFF));
@@ -141,10 +141,10 @@ set_color_writemask(UINT color_writemask) {
 ////////////////////////////////////////////////////////////////////
 INLINE void DXGraphicsStateGuardian8::
 set_vertex_format(DWORD NewFvfType) {
-  if (_CurFVFType != NewFvfType) {
-    _CurFVFType = NewFvfType;
+  if (_cur_fvf_type != NewFvfType) {
+    _cur_fvf_type = NewFvfType;
 
-    HRESULT hr = _pD3DDevice->SetVertexShader(NewFvfType);
+    HRESULT hr = _d3d_device->SetVertexShader(NewFvfType);
 #ifndef NDEBUG
     if(FAILED(hr)) {
       dxgsg8_cat.error() << "SetVertexShader(0x" << (void*)NewFvfType<<") failed" << D3DERRORSTRING(hr);
@@ -216,7 +216,7 @@ INLINE void DXGraphicsStateGuardian8::
 enable_alpha_test(bool val) {
   if (_alpha_test_enabled != val) {
     _alpha_test_enabled = val;
-    _pD3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, (DWORD)val);
+    _d3d_device->SetRenderState(D3DRS_ALPHATESTENABLE, (DWORD)val);
   }
 }
 
@@ -229,7 +229,7 @@ INLINE void DXGraphicsStateGuardian8::
 enable_blend(bool val) {
   if (_blend_enabled != val) {
     _blend_enabled = val;
-    _pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, (DWORD)val);
+    _d3d_device->SetRenderState(D3DRS_ALPHABLENDENABLE, (DWORD)val);
   }
 }
 
@@ -242,7 +242,7 @@ INLINE void DXGraphicsStateGuardian8::
 call_dxLightModelAmbient(const Colorf &color) {
   if (_lmodel_ambient != color) {
     _lmodel_ambient = color;
-    _pD3DDevice->SetRenderState(D3DRS_AMBIENT, 
+    _d3d_device->SetRenderState(D3DRS_AMBIENT, 
                                  D3DCOLOR_COLORVALUE(color[0], color[1], color[2], color[3]));
   }
 }
@@ -256,12 +256,12 @@ INLINE void DXGraphicsStateGuardian8::
 call_dxAlphaFunc(D3DCMPFUNC func, float reference_alpha) {
   if (_alpha_func != func) {
     _alpha_func = func;
-    _pD3DDevice->SetRenderState(D3DRS_ALPHAFUNC, func);
+    _d3d_device->SetRenderState(D3DRS_ALPHAFUNC, func);
   }
 
   if(_alpha_func_refval != reference_alpha) {
     _alpha_func_refval = reference_alpha;
-    _pD3DDevice->SetRenderState(D3DRS_ALPHAREF, (UINT) (reference_alpha*255.0f));  //d3d uses 0x0-0xFF, not a float
+    _d3d_device->SetRenderState(D3DRS_ALPHAREF, (UINT) (reference_alpha*255.0f));  //d3d uses 0x0-0xFF, not a float
   }
 }
 
@@ -274,11 +274,11 @@ INLINE void DXGraphicsStateGuardian8::
 call_dxBlendFunc(D3DBLEND sfunc, D3DBLEND dfunc) {
   if (_blend_source_func != sfunc) {
     _blend_source_func = sfunc;
-    _pD3DDevice->SetRenderState(D3DRS_SRCBLEND, sfunc);
+    _d3d_device->SetRenderState(D3DRS_SRCBLEND, sfunc);
   }
   if (_blend_dest_func != dfunc) {
     _blend_dest_func = dfunc;
-    _pD3DDevice->SetRenderState(D3DRS_DESTBLEND, dfunc);
+    _d3d_device->SetRenderState(D3DRS_DESTBLEND, dfunc);
   }
 }
 
@@ -292,7 +292,7 @@ enable_dither(bool val) {
   if (_dither_enabled != val) {
     _dither_enabled = val;
 
-    _pD3DDevice->SetRenderState(D3DRS_DITHERENABLE, (DWORD)val);
+    _d3d_device->SetRenderState(D3DRS_DITHERENABLE, (DWORD)val);
   }
 }
 

File diff suppressed because it is too large
+ 159 - 159
panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx


+ 8 - 8
panda/src/dxgsg8/dxGraphicsStateGuardian8.h

@@ -168,7 +168,7 @@ protected:
   void set_texture_blend_mode(int i, const TextureStage *stage);
 
   void dx_cleanup();
-  HRESULT reset_d3d_device(D3DPRESENT_PARAMETERS *pPresParams, 
+  HRESULT reset_d3d_device(D3DPRESENT_PARAMETERS *p_presentation_params, 
                            DXScreenData **pScrn = NULL);
 
   bool check_cooperative_level();
@@ -184,12 +184,12 @@ protected:
   static D3DTEXTUREOP get_tex_color_op1(TextureStage::Mode mode);
 
 protected:
-  DXScreenData *_pScrn;
-  LPDIRECT3DDEVICE8 _pD3DDevice;  // same as pScrn->_pD3DDevice, cached for spd
-  IDirect3DSwapChain8 *_pSwapChain;
-  D3DPRESENT_PARAMETERS _PresReset;  // This is built during reset device
+  DXScreenData *_screen;
+  LPDIRECT3DDEVICE8 _d3d_device;  // same as pScrn->_d3d_device, cached for spd
+  IDirect3DSwapChain8 *_swap_chain;
+  D3DPRESENT_PARAMETERS _presentation_reset;  // This is built during reset device
 
-  bool _bDXisReady;
+  bool _dx_is_ready;
   HRESULT _last_testcooplevel_result;
 
   bool _transform_stale;
@@ -198,7 +198,7 @@ protected:
   RenderBuffer::Type _cur_read_pixel_buffer;  // source for copy_pixel_buffer operation
   bool _auto_rescale_normal;
 
-  DWORD _CurFVFType;
+  DWORD _cur_fvf_type;
 
   D3DCOLOR _d3dcolor_clear_value;
   UINT _color_writemask;
@@ -215,7 +215,7 @@ protected:
     PerVertexFog=D3DRS_FOGVERTEXMODE,
     PerPixelFog=D3DRS_FOGTABLEMODE
   };
-  DxgsgFogType _doFogType;
+  DxgsgFogType _do_fog_type;
   bool _fog_enabled;
 
   float _alpha_func_refval;  // d3d stores UINT, panda stores this as float.  we store float

+ 1 - 1
panda/src/dxgsg8/dxIndexBufferContext8.cxx

@@ -71,7 +71,7 @@ create_ibuffer(DXScreenData &scrn) {
   D3DFORMAT index_type = 
     DXGraphicsStateGuardian8::get_index_type(get_data()->get_index_type());
 
-  HRESULT hr = scrn.pD3DDevice->CreateIndexBuffer
+  HRESULT hr = scrn._d3d_device->CreateIndexBuffer
     (get_data()->get_data_size_bytes(), D3DUSAGE_WRITEONLY,
      index_type, D3DPOOL_MANAGED, &_ibuffer);
   if (FAILED(hr)) {

+ 2 - 2
panda/src/dxgsg8/dxInput8.cxx

@@ -102,7 +102,7 @@ bool DInput8Info::InitDirectInput(void) {
     return true;
 }
 
-bool DInput8Info::CreateJoystickOrPad(HWND hWnd) {
+bool DInput8Info::CreateJoystickOrPad(HWND _window) {
     bool bFoundDev = false;
     UINT devnum=0;
     char *errstr=NULL;
@@ -156,7 +156,7 @@ bool DInput8Info::CreateJoystickOrPad(HWND hWnd) {
 
     // Set the cooperative level to let DInput know how this device should
     // interact with the system and with other DInput applications.
-    hr = pJoyDevice->SetCooperativeLevel( hWnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND);
+    hr = pJoyDevice->SetCooperativeLevel( _window, DISCL_EXCLUSIVE | DISCL_FOREGROUND);
     if(FAILED(hr)) {
         errstr="SetCooperativeLevel";
         goto handle_error;

+ 1 - 1
panda/src/dxgsg8/dxInput8.h

@@ -29,7 +29,7 @@ public:
  DInput8Info(void);
  ~DInput8Info(void);
  bool InitDirectInput(void);
- bool CreateJoystickOrPad(HWND hWnd);
+ bool CreateJoystickOrPad(HWND _window);
  bool ReadJoystick(int devnum, DIJOYSTATE2 &js);
 
  HINSTANCE _hDInputDLL;

+ 240 - 236
panda/src/dxgsg8/dxTextureContext8.cxx

@@ -75,9 +75,9 @@ DXTextureContext8::
 IDirect3DTexture8 *DXTextureContext8::
 create_texture(DXScreenData &scrn) {
   HRESULT hr;
-  int cNumAlphaBits;     //  number of alpha bits in texture pixfmt
-  D3DFORMAT TargetPixFmt = D3DFMT_UNKNOWN;
-  bool bNeedLuminance = false;
+  int num_alpha_bits;     //  number of alpha bits in texture pixfmt
+  D3DFORMAT target_pixel_format = D3DFMT_UNKNOWN;
+  bool needs_luminance = false;
 
   nassertr(IS_VALID_PTR(_texture), NULL);
 
@@ -86,22 +86,22 @@ create_texture(DXScreenData &scrn) {
   clear_dirty_flags(Texture::DF_image | Texture::DF_mipmap);
 
   // bpp indicates requested fmt, not texture fmt
-  DWORD target_bpp = get_bits_per_pixel(_texture->get_format(), &cNumAlphaBits);
-  DWORD cNumColorChannels = _texture->get_num_components();
+  DWORD target_bpp = get_bits_per_pixel(_texture->get_format(), &num_alpha_bits);
+  DWORD num_color_channels = _texture->get_num_components();
 
-  //PRINT_REFCNT(dxgsg8, scrn.pD3D8);
+  //PRINT_REFCNT(dxgsg8, scrn._d3d8);
 
-  DWORD dwOrigWidth = (DWORD)_texture->get_x_size();
-  DWORD dwOrigHeight = (DWORD)_texture->get_y_size();
+  DWORD orig_width = (DWORD)_texture->get_x_size();
+  DWORD orig_height = (DWORD)_texture->get_y_size();
 
   if ((_texture->get_format() == Texture::F_luminance_alpha)||
-     (_texture->get_format() == Texture::F_luminance_alphamask) ||
-     (_texture->get_format() == Texture::F_luminance)) {
-    bNeedLuminance = true;
+      (_texture->get_format() == Texture::F_luminance_alphamask) ||
+      (_texture->get_format() == Texture::F_luminance)) {
+    needs_luminance = true;
   }
 
-  if (cNumAlphaBits > 0) {
-    if (cNumColorChannels == 3) {
+  if (num_alpha_bits > 0) {
+    if (num_color_channels == 3) {
       dxgsg8_cat.error()
         << "texture " << _tex->get_name() 
         << " has no inherent alpha channel, but alpha format is requested!\n";
@@ -112,16 +112,16 @@ create_texture(DXScreenData &scrn) {
 
   // figure out what 'D3DFMT' the Texture is in, so D3DXLoadSurfFromMem knows how to perform copy
 
-  switch (cNumColorChannels) {
+  switch (num_color_channels) {
   case 1:
-    if (cNumAlphaBits > 0) {
+    if (num_alpha_bits > 0) {
       _d3d_format = D3DFMT_A8;
-    } else if (bNeedLuminance) {
+    } else if (needs_luminance) {
       _d3d_format = D3DFMT_L8;
     }
     break;
   case 2:
-    assert(bNeedLuminance && (cNumAlphaBits > 0));
+    assert(needs_luminance && (num_alpha_bits > 0));
     _d3d_format = D3DFMT_A8L8;
     break;
   case 3:
@@ -135,89 +135,90 @@ create_texture(DXScreenData &scrn) {
   // make sure we handled all the possible cases
   assert(_d3d_format != D3DFMT_UNKNOWN);
 
-  DWORD TargetWidth = dwOrigWidth;
-  DWORD TargetHeight = dwOrigHeight;
+  DWORD target_width = orig_width;
+  DWORD target_height = orig_height;
 
-  if (scrn.d3dcaps.TextureCaps & D3DPTEXTURECAPS_POW2) {
-    if (!ISPOW2(TargetWidth)) {
-      TargetWidth = down_to_power_2(TargetWidth);
+  if (scrn._d3dcaps.TextureCaps & D3DPTEXTURECAPS_POW2) {
+    if (!ISPOW2(target_width)) {
+      target_width = down_to_power_2(target_width);
     }
-    if (!ISPOW2(TargetHeight)) {
-      TargetHeight = down_to_power_2(TargetHeight);
+    if (!ISPOW2(target_height)) {
+      target_height = down_to_power_2(target_height);
     }
   }
 
-  if (TargetWidth > scrn.d3dcaps.MaxTextureWidth) {
-    TargetWidth = scrn.d3dcaps.MaxTextureWidth;
+  if (target_width > scrn._d3dcaps.MaxTextureWidth) {
+    target_width = scrn._d3dcaps.MaxTextureWidth;
   }
-  if (TargetHeight > scrn.d3dcaps.MaxTextureHeight) {
-    TargetHeight = scrn.d3dcaps.MaxTextureHeight;
+  if (target_height > scrn._d3dcaps.MaxTextureHeight) {
+    target_height = scrn._d3dcaps.MaxTextureHeight;
   }
 
   // checks for SQUARE reqmt (nvidia riva128 needs this)
-  if ((TargetWidth != TargetHeight) && (scrn.d3dcaps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)) {
+  if ((target_width != target_height) && (scrn._d3dcaps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)) {
     // assume pow2 textures.   sum exponents, divide by 2 rounding down to get sq size
     int i, width_exp, height_exp;
-    for (i = TargetWidth, width_exp = 0; i > 1; width_exp++, i >>= 1);
-    for (i = TargetHeight, height_exp = 0; i > 1; height_exp++, i >>= 1);
-    TargetHeight = TargetWidth = 1<<((width_exp+height_exp)>>1);
+    for (i = target_width, width_exp = 0; i > 1; width_exp++, i >>= 1);
+    for (i = target_height, height_exp = 0; i > 1; height_exp++, i >>= 1);
+    target_height = target_width = 1<<((width_exp+height_exp)>>1);
   }
 
-  bool bShrinkOriginal = false;
+  bool shrink_original = false;
 
-  if (dwOrigWidth != TargetWidth || dwOrigHeight != TargetHeight) {
+  if (orig_width != target_width || orig_height != target_height) {
     dxgsg8_cat.info()
       << "Reducing size of " << _tex->get_name()
-      << " from " << dwOrigWidth << "x" << dwOrigHeight
-      << " to " << TargetWidth << "x" << TargetHeight << "\n";
+      << " from " << orig_width << "x" << orig_height
+      << " to " << target_width << "x" << target_height << "\n";
 
-    bShrinkOriginal = true;
+    shrink_original = true;
   }
 
-  char *szErrorMsg;
+  const char *error_message;
 
-  szErrorMsg = "create_texture failed: couldn't find compatible device Texture Pixel Format for input texture";
+  error_message = "create_texture failed: couldn't find compatible device Texture Pixel Format for input texture";
 
-  if (dxgsg8_cat.is_spam())
+  if (dxgsg8_cat.is_spam()) {
     dxgsg8_cat.spam()
       << "create_texture handling target bitdepth: " << target_bpp
-      << " alphabits: " << cNumAlphaBits << endl;
+      << " alphabits: " << num_alpha_bits << endl;
+  }
 
   // I could possibly replace some of this logic with
-  // D3DXCheckTextureRequirements(), but it wouldnt handle all my
+  // D3DXCheckTextureRequirements(), but it wouldn't handle all my
   // specialized low-memory cases perfectly
 
 #define CONVTYPE_STMT
 
 #define CHECK_FOR_FMT(FMT, CONV)  \
-                    if (scrn.SupportedTexFmtsMask & FMT##_FLAG) {   \
+                    if (scrn._supported_tex_formats_mask & FMT##_FLAG) {   \
                         CONVTYPE_STMT;                             \
-                        TargetPixFmt = D3DFMT_##FMT;                 \
+                        target_pixel_format = D3DFMT_##FMT;                 \
                         goto found_matching_format; }
 
   // handle each target bitdepth separately.  might be less confusing
-  // to reorg by cNumColorChannels (input type, rather than desired
+  // to reorg by num_color_channels (input type, rather than desired
   // 1st target)
   switch (target_bpp) {
 
     // IMPORTANT NOTE:
     // target_bpp is REQUESTED bpp, not what exists in the texture
-    // array (the texture array contains cNumColorChannels*8bits)
+    // array (the texture array contains num_color_channels*8bits)
 
   case 32:
-    if (!((cNumColorChannels == 3) || (cNumColorChannels == 4)))
+    if (!((num_color_channels == 3) || (num_color_channels == 4)))
       break; //bail
 
     if (!dx_force_16bpptextures) {
-      if (cNumColorChannels == 4) {
+      if (num_color_channels == 4) {
         CHECK_FOR_FMT(A8R8G8B8, Conv32to32);
       } else {
         CHECK_FOR_FMT(A8R8G8B8, Conv24to32);
       }
     }
 
-    if (cNumAlphaBits>0) {
-      assert(cNumColorChannels == 4);
+    if (num_alpha_bits>0) {
+      assert(num_color_channels == 4);
 
       // no 32-bit fmt, look for 16 bit w/alpha  (1-15)
 
@@ -234,7 +235,7 @@ create_texture(DXScreenData &scrn) {
       // 32->16 conversion.  This should be true on most cards.
 
 #ifndef FORCE_16bpp_1555
-      if (cNumAlphaBits == 1)
+      if (num_alpha_bits == 1)
 #endif
         {
           CHECK_FOR_FMT(A1R5G5B5, Conv32to16_1555);
@@ -246,11 +247,11 @@ create_texture(DXScreenData &scrn) {
 
       // At this point, bail.  Don't worry about converting to
       // non-alpha formats yet, I think this will be a very rare case.
-      szErrorMsg = "create_texture failed: couldn't find compatible Tex DDPIXELFORMAT! no available 16 or 32-bit alpha formats!";
+      error_message = "create_texture failed: couldn't find compatible Tex DDPIXELFORMAT! no available 16 or 32-bit alpha formats!";
     } else {
       // convert 3 or 4 channel to closest 16bpp color fmt
 
-      if (cNumColorChannels == 3) {
+      if (num_color_channels == 3) {
         CHECK_FOR_FMT(R5G6B5, Conv24to16_4444);
         CHECK_FOR_FMT(X1R5G5B5, Conv24to16_X555);
       } else {
@@ -261,7 +262,7 @@ create_texture(DXScreenData &scrn) {
     break;
 
   case 24:
-    assert(cNumColorChannels == 3);
+    assert(num_color_channels == 3);
 
     if (!dx_force_16bpptextures) {
       CHECK_FOR_FMT(R8G8B8, Conv24to24);
@@ -279,9 +280,9 @@ create_texture(DXScreenData &scrn) {
     break;
 
   case 16:
-    if (bNeedLuminance) {
-      assert(cNumAlphaBits>0);
-      assert(cNumColorChannels == 2);
+    if (needs_luminance) {
+      assert(num_alpha_bits>0);
+      assert(num_color_channels == 2);
 
       CHECK_FOR_FMT(A8L8, ConvLum16to16);
 
@@ -290,7 +291,7 @@ create_texture(DXScreenData &scrn) {
       }
 
 #ifndef FORCE_16bpp_1555
-      if (cNumAlphaBits == 1)
+      if (num_alpha_bits == 1)
 #endif
         {
           CHECK_FOR_FMT(A1R5G5B5, ConvLum16to16_1555);
@@ -300,16 +301,16 @@ create_texture(DXScreenData &scrn) {
       CHECK_FOR_FMT(A4R4G4B4, ConvLum16to16_4444);
       CHECK_FOR_FMT(A1R5G5B5, ConvLum16to16_1555);
     } else {
-      assert((cNumColorChannels == 3)||(cNumColorChannels == 4));
+      assert((num_color_channels == 3)||(num_color_channels == 4));
       // look for compatible 16bit fmts, if none then give up
       // (dont worry about other bitdepths for 16 bit)
-      switch(cNumAlphaBits) {
+      switch(num_alpha_bits) {
       case 0:
-        if (cNumColorChannels == 3) {
+        if (num_color_channels == 3) {
           CHECK_FOR_FMT(R5G6B5, Conv24to16_0565);
           CHECK_FOR_FMT(X1R5G5B5, Conv24to16_X555);
         } else {
-          assert(cNumColorChannels == 4);
+          assert(num_color_channels == 4);
           // it could be 4 if user asks us to throw away the alpha channel
           CHECK_FOR_FMT(R5G6B5, Conv32to16_0565);
           CHECK_FOR_FMT(X1R5G5B5, Conv32to16_X555);
@@ -320,23 +321,23 @@ create_texture(DXScreenData &scrn) {
         // explicitly want 1-5-5-5 fmt, as opposed to F_rgbm, which
         // could use 32bpp ARGB.  fail if this particular fmt not
         // avail.
-        assert(cNumColorChannels == 4);
+        assert(num_color_channels == 4);
         CHECK_FOR_FMT(X1R5G5B5, Conv32to16_X555);
         break;
       case 4:
         // app specifically requests 4-4-4-4 F_rgba4 case, as opposed
         // to F_rgba, which could use 32bpp ARGB
-        assert(cNumColorChannels == 4);
+        assert(num_color_channels == 4);
         CHECK_FOR_FMT(A4R4G4B4, Conv32to16_4444);
         break;
       default: assert(0);  // problem in get_bits_per_pixel()?
       }
     }
   case 8:
-    if (bNeedLuminance) {
+    if (needs_luminance) {
       // dont bother handling those other 8bit lum fmts like 4-4,
       // since 16 8-8 is usually supported too
-      assert(cNumColorChannels == 1);
+      assert(num_color_channels == 1);
 
       // look for native lum fmt first
       CHECK_FOR_FMT(L8, ConvLum8to8);
@@ -350,7 +351,7 @@ create_texture(DXScreenData &scrn) {
       CHECK_FOR_FMT(R5G6B5, ConvLum8to16_0565);
       CHECK_FOR_FMT(X1R5G5B5, ConvLum8to16_X555);
 
-    } else if (cNumAlphaBits == 8) {
+    } else if (num_alpha_bits == 8) {
       // look for 16bpp A8L8, else 32-bit ARGB, else 16-4444.
 
       // skip 8bit alpha only (D3DFMT_A8), because I think only voodoo
@@ -369,15 +370,15 @@ create_texture(DXScreenData &scrn) {
     break;
 
   default:
-    szErrorMsg = "create_texture failed: unhandled pixel bitdepth in DX loader";
+    error_message = "create_texture failed: unhandled pixel bitdepth in DX loader";
   }
 
   // if we've gotten here, haven't found a match
   dxgsg8_cat.error()
-    << szErrorMsg << ": " << _tex->get_name() << endl
-    << "NumColorChannels: " <<cNumColorChannels << "; NumAlphaBits: " << cNumAlphaBits
-    << "; targetbpp: " <<target_bpp << "; SupportedTexFmtsMask: 0x" << (void*)scrn.SupportedTexFmtsMask
-    << "; NeedLuminance: " << bNeedLuminance << endl;
+    << error_message << ": " << _tex->get_name() << endl
+    << "NumColorChannels: " <<num_color_channels << "; NumAlphaBits: " << num_alpha_bits
+    << "; targetbpp: " <<target_bpp << "; _supported_tex_formats_mask: 0x" << (void*)scrn._supported_tex_formats_mask
+    << "; NeedLuminance: " << needs_luminance << endl;
   goto error_exit;
 
   ///////////////////////////////////////////////////////////
@@ -389,29 +390,29 @@ create_texture(DXScreenData &scrn) {
     // Instead of creating a texture with the found format, we will
     // need to make one that exactly matches the framebuffer's
     // format.  Look up what that format is.
-    IDirect3DSurface8 *pCurRenderTarget;
-    hr = scrn.pD3DDevice->GetRenderTarget(&pCurRenderTarget);
+    IDirect3DSurface8 *render_target;
+    hr = scrn._d3d_device->GetRenderTarget(&render_target);
     if (FAILED(hr)) {
       dxgsg8_cat.error()
         << "GetRenderTgt failed in create_texture: " << D3DERRORSTRING(hr);
     } else {
-      D3DSURFACE_DESC SurfDesc;
-      hr = pCurRenderTarget->GetDesc(&SurfDesc);
+      D3DSURFACE_DESC surface_desc;
+      hr = render_target->GetDesc(&surface_desc);
       if (FAILED(hr)) {
         dxgsg8_cat.error()
           << "GetDesc failed in create_texture: " << D3DERRORSTRING(hr);
       } else {
-        if (TargetPixFmt != SurfDesc.Format) {
+        if (target_pixel_format != surface_desc.Format) {
           if (dxgsg8_cat.is_debug()) {
             dxgsg8_cat.debug()
-              << "Chose format " << D3DFormatStr(SurfDesc.Format)
-              << " instead of " << D3DFormatStr(TargetPixFmt)
+              << "Chose format " << D3DFormatStr(surface_desc.Format)
+              << " instead of " << D3DFormatStr(target_pixel_format)
               << " for texture to match framebuffer.\n";
           }
-          TargetPixFmt = SurfDesc.Format;
+          target_pixel_format = surface_desc.Format;
         }
       }
-      SAFE_RELEASE(pCurRenderTarget);
+      SAFE_RELEASE(render_target);
     }
   }
 
@@ -423,12 +424,14 @@ create_texture(DXScreenData &scrn) {
   ft = _tex->get_magfilter();
   if ((ft != Texture::FT_linear) && ft != Texture::FT_nearest) {
     // mipmap settings make no sense for magfilter
-    if (ft == Texture::FT_nearest_mipmap_nearest)
+    if (ft == Texture::FT_nearest_mipmap_nearest) {
       ft = Texture::FT_nearest;
-    else ft = Texture::FT_linear;
+    } else {
+      ft = Texture::FT_linear;
+    }
   }
 
-  if ((ft == Texture::FT_linear) && !(scrn.d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFLINEAR)) {
+  if ((ft == Texture::FT_linear) && !(scrn._d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFLINEAR)) {
     ft = Texture::FT_nearest;
   }
   _tex->set_magfilter(ft);
@@ -466,15 +469,15 @@ create_texture(DXScreenData &scrn) {
     ft = Texture::FT_linear;
   }
 
-  assert((scrn.d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFPOINT) != 0);
+  assert((scrn._d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFPOINT) != 0);
 
 #define TRILINEAR_MIPMAP_TEXFILTERCAPS (D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MINFLINEAR)
 
   // do any other filter type degradations necessary
   switch(ft) {
   case Texture::FT_linear_mipmap_linear:
-    if ((scrn.d3dcaps.TextureFilterCaps & TRILINEAR_MIPMAP_TEXFILTERCAPS) != TRILINEAR_MIPMAP_TEXFILTERCAPS) {
-      if (scrn.d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR) {
+    if ((scrn._d3dcaps.TextureFilterCaps & TRILINEAR_MIPMAP_TEXFILTERCAPS) != TRILINEAR_MIPMAP_TEXFILTERCAPS) {
+      if (scrn._d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR) {
         ft = Texture::FT_linear_mipmap_nearest;
       } else {
         // if you cant do linear in a level, you probably cant do
@@ -486,21 +489,21 @@ create_texture(DXScreenData &scrn) {
 
   case Texture::FT_nearest_mipmap_linear:
     // if we dont have bilinear, do nearest_nearest
-    if (!((scrn.d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MIPFPOINT) &&
-          (scrn.d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR))) {
+    if (!((scrn._d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MIPFPOINT) &&
+          (scrn._d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR))) {
       ft = Texture::FT_nearest_mipmap_nearest;
     }
     break;
 
   case Texture::FT_linear_mipmap_nearest:
     // if we dont have mip linear, do nearest_nearest
-    if (!(scrn.d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MIPFLINEAR)) {
+    if (!(scrn._d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MIPFLINEAR)) {
       ft = Texture::FT_nearest_mipmap_nearest;
     }
     break;
 
   case Texture::FT_linear:
-    if (!(scrn.d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR)) {
+    if (!(scrn._d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR)) {
       ft = Texture::FT_nearest;
     }
     break;
@@ -511,11 +514,11 @@ create_texture(DXScreenData &scrn) {
   uint aniso_degree;
 
   aniso_degree = 1;
-  if (scrn.d3dcaps.RasterCaps & D3DPRASTERCAPS_ANISOTROPY) {
+  if (scrn._d3dcaps.RasterCaps & D3DPRASTERCAPS_ANISOTROPY) {
     aniso_degree = _tex->get_anisotropic_degree();
-    if ((aniso_degree>scrn.d3dcaps.MaxAnisotropy) || 
+    if ((aniso_degree>scrn._d3dcaps.MaxAnisotropy) || 
         dx_force_anisotropic_filtering) {
-      aniso_degree = scrn.d3dcaps.MaxAnisotropy;
+      aniso_degree = scrn._d3dcaps.MaxAnisotropy;
     }
   }
   _tex->set_anisotropic_degree(aniso_degree);
@@ -526,11 +529,11 @@ create_texture(DXScreenData &scrn) {
     << " to: " << aniso_degree << endl;
 #endif
 
-  UINT cMipLevelCount;
+  UINT mip_level_count;
 
   if (_has_mipmaps) {
     // tell CreateTex to alloc space for all mip levels down to 1x1
-    cMipLevelCount = 0;
+    mip_level_count = 0;
 
     if (dxgsg8_cat.is_debug()) {
       dxgsg8_cat.debug()
@@ -538,11 +541,11 @@ create_texture(DXScreenData &scrn) {
         << endl;
     }
   } else {
-    cMipLevelCount = 1;
+    mip_level_count = 1;
   }
 
-  hr = scrn.pD3DDevice->CreateTexture(TargetWidth, TargetHeight, cMipLevelCount, 0x0,
-                                      TargetPixFmt, D3DPOOL_MANAGED, &_d3d_texture);
+  hr = scrn._d3d_device->CreateTexture(target_width, target_height, mip_level_count, 0x0,
+                                       target_pixel_format, D3DPOOL_MANAGED, &_d3d_texture);
   if (FAILED(hr)) {
     dxgsg8_cat.error()
       << "D3D create_texture failed!" << D3DERRORSTRING(hr);
@@ -553,7 +556,7 @@ create_texture(DXScreenData &scrn) {
     dxgsg8_cat.debug()
       << "create_texture: " << _tex->get_name()
       << " converting panda equivalent of " << D3DFormatStr(_d3d_format)
-      << " => " << D3DFormatStr(TargetPixFmt) << endl;
+      << " => " << D3DFormatStr(target_pixel_format) << endl;
   }
 
   hr = fill_d3d_texture_pixels();
@@ -561,7 +564,7 @@ create_texture(DXScreenData &scrn) {
     goto error_exit;
   }
 
-  // PRINT_REFCNT(dxgsg8, scrn.pD3D8);
+  // PRINT_REFCNT(dxgsg8, scrn._d3d8);
 
   // Return the newly created texture
   return _d3d_texture;
@@ -603,103 +606,104 @@ d3d_surface_to_texture(RECT &source_rect, IDirect3DSurface8 *d3d_surface, Textur
   // arbitrary fmt to ARGB in-memory user buffer
 
   HRESULT hr;
-  DWORD dwNumComponents = result->get_num_components();
+  DWORD num_components = result->get_num_components();
 
   nassertr(result->get_component_width() == sizeof(BYTE), E_FAIL);   // cant handle anything else now
   nassertr(result->get_component_type() == Texture::T_unsigned_byte, E_FAIL);   // cant handle anything else now
-  nassertr((dwNumComponents == 3) || (dwNumComponents == 4), E_FAIL);  // cant handle anything else now
+  nassertr((num_components == 3) || (num_components == 4), E_FAIL);  // cant handle anything else now
   nassertr(IS_VALID_PTR(d3d_surface), E_FAIL);
 
-  BYTE *pbuf = result->modify_ram_image().p();
+  BYTE *buf = result->modify_ram_image().p();
 
   if (IsBadWritePtr(d3d_surface, sizeof(DWORD))) {
     dxgsg8_cat.error() << "d3d_surface_to_texture failed: bad pD3DSurf ptr value (" << ((void*)d3d_surface) << ")\n";
     exit(1);
   }
 
-  DWORD dwXWindowOffset, dwYWindowOffset;
-  DWORD dwCopyWidth, dwCopyHeight;
+  DWORD x_window_offset, y_window_offset;
+  DWORD copy_width, copy_height;
 
-  D3DLOCKED_RECT LockedRect;
-  D3DSURFACE_DESC SurfDesc;
+  D3DLOCKED_RECT locked_rect;
+  D3DSURFACE_DESC surface_desc;
 
-  hr = d3d_surface->GetDesc(&SurfDesc);
+  hr = d3d_surface->GetDesc(&surface_desc);
 
-  dwXWindowOffset = source_rect.left, dwYWindowOffset = source_rect.top;
-  dwCopyWidth = RECT_XSIZE(source_rect);
-  dwCopyHeight = RECT_YSIZE(source_rect);
+  x_window_offset = source_rect.left, y_window_offset = source_rect.top;
+  copy_width = RECT_XSIZE(source_rect);
+  copy_height = RECT_YSIZE(source_rect);
 
-  //make sure there's enough space in the texture, its size must match (especially xsize)
-  // or scanlines will be too long
+  //make sure there's enough space in the texture, its size must match
+  //(especially xsize) or scanlines will be too long
 
-  if (!((dwCopyWidth == result->get_x_size()) && (dwCopyHeight <= (DWORD)result->get_y_size()))) {
+  if (!((copy_width == result->get_x_size()) && (copy_height <= (DWORD)result->get_y_size()))) {
     dxgsg8_cat.error() << "d3d_surface_to_texture, Texture size too small to hold display surface!\n";
     nassertr(false, E_FAIL);
     return E_FAIL;
   }
 
-  hr = d3d_surface->LockRect(&LockedRect, (CONST RECT*)NULL, (D3DLOCK_READONLY | D3DLOCK_NO_DIRTY_UPDATE /* | D3DLOCK_NOSYSLOCK */));
+  hr = d3d_surface->LockRect(&locked_rect, (CONST RECT*)NULL, (D3DLOCK_READONLY | D3DLOCK_NO_DIRTY_UPDATE /* | D3DLOCK_NOSYSLOCK */));
   if (FAILED(hr)) {
     dxgsg8_cat.error() << "d3d_surface_to_texture LockRect() failed!" << D3DERRORSTRING(hr);
     return hr;
   }
 
   // ones not listed not handled yet
-  nassertr((SurfDesc.Format == D3DFMT_A8R8G8B8) ||
-           (SurfDesc.Format == D3DFMT_X8R8G8B8) ||
-           (SurfDesc.Format == D3DFMT_R8G8B8) ||
-           (SurfDesc.Format == D3DFMT_R5G6B5) ||
-           (SurfDesc.Format == D3DFMT_X1R5G5B5) ||
-           (SurfDesc.Format == D3DFMT_A1R5G5B5) ||
-           (SurfDesc.Format == D3DFMT_A4R4G4B4), E_FAIL);
+  nassertr((surface_desc.Format == D3DFMT_A8R8G8B8) ||
+           (surface_desc.Format == D3DFMT_X8R8G8B8) ||
+           (surface_desc.Format == D3DFMT_R8G8B8) ||
+           (surface_desc.Format == D3DFMT_R5G6B5) ||
+           (surface_desc.Format == D3DFMT_X1R5G5B5) ||
+           (surface_desc.Format == D3DFMT_A1R5G5B5) ||
+           (surface_desc.Format == D3DFMT_A4R4G4B4), E_FAIL);
 
-  //pbuf contains raw ARGB in Texture byteorder
+  //buf contains raw ARGB in Texture byteorder
 
-  DWORD BytePitch = LockedRect.Pitch;
-  BYTE* pSurfBytes = (BYTE*)LockedRect.pBits;
+  DWORD byte_pitch = locked_rect.Pitch;
+  BYTE *surface_bytes = (BYTE *)locked_rect.pBits;
 
-  // writes out last line in DDSurf first in PixelBuf, so Y line order precedes inversely
+  // writes out last line in DDSurf first in PixelBuf, so Y line order
+  // precedes inversely
 
   if (dxgsg8_cat.is_debug()) {
     dxgsg8_cat.debug()
-      << "d3d_surface_to_texture converting " << D3DFormatStr(SurfDesc.Format) << "bpp DDSurf to "
-      <<  dwNumComponents << "-channel panda Texture\n";
+      << "d3d_surface_to_texture converting " << D3DFormatStr(surface_desc.Format) 
+      << "bpp DDSurf to " <<  num_components << "-channel panda Texture\n";
   }
 
-  DWORD *pDstWord = (DWORD *) pbuf;
-  BYTE *pDstByte = (BYTE *) pbuf;
+  DWORD *dest_word = (DWORD *)buf;
+  BYTE *dest_byte = (BYTE *)buf;
 
-  switch(SurfDesc.Format) {
+  switch(surface_desc.Format) {
   case D3DFMT_A8R8G8B8:
   case D3DFMT_X8R8G8B8: {
-    if (dwNumComponents == 4) {
-      DWORD *pSrcWord;
-      BYTE *pDstLine = (BYTE*)pDstWord;
-
-      pSurfBytes += BytePitch*(dwYWindowOffset+dwCopyHeight-1);
-      for(DWORD y = 0; y<dwCopyHeight; y++, pSurfBytes -= BytePitch) {
-        pSrcWord = ((DWORD*)pSurfBytes)+dwXWindowOffset;
-        memcpy(pDstLine, pSrcWord, BytePitch);
-        pDstLine += BytePitch;
+    if (num_components == 4) {
+      DWORD *source_word;
+      BYTE *dest_line = (BYTE*)dest_word;
+
+      surface_bytes += byte_pitch*(y_window_offset+copy_height-1);
+      for (DWORD y = 0; y<copy_height; y++, surface_bytes -= byte_pitch) {
+        source_word = ((DWORD*)surface_bytes)+x_window_offset;
+        memcpy(dest_line, source_word, byte_pitch);
+        dest_line += byte_pitch;
       }
     } else {
       // 24bpp texture case (numComponents == 3)
-      DWORD *pSrcWord;
-      pSurfBytes += BytePitch*(dwYWindowOffset+dwCopyHeight-1);
-      for(DWORD y = 0; y<dwCopyHeight; y++, pSurfBytes -= BytePitch) {
-        pSrcWord = ((DWORD*)pSurfBytes)+dwXWindowOffset;
+      DWORD *source_word;
+      surface_bytes += byte_pitch*(y_window_offset+copy_height-1);
+      for (DWORD y = 0; y<copy_height; y++, surface_bytes -= byte_pitch) {
+        source_word = ((DWORD*)surface_bytes)+x_window_offset;
 
-        for(DWORD x = 0; x<dwCopyWidth; x++, pSrcWord++) {
+        for (DWORD x = 0; x<copy_width; x++, source_word++) {
           BYTE r, g, b;
-          DWORD dwPixel = *pSrcWord;
+          DWORD pixel = *source_word;
 
-          r = (BYTE)((dwPixel>>16) & g_LowByteMask);
-          g = (BYTE)((dwPixel>> 8) & g_LowByteMask);
-          b = (BYTE)((dwPixel    ) & g_LowByteMask);
+          r = (BYTE)((pixel>>16) & g_LowByteMask);
+          g = (BYTE)((pixel>> 8) & g_LowByteMask);
+          b = (BYTE)((pixel    ) & g_LowByteMask);
 
-          *pDstByte += b;
-          *pDstByte += g;
-          *pDstByte += r;
+          *dest_byte += b;
+          *dest_byte += g;
+          *dest_byte += r;
         }
       }
     }
@@ -707,28 +711,28 @@ d3d_surface_to_texture(RECT &source_rect, IDirect3DSurface8 *d3d_surface, Textur
   }
 
   case D3DFMT_R8G8B8: {
-    BYTE *pSrcByte;
-    pSurfBytes += BytePitch*(dwYWindowOffset+dwCopyHeight-1);
+    BYTE *source_byte;
+    surface_bytes += byte_pitch*(y_window_offset+copy_height-1);
 
-    if (dwNumComponents == 4) {
-      for(DWORD y = 0; y<dwCopyHeight; y++, pSurfBytes -= BytePitch) {
-        pSrcByte = pSurfBytes+dwXWindowOffset*3*sizeof(BYTE);
-        for(DWORD x = 0; x<dwCopyWidth; x++, pDstWord++) {
+    if (num_components == 4) {
+      for (DWORD y = 0; y<copy_height; y++, surface_bytes -= byte_pitch) {
+        source_byte = surface_bytes+x_window_offset*3*sizeof(BYTE);
+        for (DWORD x = 0; x<copy_width; x++, dest_word++) {
           DWORD r, g, b;
 
-          b = *pSrcByte++;
-          g = *pSrcByte++;
-          r = *pSrcByte++;
+          b = *source_byte++;
+          g = *source_byte++;
+          r = *source_byte++;
 
-          *pDstWord = 0xFF000000 | (r << 16) | (g << 8) | b;
+          *dest_word = 0xFF000000 | (r << 16) | (g << 8) | b;
         }
       }
     } else {
       // 24bpp texture case (numComponents == 3)
-      for(DWORD y = 0; y<dwCopyHeight; y++, pSurfBytes -= BytePitch) {
-        pSrcByte = pSurfBytes+dwXWindowOffset*3*sizeof(BYTE);
-        memcpy(pDstByte, pSrcByte, BytePitch);
-        pDstByte += BytePitch;
+      for (DWORD y = 0; y<copy_height; y++, surface_bytes -= byte_pitch) {
+        source_byte = surface_bytes+x_window_offset*3*sizeof(BYTE);
+        memcpy(dest_byte, source_byte, byte_pitch);
+        dest_byte += byte_pitch;
       }
     }
     break;
@@ -738,20 +742,20 @@ d3d_surface_to_texture(RECT &source_rect, IDirect3DSurface8 *d3d_surface, Textur
   case D3DFMT_X1R5G5B5:
   case D3DFMT_A1R5G5B5:
   case D3DFMT_A4R4G4B4: {
-    WORD  *pSrcWord;
+    WORD  *source_word;
     // handle 0555, 1555, 0565, 4444 in same loop
 
     BYTE redshift, greenshift, blueshift;
     DWORD redmask, greenmask, bluemask;
 
-    if (SurfDesc.Format == D3DFMT_R5G6B5) {
+    if (surface_desc.Format == D3DFMT_R5G6B5) {
       redshift = (11-3);
       redmask = 0xF800;
       greenmask = 0x07E0;
       greenshift = (5-2);
       bluemask = 0x001F;
       blueshift = 3;
-    } else if (SurfDesc.Format == D3DFMT_A4R4G4B4) {
+    } else if (surface_desc.Format == D3DFMT_A4R4G4B4) {
       redmask = 0x0F00;
       redshift = 4;
       greenmask = 0x00F0;
@@ -767,44 +771,44 @@ d3d_surface_to_texture(RECT &source_rect, IDirect3DSurface8 *d3d_surface, Textur
       blueshift = 3;
     }
 
-    pSurfBytes += BytePitch*(dwYWindowOffset+dwCopyHeight-1);
-    if (dwNumComponents == 4) {
+    surface_bytes += byte_pitch*(y_window_offset+copy_height-1);
+    if (num_components == 4) {
       // Note: these 16bpp loops ignore input alpha completely (alpha
       // is set to fully opaque in texture!)
 
       // if we need to capture alpha, probably need to make separate
       // loops for diff 16bpp fmts for best speed
 
-      for(DWORD y = 0; y<dwCopyHeight; y++, pSurfBytes -= BytePitch) {
-        pSrcWord = ((WORD*)pSurfBytes)+dwXWindowOffset;
-        for(DWORD x = 0; x<dwCopyWidth; x++, pSrcWord++, pDstWord++) {
-          WORD dwPixel = *pSrcWord;
+      for (DWORD y = 0; y<copy_height; y++, surface_bytes -= byte_pitch) {
+        source_word = ((WORD*)surface_bytes)+x_window_offset;
+        for (DWORD x = 0; x<copy_width; x++, source_word++, dest_word++) {
+          WORD pixel = *source_word;
           BYTE r, g, b;
 
-          b = (dwPixel & bluemask) << blueshift;
-          g = (dwPixel & greenmask) >> greenshift;
-          r = (dwPixel & redmask) >> redshift;
+          b = (pixel & bluemask) << blueshift;
+          g = (pixel & greenmask) >> greenshift;
+          r = (pixel & redmask) >> redshift;
 
           // alpha is just set to 0xFF
 
-          *pDstWord = 0xFF000000 | (r << 16) | (g << 8) | b;
+          *dest_word = 0xFF000000 | (r << 16) | (g << 8) | b;
         }
       }
     } else {
       // 24bpp texture case (numComponents == 3)
-      for(DWORD y = 0; y<dwCopyHeight; y++, pSurfBytes -= BytePitch) {
-        pSrcWord = ((WORD*)pSurfBytes)+dwXWindowOffset;
-        for(DWORD x = 0; x<dwCopyWidth; x++, pSrcWord++) {
-          WORD dwPixel = *pSrcWord;
+      for (DWORD y = 0; y<copy_height; y++, surface_bytes -= byte_pitch) {
+        source_word = ((WORD*)surface_bytes)+x_window_offset;
+        for (DWORD x = 0; x<copy_width; x++, source_word++) {
+          WORD pixel = *source_word;
           BYTE r, g, b;
 
-          b = (dwPixel & bluemask) << blueshift;
-          g = (dwPixel & greenmask) >> greenshift;
-          r = (dwPixel & redmask) >> redshift;
+          b = (pixel & bluemask) << blueshift;
+          g = (pixel & greenmask) >> greenshift;
+          r = (pixel & redmask) >> redshift;
 
-          *pDstByte += b;
-          *pDstByte += g;
-          *pDstByte += r;
+          *dest_byte += b;
+          *dest_byte += g;
+          *dest_byte += r;
         }
       }
     }
@@ -841,62 +845,62 @@ fill_d3d_texture_pixels() {
 
   assert(IS_VALID_PTR(_d3d_texture));
 
-  DWORD OrigWidth  = (DWORD) _texture->get_x_size();
-  DWORD OrigHeight = (DWORD) _texture->get_y_size();
-  DWORD cNumColorChannels = _texture->get_num_components();
-  D3DFORMAT SrcFormat = _d3d_format;
-  BYTE *pPixels = (BYTE*)image.p();
+  DWORD orig_width  = (DWORD) _texture->get_x_size();
+  DWORD orig_height = (DWORD) _texture->get_y_size();
+  DWORD num_color_channels = _texture->get_num_components();
+  D3DFORMAT source_format = _d3d_format;
+  BYTE *pixels = (BYTE*)image.p();
   int component_width = _texture->get_component_width();
 
-  assert(IS_VALID_PTR(pPixels));
+  assert(IS_VALID_PTR(pixels));
 
-  IDirect3DSurface8 *pMipLevel0;
-  hr = _d3d_texture->GetSurfaceLevel(0, &pMipLevel0);
+  IDirect3DSurface8 *mip_level_0;
+  hr = _d3d_texture->GetSurfaceLevel(0, &mip_level_0);
   if (FAILED(hr)) {
     dxgsg8_cat.error() << "FillDDSurfaceTexturePixels failed for " << _tex->get_name() << ", GetSurfaceLevel failed" << D3DERRORSTRING(hr);
     return E_FAIL;
   }
 
-  RECT SrcSize;
-  SrcSize.left = SrcSize.top = 0;
-  SrcSize.right = OrigWidth;
-  SrcSize.bottom = OrigHeight;
+  RECT source_size;
+  source_size.left = source_size.top = 0;
+  source_size.right = orig_width;
+  source_size.bottom = orig_height;
 
-  UINT SrcPixBufRowByteLength = OrigWidth*cNumColorChannels;
+  UINT source_row_byte_length = orig_width * num_color_channels;
 
-  DWORD Lev0Filter, MipFilterFlags;
-  bool bUsingTempPixBuf = false;
+  DWORD level_0_filter, mip_filter_flags;
+  bool using_temp_buffer = false;
 
   // need filtering if size changes, (also if bitdepth reduced (need dithering)??)
-  Lev0Filter = D3DX_FILTER_LINEAR ; //| D3DX_FILTER_DITHER;  //dithering looks ugly on i810 for 4444 textures
+  level_0_filter = D3DX_FILTER_LINEAR ; //| D3DX_FILTER_DITHER;  //dithering looks ugly on i810 for 4444 textures
 
   // D3DXLoadSurfaceFromMemory will load black luminance and we want full white,
   // so convert to explicit luminance-alpha format
   if (_d3d_format == D3DFMT_A8) {
     // alloc buffer for explicit D3DFMT_A8L8
-    USHORT *pTempPixBuf = new USHORT[OrigWidth*OrigHeight];
-    if (!IS_VALID_PTR(pTempPixBuf)) {
+    USHORT *temp_buffer = new USHORT[orig_width*orig_height];
+    if (!IS_VALID_PTR(temp_buffer)) {
       dxgsg8_cat.error() << "FillDDSurfaceTexturePixels couldnt alloc mem for temp pixbuf!\n";
       goto exit_FillDDSurf;
     }
-    bUsingTempPixBuf = true;
+    using_temp_buffer = true;
 
-    USHORT *pOutPix = pTempPixBuf;
-    BYTE *pSrcPix = pPixels + component_width - 1;
-    for (UINT y = 0; y < OrigHeight; y++) {
+    USHORT *out_pixels = temp_buffer;
+    BYTE *source_pixels = pixels + component_width - 1;
+    for (UINT y = 0; y < orig_height; y++) {
       for (UINT x = 0;
-           x < OrigWidth;
-           x++, pSrcPix += component_width, pOutPix++) {
+           x < orig_width;
+           x++, source_pixels += component_width, out_pixels++) {
         // add full white, which is our interpretation of alpha-only
         // (similar to default adding full opaque alpha 0xFF to
         // RGB-only textures)
-        *pOutPix = ((*pSrcPix) << 8 ) | 0xFF;
+        *out_pixels = ((*source_pixels) << 8 ) | 0xFF;
       }
     }
 
-    SrcFormat = D3DFMT_A8L8;
-    SrcPixBufRowByteLength = OrigWidth*sizeof(USHORT);
-    pPixels = (BYTE*)pTempPixBuf;
+    source_format = D3DFMT_A8L8;
+    source_row_byte_length = orig_width*sizeof(USHORT);
+    pixels = (BYTE*)temp_buffer;
 
   } else if (component_width != 1) {
     // Convert from 16-bit per channel (or larger) format down to
@@ -905,29 +909,29 @@ fill_d3d_texture_pixels() {
     // anyway.
 
     int num_components = _texture->get_num_components();
-    int num_pixels = OrigWidth * OrigHeight * num_components;
-    BYTE *pTempPixBuf = new BYTE[num_pixels];
-    if (!IS_VALID_PTR(pTempPixBuf)) {
+    int num_pixels = orig_width * orig_height * num_components;
+    BYTE *temp_buffer = new BYTE[num_pixels];
+    if (!IS_VALID_PTR(temp_buffer)) {
       dxgsg8_cat.error() << "FillDDSurfaceTexturePixels couldnt alloc mem for temp pixbuf!\n";
       goto exit_FillDDSurf;
     }
-    bUsingTempPixBuf = true;
+    using_temp_buffer = true;
 
-    BYTE *pSrcPix = pPixels + component_width - 1;
+    BYTE *source_pixels = pixels + component_width - 1;
     for (int i = 0; i < num_pixels; i++) {
-      pTempPixBuf[i] = *pSrcPix;
-      pSrcPix += component_width;
+      temp_buffer[i] = *source_pixels;
+      source_pixels += component_width;
     }
-    pPixels = (BYTE*)pTempPixBuf;
+    pixels = (BYTE*)temp_buffer;
   }
 
 
   // filtering may be done here if texture if targetsize != origsize
 #ifdef DO_PSTATS
-  GraphicsStateGuardian::_data_transferred_pcollector.add_level(SrcPixBufRowByteLength * OrigHeight);
+  GraphicsStateGuardian::_data_transferred_pcollector.add_level(source_row_byte_length * orig_height);
 #endif
-  hr = D3DXLoadSurfaceFromMemory(pMipLevel0, (PALETTEENTRY*)NULL, (RECT*)NULL, (LPCVOID)pPixels, SrcFormat,
-                                 SrcPixBufRowByteLength, (PALETTEENTRY*)NULL, &SrcSize, Lev0Filter, (D3DCOLOR)0x0);
+  hr = D3DXLoadSurfaceFromMemory(mip_level_0, (PALETTEENTRY*)NULL, (RECT*)NULL, (LPCVOID)pixels, source_format,
+                                 source_row_byte_length, (PALETTEENTRY*)NULL, &source_size, level_0_filter, (D3DCOLOR)0x0);
   if (FAILED(hr)) {
     dxgsg8_cat.error() << "FillDDSurfaceTexturePixels failed for " << _tex->get_name() << ", D3DXLoadSurfFromMem failed" << D3DERRORSTRING(hr);
     goto exit_FillDDSurf;
@@ -935,14 +939,14 @@ fill_d3d_texture_pixels() {
 
   if (_has_mipmaps) {
     if (!dx_use_triangle_mipgen_filter) {
-      MipFilterFlags = D3DX_FILTER_BOX;
+      mip_filter_flags = D3DX_FILTER_BOX;
     } else {
-      MipFilterFlags = D3DX_FILTER_TRIANGLE;
+      mip_filter_flags = D3DX_FILTER_TRIANGLE;
     }
 
-    //    MipFilterFlags| = D3DX_FILTER_DITHER;
+    //    mip_filter_flags| = D3DX_FILTER_DITHER;
 
-    hr = D3DXFilterTexture(_d3d_texture, (PALETTEENTRY*)NULL, 0, MipFilterFlags);
+    hr = D3DXFilterTexture(_d3d_texture, (PALETTEENTRY*)NULL, 0, mip_filter_flags);
     if (FAILED(hr)) {
       dxgsg8_cat.error()
         << "FillDDSurfaceTexturePixels failed for " << _tex->get_name() << ", D3DXFilterTex failed" << D3DERRORSTRING(hr);
@@ -951,10 +955,10 @@ fill_d3d_texture_pixels() {
   }
 
  exit_FillDDSurf:
-  if (bUsingTempPixBuf) {
-    SAFE_DELETE_ARRAY(pPixels);
+  if (using_temp_buffer) {
+    SAFE_DELETE_ARRAY(pixels);
   }
-  RELEASE(pMipLevel0, dxgsg8, "FillDDSurf MipLev0 texture ptr", RELEASE_ONCE);
+  RELEASE(mip_level_0, dxgsg8, "FillDDSurf MipLev0 texture ptr", RELEASE_ONCE);
   return hr;
 }
 

+ 1 - 1
panda/src/dxgsg8/dxVertexBufferContext8.cxx

@@ -194,7 +194,7 @@ create_vbuffer(DXScreenData &scrn) {
     _vbuffer = NULL;
   }
 
-  HRESULT hr = scrn.pD3DDevice->CreateVertexBuffer
+  HRESULT hr = scrn._d3d_device->CreateVertexBuffer
     (get_data()->get_data_size_bytes(), D3DUSAGE_WRITEONLY,
      _fvf, D3DPOOL_MANAGED, &_vbuffer);
   if (FAILED(hr)) {

+ 20 - 20
panda/src/dxgsg8/dxgsg8base.h

@@ -186,26 +186,26 @@ typedef enum {
 #define RECT_YSIZE(REC) (REC.bottom-REC.top)
 
 struct DXScreenData {
-  LPDIRECT3DDEVICE8 pD3DDevice;
-  IDirect3DSwapChain8 *pSwapChain;
-  LPDIRECT3D8 pD3D8;  // copied from DXGraphicsPipe8 for convenience
-  HWND hWnd;
-  HMONITOR hMon;
-  DWORD MaxAvailVidMem;
-  ushort CardIDNum;  // adapter ID
-  ushort depth_buffer_bitdepth;  //GetSurfaceDesc is not reliable so must store this explicitly
-  bool bCanDirectDisableColorWrites;  // if true, dont need blending for this
-  bool bIsLowVidMemCard;
-  bool bIsTNLDevice;
-  bool bCanUseHWVertexShaders;
-  bool bCanUsePixelShaders;
-  bool bIsDX81;
-  UINT SupportedScreenDepthsMask;
-  UINT SupportedTexFmtsMask;
-  D3DCAPS8 d3dcaps;
-  D3DDISPLAYMODE DisplayMode;
-  D3DPRESENT_PARAMETERS PresParams;  // not redundant with DisplayMode since width/height must be 0 for windowed mode
-  D3DADAPTER_IDENTIFIER8 DXDeviceID;
+  LPDIRECT3DDEVICE8 _d3d_device;
+  IDirect3DSwapChain8 *_swap_chain;
+  LPDIRECT3D8 _d3d8;  // copied from DXGraphicsPipe8 for convenience
+  HWND _window;
+  HMONITOR _monitor;
+  DWORD _max_available_video_memory;
+  ushort _card_id;  // adapter ID
+  ushort _depth_buffer_bitdepth;  //GetSurfaceDesc is not reliable so must store this explicitly
+  bool _can_direct_disable_color_writes;  // if true, dont need blending for this
+  bool _is_low_memory_card;
+  bool _is_tnl_device;
+  bool _can_use_hw_vertex_shaders;
+  bool _can_use_pixel_shaders;
+  bool _is_dx8_1;
+  UINT _supported_screen_depths_mask;
+  UINT _supported_tex_formats_mask;
+  D3DCAPS8 _d3dcaps;
+  D3DDISPLAYMODE _display_mode;
+  D3DPRESENT_PARAMETERS _presentation_params;  // not redundant with _display_mode since width/height must be 0 for windowed mode
+  D3DADAPTER_IDENTIFIER8 _dx_device_id;
 };
 
 

+ 56 - 56
panda/src/dxgsg8/wdxGraphicsPipe8.cxx

@@ -36,7 +36,7 @@ wdxGraphicsPipe8::
 wdxGraphicsPipe8() {
   _hDDrawDLL = NULL;
   _hD3D8_DLL = NULL;
-  _pD3D8 = NULL;
+  __d3d8 = NULL;
   _is_valid = init();
 }
 
@@ -47,7 +47,7 @@ wdxGraphicsPipe8() {
 ////////////////////////////////////////////////////////////////////
 wdxGraphicsPipe8::
 ~wdxGraphicsPipe8() {
-  RELEASE(_pD3D8, wdxdisplay8, "ID3D8", RELEASE_DOWN_TO_ZERO);
+  RELEASE(__d3d8, wdxdisplay8, "ID3D8", RELEASE_DOWN_TO_ZERO);
   SAFE_FREELIB(_hD3D8_DLL);
   SAFE_FREELIB(_hDDrawDLL);
 }
@@ -143,15 +143,15 @@ init() {
   hFind = FindFirstFile (tmppath, &TempFindData);
   if (hFind != INVALID_HANDLE_VALUE) {
     FindClose(hFind);
-    _bIsDX81 = true;
-    _pD3D8 = (*_Direct3DCreate8)(D3D_SDK_VERSION_8_1);
+    __is_dx8_1 = true;
+    __d3d8 = (*_Direct3DCreate8)(D3D_SDK_VERSION_8_1);
   } else {
-    _bIsDX81 = false;
-    _pD3D8 = (*_Direct3DCreate8)(D3D_SDK_VERSION_8_0);
+    __is_dx8_1 = false;
+    __d3d8 = (*_Direct3DCreate8)(D3D_SDK_VERSION_8_0);
   }
 
-  if (_pD3D8 == NULL) {
-    wdxdisplay8_cat.error() << "Direct3DCreate8(8." << (_bIsDX81 ? "1" : "0") << ") failed!, error = " << GetLastError() << endl;
+  if (__d3d8 == NULL) {
+    wdxdisplay8_cat.error() << "Direct3DCreate8(8." << (__is_dx8_1 ? "1" : "0") << ") failed!, error = " << GetLastError() << endl;
     //release_gsg();
     goto error;
   }
@@ -284,8 +284,8 @@ find_all_card_memavails() {
 
     if (!dx_do_vidmemsize_check) {
       // still calling the DD stuff to get deviceID, etc.  is this necessary?
-      _card_ids[i].MaxAvailVidMem = UNKNOWN_VIDMEM_SIZE;
-      _card_ids[i].bIsLowVidMemCard = false;
+      _card_ids[i]._max_available_video_memory = UNKNOWN_VIDMEM_SIZE;
+      _card_ids[i]._is_low_memory_card = false;
       continue;
     }
 
@@ -303,11 +303,11 @@ find_all_card_memavails() {
       }
     }
 
-    // after SetDisplayMode, GetAvailVidMem totalmem seems to go down
+    // after Set_display_mode, GetAvailVidMem totalmem seems to go down
     // by 1.2 meg (contradicting above comment and what I think would
     // be correct behavior (shouldnt FS mode release the desktop
     // vidmem?), so this is the true value
-    _card_ids[i].MaxAvailVidMem = dwVidMemTotal;
+    _card_ids[i]._max_available_video_memory = dwVidMemTotal;
 
     // I can never get this stuff to work reliably, so I'm just
     // rounding up to nearest pow2.  Could try to get
@@ -321,7 +321,7 @@ find_all_card_memavails() {
       ((dwVidMemTotal > CRAPPY_DRIVER_IS_LYING_VIDMEMTHRESHOLD) &&
        (dwVidMemTotal< LOWVIDMEMTHRESHOLD));
 
-    _card_ids[i].bIsLowVidMemCard = bLowVidMemFlag;
+    _card_ids[i]._is_low_memory_card = bLowVidMemFlag;
     wdxdisplay8_cat.info()
       << "SetLowVidMem flag to " << bLowVidMemFlag
       << " based on adjusted VidMemTotal: " << dwVidMemTotal << endl;
@@ -343,17 +343,17 @@ dx7_driver_enum_callback(GUID *pGUID, TCHAR *strDesc, TCHAR *strName,
   ZeroMemory(&card_id, sizeof(CardID));
 
   if (hm == NULL) {
-    card_id.hMon = MonitorFromWindow(GetDesktopWindow(),
+    card_id._monitor = MonitorFromWindow(GetDesktopWindow(),
                                      MONITOR_DEFAULTTOPRIMARY);
   } else {
-    card_id.hMon = hm;
+    card_id._monitor = hm;
   }
 
   if (pGUID != NULL) {
     memcpy(&card_id.DX7_DeviceGUID, pGUID, sizeof(GUID));
   }
 
-  card_id.MaxAvailVidMem = UNKNOWN_VIDMEM_SIZE;
+  card_id._max_available_video_memory = UNKNOWN_VIDMEM_SIZE;
 
   self->_card_ids.push_back(card_id);
 
@@ -366,7 +366,7 @@ dx7_driver_enum_callback(GUID *pGUID, TCHAR *strDesc, TCHAR *strName,
 //  Description:
 ////////////////////////////////////////////////////////////////////
 bool wdxGraphicsPipe8::
-find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &TestDisplayMode,
+find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &Test_display_mode,
                        D3DFORMAT *pBestFmt, bool bWantStencil,
                        bool bForce16bpp, bool bVerboseMode) const {
   // list fmts in order of preference
@@ -374,14 +374,14 @@ find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &TestDisplayMode,
   static D3DFORMAT NoStencilPrefList[NUM_TEST_ZFMTS] = {D3DFMT_D32, D3DFMT_D24X8, D3DFMT_D16};
   static D3DFORMAT StencilPrefList[NUM_TEST_ZFMTS] = {D3DFMT_D24S8, D3DFMT_D24X4S4, D3DFMT_D15S1};
 
-  // do not use Display.DisplayMode since that is probably not set yet, use TestDisplayMode instead
+  // do not use Display._display_mode since that is probably not set yet, use Test_display_mode instead
 
   *pBestFmt = D3DFMT_UNKNOWN;
   HRESULT hr;
 
   // nvidia likes zbuf depth to match rendertarget depth
   bool bOnlySelect16bpp = (bForce16bpp ||
-                           (IS_NVIDIA(Display.DXDeviceID) && IS_16BPP_DISPLAY_FORMAT(TestDisplayMode.Format)));
+                           (IS_NVIDIA(Display._dx_device_id) && IS_16BPP_DISPLAY_FORMAT(Test_display_mode.Format)));
 
   if (bVerboseMode) {
     wdxdisplay8_cat.info()
@@ -396,9 +396,9 @@ find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &TestDisplayMode,
       continue;
     }
 
-    hr = Display.pD3D8->CheckDeviceFormat(Display.CardIDNum,
+    hr = Display._d3d8->CheckDeviceFormat(Display._card_id,
                                           D3DDEVTYPE_HAL,
-                                          TestDisplayMode.Format,
+                                          Test_display_mode.Format,
                                           D3DUSAGE_DEPTHSTENCIL,
                                           D3DRTYPE_SURFACE, TestDepthFmt);
 
@@ -417,10 +417,10 @@ find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &TestDisplayMode,
       exit(1);
     }
 
-    hr = Display.pD3D8->CheckDepthStencilMatch(Display.CardIDNum,
+    hr = Display._d3d8->CheckDepthStencilMatch(Display._card_id,
                                                D3DDEVTYPE_HAL,
-                                               TestDisplayMode.Format,   // adapter format
-                                               TestDisplayMode.Format,   // backbuffer fmt  (should be the same in my apps)
+                                               Test_display_mode.Format,   // adapter format
+                                               Test_display_mode.Format,   // backbuffer fmt  (should be the same in my apps)
                                                TestDepthFmt);
     if (SUCCEEDED(hr)) {
       *pBestFmt = TestDepthFmt;
@@ -430,13 +430,13 @@ find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &TestDisplayMode,
         if (bVerboseMode) {
           wdxdisplay8_cat.info()
             << "FindBestDepthFmt: ChkDepMatch returns NotAvail for "
-            << D3DFormatStr(TestDisplayMode.Format) << ", "
+            << D3DFormatStr(Test_display_mode.Format) << ", "
             << D3DFormatStr(TestDepthFmt) << endl;
         }
       } else {
         wdxdisplay8_cat.error()
           << "unexpected CheckDepthStencilMatch failure for "
-          << D3DFormatStr(TestDisplayMode.Format) << ", "
+          << D3DFormatStr(Test_display_mode.Format) << ", "
           << D3DFormatStr(TestDepthFmt) << endl;
         exit(1);
       }
@@ -460,8 +460,8 @@ find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &TestDisplayMode,
 ////////////////////////////////////////////////////////////////////
 bool wdxGraphicsPipe8::
 special_check_fullscreen_resolution(DXScreenData &scrn, UINT x_size, UINT y_size) {
-  DWORD VendorId = scrn.DXDeviceID.VendorId;
-  DWORD DeviceId = scrn.DXDeviceID.DeviceId;
+  DWORD VendorId = scrn._dx_device_id.VendorId;
+  DWORD DeviceId = scrn._dx_device_id.DeviceId;
 
   switch (VendorId) {
   case 0x8086:  // Intel
@@ -490,20 +490,20 @@ void wdxGraphicsPipe8::
 search_for_valid_displaymode(DXScreenData &scrn,
                              UINT RequestedX_Size, UINT RequestedY_Size,
                              bool bWantZBuffer, bool bWantStencil,
-                             UINT *pSupportedScreenDepthsMask,
+                             UINT *p_supported_screen_depths_mask,
                              bool *pCouldntFindAnyValidZBuf,
                              D3DFORMAT *pSuggestedPixFmt,
                              bool bForce16bppZBuffer,
                              bool bVerboseMode) {
 
-  assert(IS_VALID_PTR(scrn.pD3D8));
+  assert(IS_VALID_PTR(scrn._d3d8));
   HRESULT hr;
 
   *pSuggestedPixFmt = D3DFMT_UNKNOWN;
-  *pSupportedScreenDepthsMask = 0x0;
+  *p_supported_screen_depths_mask = 0x0;
   *pCouldntFindAnyValidZBuf = false;
 
-  int cNumModes = scrn.pD3D8->GetAdapterModeCount(scrn.CardIDNum);
+  int cNumModes = scrn._d3d8->GetAdapterModeCount(scrn._card_id);
   D3DDISPLAYMODE BestDispMode;
   ZeroMemory(&BestDispMode, sizeof(BestDispMode));
 
@@ -519,7 +519,7 @@ search_for_valid_displaymode(DXScreenData &scrn,
   // 640x480 32bpp?)
   bool bDoMemBasedChecks =
     ((!((RequestedX_Size == 640)&&(RequestedY_Size == 480))) &&
-     (scrn.MaxAvailVidMem != UNKNOWN_VIDMEM_SIZE) &&
+     (scrn._max_available_video_memory != UNKNOWN_VIDMEM_SIZE) &&
      (!special_check_fullscreen_resolution(scrn, RequestedX_Size, RequestedY_Size)));
 
   if (bVerboseMode || wdxdisplay8_cat.is_spam()) {
@@ -529,11 +529,11 @@ search_for_valid_displaymode(DXScreenData &scrn,
 
   for (int i = 0; i < cNumModes; i++) {
     D3DDISPLAYMODE dispmode;
-    hr = scrn.pD3D8->EnumAdapterModes(scrn.CardIDNum, i, &dispmode);
+    hr = scrn._d3d8->EnumAdapterModes(scrn._card_id, i, &dispmode);
     if (FAILED(hr)) {
       wdxdisplay8_cat.error()
-        << "EnumAdapterDisplayMode failed for device #"
-        << scrn.CardIDNum << D3DERRORSTRING(hr);
+        << "EnumAdapter_display_mode failed for device #"
+        << scrn._card_id << D3DERRORSTRING(hr);
       continue;
     }
 
@@ -563,7 +563,7 @@ search_for_valid_displaymode(DXScreenData &scrn,
     // requested size, so even if this call succeeds, could still get
     // an out-of-video-mem error
 
-    hr = scrn.pD3D8->CheckDeviceFormat(scrn.CardIDNum, D3DDEVTYPE_HAL, dispmode.Format,
+    hr = scrn._d3d8->CheckDeviceFormat(scrn._card_id, D3DDEVTYPE_HAL, dispmode.Format,
                                        D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE,
                                        dispmode.Format);
     if (FAILED(hr)) {
@@ -578,7 +578,7 @@ search_for_valid_displaymode(DXScreenData &scrn,
       } else {
         wdxdisplay8_cat.error()
           << "CheckDeviceFormat failed for device #"
-          << scrn.CardIDNum << D3DERRORSTRING(hr);
+          << scrn._card_id << D3DERRORSTRING(hr);
         continue;
       }
     }
@@ -611,15 +611,15 @@ search_for_valid_displaymode(DXScreenData &scrn,
           << "Testing Mode (" <<RequestedX_Size<<"x" << RequestedY_Size
           << ", " << D3DFormatStr(dispmode.Format) << ")\nReqdVidMem: "
           << (int)RendTgtMinMemReqmt << " AvailVidMem: "
-          << scrn.MaxAvailVidMem << endl;
+          << scrn._max_available_video_memory << endl;
 
-      if (RendTgtMinMemReqmt > scrn.MaxAvailVidMem) {
+      if (RendTgtMinMemReqmt > scrn._max_available_video_memory) {
         if (bVerboseMode || wdxdisplay8_cat.is_debug())
           wdxdisplay8_cat.info()
             << "not enough VidMem for render tgt, skipping display fmt "
             << D3DFormatStr(dispmode.Format) << " ("
             << (int)RendTgtMinMemReqmt << " > "
-            << scrn.MaxAvailVidMem << ")\n";
+            << scrn._max_available_video_memory << ")\n";
         continue;
       }
     }
@@ -644,19 +644,19 @@ search_for_valid_displaymode(DXScreenData &scrn,
             << "Testing Mode w/Z (" << RequestedX_Size << "x"
             << RequestedY_Size << ", " << D3DFormatStr(dispmode.Format)
             << ")\nReqdVidMem: " << (int)MinMemReqmt << " AvailVidMem: "
-            << scrn.MaxAvailVidMem << endl;
+            << scrn._max_available_video_memory << endl;
 
-        if (MinMemReqmt > scrn.MaxAvailVidMem) {
+        if (MinMemReqmt > scrn._max_available_video_memory) {
           if (bVerboseMode || wdxdisplay8_cat.is_debug())
             wdxdisplay8_cat.info()
               << "not enough VidMem for RendTgt+zbuf, skipping display fmt "
               << D3DFormatStr(dispmode.Format) << " (" << (int)MinMemReqmt
-              << " > " << scrn.MaxAvailVidMem << ")\n";
+              << " > " << scrn._max_available_video_memory << ")\n";
           continue;
         }
       }
 
-      if ((!bDoMemBasedChecks) || (MinMemReqmt<scrn.MaxAvailVidMem)) {
+      if ((!bDoMemBasedChecks) || (MinMemReqmt<scrn._max_available_video_memory)) {
         if (!IS_16BPP_ZBUFFER(zformat)) {
           // see if things fit with a 16bpp zbuffer
 
@@ -673,7 +673,7 @@ search_for_valid_displaymode(DXScreenData &scrn,
 
           // right now I'm not going to use these flags, just let the
           // create fail out-of-mem and retry at 16bpp
-          *pSupportedScreenDepthsMask |=
+          *p_supported_screen_depths_mask |=
             (IS_16BPP_DISPLAY_FORMAT(dispmode.Format) ? DISPLAY_16BPP_REQUIRES_16BPP_ZBUFFER_FLAG : DISPLAY_32BPP_REQUIRES_16BPP_ZBUFFER_FLAG);
         }
       }
@@ -691,35 +691,35 @@ search_for_valid_displaymode(DXScreenData &scrn,
 
     switch (dispmode.Format) {
     case D3DFMT_X1R5G5B5:
-      *pSupportedScreenDepthsMask |= X1R5G5B5_FLAG;
+      *p_supported_screen_depths_mask |= X1R5G5B5_FLAG;
       break;
     case D3DFMT_X8R8G8B8:
-      *pSupportedScreenDepthsMask |= X8R8G8B8_FLAG;
+      *p_supported_screen_depths_mask |= X8R8G8B8_FLAG;
       break;
     case D3DFMT_A8R8G8B8:
-      *pSupportedScreenDepthsMask |= A8R8G8B8_FLAG;
+      *p_supported_screen_depths_mask |= A8R8G8B8_FLAG;
       break;
     case D3DFMT_R5G6B5:
-      *pSupportedScreenDepthsMask |= R5G6B5_FLAG;
+      *p_supported_screen_depths_mask |= R5G6B5_FLAG;
       break;
     default:
       // Render target formats should be only D3DFMT_X1R5G5B5,
       // D3DFMT_R5G6B5, D3DFMT_X8R8G8B8 and D3DFMT_A8R8G8B8
       wdxdisplay8_cat.error()
         << "unrecognized supported fmt " << D3DFormatStr(dispmode.Format)
-        << " returned by EnumAdapterDisplayModes!\n";
+        << " returned by EnumAdapter_display_modes!\n";
     }
   }
 
   // note: this chooses 32bpp, which may not be preferred over 16 for
   // memory & speed reasons on some older cards in particular
-  if (*pSupportedScreenDepthsMask & X8R8G8B8_FLAG) {
+  if (*p_supported_screen_depths_mask & X8R8G8B8_FLAG) {
     *pSuggestedPixFmt = D3DFMT_X8R8G8B8;
-  } else if (*pSupportedScreenDepthsMask & A8R8G8B8_FLAG) {
+  } else if (*p_supported_screen_depths_mask & A8R8G8B8_FLAG) {
     *pSuggestedPixFmt = D3DFMT_A8R8G8B8;
-  } else if (*pSupportedScreenDepthsMask & R5G6B5_FLAG) {
+  } else if (*p_supported_screen_depths_mask & R5G6B5_FLAG) {
     *pSuggestedPixFmt = D3DFMT_R5G6B5;
-  } else if (*pSupportedScreenDepthsMask & X1R5G5B5_FLAG) {
+  } else if (*p_supported_screen_depths_mask & X1R5G5B5_FLAG) {
     *pSuggestedPixFmt = D3DFMT_X1R5G5B5;
   }
 
@@ -740,7 +740,7 @@ PT(GraphicsDevice) wdxGraphicsPipe8::
 make_device(void *scrn) {
   PT(DXGraphicsDevice8) device = new DXGraphicsDevice8(this);
   memcpy(&device->_Scrn, scrn, sizeof(device->_Scrn));
-  device->_pD3DDevice = device->_Scrn.pD3DDevice;
+  device->_d3d_device = device->_Scrn._d3d_device;
 
   _device = device;
   wdxdisplay8_cat.info() << "walla: device" << device << "\n";

+ 7 - 7
panda/src/dxgsg8/wdxGraphicsPipe8.h

@@ -42,14 +42,14 @@ public:
                                              GraphicsStateGuardian *share_with);
   virtual PT(GraphicsDevice) make_device(void *scrn);
 
-  bool find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &TestDisplayMode,
+  bool find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &Test_display_mode,
                               D3DFORMAT *pBestFmt, bool bWantStencil,
                               bool bForce16bpp, bool bVerboseMode = false) const;
 
   void search_for_valid_displaymode(DXScreenData &scrn,
                                     UINT RequestedX_Size, UINT RequestedY_Size,
                                     bool bWantZBuffer, bool bWantStencil,
-                                    UINT *pSupportedScreenDepthsMask,
+                                    UINT *p_supported_screen_depths_mask,
                                     bool *pCouldntFindAnyValidZBuf,
                                     D3DFORMAT *pSuggestedPixFmt,
                                     bool bForce16bppZBuffer,
@@ -71,7 +71,7 @@ private:
 private:
   HINSTANCE _hDDrawDLL;
   HINSTANCE _hD3D8_DLL;
-  LPDIRECT3D8 _pD3D8;
+  LPDIRECT3D8 __d3d8;
 
 
   typedef LPDIRECT3D8 (WINAPI *Direct3DCreate8_ProcPtr)(UINT SDKVersion);
@@ -84,16 +84,16 @@ private:
   // CardID is used in DX7 lowmem card-classification pass so DX8 can
   // establish correspondence b/w DX7 mem info & DX8 device
   struct CardID {
-    HMONITOR hMon;
-    DWORD MaxAvailVidMem;
-    bool  bIsLowVidMemCard;
+    HMONITOR _monitor;
+    DWORD _max_available_video_memory;
+    bool  _is_low_memory_card;
     GUID  DX7_DeviceGUID;
     DWORD VendorID, DeviceID;
   };
   
   typedef pvector<CardID> CardIDs;
   CardIDs _card_ids;
-  bool _bIsDX81;
+  bool __is_dx8_1;
 
 public:
   static TypeHandle get_class_type() {

+ 174 - 174
panda/src/dxgsg8/wdxGraphicsWindow8.cxx

@@ -177,13 +177,13 @@ verify_window_sizes(int numsizes, int *dimen) {
       bIsGoodMode = true;
 
     } else {
-      if (_wcontext.bIsLowVidMemCard) {
+      if (_wcontext._is_low_memory_card) {
         bIsGoodMode = ((x_size == 640) && (y_size == 480));
       } else  {
         dxpipe->search_for_valid_displaymode
-          (_wcontext, x_size, y_size, _wcontext.PresParams.EnableAutoDepthStencil != false,
-           IS_STENCIL_FORMAT(_wcontext.PresParams.AutoDepthStencilFormat),
-           &_wcontext.SupportedScreenDepthsMask,
+          (_wcontext, x_size, y_size, _wcontext._presentation_params.EnableAutoDepthStencil != false,
+           IS_STENCIL_FORMAT(_wcontext._presentation_params.AutoDepthStencilFormat),
+           &_wcontext._supported_screen_depths_mask,
            &CouldntFindAnyValidZBuf, &newPixFmt, dx_force_16bpp_zbuffer);
         bIsGoodMode = (newPixFmt != D3DFMT_UNKNOWN);
       }
@@ -240,13 +240,13 @@ open_window() {
     return false;
   }
 
-  wdxdisplay8_cat.debug() << "_wcontext.hWnd is " << _wcontext.hWnd << "\n";
+  wdxdisplay8_cat.debug() << "_wcontext._window is " << _wcontext._window << "\n";
   if (!WinGraphicsWindow::open_window()) {
     return false;
   }
-  _wcontext.hWnd = _hWnd;
+  _wcontext._window = _hWnd;
 
-  wdxdisplay8_cat.debug() << "_wcontext.hWnd is " << _wcontext.hWnd << "\n";
+  wdxdisplay8_cat.debug() << "_wcontext._window is " << _wcontext._window << "\n";
 
   // Here check if a device already exists. If so, then this open_window
   // call may be an extension to create multiple windows on same device
@@ -261,7 +261,7 @@ open_window() {
         dxgsg->dx_cleanup();
       }
 
-      wdxdisplay8_cat.debug() << "device width " << _wcontext.DisplayMode.Width << "\n";
+      wdxdisplay8_cat.debug() << "device width " << _wcontext._display_mode.Width << "\n";
       if (!create_screen_buffers_and_device(_wcontext, dx_force_16bpp_zbuffer)) {
         // just crash here
         wdxdisplay8_cat.error() << "fatal: must be trying to create two fullscreen windows: not supported\n";
@@ -274,19 +274,19 @@ open_window() {
 
     } else {
       // fill in the DXScreenData from dxdevice here and change the
-      // reference to hWnd.
+      // reference to _window.
       wdxdisplay8_cat.debug() << "device is not null\n";
 
       dxdev = (DXGraphicsDevice8*)dxgsg->get_pipe()->get_device();
       props = get_properties();
       memcpy(&_wcontext, &dxdev->_Scrn, sizeof(DXScreenData));
 
-      _wcontext.PresParams.Windowed = !is_fullscreen();
-      _wcontext.PresParams.hDeviceWindow = _wcontext.hWnd = _hWnd;
-      _wcontext.PresParams.BackBufferWidth = _wcontext.DisplayMode.Width = props.get_x_size();
-      _wcontext.PresParams.BackBufferHeight = _wcontext.DisplayMode.Height = props.get_y_size();
+      _wcontext._presentation_params.Windowed = !is_fullscreen();
+      _wcontext._presentation_params.hDeviceWindow = _wcontext._window = _hWnd;
+      _wcontext._presentation_params.BackBufferWidth = _wcontext._display_mode.Width = props.get_x_size();
+      _wcontext._presentation_params.BackBufferHeight = _wcontext._display_mode.Height = props.get_y_size();
 
-      wdxdisplay8_cat.debug() << "device width " << _wcontext.PresParams.BackBufferWidth << "\n";
+      wdxdisplay8_cat.debug() << "device width " << _wcontext._presentation_params.BackBufferWidth << "\n";
       if (!dxgsg->create_swap_chain(&_wcontext)) {
         discard_device = true;
         continue; // try again
@@ -295,7 +295,7 @@ open_window() {
       break;
     }
   }
-  wdxdisplay8_cat.debug() << "swapchain is " << _wcontext.pSwapChain << "\n";
+  wdxdisplay8_cat.debug() << "swapchain is " << _wcontext._swap_chain << "\n";
   return true;
 }
 
@@ -313,15 +313,15 @@ reset_window(bool swapchain) {
   DXGraphicsStateGuardian8 *dxgsg;
   DCAST_INTO_V(dxgsg, _gsg);
   if (swapchain) {
-    if (_wcontext.pSwapChain) {
+    if (_wcontext._swap_chain) {
       dxgsg->create_swap_chain(&_wcontext);
-      wdxdisplay8_cat.debug() << "created swapchain " << _wcontext.pSwapChain << "\n";
+      wdxdisplay8_cat.debug() << "created swapchain " << _wcontext._swap_chain << "\n";
     }
   }
   else {
-    if (_wcontext.pSwapChain) {
+    if (_wcontext._swap_chain) {
       dxgsg->release_swap_chain(&_wcontext);
-      wdxdisplay8_cat.debug() << "released swapchain " << _wcontext.pSwapChain << "\n";
+      wdxdisplay8_cat.debug() << "released swapchain " << _wcontext._swap_chain << "\n";
     }
   }
 }
@@ -393,8 +393,8 @@ bool wdxGraphicsWindow8::
 do_fullscreen_resize(int x_size, int y_size) {
   bool bCouldntFindValidZBuf;
   D3DFORMAT pixFmt;
-  bool bNeedZBuffer = (_wcontext.PresParams.EnableAutoDepthStencil != false);
-  bool bNeedStencilBuffer = IS_STENCIL_FORMAT(_wcontext.PresParams.AutoDepthStencilFormat);
+  bool bNeedZBuffer = (_wcontext._presentation_params.EnableAutoDepthStencil != false);
+  bool bNeedStencilBuffer = IS_STENCIL_FORMAT(_wcontext._presentation_params.AutoDepthStencilFormat);
 
   wdxGraphicsPipe8 *dxpipe;
   DCAST_INTO_R(dxpipe, _pipe, false);
@@ -405,8 +405,8 @@ do_fullscreen_resize(int x_size, int y_size) {
   if (!dxpipe->special_check_fullscreen_resolution(_wcontext, x_size, y_size)) {
     // bypass the lowvidmem test below for certain "lowmem" cards we know have valid modes
 
-    if (_wcontext.bIsLowVidMemCard && (!((x_size == 640) && (y_size == 480)))) {
-      wdxdisplay8_cat.error() << "resize() failed: will not try to resize low vidmem device #" << _wcontext.CardIDNum << " to non-640x480!\n";
+    if (_wcontext._is_low_memory_card && (!((x_size == 640) && (y_size == 480)))) {
+      wdxdisplay8_cat.error() << "resize() failed: will not try to resize low vidmem device #" << _wcontext._card_id << " to non-640x480!\n";
       return bResizeSucceeded;
     }
   }
@@ -415,7 +415,7 @@ do_fullscreen_resize(int x_size, int y_size) {
   // a-priori that res is valid so we can get a valid pixfmt
   dxpipe->search_for_valid_displaymode(_wcontext, x_size, y_size,
                                        bNeedZBuffer, bNeedStencilBuffer,
-                                       &_wcontext.SupportedScreenDepthsMask,
+                                       &_wcontext._supported_screen_depths_mask,
                                        &bCouldntFindValidZBuf,
                                        &pixFmt, dx_force_16bpp_zbuffer);
   bIsGoodMode = (pixFmt != D3DFMT_UNKNOWN);
@@ -423,31 +423,31 @@ do_fullscreen_resize(int x_size, int y_size) {
   if (!bIsGoodMode) {
     wdxdisplay8_cat.error() << "resize() failed: "
                             << (bCouldntFindValidZBuf ? "Couldnt find valid zbuffer format to go with FullScreen mode" : "No supported FullScreen modes")
-                            << " at " << x_size << "x" << y_size << " for device #" << _wcontext.CardIDNum << endl;
+                            << " at " << x_size << "x" << y_size << " for device #" << _wcontext._card_id << endl;
     return bResizeSucceeded;
   }
 
   // reset_device_resize_window handles both windowed & fullscrn,
   // so need to set new displaymode manually here
-  _wcontext.DisplayMode.Width = x_size;
-  _wcontext.DisplayMode.Height = y_size;
-  _wcontext.DisplayMode.Format = pixFmt;
-  _wcontext.DisplayMode.RefreshRate = D3DPRESENT_RATE_DEFAULT;
+  _wcontext._display_mode.Width = x_size;
+  _wcontext._display_mode.Height = y_size;
+  _wcontext._display_mode.Format = pixFmt;
+  _wcontext._display_mode.RefreshRate = D3DPRESENT_RATE_DEFAULT;
 
-  _wcontext.PresParams.BackBufferFormat = pixFmt;   // make reset_device_resize use presparams or displaymode??
+  _wcontext._presentation_params.BackBufferFormat = pixFmt;   // make reset_device_resize use presparams or displaymode??
 
   bResizeSucceeded = reset_device_resize_window(x_size, y_size);
 
   if (!bResizeSucceeded) {
     wdxdisplay8_cat.error() << "resize() failed with OUT-OF-MEMORY error!\n";
 
-    if ((!IS_16BPP_DISPLAY_FORMAT(_wcontext.PresParams.BackBufferFormat)) &&
-        (_wcontext.SupportedScreenDepthsMask & (R5G6B5_FLAG|X1R5G5B5_FLAG))) {
+    if ((!IS_16BPP_DISPLAY_FORMAT(_wcontext._presentation_params.BackBufferFormat)) &&
+        (_wcontext._supported_screen_depths_mask & (R5G6B5_FLAG|X1R5G5B5_FLAG))) {
       // fallback strategy, if we trying >16bpp, fallback to 16bpp buffers
-      _wcontext.DisplayMode.Format = ((_wcontext.SupportedScreenDepthsMask & R5G6B5_FLAG) ? D3DFMT_R5G6B5 : D3DFMT_X1R5G5B5);
+      _wcontext._display_mode.Format = ((_wcontext._supported_screen_depths_mask & R5G6B5_FLAG) ? D3DFMT_R5G6B5 : D3DFMT_X1R5G5B5);
       dx_force_16bpp_zbuffer = true;
       if (wdxdisplay8_cat.info())
-        wdxdisplay8_cat.info() << "CreateDevice failed with out-of-vidmem, retrying w/16bpp buffers on device #" << _wcontext.CardIDNum << endl;
+        wdxdisplay8_cat.info() << "CreateDevice failed with out-of-vidmem, retrying w/16bpp buffers on device #" << _wcontext._card_id << endl;
 
       bResizeSucceeded = reset_device_resize_window(x_size, y_size);  // create the new resized rendertargets
     }
@@ -474,27 +474,27 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
   // auto-res-select in any future init sequence.
   dx_pick_best_screenres = false;
 
-  DWORD dwRenderWidth = Display.DisplayMode.Width;
-  DWORD dwRenderHeight = Display.DisplayMode.Height;
+  DWORD dwRenderWidth = Display._display_mode.Width;
+  DWORD dwRenderHeight = Display._display_mode.Height;
   DWORD dwBehaviorFlags = 0x0;
-  LPDIRECT3D8 pD3D8 = Display.pD3D8;
-  D3DCAPS8 *pD3DCaps = &Display.d3dcaps;
-  D3DPRESENT_PARAMETERS* pPresParams = &Display.PresParams;
+  LPDIRECT3D8 _d3d8 = Display._d3d8;
+  D3DCAPS8 *pD3DCaps = &Display._d3dcaps;
+  D3DPRESENT_PARAMETERS* presentation_params = &Display._presentation_params;
   RECT view_rect;
   HRESULT hr;
 
-  wdxdisplay8_cat.debug() << "Display Width " << dwRenderWidth << " and PresParam Width " << _wcontext.PresParams.BackBufferWidth << "\n";
+  wdxdisplay8_cat.debug() << "Display Width " << dwRenderWidth << " and PresParam Width " << _wcontext._presentation_params.BackBufferWidth << "\n";
 
   // BUGBUG: need to change panda to put frame buffer properties with GraphicsWindow, not GSG!!
   int frame_buffer_mode = _gsg->get_properties().get_frame_buffer_mode();
   bool bWantStencil = ((frame_buffer_mode & FrameBufferProperties::FM_stencil) != 0);
 
-  PRINT_REFCNT(wdxdisplay8, pD3D8);
+  PRINT_REFCNT(wdxdisplay8, _d3d8);
 
-  assert(pD3D8 != NULL);
+  assert(_d3d8 != NULL);
   assert(pD3DCaps->DevCaps & D3DDEVCAPS_HWRASTERIZATION);
 
-  pPresParams->BackBufferFormat = Display.DisplayMode.Format;  // dont need dest alpha, so just use adapter format
+  presentation_params->BackBufferFormat = Display._display_mode.Format;  // dont need dest alpha, so just use adapter format
 
   bool do_sync = sync_video;
 
@@ -505,65 +505,65 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
   }
 
   // verify the rendertarget fmt one last time
-  if (FAILED(pD3D8->CheckDeviceFormat(Display.CardIDNum, D3DDEVTYPE_HAL, Display.DisplayMode.Format, D3DUSAGE_RENDERTARGET,
-                                      D3DRTYPE_SURFACE, pPresParams->BackBufferFormat))) {
-    wdxdisplay8_cat.error() << "device #" << Display.CardIDNum << " CheckDeviceFmt failed for surface fmt " << D3DFormatStr(pPresParams->BackBufferFormat) << endl;
+  if (FAILED(_d3d8->CheckDeviceFormat(Display._card_id, D3DDEVTYPE_HAL, Display._display_mode.Format, D3DUSAGE_RENDERTARGET,
+                                      D3DRTYPE_SURFACE, presentation_params->BackBufferFormat))) {
+    wdxdisplay8_cat.error() << "device #" << Display._card_id << " CheckDeviceFmt failed for surface fmt " << D3DFormatStr(presentation_params->BackBufferFormat) << endl;
     goto Fallback_to_16bpp_buffers;
   }
 
-  if (FAILED(pD3D8->CheckDeviceType(Display.CardIDNum, D3DDEVTYPE_HAL, Display.DisplayMode.Format, pPresParams->BackBufferFormat,
+  if (FAILED(_d3d8->CheckDeviceType(Display._card_id, D3DDEVTYPE_HAL, Display._display_mode.Format, presentation_params->BackBufferFormat,
                                     is_fullscreen()))) {
-    wdxdisplay8_cat.error() << "device #" << Display.CardIDNum << " CheckDeviceType failed for surface fmt " << D3DFormatStr(pPresParams->BackBufferFormat) << endl;
+    wdxdisplay8_cat.error() << "device #" << Display._card_id << " CheckDeviceType failed for surface fmt " << D3DFormatStr(presentation_params->BackBufferFormat) << endl;
     goto Fallback_to_16bpp_buffers;
   }
 
-  if (Display.PresParams.EnableAutoDepthStencil) {
-    if (!dxpipe->find_best_depth_format(Display, Display.DisplayMode,
-                                        &Display.PresParams.AutoDepthStencilFormat,
+  if (Display._presentation_params.EnableAutoDepthStencil) {
+    if (!dxpipe->find_best_depth_format(Display, Display._display_mode,
+                                        &Display._presentation_params.AutoDepthStencilFormat,
                                         bWantStencil, false)) {
       wdxdisplay8_cat.error()
         << "find_best_depth_format failed in CreateScreenBuffers for device #"
-        << Display.CardIDNum << endl;
+        << Display._card_id << endl;
       goto Fallback_to_16bpp_buffers;
     }
-    _depth_buffer_bpp = D3DFMT_to_DepthBits(Display.PresParams.AutoDepthStencilFormat);
+    _depth_buffer_bpp = D3DFMT_to_DepthBits(Display._presentation_params.AutoDepthStencilFormat);
   } else {
     _depth_buffer_bpp = 0;
   }
 
-  pPresParams->Windowed = !is_fullscreen();
+  presentation_params->Windowed = !is_fullscreen();
 
   if (dx_multisample_antialiasing_level>1) {
     // need to check both rendertarget and zbuffer fmts
-    hr = pD3D8->CheckDeviceMultiSampleType(Display.CardIDNum, D3DDEVTYPE_HAL, Display.DisplayMode.Format,
+    hr = _d3d8->CheckDeviceMultiSampleType(Display._card_id, D3DDEVTYPE_HAL, Display._display_mode.Format,
                                            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;
+      wdxdisplay8_cat.fatal() << "device #" << Display._card_id << " doesnt support multisample level " << dx_multisample_antialiasing_level << "surface fmt " << D3DFormatStr(Display._display_mode.Format) << endl;
       return false;
     }
 
-    if (Display.PresParams.EnableAutoDepthStencil) {
-      hr = pD3D8->CheckDeviceMultiSampleType(Display.CardIDNum, D3DDEVTYPE_HAL, Display.PresParams.AutoDepthStencilFormat,
+    if (Display._presentation_params.EnableAutoDepthStencil) {
+      hr = _d3d8->CheckDeviceMultiSampleType(Display._card_id, D3DDEVTYPE_HAL, Display._presentation_params.AutoDepthStencilFormat,
                                              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;
+        wdxdisplay8_cat.fatal() << "device #" << Display._card_id << " doesnt support multisample level " << dx_multisample_antialiasing_level << "surface fmt " << D3DFormatStr(Display._presentation_params.AutoDepthStencilFormat) << endl;
         return false;
       }
     }
 
-    pPresParams->MultiSampleType = D3DMULTISAMPLE_TYPE(dx_multisample_antialiasing_level.get_value());
+    presentation_params->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;
+      wdxdisplay8_cat.info() << "device #" << Display._card_id << " using multisample antialiasing level " << dx_multisample_antialiasing_level << endl;
   }
 
-  pPresParams->BackBufferCount = 1;
-  pPresParams->Flags = 0x0;
-  pPresParams->hDeviceWindow = Display.hWnd;
-  pPresParams->BackBufferWidth = Display.DisplayMode.Width;
-  pPresParams->BackBufferHeight = Display.DisplayMode.Height;
+  presentation_params->BackBufferCount = 1;
+  presentation_params->Flags = 0x0;
+  presentation_params->hDeviceWindow = Display._window;
+  presentation_params->BackBufferWidth = Display._display_mode.Width;
+  presentation_params->BackBufferHeight = Display._display_mode.Height;
 
-  if (_wcontext.bIsTNLDevice) {
+  if (_wcontext._is_tnl_device) {
     dwBehaviorFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
     // note: we could create a pure device in this case if I
     // eliminated the GetRenderState calls in dxgsg
@@ -583,22 +583,22 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
   // false, causing us to go into a 'wait-for WM_ACTIVATEAPP true'
   // loop, and the event never comes so we hang in fullscreen wait.
   // also doing this for windowed mode since it was requested.
-  if (!SetForegroundWindow(Display.hWnd)) {
+  if (!SetForegroundWindow(Display._window)) {
     wdxdisplay8_cat.warning() << "SetForegroundWindow() failed!\n";
   }
 
   if (is_fullscreen()) {
-    pPresParams->SwapEffect = D3DSWAPEFFECT_DISCARD;  // we dont care about preserving contents of old frame
-    pPresParams->FullScreen_PresentationInterval = (do_sync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE);
-    pPresParams->FullScreen_RefreshRateInHz = Display.DisplayMode.RefreshRate;
+    presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD;  // we dont care about preserving contents of old frame
+    presentation_params->FullScreen_PresentationInterval = (do_sync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE);
+    presentation_params->FullScreen_RefreshRateInHz = Display._display_mode.RefreshRate;
 
-    ClearToBlack(Display.hWnd, get_properties());
+    ClearToBlack(Display._window, get_properties());
 
-    hr = pD3D8->CreateDevice(Display.CardIDNum, D3DDEVTYPE_HAL, _hWnd,
-                             dwBehaviorFlags, pPresParams, &Display.pD3DDevice);
+    hr = _d3d8->CreateDevice(Display._card_id, D3DDEVTYPE_HAL, _hWnd,
+                             dwBehaviorFlags, presentation_params, &Display._d3d_device);
 
     if (FAILED(hr)) {
-      wdxdisplay8_cat.fatal() << "D3D CreateDevice failed for device #" << Display.CardIDNum << ", " << D3DERRORSTRING(hr);
+      wdxdisplay8_cat.fatal() << "D3D CreateDevice failed for device #" << Display._card_id << ", " << D3DERRORSTRING(hr);
 
       if (hr == D3DERR_OUTOFVIDEOMEMORY)
         goto Fallback_to_16bpp_buffers;
@@ -612,7 +612,7 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
   else {          // CREATE WINDOWED BUFFERS
 
     D3DDISPLAYMODE dispmode;
-    hr = Display.pD3D8->GetAdapterDisplayMode(Display.CardIDNum, &dispmode);
+    hr = Display._d3d8->GetAdapterDisplayMode(Display._card_id, &dispmode);
 
     if (FAILED(hr)) {
       wdxdisplay8_cat.fatal() << "GetAdapterDisplayMode failed" << D3DERRORSTRING(hr);
@@ -624,40 +624,40 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
       return false;
     }
 
-    pPresParams->FullScreen_PresentationInterval = 0;
+    presentation_params->FullScreen_PresentationInterval = 0;
 
     if (dx_multisample_antialiasing_level<2) {
       if (do_sync) {
-        pPresParams->SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
+        presentation_params->SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
       } else {
-        pPresParams->SwapEffect = D3DSWAPEFFECT_DISCARD;  //D3DSWAPEFFECT_COPY;  does this make any difference?
+        presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD;  //D3DSWAPEFFECT_COPY;  does this make any difference?
       }
     } else {
-      pPresParams->SwapEffect = D3DSWAPEFFECT_DISCARD;
+      presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD;
     }
 
-    //assert((dwRenderWidth == pPresParams->BackBufferWidth)&&(dwRenderHeight == pPresParams->BackBufferHeight));
+    //assert((dwRenderWidth == presentation_params->BackBufferWidth)&&(dwRenderHeight == presentation_params->BackBufferHeight));
 
-    hr = pD3D8->CreateDevice(Display.CardIDNum, D3DDEVTYPE_HAL, _hWnd,
-                             dwBehaviorFlags, pPresParams, &Display.pD3DDevice);
+    hr = _d3d8->CreateDevice(Display._card_id, D3DDEVTYPE_HAL, _hWnd,
+                             dwBehaviorFlags, presentation_params, &Display._d3d_device);
 
     if (FAILED(hr)) {
-      wdxdisplay8_cat.warning() << "pPresParams->BackBufferWidth : " << pPresParams->BackBufferWidth << endl;
-      wdxdisplay8_cat.warning() << "pPresParams->BackBufferHeight : " << pPresParams->BackBufferHeight << endl;
-      wdxdisplay8_cat.warning() << "pPresParams->BackBufferFormat : " << pPresParams->BackBufferFormat << endl;
-      wdxdisplay8_cat.warning() << "pPresParams->BackBufferCount : " << pPresParams->BackBufferCount << endl;
-      wdxdisplay8_cat.warning() << "D3D CreateDevice failed for device #" << Display.CardIDNum << D3DERRORSTRING(hr);
+      wdxdisplay8_cat.warning() << "presentation_params->BackBufferWidth : " << presentation_params->BackBufferWidth << endl;
+      wdxdisplay8_cat.warning() << "presentation_params->BackBufferHeight : " << presentation_params->BackBufferHeight << endl;
+      wdxdisplay8_cat.warning() << "presentation_params->BackBufferFormat : " << presentation_params->BackBufferFormat << endl;
+      wdxdisplay8_cat.warning() << "presentation_params->BackBufferCount : " << presentation_params->BackBufferCount << endl;
+      wdxdisplay8_cat.warning() << "D3D CreateDevice failed for device #" << Display._card_id << D3DERRORSTRING(hr);
       goto Fallback_to_16bpp_buffers;
     }
   }  // end create windowed buffers
 
   //  ========================================================
 
-  PRINT_REFCNT(wdxdisplay8, _wcontext.pD3DDevice);
+  PRINT_REFCNT(wdxdisplay8, _wcontext._d3d_device);
 
-  if (pPresParams->EnableAutoDepthStencil) {
+  if (presentation_params->EnableAutoDepthStencil) {
     _buffer_mask |= RenderBuffer::T_depth;
-    if (IS_STENCIL_FORMAT(pPresParams->AutoDepthStencilFormat)) {
+    if (IS_STENCIL_FORMAT(presentation_params->AutoDepthStencilFormat)) {
       _buffer_mask |= RenderBuffer::T_stencil;
     }
   }
@@ -668,26 +668,26 @@ create_screen_buffers_and_device(DXScreenData &Display, bool force_16bpp_zbuffer
 
  Fallback_to_16bpp_buffers:
 
-  if ((!IS_16BPP_DISPLAY_FORMAT(pPresParams->BackBufferFormat)) &&
-      (Display.SupportedScreenDepthsMask & (R5G6B5_FLAG|X1R5G5B5_FLAG))) {
+  if ((!IS_16BPP_DISPLAY_FORMAT(presentation_params->BackBufferFormat)) &&
+      (Display._supported_screen_depths_mask & (R5G6B5_FLAG|X1R5G5B5_FLAG))) {
     // fallback strategy, if we trying >16bpp, fallback to 16bpp buffers
 
-    Display.DisplayMode.Format = ((Display.SupportedScreenDepthsMask & R5G6B5_FLAG) ? D3DFMT_R5G6B5 : D3DFMT_X1R5G5B5);
+    Display._display_mode.Format = ((Display._supported_screen_depths_mask & R5G6B5_FLAG) ? D3DFMT_R5G6B5 : D3DFMT_X1R5G5B5);
 
     if (wdxdisplay8_cat.info()) {
       wdxdisplay8_cat.info()
         << "CreateDevice failed with out-of-vidmem or invalid BackBufferFormat, retrying w/16bpp buffers on device #"
-        << Display.CardIDNum << endl;
+        << Display._card_id << endl;
     }
     return create_screen_buffers_and_device(Display, true);
     //return;
 
   } else if (!((dwRenderWidth == 640)&&(dwRenderHeight == 480))) {
     if (wdxdisplay8_cat.info())
-      wdxdisplay8_cat.info() << "CreateDevice failed w/out-of-vidmem, retrying at 640x480 w/16bpp buffers on device #" << Display.CardIDNum << endl;
+      wdxdisplay8_cat.info() << "CreateDevice failed w/out-of-vidmem, retrying at 640x480 w/16bpp buffers on device #" << Display._card_id << endl;
     // try final fallback to 640x480x16
-    Display.DisplayMode.Width = 640;
-    Display.DisplayMode.Height = 480;
+    Display._display_mode.Width = 640;
+    Display._display_mode.Height = 480;
     return create_screen_buffers_and_device(Display, true);
     //return;
 
@@ -713,13 +713,13 @@ choose_device() {
   wdxGraphicsPipe8 *dxpipe;
   DCAST_INTO_R(dxpipe, _pipe, false);
 
-  int num_adapters = dxpipe->_pD3D8->GetAdapterCount();
+  int num_adapters = dxpipe->__d3d8->GetAdapterCount();
   DXDeviceInfoVec device_infos;
 
   for (int i = 0; i < num_adapters; i++) {
     D3DADAPTER_IDENTIFIER8 adapter_info;
     ZeroMemory(&adapter_info, sizeof(D3DADAPTER_IDENTIFIER8));
-    hr = dxpipe->_pD3D8->GetAdapterIdentifier(i, D3DENUM_NO_WHQL_LEVEL, &adapter_info);
+    hr = dxpipe->__d3d8->GetAdapterIdentifier(i, D3DENUM_NO_WHQL_LEVEL, &adapter_info);
     if (FAILED(hr)) {
       wdxdisplay8_cat.fatal()
         << "D3D GetAdapterID(" << i << ") failed: "
@@ -730,7 +730,7 @@ choose_device() {
     LARGE_INTEGER *DrvVer = &adapter_info.DriverVersion;
 
     wdxdisplay8_cat.info()
-      << "D3D8." << (dxpipe->_bIsDX81 ?"1":"0") << " Adapter[" << i << "]: " << adapter_info.Description
+      << "D3D8." << (dxpipe->__is_dx8_1 ?"1":"0") << " Adapter[" << i << "]: " << adapter_info.Description
       << ", Driver: " << adapter_info.Driver << ", DriverVersion: ("
       << HIWORD(DrvVer->HighPart) << "." << LOWORD(DrvVer->HighPart) << "."
       << HIWORD(DrvVer->LowPart) << "." << LOWORD(DrvVer->LowPart)
@@ -739,8 +739,8 @@ choose_device() {
       << " SubsysID: 0x" << (void*) adapter_info.SubSysId
       << " Revision: 0x" << (void*) adapter_info.Revision << endl;
 
-    HMONITOR hMon = dxpipe->_pD3D8->GetAdapterMonitor(i);
-    if (hMon == NULL) {
+    HMONITOR _monitor = dxpipe->__d3d8->GetAdapterMonitor(i);
+    if (_monitor == NULL) {
       wdxdisplay8_cat.info()
         << "D3D8 Adapter[" << i << "]: seems to be disabled, skipping it\n";
       continue;
@@ -756,7 +756,7 @@ choose_device() {
             MAX_DEVICE_IDENTIFIER_STRING);
     devinfo.VendorID = adapter_info.VendorId;
     devinfo.DeviceID = adapter_info.DeviceId;
-    devinfo.hMon = hMon;
+    devinfo._monitor = _monitor;
     devinfo.cardID = i;
 
     device_infos.push_back(devinfo);
@@ -816,26 +816,26 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
   DWORD dwRenderWidth = properties.get_x_size();
   DWORD dwRenderHeight = properties.get_y_size();
   HRESULT hr;
-  LPDIRECT3D8 pD3D8 = dxpipe->_pD3D8;
+  LPDIRECT3D8 _d3d8 = dxpipe->__d3d8;
 
   assert(_dxgsg != NULL);
-  _wcontext.pD3D8 = pD3D8;
-  _wcontext.bIsDX81 = dxpipe->_bIsDX81;
-  _wcontext.CardIDNum = device_info->cardID;  // could this change by end?
+  _wcontext._d3d8 = _d3d8;
+  _wcontext._is_dx8_1 = dxpipe->__is_dx8_1;
+  _wcontext._card_id = device_info->cardID;  // could this change by end?
 
   int frame_buffer_mode = _gsg->get_properties().get_frame_buffer_mode();
   bool bWantStencil = ((frame_buffer_mode & FrameBufferProperties::FM_stencil) != 0);
 
-  hr = pD3D8->GetAdapterIdentifier(device_info->cardID, D3DENUM_NO_WHQL_LEVEL,
-                                   &_wcontext.DXDeviceID);
+  hr = _d3d8->GetAdapterIdentifier(device_info->cardID, D3DENUM_NO_WHQL_LEVEL,
+                                   &_wcontext._dx_device_id);
   if (FAILED(hr)) {
     wdxdisplay8_cat.error()
       << "D3D GetAdapterID failed" << D3DERRORSTRING(hr);
     return false;
   }
 
-  D3DCAPS8 d3dcaps;
-  hr = pD3D8->GetDeviceCaps(device_info->cardID, D3DDEVTYPE_HAL, &d3dcaps);
+  D3DCAPS8 _d3dcaps;
+  hr = _d3d8->GetDeviceCaps(device_info->cardID, D3DDEVTYPE_HAL, &_d3dcaps);
   if (FAILED(hr)) {
     if ((hr == D3DERR_INVALIDDEVICE)||(hr == D3DERR_NOTAVAILABLE)) {
       wdxdisplay8_cat.error()
@@ -850,16 +850,16 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
   }
 
   //search_for_valid_displaymode needs these to be set
-  memcpy(&_wcontext.d3dcaps, &d3dcaps, sizeof(D3DCAPS8));
-  _wcontext.CardIDNum = device_info->cardID;
+  memcpy(&_wcontext._d3dcaps, &_d3dcaps, sizeof(D3DCAPS8));
+  _wcontext._card_id = device_info->cardID;
 
-  _wcontext.MaxAvailVidMem = UNKNOWN_VIDMEM_SIZE;
-  _wcontext.bIsLowVidMemCard = false;
+  _wcontext._max_available_video_memory = UNKNOWN_VIDMEM_SIZE;
+  _wcontext._is_low_memory_card = false;
 
   // bugbug: wouldnt we like to do GetAVailVidMem so we can do
   // upper-limit memory computation for dx8 cards too?  otherwise
   // verify_window_sizes cant do much
-  if ((d3dcaps.MaxStreams == 0) || dx_pick_best_screenres) {
+  if ((_d3dcaps.MaxStreams == 0) || dx_pick_best_screenres) {
     if (wdxdisplay8_cat.is_debug()) {
       wdxdisplay8_cat.debug()
         << "checking vidmem size\n";
@@ -871,23 +871,23 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
     for (IDnum = 0; IDnum < dxpipe->_card_ids.size(); IDnum++) {
       if ((device_info->VendorID == dxpipe->_card_ids[IDnum].VendorID) &&
           (device_info->DeviceID == dxpipe->_card_ids[IDnum].DeviceID) &&
-          (device_info->hMon == dxpipe->_card_ids[IDnum].hMon))
+          (device_info->_monitor == dxpipe->_card_ids[IDnum]._monitor))
         break;
     }
 
     if (IDnum < dxpipe->_card_ids.size()) {
-      _wcontext.MaxAvailVidMem = dxpipe->_card_ids[IDnum].MaxAvailVidMem;
-      _wcontext.bIsLowVidMemCard = dxpipe->_card_ids[IDnum].bIsLowVidMemCard;
+      _wcontext._max_available_video_memory = dxpipe->_card_ids[IDnum]._max_available_video_memory;
+      _wcontext._is_low_memory_card = dxpipe->_card_ids[IDnum]._is_low_memory_card;
     } else {
       wdxdisplay8_cat.error()
         << "Error: couldnt find a CardID match in DX7 info, assuming card is not a lowmem card\n";
     }
   }
 
-  if ((bWantStencil) && (d3dcaps.StencilCaps == 0x0)) {
+  if ((bWantStencil) && (_d3dcaps.StencilCaps == 0x0)) {
     wdxdisplay8_cat.fatal()
       << "Stencil ability requested, but device #" << device_info->cardID
-      << " (" << _wcontext.DXDeviceID.Description
+      << " (" << _wcontext._dx_device_id.Description
       << "), has no stencil capability!\n";
     return false;
   }
@@ -896,27 +896,27 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
   // supported in HW (see GF2) for this case, you probably want MIXED
   // processing to use HW for fixed-fn vertex processing and SW for
   // vtx shaders
-  _wcontext.bIsTNLDevice =
-    ((d3dcaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) != 0);
-  _wcontext.bCanUseHWVertexShaders =
-    (d3dcaps.VertexShaderVersion >= D3DVS_VERSION(1, 0));
-  _wcontext.bCanUsePixelShaders =
-    (d3dcaps.PixelShaderVersion >= D3DPS_VERSION(1, 0));
+  _wcontext._is_tnl_device =
+    ((_d3dcaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) != 0);
+  _wcontext._can_use_hw_vertex_shaders =
+    (_d3dcaps.VertexShaderVersion >= D3DVS_VERSION(1, 0));
+  _wcontext._can_use_pixel_shaders =
+    (_d3dcaps.PixelShaderVersion >= D3DPS_VERSION(1, 0));
 
   bool bNeedZBuffer =
-    ((!(d3dcaps.RasterCaps & D3DPRASTERCAPS_ZBUFFERLESSHSR )) &&
+    ((!(_d3dcaps.RasterCaps & D3DPRASTERCAPS_ZBUFFERLESSHSR )) &&
      ((frame_buffer_mode & FrameBufferProperties::FM_depth) != 0));
 
-  _wcontext.PresParams.EnableAutoDepthStencil = bNeedZBuffer;
+  _wcontext._presentation_params.EnableAutoDepthStencil = bNeedZBuffer;
 
   D3DFORMAT pixFmt = D3DFMT_UNKNOWN;
 
   if (is_fullscreen()) {
     bool bCouldntFindValidZBuf;
-    if (!_wcontext.bIsLowVidMemCard) {
+    if (!_wcontext._is_low_memory_card) {
       bool bUseDefaultSize = dx_pick_best_screenres &&
-        ((_wcontext.MaxAvailVidMem == UNKNOWN_VIDMEM_SIZE) ||
-         is_badvidmem_card(&_wcontext.DXDeviceID));
+        ((_wcontext._max_available_video_memory == UNKNOWN_VIDMEM_SIZE) ||
+         is_badvidmem_card(&_wcontext._dx_device_id));
 
       if (dx_pick_best_screenres && !bUseDefaultSize) {
         typedef struct {
@@ -943,18 +943,18 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
 
         for(int i = NumResLims - 1; i >= 0; i--) {
           // find biggest slot card can handle
-          if (_wcontext.MaxAvailVidMem > MemRes[i].memlimit) {
+          if (_wcontext._max_available_video_memory > MemRes[i].memlimit) {
             dwRenderWidth = MemRes[i].scrnX;
             dwRenderHeight = MemRes[i].scrnY;
 
             wdxdisplay8_cat.info()
               << "pick_best_screenres: trying " << dwRenderWidth
               << "x" << dwRenderHeight << " based on "
-              << _wcontext.MaxAvailVidMem << " bytes avail\n";
+              << _wcontext._max_available_video_memory << " bytes avail\n";
 
             dxpipe->search_for_valid_displaymode(_wcontext, dwRenderWidth, dwRenderHeight,
                                                  bNeedZBuffer, bWantStencil,
-                                                 &_wcontext.SupportedScreenDepthsMask,
+                                                 &_wcontext._supported_screen_depths_mask,
                                                  &bCouldntFindValidZBuf,
                                                  &pixFmt, dx_force_16bpp_zbuffer);
 
@@ -969,7 +969,7 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
               << "skipping scrnres; "
               << (bCouldntFindValidZBuf ? "Couldnt find valid zbuffer format to go with FullScreen mode" : "No supported FullScreen modes")
               << " at " << dwRenderWidth << "x" << dwRenderHeight
-              << " for device #" << _wcontext.CardIDNum << endl;
+              << " for device #" << _wcontext._card_id << endl;
           }
         }
         // otherwise just go with whatever was specified (we probably shouldve marked this card as lowmem if it gets to end of loop w/o breaking
@@ -985,7 +985,7 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
 
         dxpipe->search_for_valid_displaymode(_wcontext, dwRenderWidth, dwRenderHeight,
                                              bNeedZBuffer, bWantStencil,
-                                             &_wcontext.SupportedScreenDepthsMask,
+                                             &_wcontext._supported_screen_depths_mask,
                                              &bCouldntFindValidZBuf,
                                              &pixFmt, dx_force_16bpp_zbuffer);
 
@@ -995,7 +995,7 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
         if (pixFmt == D3DFMT_UNKNOWN) {
           wdxdisplay8_cat.error()
             << (bCouldntFindValidZBuf ? "Couldnt find valid zbuffer format to go with FullScreen mode" : "No supported FullScreen modes")
-            << " at " << dwRenderWidth << "x" << dwRenderHeight << " for device #" << _wcontext.CardIDNum << endl;
+            << " at " << dwRenderWidth << "x" << dwRenderHeight << " for device #" << _wcontext._card_id << endl;
 
           // if it failed because of a size constraints (for non-default case), try with default size
           if (!bUseDefaultSize) {
@@ -1007,7 +1007,7 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
           // run it again in verbose mode to get more dbg info to log
           dxpipe->search_for_valid_displaymode(_wcontext, dwRenderWidth, dwRenderHeight,
                                                bNeedZBuffer, bWantStencil,
-                                               &_wcontext.SupportedScreenDepthsMask,
+                                               &_wcontext._supported_screen_depths_mask,
                                                &bCouldntFindValidZBuf,
                                                &pixFmt, dx_force_16bpp_zbuffer, true);
 
@@ -1028,28 +1028,28 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
 
       dxpipe->search_for_valid_displaymode(_wcontext, dwRenderWidth, dwRenderHeight,
                                            bNeedZBuffer, bWantStencil,
-                                           &_wcontext.SupportedScreenDepthsMask,
+                                           &_wcontext._supported_screen_depths_mask,
                                            &bCouldntFindValidZBuf,
                                            &pixFmt, dx_force_16bpp_zbuffer);
 
       // hack: figuring out exactly what res to use is tricky, instead I will
       // just use 640x480 if we have < 3 meg avail
 
-      if (_wcontext.SupportedScreenDepthsMask & R5G6B5_FLAG) {
+      if (_wcontext._supported_screen_depths_mask & R5G6B5_FLAG) {
         pixFmt = D3DFMT_R5G6B5;
-      } else if (_wcontext.SupportedScreenDepthsMask & X1R5G5B5_FLAG) {
+      } else if (_wcontext._supported_screen_depths_mask & X1R5G5B5_FLAG) {
         pixFmt = D3DFMT_X1R5G5B5;
       } else {
         wdxdisplay8_cat.fatal()
           << "Low Memory VidCard has no supported FullScreen 16bpp resolutions at "
           << dwRenderWidth << "x" << dwRenderHeight << " for device #"
           << device_info->cardID << " ("
-          << _wcontext.DXDeviceID.Description << "), skipping device...\n";
+          << _wcontext._dx_device_id.Description << "), skipping device...\n";
 
         // run it again in verbose mode to get more dbg info to log
         dxpipe->search_for_valid_displaymode(_wcontext, dwRenderWidth, dwRenderHeight,
                                              bNeedZBuffer, bWantStencil,
-                                             &_wcontext.SupportedScreenDepthsMask,
+                                             &_wcontext._supported_screen_depths_mask,
                                              &bCouldntFindValidZBuf,
                                              &pixFmt, dx_force_16bpp_zbuffer,
                                              true /* verbose mode on*/);
@@ -1058,7 +1058,7 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
 
       if (wdxdisplay8_cat.is_info()) {
         wdxdisplay8_cat.info()
-          << "Available VidMem (" << _wcontext.MaxAvailVidMem
+          << "Available VidMem (" << _wcontext._max_available_video_memory
           << ") is under threshold, using 640x480 16bpp rendertargets to save tex vidmem.\n";
       }
     }
@@ -1066,7 +1066,7 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
     // Windowed Mode
 
     D3DDISPLAYMODE dispmode;
-    hr = pD3D8->GetAdapterDisplayMode(device_info->cardID, &dispmode);
+    hr = _d3d8->GetAdapterDisplayMode(device_info->cardID, &dispmode);
     if (FAILED(hr)) {
       wdxdisplay8_cat.error()
         << "GetAdapterDisplayMode(" << device_info->cardID
@@ -1076,11 +1076,11 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
     pixFmt = dispmode.Format;
   }
 
-  _wcontext.DisplayMode.Width = dwRenderWidth;
-  _wcontext.DisplayMode.Height = dwRenderHeight;
-  _wcontext.DisplayMode.Format = pixFmt;
-  _wcontext.DisplayMode.RefreshRate = D3DPRESENT_RATE_DEFAULT;
-  _wcontext.hMon = device_info->hMon;
+  _wcontext._display_mode.Width = dwRenderWidth;
+  _wcontext._display_mode.Height = dwRenderHeight;
+  _wcontext._display_mode.Format = pixFmt;
+  _wcontext._display_mode.RefreshRate = D3DPRESENT_RATE_DEFAULT;
+  _wcontext._monitor = device_info->_monitor;
 
   if (dwRenderWidth != properties.get_x_size() ||
       dwRenderHeight != properties.get_y_size()) {
@@ -1119,19 +1119,19 @@ reset_device_resize_window(UINT new_xsize, UINT new_ysize) {
 
   DXScreenData *pScrn;
   D3DPRESENT_PARAMETERS d3dpp;
-  memcpy(&d3dpp, &_wcontext.PresParams, sizeof(D3DPRESENT_PARAMETERS));
-  _wcontext.PresParams.BackBufferWidth = new_xsize;
-  _wcontext.PresParams.BackBufferHeight = new_ysize;
+  memcpy(&d3dpp, &_wcontext._presentation_params, sizeof(D3DPRESENT_PARAMETERS));
+  _wcontext._presentation_params.BackBufferWidth = new_xsize;
+  _wcontext._presentation_params.BackBufferHeight = new_ysize;
   make_current();
-  HRESULT hr = _dxgsg->reset_d3d_device(&_wcontext.PresParams, &pScrn);
+  HRESULT hr = _dxgsg->reset_d3d_device(&_wcontext._presentation_params, &pScrn);
 
   if (FAILED(hr)) {
     bRetval = false;
     wdxdisplay8_cat.error()
       << "reset_device_resize_window Reset() failed" << D3DERRORSTRING(hr);
     if (hr == D3DERR_OUTOFVIDEOMEMORY) {
-      memcpy(&_wcontext.PresParams, &d3dpp, sizeof(D3DPRESENT_PARAMETERS));
-      hr = _dxgsg->reset_d3d_device(&_wcontext.PresParams, &pScrn);
+      memcpy(&_wcontext._presentation_params, &d3dpp, sizeof(D3DPRESENT_PARAMETERS));
+      hr = _dxgsg->reset_d3d_device(&_wcontext._presentation_params, &pScrn);
       if (FAILED(hr)) {
         wdxdisplay8_cat.error()
           << "reset_device_resize_window Reset() failed OutOfVidmem, then failed again doing Reset w/original params:" << D3DERRORSTRING(hr);
@@ -1141,8 +1141,8 @@ reset_device_resize_window(UINT new_xsize, UINT new_ysize) {
       } else {
         if (wdxdisplay8_cat.is_info()) {
           wdxdisplay8_cat.info()
-            << "reset of original size (" << _wcontext.PresParams.BackBufferWidth
-            << ", " << _wcontext.PresParams.BackBufferHeight << ") succeeded\n";
+            << "reset of original size (" << _wcontext._presentation_params.BackBufferWidth
+            << ", " << _wcontext._presentation_params.BackBufferHeight << ") succeeded\n";
         }
       }
     } else {
@@ -1154,8 +1154,8 @@ reset_device_resize_window(UINT new_xsize, UINT new_ysize) {
   }
   // before you init_resized_window you need to copy certain changes to _wcontext
   if (pScrn)
-    _wcontext.pSwapChain = pScrn->pSwapChain;
-  wdxdisplay8_cat.debug() << "swapchain is " << _wcontext.pSwapChain << "\n";
+    _wcontext._swap_chain = pScrn->_swap_chain;
+  wdxdisplay8_cat.debug() << "swapchain is " << _wcontext._swap_chain << "\n";
   init_resized_window();
   return bRetval;
 }
@@ -1168,32 +1168,32 @@ reset_device_resize_window(UINT new_xsize, UINT new_ysize) {
 //
 //               Assumes CreateDevice or Device->Reset() has just been
 //               called, and the new size is specified in
-//               _wcontext.PresParams.
+//               _wcontext._presentation_params.
 ////////////////////////////////////////////////////////////////////
 void wdxGraphicsWindow8::
 init_resized_window() {
   HRESULT hr;
 
-  DWORD newWidth = _wcontext.PresParams.BackBufferWidth;
-  DWORD newHeight = _wcontext.PresParams.BackBufferHeight;
+  DWORD newWidth = _wcontext._presentation_params.BackBufferWidth;
+  DWORD newHeight = _wcontext._presentation_params.BackBufferHeight;
 
   assert((newWidth != 0) && (newHeight != 0));
-  assert(_wcontext.hWnd != NULL);
+  assert(_wcontext._window != NULL);
 
-  if (_wcontext.PresParams.Windowed) {
+  if (_wcontext._presentation_params.Windowed) {
     POINT ul, lr;
     RECT client_rect;
 
     // need to figure out x, y origin offset of window client area on screen
     // (we already know the client area size)
 
-    GetClientRect(_wcontext.hWnd, &client_rect);
+    GetClientRect(_wcontext._window, &client_rect);
     ul.x = client_rect.left;
     ul.y = client_rect.top;
     lr.x = client_rect.right;
     lr.y = client_rect.bottom;
-    ClientToScreen(_wcontext.hWnd, &ul);
-    ClientToScreen(_wcontext.hWnd, &lr);
+    ClientToScreen(_wcontext._window, &ul);
+    ClientToScreen(_wcontext._window, &lr);
     client_rect.left = ul.x;
     client_rect.top = ul.y;
     client_rect.right = lr.x;
@@ -1201,15 +1201,15 @@ init_resized_window() {
   }
 
   // clear window to black ASAP
-  assert(_wcontext.hWnd != NULL);
-  ClearToBlack(_wcontext.hWnd, get_properties());
+  assert(_wcontext._window != NULL);
+  ClearToBlack(_wcontext._window, get_properties());
 
   // clear textures and VB's out of video&AGP mem, so cache is reset
-  hr = _wcontext.pD3DDevice->ResourceManagerDiscardBytes(0);
+  hr = _wcontext._d3d_device->ResourceManagerDiscardBytes(0);
   if (FAILED(hr)) {
     wdxdisplay8_cat.error()
       << "ResourceManagerDiscardBytes failed for device #"
-      << _wcontext.CardIDNum << D3DERRORSTRING(hr);
+      << _wcontext._card_id << D3DERRORSTRING(hr);
   }
 
   make_current();

+ 1 - 1
panda/src/dxgsg8/wdxGraphicsWindow8.h

@@ -61,7 +61,7 @@ private:
     char szDescription[MAX_DEVICE_IDENTIFIER_STRING];
     GUID guidDeviceIdentifier;
     DWORD VendorID, DeviceID;
-    HMONITOR hMon;
+    HMONITOR _monitor;
   };
   typedef pvector<DXDeviceInfo> DXDeviceInfoVec;
 

Some files were not shown because too many files changed in this diff