From 8b0927ead0a13f0fcb1305688997191b026a9190 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 3 Mar 2019 13:03:01 -1000 Subject: [PATCH] Fix D3D DXT3 loading --- lib/graphicsdev/D3D11.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/graphicsdev/D3D11.cpp b/lib/graphicsdev/D3D11.cpp index 267a794..d24025b 100644 --- a/lib/graphicsdev/D3D11.cpp +++ b/lib/graphicsdev/D3D11.cpp @@ -141,6 +141,7 @@ class D3D11TextureS : public GraphicsDataNode { DXGI_FORMAT pfmt = DXGI_FORMAT_UNKNOWN; int pxPitchNum = 1; int pxPitchDenom = 1; + int pxTilePitch = 0; bool compressed = false; switch (fmt) { case TextureFormat::RGBA8: @@ -159,12 +160,14 @@ class D3D11TextureS : public GraphicsDataNode { compressed = true; pxPitchNum = 1; pxPitchDenom = 2; + pxTilePitch = 2; break; case TextureFormat::DXT3: pfmt = DXGI_FORMAT_BC2_UNORM; compressed = true; pxPitchNum = 1; pxPitchDenom = 1; + pxTilePitch = 4; break; default: Log.report(logvisor::Fatal, "unsupported tex format"); @@ -179,7 +182,7 @@ class D3D11TextureS : public GraphicsDataNode { upData[i].SysMemPitch = width * pxPitchNum / pxPitchDenom; upData[i].SysMemSlicePitch = upData[i].SysMemPitch * height; if (compressed) - upData[i].SysMemPitch = width * 2; + upData[i].SysMemPitch = width * pxTilePitch; dataIt += upData[i].SysMemSlicePitch; if (width > 1) width /= 2;