Fix DXT2 & DXT4 support for d3d8.
This commit is contained in:
parent
ed8379d1ad
commit
9a86a0b046
|
@ -167,11 +167,12 @@ HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKE
|
|||
}
|
||||
|
||||
/* DXTn formats don't have exact pitches as they are to the new row of blocks,
|
||||
where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt3/5)
|
||||
where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt2/3/4/5)
|
||||
ie pitch = (width/4) * bytes per block */
|
||||
if (This->myDesc.Format == D3DFMT_DXT1) /* DXT1 is 8 bytes per block */
|
||||
pLockedRect->Pitch = (This->myDesc.Width/4) * 8;
|
||||
else if (This->myDesc.Format == D3DFMT_DXT3 || This->myDesc.Format == D3DFMT_DXT5) /* DXT3/5 is 16 bytes per block */
|
||||
else if (This->myDesc.Format == D3DFMT_DXT2 || This->myDesc.Format == D3DFMT_DXT3 ||
|
||||
This->myDesc.Format == D3DFMT_DXT4 || This->myDesc.Format == D3DFMT_DXT5) /* DXT2/3/4/5 is 16 bytes per block */
|
||||
pLockedRect->Pitch = (This->myDesc.Width/4) * 16;
|
||||
else
|
||||
pLockedRect->Pitch = This->bytesPerPixel * This->myDesc.Width; /* Bytes / row */
|
||||
|
@ -495,7 +496,8 @@ HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, UINT
|
|||
if (gl_level != 0)
|
||||
FIXME("Surface in texture is only supported for level 0\n");
|
||||
else if (This->myDesc.Format == D3DFMT_P8 || This->myDesc.Format == D3DFMT_A8P8 ||
|
||||
This->myDesc.Format == D3DFMT_DXT1 || This->myDesc.Format == D3DFMT_DXT3 ||
|
||||
This->myDesc.Format == D3DFMT_DXT1 || This->myDesc.Format == D3DFMT_DXT2 ||
|
||||
This->myDesc.Format == D3DFMT_DXT3 || This->myDesc.Format == D3DFMT_DXT4 ||
|
||||
This->myDesc.Format == D3DFMT_DXT5)
|
||||
FIXME("Format %d not supported\n", This->myDesc.Format);
|
||||
else {
|
||||
|
@ -568,7 +570,9 @@ HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, UINT
|
|||
}
|
||||
|
||||
if (This->myDesc.Format == D3DFMT_DXT1 ||
|
||||
This->myDesc.Format == D3DFMT_DXT2 ||
|
||||
This->myDesc.Format == D3DFMT_DXT3 ||
|
||||
This->myDesc.Format == D3DFMT_DXT4 ||
|
||||
This->myDesc.Format == D3DFMT_DXT5) {
|
||||
if (GL_SUPPORT_DEV(EXT_TEXTURE_COMPRESSION_S3TC, This->Device)) {
|
||||
TRACE("Calling glCompressedTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,0=%d, sz=%d, Mem=%p\n",
|
||||
|
|
|
@ -406,7 +406,9 @@ SHORT D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
|||
case D3DFMT_X8L8V8U8: retVal = 4; break;
|
||||
/* Compressed */
|
||||
case D3DFMT_DXT1: retVal = 1; break; /* Actually 8 bytes per 16 pixels - Special cased later */
|
||||
case D3DFMT_DXT2: retVal = 1; break; /* Actually 16 bytes per 16 pixels */
|
||||
case D3DFMT_DXT3: retVal = 1; break; /* Actually 16 bytes per 16 pixels */
|
||||
case D3DFMT_DXT4: retVal = 1; break; /* Actually 16 bytes per 16 pixels */
|
||||
case D3DFMT_DXT5: retVal = 1; break; /* Actually 16 bytes per 16 pixels */
|
||||
/* to see */
|
||||
case D3DFMT_A8: retVal = 1; break;
|
||||
|
@ -431,7 +433,9 @@ GLint D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
|||
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
|
||||
switch (fmt) {
|
||||
case D3DFMT_DXT1: retVal = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break;
|
||||
case D3DFMT_DXT2: retVal = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break;
|
||||
case D3DFMT_DXT3: retVal = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break;
|
||||
case D3DFMT_DXT4: retVal = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
|
||||
case D3DFMT_DXT5: retVal = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
|
||||
default:
|
||||
/* stupid compiler */
|
||||
|
@ -480,7 +484,9 @@ GLenum D3DFmt2GLFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
|||
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
|
||||
switch (fmt) {
|
||||
case D3DFMT_DXT1: retVal = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break;
|
||||
case D3DFMT_DXT2: retVal = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break;
|
||||
case D3DFMT_DXT3: retVal = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break;
|
||||
case D3DFMT_DXT4: retVal = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
|
||||
case D3DFMT_DXT5: retVal = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
|
||||
default:
|
||||
/* stupid compiler */
|
||||
|
@ -530,7 +536,9 @@ GLenum D3DFmt2GLType(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
|||
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
|
||||
switch (fmt) {
|
||||
case D3DFMT_DXT1: retVal = 0; break;
|
||||
case D3DFMT_DXT2: retVal = 0; break;
|
||||
case D3DFMT_DXT3: retVal = 0; break;
|
||||
case D3DFMT_DXT4: retVal = 0; break;
|
||||
case D3DFMT_DXT5: retVal = 0; break;
|
||||
default:
|
||||
/* stupid compiler */
|
||||
|
|
Loading…
Reference in New Issue