Skip to content

Commit

Permalink
d3dtrace: Fix size computation for full DXTC locks.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfonseca committed Jul 13, 2015
1 parent 46584ea commit 2ec73fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion helpers/d3d8size.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ _getFormatSize(D3DFORMAT Format, size_t & BlockSize, UINT & BlockWidth, UINT & B
default:
os::log("apitrace: warning: %s: unknown D3DFMT %u\n", __FUNCTION__, Format);
BlockWidth = 0;
BlockHeight = 0;
break;
}
}
Expand Down
2 changes: 0 additions & 2 deletions helpers/d3d9size.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ _getFormatSize(D3DFORMAT Format, size_t & BlockSize, UINT & BlockWidth, UINT & B
* Height * RowPitch will match the expected size.
*/
BlockWidth = 0;
BlockHeight = 0;
BlockSize = 0;
break;

Expand All @@ -182,7 +181,6 @@ _getFormatSize(D3DFORMAT Format, size_t & BlockSize, UINT & BlockWidth, UINT & B
default:
os::log("apitrace: warning: %s: unknown D3DFMT %u\n", __FUNCTION__, Format);
BlockWidth = 0;
BlockHeight = 0;
break;
}
}
Expand Down
16 changes: 8 additions & 8 deletions helpers/d3dcommonsize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,19 @@ _getLockSize(D3DFORMAT Format, bool Partial, UINT Width, UINT Height, INT RowPit
// Planar YUV
size = (Height + (Height + 1)/2) * RowPitch;
} else {
size_t BlockSize;
UINT BlockWidth;
UINT BlockHeight;
_getFormatSize(Format, BlockSize, BlockWidth, BlockHeight);
assert(BlockHeight);
Height = (Height + BlockHeight - 1) / BlockHeight;

size = Height * RowPitch;

if (Partial || Height == 1) {
// Must take pixel size in consideration

size_t BlockSize;
UINT BlockWidth;
UINT BlockHeight;
_getFormatSize(Format, BlockSize, BlockWidth, BlockHeight);

if (BlockWidth && BlockHeight) {
if (BlockWidth) {
Width = (Width + BlockWidth - 1) / BlockWidth;
Height = (Height + BlockHeight - 1) / BlockHeight;
size = (Width * BlockSize + 7)/ 8;
if (Height > 1) {
size += (Height - 1) * RowPitch;
Expand Down

0 comments on commit 2ec73fa

Please sign in to comment.