mirror of https://github.com/AxioDL/boo.git
Fix D3D DXT3 loading
This commit is contained in:
parent
af50240143
commit
8b0927ead0
|
@ -141,6 +141,7 @@ class D3D11TextureS : public GraphicsDataNode<ITextureS> {
|
||||||
DXGI_FORMAT pfmt = DXGI_FORMAT_UNKNOWN;
|
DXGI_FORMAT pfmt = DXGI_FORMAT_UNKNOWN;
|
||||||
int pxPitchNum = 1;
|
int pxPitchNum = 1;
|
||||||
int pxPitchDenom = 1;
|
int pxPitchDenom = 1;
|
||||||
|
int pxTilePitch = 0;
|
||||||
bool compressed = false;
|
bool compressed = false;
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case TextureFormat::RGBA8:
|
case TextureFormat::RGBA8:
|
||||||
|
@ -159,12 +160,14 @@ class D3D11TextureS : public GraphicsDataNode<ITextureS> {
|
||||||
compressed = true;
|
compressed = true;
|
||||||
pxPitchNum = 1;
|
pxPitchNum = 1;
|
||||||
pxPitchDenom = 2;
|
pxPitchDenom = 2;
|
||||||
|
pxTilePitch = 2;
|
||||||
break;
|
break;
|
||||||
case TextureFormat::DXT3:
|
case TextureFormat::DXT3:
|
||||||
pfmt = DXGI_FORMAT_BC2_UNORM;
|
pfmt = DXGI_FORMAT_BC2_UNORM;
|
||||||
compressed = true;
|
compressed = true;
|
||||||
pxPitchNum = 1;
|
pxPitchNum = 1;
|
||||||
pxPitchDenom = 1;
|
pxPitchDenom = 1;
|
||||||
|
pxTilePitch = 4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Fatal, "unsupported tex format");
|
Log.report(logvisor::Fatal, "unsupported tex format");
|
||||||
|
@ -179,7 +182,7 @@ class D3D11TextureS : public GraphicsDataNode<ITextureS> {
|
||||||
upData[i].SysMemPitch = width * pxPitchNum / pxPitchDenom;
|
upData[i].SysMemPitch = width * pxPitchNum / pxPitchDenom;
|
||||||
upData[i].SysMemSlicePitch = upData[i].SysMemPitch * height;
|
upData[i].SysMemSlicePitch = upData[i].SysMemPitch * height;
|
||||||
if (compressed)
|
if (compressed)
|
||||||
upData[i].SysMemPitch = width * 2;
|
upData[i].SysMemPitch = width * pxTilePitch;
|
||||||
dataIt += upData[i].SysMemSlicePitch;
|
dataIt += upData[i].SysMemSlicePitch;
|
||||||
if (width > 1)
|
if (width > 1)
|
||||||
width /= 2;
|
width /= 2;
|
||||||
|
|
Loading…
Reference in New Issue