Bladeren bron

Added handling for dirty box.

bkaradzic 13 jaren geleden
bovenliggende
commit
42653612cf
2 gewijzigde bestanden met toevoegingen van 14 en 4 verwijderingen
  1. 13 3
      src/renderer_d3d9.cpp
  2. 1 1
      src/renderer_d3d9.h

+ 13 - 3
src/renderer_d3d9.cpp

@@ -1352,7 +1352,7 @@ namespace bgfx
 		BX_CHECK(false, "You should not be here.");
 	}
 
-	void Texture::dirty(uint8_t _side, const Rect& _rect)
+	void Texture::dirty(uint8_t _side, const Rect& _rect, uint16_t _z, uint16_t _depth)
 	{
 		switch (m_type)
 		{
@@ -1369,7 +1369,14 @@ namespace bgfx
 
 		case Texture3D:
 			{
-//				DX_CHECK(m_texture3d->AddDirtyRect(_box) );
+				D3DBOX box;
+				box.Left = _rect.m_x;
+				box.Top = _rect.m_y;
+				box.Right = box.Left + _rect.m_width;
+				box.Bottom = box.Top + _rect.m_height;
+				box.Front = _z;
+				box.Back = box.Front + _depth;
+				DX_CHECK(m_texture3d->AddDirtyBox(&box) );
 			}
 			return;
 
@@ -1619,7 +1626,10 @@ namespace bgfx
 			}
 		}
 
-		dirty(_side, _rect);
+		if (0 == _mip)
+		{
+			dirty(_side, _rect, _z, _depth);
+		}
 	}
 
 	void Texture::updateEnd()

+ 1 - 1
src/renderer_d3d9.h

@@ -320,7 +320,7 @@ namespace bgfx
 
 		uint8_t* lock(uint8_t _side, uint8_t _lod, uint32_t& _pitch, uint32_t& _slicePitch, const Rect* _rect = NULL);
 		void unlock(uint8_t _side, uint8_t _lod);
-		void dirty(uint8_t _side, const Rect& _rect);
+		void dirty(uint8_t _side, const Rect& _rect, uint16_t _z, uint16_t _depth);
 
 		void create(const Memory* _mem, uint32_t _flags);