Browse Source

small tweak

cxgeorge 24 years ago
parent
commit
67d1054ec7

+ 29 - 36
panda/src/dxgsg/dxGraphicsStateGuardian.cxx

@@ -3980,35 +3980,38 @@ apply_texture(TextureContext *tc) {
 
 
     int dirty = dtc->get_dirty_flags();
     int dirty = dtc->get_dirty_flags();
 
 
-    if( _pCurTexContext == dtc && dirty == 0) {
-        return;  // tex already set (and possible problem in state-sorting?)
-    }
-
-    // If the texture image has changed, or if its use of mipmaps has
-    // changed, we need to re-create the image.
-    if ((dirty & (Texture::DF_image | Texture::DF_mipmap)) != 0) {
-      // If this is *only* because of a mipmap change, issue a
-      // warning--it is likely that this change is the result of an
-      // error or oversight.
-      if ((dirty & Texture::DF_image) == 0) {
-        dxgsg_cat.warning()
-          << "Texture " << *dtc->_texture << " has changed mipmap state.\n";
-      }
-
-      dtc->DeleteTexture();
-      if (dtc->CreateTexture(_d3dDevice,_cNumTexPixFmts,_pTexPixFmts) == NULL) {
-        // Oops, we can't re-create the texture for some reason.
-        dxgsg_cat.error()
-          << "Unable to re-create texture " << *dtc->_texture << endl;
-
-        release_texture(dtc);
-        enable_texturing(false);
-        return;
+    if (dirty) {
+      // If the texture image has changed, or if its use of mipmaps has
+      // changed, we need to re-create the image.  Ignore other types of 
+      // changes, which arent significant for dx
+
+      if((dirty & (Texture::DF_image | Texture::DF_mipmap)) != 0) {
+          // If this is *only* because of a mipmap change, issue a
+          // warning--it is likely that this change is the result of an
+          // error or oversight.
+          if ((dirty & Texture::DF_image) == 0) {
+            dxgsg_cat.warning()
+              << "Texture " << *dtc->_texture << " has changed mipmap state.\n";
+          }
+    
+          dtc->DeleteTexture();
+          if (dtc->CreateTexture(_d3dDevice,_cNumTexPixFmts,_pTexPixFmts) == NULL) {
+            // Oops, we can't re-create the texture for some reason.
+            dxgsg_cat.error()
+              << "Unable to re-create texture " << *dtc->_texture << endl;
+    
+            release_texture(dtc);
+            enable_texturing(false);
+            return;
+          }
       }
       }
+      dtc->clear_dirty_flags();
+    } else {
+       if(_pCurTexContext == dtc) {
+          return;  // tex already set (and possible problem in state-sorting?)
+       }
     }
     }
 
 
-    dtc->clear_dirty_flags();
-
     Texture *tex = tc->_texture;
     Texture *tex = tc->_texture;
     Texture::WrapMode wrapU,wrapV;
     Texture::WrapMode wrapU,wrapV;
     wrapU=tex->get_wrapu();
     wrapU=tex->get_wrapu();
@@ -4023,16 +4026,6 @@ apply_texture(TextureContext *tc) {
         _CurTexWrapModeV = wrapV;
         _CurTexWrapModeV = wrapV;
     }
     }
 
 
-/*
-#ifdef _DEBUG
-    Texture::WrapMode wrapval;
-    _d3dDevice->GetTextureStageState(0,D3DTSS_ADDRESSU,(DWORD*)&wrapval);
-    assert(get_texture_wrap_mode(wrapU) == wrapval);
-    _d3dDevice->GetTextureStageState(0,D3DTSS_ADDRESSV,(DWORD*)&wrapval);
-    assert(get_texture_wrap_mode(wrapV) == wrapval);
-#endif
-*/
-
     uint aniso_degree=tex->get_anisotropic_degree();
     uint aniso_degree=tex->get_anisotropic_degree();
     Texture::FilterType ft=tex->get_magfilter();
     Texture::FilterType ft=tex->get_magfilter();
 
 

+ 0 - 2
panda/src/dxgsg/dxGraphicsStateGuardian.h

@@ -241,8 +241,6 @@ protected:
   void set_draw_buffer(const RenderBuffer &rb);
   void set_draw_buffer(const RenderBuffer &rb);
   void set_read_buffer(const RenderBuffer &rb);
   void set_read_buffer(const RenderBuffer &rb);
 
 
-  void bind_texture(TextureContext *tc);
-
   // for storage of the flexible vertex format
   // for storage of the flexible vertex format
   char *_pCurFvfBufPtr,*_pFvfBufBasePtr;
   char *_pCurFvfBufPtr,*_pFvfBufBasePtr;
   INLINE void add_to_FVFBuf(void *data,  size_t bytes) ;
   INLINE void add_to_FVFBuf(void *data,  size_t bytes) ;