mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-08 16:01:42 +12:00
move linear to swizzle and get_size_type
symbol undef though
This commit is contained in:
parent
3de47c201c
commit
6f71d04aa4
7 changed files with 76 additions and 71 deletions
|
@ -7,37 +7,6 @@
|
|||
|
||||
#define MAX2(a, b) ((a) > (b)) ? (a) : (b)
|
||||
|
||||
unsigned LinearToSwizzleAddress(unsigned x, unsigned y, unsigned z, unsigned log2_width, unsigned log2_height, unsigned log2_depth)
|
||||
{
|
||||
unsigned offset = 0;
|
||||
unsigned shift_count = 0;
|
||||
while (log2_width | log2_height | log2_depth) {
|
||||
if (log2_width)
|
||||
{
|
||||
offset |= (x & 0x01) << shift_count;
|
||||
x >>= 1;
|
||||
++shift_count;
|
||||
--log2_width;
|
||||
}
|
||||
if (log2_height)
|
||||
{
|
||||
offset |= (y & 0x01) << shift_count;
|
||||
y >>= 1;
|
||||
++shift_count;
|
||||
--log2_height;
|
||||
}
|
||||
if (log2_depth)
|
||||
{
|
||||
offset |= (z & 0x01) << shift_count;
|
||||
z >>= 1;
|
||||
++shift_count;
|
||||
--log2_depth;
|
||||
}
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write data, assume src pixels are packed but not mipmaplevel
|
||||
*/
|
||||
|
@ -101,7 +70,7 @@ writeTexelsSwizzled(const char *src, char *dst, size_t widthInBlock, size_t heig
|
|||
|
||||
for (int row = 0; row < currentHeight; row++)
|
||||
for (int j = 0; j < currentWidth; j++)
|
||||
castedDst[(row * rowPitch / 4) + j] = castedSrc[LinearToSwizzleAddress(j, row, 0, log2width, log2height, 0)];
|
||||
castedDst[(row * rowPitch / 4) + j] = castedSrc[rsx::linear_to_swizzle(j, row, 0, log2width, log2height, 0)];
|
||||
|
||||
offsetInDst += currentHeight * rowPitch;
|
||||
offsetInSrc += currentHeight * widthInBlock * blockSize;
|
||||
|
@ -176,7 +145,7 @@ write16bTexelsSwizzled(const char *src, char *dst, size_t widthInBlock, size_t h
|
|||
|
||||
for (int row = 0; row < currentHeight; row++)
|
||||
for (int j = 0; j < currentWidth; j++)
|
||||
castedDst[(row * rowPitch / 2) + j] = castedSrc[LinearToSwizzleAddress(j, row, 0, log2width, log2height, 0)];
|
||||
castedDst[(row * rowPitch / 2) + j] = castedSrc[rsx::linear_to_swizzle(j, row, 0, log2width, log2height, 0)];
|
||||
|
||||
offsetInDst += currentHeight * rowPitch;
|
||||
offsetInSrc += currentHeight * widthInBlock * blockSize;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue