From 42653612cf388d99b071028a994c55b1d0085219 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Sat, 2 Mar 2013 23:20:28 -0800 Subject: [PATCH] Added handling for dirty box. --- src/renderer_d3d9.cpp | 16 +++++++++++++--- src/renderer_d3d9.h | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 8da29a019..a528f0b0c 100644 --- a/src/renderer_d3d9.cpp +++ b/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() diff --git a/src/renderer_d3d9.h b/src/renderer_d3d9.h index d9c412830..ad532e5ed 100644 --- a/src/renderer_d3d9.h +++ b/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);