diff options
author | CrystalPT <CrystalPT@svn> | 2010-09-10 04:49:49 +0000 |
---|---|---|
committer | CrystalPT <CrystalPT@svn> | 2010-09-10 04:49:49 +0000 |
commit | 603fd537535c426586843f8ee1fe8146c57dc180 (patch) | |
tree | 2f7c44cfe84c1a31bf99af12f3faf9a7be271847 | |
parent | a81a668ce1dd9d251b59f8e02b810d839da25c6d (diff) |
[WIN32] workaround Intel compressed texture issue
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@33651 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | guilib/Texture.cpp | 16 | ||||
-rw-r--r-- | xbmc/RenderSystem.cpp | 1 | ||||
-rw-r--r-- | xbmc/RenderSystem.h | 2 | ||||
-rw-r--r-- | xbmc/RenderSystemDX.cpp | 14 |
4 files changed, 26 insertions, 7 deletions
diff --git a/guilib/Texture.cpp b/guilib/Texture.cpp index a45dc5fb1f..3f2a5b22dd 100644 --- a/guilib/Texture.cpp +++ b/guilib/Texture.cpp @@ -53,15 +53,17 @@ void CBaseTexture::Allocate(unsigned int width, unsigned int height, unsigned in m_format = format; m_orientation = 0; + m_textureWidth = m_imageWidth; + m_textureHeight = m_imageHeight; + + if (m_format & XB_FMT_DXT_MASK) + while (GetPitch() < g_Windowing.GetMinDXTPitch()) + m_textureWidth += GetBlockSize(); + if (!g_Windowing.SupportsNPOT((m_format & XB_FMT_DXT_MASK) != 0)) { - m_textureWidth = PadPow2(m_imageWidth); - m_textureHeight = PadPow2(m_imageHeight); - } - else - { - m_textureWidth = m_imageWidth; - m_textureHeight = m_imageHeight; + m_textureWidth = PadPow2(m_textureWidth); + m_textureHeight = PadPow2(m_textureHeight); } if (m_format & XB_FMT_DXT_MASK) { // DXT textures must be a multiple of 4 in width and height diff --git a/xbmc/RenderSystem.cpp b/xbmc/RenderSystem.cpp index df40282f6d..6dc7e04390 100644 --- a/xbmc/RenderSystem.cpp +++ b/xbmc/RenderSystem.cpp @@ -29,6 +29,7 @@ CRenderSystemBase::CRenderSystemBase() m_RenderVersionMajor = 0; m_RenderVersionMinor = 0; m_renderCaps = 0; + m_minDXTPitch = 0; } CRenderSystemBase::~CRenderSystemBase() diff --git a/xbmc/RenderSystem.h b/xbmc/RenderSystem.h index 0bed30726d..6184bf746c 100644 --- a/xbmc/RenderSystem.h +++ b/xbmc/RenderSystem.h @@ -93,12 +93,14 @@ public: bool SupportsDXT() const; bool SupportsNPOT(bool dxt) const; unsigned int GetMaxTextureSize() const { return m_maxTextureSize; } + unsigned int GetMinDXTPitch() const { return m_minDXTPitch; } protected: bool m_bRenderCreated; RenderingSystemType m_enumRenderingSystem; bool m_bVSync; unsigned int m_maxTextureSize; + unsigned int m_minDXTPitch; CStdString m_RenderRenderer; CStdString m_RenderVendor; diff --git a/xbmc/RenderSystemDX.cpp b/xbmc/RenderSystemDX.cpp index cfc857ddfc..05f084ef49 100644 --- a/xbmc/RenderSystemDX.cpp +++ b/xbmc/RenderSystemDX.cpp @@ -501,6 +501,20 @@ bool CRenderSystemDX::CreateDevice() m_renderCaps &= ~RENDER_CAPS_DXT_NPOT; } + // Intel quirk: DXT texture pitch must be > 64 + // when using D3DPOOL_DEFAULT + D3DUSAGE_DYNAMIC textures (no other choice with D3D9Ex) + // DXT1: 32 pixels wide is the largest non-working texture width + // DXT3/5: 16 pixels wide ---------------------------------------- + // Both equal to a pitch of 64. So far no Intel has DXT NPOT (including i3/i5/i7, so just go with the next higher POT. + // See ticket #9578 +// if(m_defaultD3DUsage == D3DUSAGE_DYNAMIC +// && m_defaultD3DPool == D3DPOOL_DEFAULT +// && AIdentifier.VendorId == 32902) + { + CLog::Log(LOGDEBUG, __FUNCTION__" - Intel workaround - specifying minimum pitch for compressed textures."); + m_minDXTPitch = 128; + } + D3DDISPLAYMODE mode; if (SUCCEEDED(m_pD3DDevice->GetDisplayMode(0, &mode))) m_screenHeight = mode.Height; |