mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Remove 2xSAI support.
This commit is contained in:
parent
f7e0aa6e10
commit
21b40c7a6c
647
2xSAI.cpp
647
2xSAI.cpp
|
@ -1,647 +0,0 @@
|
|||
#include "Types.h"
|
||||
#include "GBI.h"
|
||||
|
||||
static inline s16 GetResult1( u32 A, u32 B, u32 C, u32 D, u32 E )
|
||||
{
|
||||
s16 x = 0;
|
||||
s16 y = 0;
|
||||
s16 r = 0;
|
||||
|
||||
if (A == C) x += 1; else if (B == C) y += 1;
|
||||
if (A == D) x += 1; else if (B == D) y += 1;
|
||||
if (x <= 1) r += 1;
|
||||
if (y <= 1) r -= 1;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline s16 GetResult2( u32 A, u32 B, u32 C, u32 D, u32 E)
|
||||
{
|
||||
s16 x = 0;
|
||||
s16 y = 0;
|
||||
s16 r = 0;
|
||||
|
||||
if (A == C) x += 1; else if (B == C) y += 1;
|
||||
if (A == D) x += 1; else if (B == D) y += 1;
|
||||
if (x <= 1) r -= 1;
|
||||
if (y <= 1) r += 1;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static inline s16 GetResult( u32 A, u32 B, u32 C, u32 D )
|
||||
{
|
||||
s16 x = 0;
|
||||
s16 y = 0;
|
||||
s16 r = 0;
|
||||
|
||||
if (A == C) x += 1; else if (B == C) y += 1;
|
||||
if (A == D) x += 1; else if (B == D) y += 1;
|
||||
if (x <= 1) r += 1;
|
||||
if (y <= 1) r -= 1;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline u16 INTERPOLATE4444( u16 A, u16 B)
|
||||
{
|
||||
if (A != B)
|
||||
return ((A & 0xEEEE) >> 1) +
|
||||
((B & 0xEEEE) >> 1) |
|
||||
(A & B & 0x1111);
|
||||
else
|
||||
return A;
|
||||
}
|
||||
|
||||
static inline u16 INTERPOLATE5551( u16 A, u16 B)
|
||||
{
|
||||
if (A != B)
|
||||
return ((A & 0xF7BC) >> 1) +
|
||||
((B & 0xF7BC) >> 1) |
|
||||
(A & B & 0x0843);
|
||||
else
|
||||
return A;
|
||||
}
|
||||
|
||||
static inline u32 INTERPOLATE8888( u32 A, u32 B)
|
||||
{
|
||||
if (A != B)
|
||||
return ((A & 0xFEFEFEFE) >> 1) +
|
||||
((B & 0xFEFEFEFE) >> 1) |
|
||||
(A & B & 0x01010101);
|
||||
else
|
||||
return A;
|
||||
}
|
||||
|
||||
static inline u16 Q_INTERPOLATE4444( u16 A, u16 B, u16 C, u16 D)
|
||||
{
|
||||
u16 x = ((A & 0xCCCC) >> 2) +
|
||||
((B & 0xCCCC) >> 2) +
|
||||
((C & 0xCCCC) >> 2) +
|
||||
((D & 0xCCCC) >> 2);
|
||||
u16 y = (((A & 0x3333) +
|
||||
(B & 0x3333) +
|
||||
(C & 0x3333) +
|
||||
(D & 0x3333)) >> 2) & 0x3333;
|
||||
return x | y;
|
||||
}
|
||||
|
||||
static inline u16 Q_INTERPOLATE5551( u16 A, u16 B, u16 C, u16 D)
|
||||
{
|
||||
u16 x = ((A & 0xE738) >> 2) +
|
||||
((B & 0xE738) >> 2) +
|
||||
((C & 0xE738) >> 2) +
|
||||
((D & 0xE738) >> 2);
|
||||
u16 y = (((A & 0x18C6) +
|
||||
(B & 0x18C6) +
|
||||
(C & 0x18C6) +
|
||||
(D & 0x18C6)) >> 2) & 0x18C6;
|
||||
u16 z = ((A & 0x0001) +
|
||||
(B & 0x0001) +
|
||||
(C & 0x0001) +
|
||||
(D & 0x0001)) > 2 ? 1 : 0;
|
||||
return x | y | z;
|
||||
}
|
||||
|
||||
static inline u32 Q_INTERPOLATE8888( u32 A, u32 B, u32 C, u32 D)
|
||||
{
|
||||
u32 x = ((A & 0xFCFCFCFC) >> 2) +
|
||||
((B & 0xFCFCFCFC) >> 2) +
|
||||
((C & 0xFCFCFCFC) >> 2) +
|
||||
((D & 0xFCFCFCFC) >> 2);
|
||||
u32 y = (((A & 0x03030303) +
|
||||
(B & 0x03030303) +
|
||||
(C & 0x03030303) +
|
||||
(D & 0x03030303)) >> 2) & 0x03030303;
|
||||
return x | y;
|
||||
}
|
||||
|
||||
void _2xSaI4444( u16 *srcPtr, u16 *destPtr, u16 width, u16 height, s32 clampS, s32 clampT )
|
||||
{
|
||||
u16 destWidth = width << 1;
|
||||
u16 destHeight = height << 1;
|
||||
|
||||
u32 colorA, colorB, colorC, colorD,
|
||||
colorE, colorF, colorG, colorH,
|
||||
colorI, colorJ, colorK, colorL,
|
||||
colorM, colorN, colorO, colorP;
|
||||
u32 product, product1, product2;
|
||||
|
||||
s16 row0, row1, row2, row3;
|
||||
s16 col0, col1, col2, col3;
|
||||
|
||||
for (u16 y = 0; y < height; y++)
|
||||
{
|
||||
if (y > 0)
|
||||
row0 = -width;
|
||||
else
|
||||
row0 = clampT ? 0 : (height - 1) * width;
|
||||
|
||||
row1 = 0;
|
||||
|
||||
if (y < height - 1)
|
||||
{
|
||||
row2 = width;
|
||||
|
||||
if (y < height - 2)
|
||||
row3 = width << 1;
|
||||
else
|
||||
row3 = clampT ? width : -y * width;
|
||||
}
|
||||
else
|
||||
{
|
||||
row2 = clampT ? 0 : -y * width;
|
||||
row3 = clampT ? 0 : (1 - y) * width;
|
||||
}
|
||||
|
||||
for (u16 x = 0; x < width; x++)
|
||||
{
|
||||
if (x > 0)
|
||||
col0 = -1;
|
||||
else
|
||||
col0 = clampS ? 0 : width - 1;
|
||||
|
||||
col1 = 0;
|
||||
|
||||
if (x < width - 1)
|
||||
{
|
||||
col2 = 1;
|
||||
|
||||
if (x < width - 2)
|
||||
col3 = 2;
|
||||
else
|
||||
col3 = clampS ? 1 : -x;
|
||||
}
|
||||
else
|
||||
{
|
||||
col2 = clampS ? 0 : -x;
|
||||
col3 = clampS ? 0 : 1 - x;
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// Map of the pixels: I|E F|J
|
||||
// G|A B|K
|
||||
// H|C D|L
|
||||
// M|N O|P
|
||||
colorI = *(srcPtr + col0 + row0);
|
||||
colorE = *(srcPtr + col1 + row0);
|
||||
colorF = *(srcPtr + col2 + row0);
|
||||
colorJ = *(srcPtr + col3 + row0);
|
||||
|
||||
colorG = *(srcPtr + col0 + row1);
|
||||
colorA = *(srcPtr + col1 + row1);
|
||||
colorB = *(srcPtr + col2 + row1);
|
||||
colorK = *(srcPtr + col3 + row1);
|
||||
|
||||
colorH = *(srcPtr + col0 + row2);
|
||||
colorC = *(srcPtr + col1 + row2);
|
||||
colorD = *(srcPtr + col2 + row2);
|
||||
colorL = *(srcPtr + col3 + row2);
|
||||
|
||||
colorM = *(srcPtr + col0 + row3);
|
||||
colorN = *(srcPtr + col1 + row3);
|
||||
colorO = *(srcPtr + col2 + row3);
|
||||
colorP = *(srcPtr + col3 + row3);
|
||||
|
||||
if ((colorA == colorD) && (colorB != colorC))
|
||||
{
|
||||
if ( ((colorA == colorE) && (colorB == colorL)) ||
|
||||
((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ)) )
|
||||
product = colorA;
|
||||
else
|
||||
product = INTERPOLATE4444(colorA, colorB);
|
||||
|
||||
if (((colorA == colorG) && (colorC == colorO)) ||
|
||||
((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM)) )
|
||||
product1 = colorA;
|
||||
else
|
||||
product1 = INTERPOLATE4444(colorA, colorC);
|
||||
|
||||
product2 = colorA;
|
||||
}
|
||||
else if ((colorB == colorC) && (colorA != colorD))
|
||||
{
|
||||
if (((colorB == colorF) && (colorA == colorH)) ||
|
||||
((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI)) )
|
||||
product = colorB;
|
||||
else
|
||||
product = INTERPOLATE4444(colorA, colorB);
|
||||
|
||||
if (((colorC == colorH) && (colorA == colorF)) ||
|
||||
((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI)) )
|
||||
product1 = colorC;
|
||||
else
|
||||
product1 = INTERPOLATE4444(colorA, colorC);
|
||||
product2 = colorB;
|
||||
}
|
||||
else if ((colorA == colorD) && (colorB == colorC))
|
||||
{
|
||||
if (colorA == colorB)
|
||||
{
|
||||
product = colorA;
|
||||
product1 = colorA;
|
||||
product2 = colorA;
|
||||
}
|
||||
else
|
||||
{
|
||||
s16 r = 0;
|
||||
product1 = INTERPOLATE4444(colorA, colorC);
|
||||
product = INTERPOLATE4444(colorA, colorB);
|
||||
|
||||
r += GetResult1 (colorA, colorB, colorG, colorE, colorI);
|
||||
r += GetResult2 (colorB, colorA, colorK, colorF, colorJ);
|
||||
r += GetResult2 (colorB, colorA, colorH, colorN, colorM);
|
||||
r += GetResult1 (colorA, colorB, colorL, colorO, colorP);
|
||||
|
||||
if (r > 0)
|
||||
product2 = colorA;
|
||||
else if (r < 0)
|
||||
product2 = colorB;
|
||||
else
|
||||
product2 = Q_INTERPOLATE4444(colorA, colorB, colorC, colorD);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
product2 = Q_INTERPOLATE4444(colorA, colorB, colorC, colorD);
|
||||
|
||||
if ((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ))
|
||||
product = colorA;
|
||||
else if ((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI))
|
||||
product = colorB;
|
||||
else
|
||||
product = INTERPOLATE4444(colorA, colorB);
|
||||
|
||||
if ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM))
|
||||
product1 = colorA;
|
||||
else if ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI))
|
||||
product1 = colorC;
|
||||
else
|
||||
product1 = INTERPOLATE4444(colorA, colorC);
|
||||
}
|
||||
|
||||
destPtr[0] = colorA;
|
||||
destPtr[1] = product;
|
||||
destPtr[destWidth] = product1;
|
||||
destPtr[destWidth + 1] = product2;
|
||||
|
||||
srcPtr++;
|
||||
destPtr += 2;
|
||||
}
|
||||
destPtr += destWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void _2xSaI5551( u16 *srcPtr, u16 *destPtr, u16 width, u16 height, s32 clampS, s32 clampT )
|
||||
{
|
||||
u16 destWidth = width << 1;
|
||||
u16 destHeight = height << 1;
|
||||
|
||||
u32 colorA, colorB, colorC, colorD,
|
||||
colorE, colorF, colorG, colorH,
|
||||
colorI, colorJ, colorK, colorL,
|
||||
colorM, colorN, colorO, colorP;
|
||||
u32 product, product1, product2;
|
||||
|
||||
s16 row0, row1, row2, row3;
|
||||
s16 col0, col1, col2, col3;
|
||||
|
||||
for (u16 y = 0; y < height; y++)
|
||||
{
|
||||
if (y > 0)
|
||||
row0 = -width;
|
||||
else
|
||||
row0 = clampT ? 0 : (height - 1) * width;
|
||||
|
||||
row1 = 0;
|
||||
|
||||
if (y < height - 1)
|
||||
{
|
||||
row2 = width;
|
||||
|
||||
if (y < height - 2)
|
||||
row3 = width << 1;
|
||||
else
|
||||
row3 = clampT ? width : -y * width;
|
||||
}
|
||||
else
|
||||
{
|
||||
row2 = clampT ? 0 : -y * width;
|
||||
row3 = clampT ? 0 : (1 - y) * width;
|
||||
}
|
||||
|
||||
for (u16 x = 0; x < width; x++)
|
||||
{
|
||||
if (x > 0)
|
||||
col0 = -1;
|
||||
else
|
||||
col0 = clampS ? 0 : width - 1;
|
||||
|
||||
col1 = 0;
|
||||
|
||||
if (x < width - 1)
|
||||
{
|
||||
col2 = 1;
|
||||
|
||||
if (x < width - 2)
|
||||
col3 = 2;
|
||||
else
|
||||
col3 = clampS ? 1 : -x;
|
||||
}
|
||||
else
|
||||
{
|
||||
col2 = clampS ? 0 : -x;
|
||||
col3 = clampS ? 0 : 1 - x;
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// Map of the pixels: I|E F|J
|
||||
// G|A B|K
|
||||
// H|C D|L
|
||||
// M|N O|P
|
||||
colorI = *(srcPtr + col0 + row0);
|
||||
colorE = *(srcPtr + col1 + row0);
|
||||
colorF = *(srcPtr + col2 + row0);
|
||||
colorJ = *(srcPtr + col3 + row0);
|
||||
|
||||
colorG = *(srcPtr + col0 + row1);
|
||||
colorA = *(srcPtr + col1 + row1);
|
||||
colorB = *(srcPtr + col2 + row1);
|
||||
colorK = *(srcPtr + col3 + row1);
|
||||
|
||||
colorH = *(srcPtr + col0 + row2);
|
||||
colorC = *(srcPtr + col1 + row2);
|
||||
colorD = *(srcPtr + col2 + row2);
|
||||
colorL = *(srcPtr + col3 + row2);
|
||||
|
||||
colorM = *(srcPtr + col0 + row3);
|
||||
colorN = *(srcPtr + col1 + row3);
|
||||
colorO = *(srcPtr + col2 + row3);
|
||||
colorP = *(srcPtr + col3 + row3);
|
||||
|
||||
if ((colorA == colorD) && (colorB != colorC))
|
||||
{
|
||||
if ( ((colorA == colorE) && (colorB == colorL)) ||
|
||||
((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ)) )
|
||||
product = colorA;
|
||||
else
|
||||
product = INTERPOLATE5551(colorA, colorB);
|
||||
|
||||
if (((colorA == colorG) && (colorC == colorO)) ||
|
||||
((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM)) )
|
||||
product1 = colorA;
|
||||
else
|
||||
product1 = INTERPOLATE5551(colorA, colorC);
|
||||
|
||||
product2 = colorA;
|
||||
}
|
||||
else if ((colorB == colorC) && (colorA != colorD))
|
||||
{
|
||||
if (((colorB == colorF) && (colorA == colorH)) ||
|
||||
((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI)) )
|
||||
product = colorB;
|
||||
else
|
||||
product = INTERPOLATE5551(colorA, colorB);
|
||||
|
||||
if (((colorC == colorH) && (colorA == colorF)) ||
|
||||
((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI)) )
|
||||
product1 = colorC;
|
||||
else
|
||||
product1 = INTERPOLATE5551(colorA, colorC);
|
||||
product2 = colorB;
|
||||
}
|
||||
else if ((colorA == colorD) && (colorB == colorC))
|
||||
{
|
||||
if (colorA == colorB)
|
||||
{
|
||||
product = colorA;
|
||||
product1 = colorA;
|
||||
product2 = colorA;
|
||||
}
|
||||
else
|
||||
{
|
||||
s16 r = 0;
|
||||
product1 = INTERPOLATE5551(colorA, colorC);
|
||||
product = INTERPOLATE5551(colorA, colorB);
|
||||
|
||||
r += GetResult1 (colorA, colorB, colorG, colorE, colorI);
|
||||
r += GetResult2 (colorB, colorA, colorK, colorF, colorJ);
|
||||
r += GetResult2 (colorB, colorA, colorH, colorN, colorM);
|
||||
r += GetResult1 (colorA, colorB, colorL, colorO, colorP);
|
||||
|
||||
if (r > 0)
|
||||
product2 = colorA;
|
||||
else if (r < 0)
|
||||
product2 = colorB;
|
||||
else
|
||||
product2 = Q_INTERPOLATE5551(colorA, colorB, colorC, colorD);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
product2 = Q_INTERPOLATE5551(colorA, colorB, colorC, colorD);
|
||||
|
||||
if ((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ))
|
||||
product = colorA;
|
||||
else if ((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI))
|
||||
product = colorB;
|
||||
else
|
||||
product = INTERPOLATE5551(colorA, colorB);
|
||||
|
||||
if ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM))
|
||||
product1 = colorA;
|
||||
else if ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI))
|
||||
product1 = colorC;
|
||||
else
|
||||
product1 = INTERPOLATE5551(colorA, colorC);
|
||||
}
|
||||
|
||||
destPtr[0] = colorA;
|
||||
destPtr[1] = product;
|
||||
destPtr[destWidth] = product1;
|
||||
destPtr[destWidth + 1] = product2;
|
||||
|
||||
srcPtr++;
|
||||
destPtr += 2;
|
||||
}
|
||||
destPtr += destWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void _2xSaI8888( u32 *srcPtr, u32 *destPtr, u16 width, u16 height, s32 clampS, s32 clampT )
|
||||
{
|
||||
u16 destWidth = width << 1;
|
||||
u16 destHeight = height << 1;
|
||||
|
||||
u32 colorA, colorB, colorC, colorD,
|
||||
colorE, colorF, colorG, colorH,
|
||||
colorI, colorJ, colorK, colorL,
|
||||
colorM, colorN, colorO, colorP;
|
||||
u32 product, product1, product2;
|
||||
|
||||
s16 row0, row1, row2, row3;
|
||||
s16 col0, col1, col2, col3;
|
||||
|
||||
for (u16 y = 0; y < height; y++)
|
||||
{
|
||||
if (y > 0)
|
||||
row0 = -width;
|
||||
else
|
||||
row0 = clampT ? 0 : (height - 1) * width;
|
||||
|
||||
row1 = 0;
|
||||
|
||||
if (y < height - 1)
|
||||
{
|
||||
row2 = width;
|
||||
|
||||
if (y < height - 2)
|
||||
row3 = width << 1;
|
||||
else
|
||||
row3 = clampT ? width : -y * width;
|
||||
}
|
||||
else
|
||||
{
|
||||
row2 = clampT ? 0 : -y * width;
|
||||
row3 = clampT ? 0 : (1 - y) * width;
|
||||
}
|
||||
|
||||
for (u16 x = 0; x < width; x++)
|
||||
{
|
||||
if (x > 0)
|
||||
col0 = -1;
|
||||
else
|
||||
col0 = clampS ? 0 : width - 1;
|
||||
|
||||
col1 = 0;
|
||||
|
||||
if (x < width - 1)
|
||||
{
|
||||
col2 = 1;
|
||||
|
||||
if (x < width - 2)
|
||||
col3 = 2;
|
||||
else
|
||||
col3 = clampS ? 1 : -x;
|
||||
}
|
||||
else
|
||||
{
|
||||
col2 = clampS ? 0 : -x;
|
||||
col3 = clampS ? 0 : 1 - x;
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// Map of the pixels: I|E F|J
|
||||
// G|A B|K
|
||||
// H|C D|L
|
||||
// M|N O|P
|
||||
colorI = *(srcPtr + col0 + row0);
|
||||
colorE = *(srcPtr + col1 + row0);
|
||||
colorF = *(srcPtr + col2 + row0);
|
||||
colorJ = *(srcPtr + col3 + row0);
|
||||
|
||||
colorG = *(srcPtr + col0 + row1);
|
||||
colorA = *(srcPtr + col1 + row1);
|
||||
colorB = *(srcPtr + col2 + row1);
|
||||
colorK = *(srcPtr + col3 + row1);
|
||||
|
||||
colorH = *(srcPtr + col0 + row2);
|
||||
colorC = *(srcPtr + col1 + row2);
|
||||
colorD = *(srcPtr + col2 + row2);
|
||||
colorL = *(srcPtr + col3 + row2);
|
||||
|
||||
colorM = *(srcPtr + col0 + row3);
|
||||
colorN = *(srcPtr + col1 + row3);
|
||||
colorO = *(srcPtr + col2 + row3);
|
||||
colorP = *(srcPtr + col3 + row3);
|
||||
|
||||
if ((colorA == colorD) && (colorB != colorC))
|
||||
{
|
||||
if ( ((colorA == colorE) && (colorB == colorL)) ||
|
||||
((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ)) )
|
||||
product = colorA;
|
||||
else
|
||||
product = INTERPOLATE8888(colorA, colorB);
|
||||
|
||||
if (((colorA == colorG) && (colorC == colorO)) ||
|
||||
((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM)) )
|
||||
product1 = colorA;
|
||||
else
|
||||
product1 = INTERPOLATE8888(colorA, colorC);
|
||||
|
||||
product2 = colorA;
|
||||
}
|
||||
else if ((colorB == colorC) && (colorA != colorD))
|
||||
{
|
||||
if (((colorB == colorF) && (colorA == colorH)) ||
|
||||
((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI)) )
|
||||
product = colorB;
|
||||
else
|
||||
product = INTERPOLATE8888(colorA, colorB);
|
||||
|
||||
if (((colorC == colorH) && (colorA == colorF)) ||
|
||||
((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI)) )
|
||||
product1 = colorC;
|
||||
else
|
||||
product1 = INTERPOLATE8888(colorA, colorC);
|
||||
product2 = colorB;
|
||||
}
|
||||
else if ((colorA == colorD) && (colorB == colorC))
|
||||
{
|
||||
if (colorA == colorB)
|
||||
{
|
||||
product = colorA;
|
||||
product1 = colorA;
|
||||
product2 = colorA;
|
||||
}
|
||||
else
|
||||
{
|
||||
s16 r = 0;
|
||||
product1 = INTERPOLATE8888(colorA, colorC);
|
||||
product = INTERPOLATE8888(colorA, colorB);
|
||||
|
||||
r += GetResult1 (colorA, colorB, colorG, colorE, colorI);
|
||||
r += GetResult2 (colorB, colorA, colorK, colorF, colorJ);
|
||||
r += GetResult2 (colorB, colorA, colorH, colorN, colorM);
|
||||
r += GetResult1 (colorA, colorB, colorL, colorO, colorP);
|
||||
|
||||
if (r > 0)
|
||||
product2 = colorA;
|
||||
else if (r < 0)
|
||||
product2 = colorB;
|
||||
else
|
||||
product2 = Q_INTERPOLATE8888(colorA, colorB, colorC, colorD);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
product2 = Q_INTERPOLATE8888(colorA, colorB, colorC, colorD);
|
||||
|
||||
if ((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ))
|
||||
product = colorA;
|
||||
else if ((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI))
|
||||
product = colorB;
|
||||
else
|
||||
product = INTERPOLATE8888(colorA, colorB);
|
||||
|
||||
if ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM))
|
||||
product1 = colorA;
|
||||
else if ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI))
|
||||
product1 = colorC;
|
||||
else
|
||||
product1 = INTERPOLATE8888(colorA, colorC);
|
||||
}
|
||||
|
||||
destPtr[0] = colorA;
|
||||
destPtr[1] = product;
|
||||
destPtr[destWidth] = product1;
|
||||
destPtr[destWidth + 1] = product2;
|
||||
|
||||
srcPtr++;
|
||||
destPtr += 2;
|
||||
}
|
||||
destPtr += destWidth;
|
||||
}
|
||||
}
|
||||
|
9
2xSAI.h
9
2xSAI.h
|
@ -1,9 +0,0 @@
|
|||
#ifndef _2XSAI_H
|
||||
#define _2XSAI_H
|
||||
#include "Types.h"
|
||||
|
||||
void _2xSaI8888( u32 *srcPtr, u32 *destPtr, u16 width, u16 height, s32 clampS, s32 clampT );
|
||||
void _2xSaI4444( u16 *srcPtr, u16 *destPtr, u16 width, u16 height, s32 clampS, s32 clampT );
|
||||
void _2xSaI5551( u16 *srcPtr, u16 *destPtr, u16 width, u16 height, s32 clampS, s32 clampT );
|
||||
#endif
|
||||
|
|
@ -2,8 +2,7 @@ cmake_minimum_required(VERSION 2.6)
|
|||
|
||||
project( GLideN64 )
|
||||
|
||||
set(GLideN64_SOURCES
|
||||
2xSAI.cpp
|
||||
set(GLideN64_SOURCES
|
||||
3DMath.cpp
|
||||
Combiner.cpp
|
||||
CRC.cpp
|
||||
|
|
16
Config.cpp
16
Config.cpp
|
@ -73,8 +73,8 @@ void Config_LoadConfig()
|
|||
RegQueryValueEx( hKey, "Force Bilinear", 0, NULL, (BYTE*)&value, &size );
|
||||
config.texture.forceBilinear = value ? TRUE : FALSE;
|
||||
|
||||
RegQueryValueEx( hKey, "Enable 2xSaI", 0, NULL, (BYTE*)&value, &size );
|
||||
config.texture.enable2xSaI = value ? TRUE : FALSE;
|
||||
RegQueryValueEx( hKey, "Write depth", 0, NULL, (BYTE*)&value, &size );
|
||||
config.frameBufferEmulation.copyDepthToRDRAM = value ? TRUE : FALSE;
|
||||
|
||||
RegQueryValueEx( hKey, "Enable Fog", 0, NULL, (BYTE*)&value, &size );
|
||||
config.enableFog = value ? TRUE : FALSE;
|
||||
|
@ -105,14 +105,13 @@ void Config_LoadConfig()
|
|||
config.texture.forceBilinear = FALSE;
|
||||
cache.maxBytes = 32 * 1048576;
|
||||
config.frameBufferEmulation.enable = FALSE;
|
||||
config.texture.enable2xSaI = FALSE;
|
||||
config.frameBufferEmulation.copyDepthToRDRAM = FALSE;
|
||||
config.texture.textureBitDepth = 1;
|
||||
config.enableHWLighting = FALSE;
|
||||
}
|
||||
|
||||
// manually set frame bufer emulation options
|
||||
config.frameBufferEmulation.copyToRDRAM = FALSE;
|
||||
config.frameBufferEmulation.copyDepthToRDRAM = FALSE;
|
||||
config.frameBufferEmulation.copyFromRDRAM = FALSE;
|
||||
config.frameBufferEmulation.ignoreCFB = TRUE;
|
||||
config.frameBufferEmulation.N64DepthCompare = FALSE;
|
||||
|
@ -136,8 +135,8 @@ void Config_SaveConfig()
|
|||
value = config.texture.forceBilinear ? 1 : 0;
|
||||
RegSetValueEx( hKey, "Force Bilinear", 0, REG_DWORD, (BYTE*)&value, 4 );
|
||||
|
||||
value = config.texture.enable2xSaI ? 1 : 0;
|
||||
RegSetValueEx( hKey, "Enable 2xSaI", 0, REG_DWORD, (BYTE*)&value, 4 );
|
||||
value = config.frameBufferEmulation.copyDepthToRDRAM ? 1 : 0;
|
||||
RegSetValueEx( hKey, "Write depth", 0, REG_DWORD, (BYTE*)&value, 4 );
|
||||
|
||||
value = config.enableFog ? 1 : 0;
|
||||
RegSetValueEx( hKey, "Enable Fog", 0, REG_DWORD, (BYTE*)&value, 4 );
|
||||
|
@ -166,9 +165,8 @@ void Config_ApplyDlgConfig( HWND hWndDlg )
|
|||
cache.maxBytes = atol( text ) * 1048576;
|
||||
|
||||
config.texture.forceBilinear = (SendDlgItemMessage( hWndDlg, IDC_FORCEBILINEAR, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
|
||||
config.texture.enable2xSaI = (SendDlgItemMessage( hWndDlg, IDC_ENABLE2XSAI, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
|
||||
config.frameBufferEmulation.copyDepthToRDRAM = (SendDlgItemMessage( hWndDlg, IDC_ENABLEDEPTHWRITE, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
|
||||
config.enableFog = (SendDlgItemMessage( hWndDlg, IDC_FOG, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
|
||||
//OGL.originAdjust = (OGL.enable2xSaI ? 0.25f : 0.50f);
|
||||
|
||||
config.video.fullscreenBits = fullscreen.bitDepth[SendDlgItemMessage( hWndDlg, IDC_FULLSCREENBITDEPTH, CB_GETCURSEL, 0, 0 )];
|
||||
i = SendDlgItemMessage( hWndDlg, IDC_FULLSCREENRES, CB_GETCURSEL, 0, 0 );
|
||||
|
@ -328,7 +326,7 @@ BOOL CALLBACK ConfigDlgProc( HWND hWndDlg, UINT message, WPARAM wParam, LPARAM l
|
|||
SendDlgItemMessage( hWndDlg, IDC_WINDOWEDRES, CB_SETCURSEL, i, 0 );
|
||||
}
|
||||
}
|
||||
SendDlgItemMessage( hWndDlg, IDC_ENABLE2XSAI, BM_SETCHECK, config.texture.enable2xSaI ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );
|
||||
SendDlgItemMessage( hWndDlg, IDC_ENABLEDEPTHWRITE, BM_SETCHECK, config.frameBufferEmulation.copyDepthToRDRAM ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );
|
||||
// Set forced bilinear check box
|
||||
SendDlgItemMessage( hWndDlg, IDC_FORCEBILINEAR, BM_SETCHECK, config.texture.forceBilinear ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );
|
||||
SendDlgItemMessage( hWndDlg, IDC_TEXTUREBPP, CB_ADDSTRING, 0, (LPARAM)"16-bit only (faster)" );
|
||||
|
|
1
Config.h
1
Config.h
|
@ -18,7 +18,6 @@ struct Config
|
|||
u32 maxAnisotropy;
|
||||
u32 textureBitDepth;
|
||||
u32 forceBilinear;
|
||||
u32 enable2xSaI;
|
||||
u32 pow2;
|
||||
} texture;
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ Option configOptions[] =
|
|||
{"window height", &config.video.windowedHeight, 480},
|
||||
{"#Texture Settings:", NULL, 0},
|
||||
{"force bilinear", &config.texture.forceBilinear, 0},
|
||||
{"enable 2xSAI", &config.texture.enable2xSaI, 0},
|
||||
{"cache size", &cache.maxBytes, 64*1048576},
|
||||
{"texture bit depth", &config.texture.textureBitDepth, 1},
|
||||
{"#Emulation Settings:", NULL, 0},
|
||||
|
|
|
@ -234,7 +234,6 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="2xSAI.cpp" />
|
||||
<ClCompile Include="3DMath.cpp" />
|
||||
<ClCompile Include="Combiner.cpp" />
|
||||
<ClCompile Include="Config.cpp">
|
||||
|
@ -273,7 +272,6 @@
|
|||
<ClCompile Include="GLSLCombiner.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="2xSAI.h" />
|
||||
<ClInclude Include="3DMath.h" />
|
||||
<ClInclude Include="Combiner.h" />
|
||||
<ClInclude Include="Config.h" />
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="2xSAI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Combiner.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -122,9 +119,6 @@
|
|||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="2xSAI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="3DMath.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
BIN
Resource.aps
BIN
Resource.aps
Binary file not shown.
10
Resource.rc
10
Resource.rc
|
@ -13,13 +13,11 @@
|
|||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -113,7 +111,7 @@ BEGIN
|
|||
LTEXT "Resolution:",IDC_STATIC,136,18,37,8
|
||||
LTEXT "Refresh Rate:",IDC_STATIC,187,18,46,8
|
||||
COMBOBOX IDC_FULLSCREENBITDEPTH,80,31,39,111,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Enable 2xSaI texture scaling",IDC_ENABLE2XSAI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,66,107,10
|
||||
CONTROL "Enable depth buffer write",IDC_ENABLEDEPTHWRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,66,98,10
|
||||
CONTROL "Enable Fog",IDC_FOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,135,81,51,10
|
||||
CONTROL "Hardware Frame Buffer Textures (Experimental)",IDC_FRAMEBUFFER,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,154,171,10
|
||||
|
@ -143,7 +141,7 @@ END
|
|||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_DEBUGDLG, DIALOG
|
||||
BEGIN
|
||||
|
@ -195,7 +193,7 @@ BEGIN
|
|||
0
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
62
Textures.cpp
62
Textures.cpp
|
@ -9,7 +9,6 @@
|
|||
#include "N64.h"
|
||||
#include "CRC.h"
|
||||
#include "convert.h"
|
||||
#include "2xSAI.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "Config.h"
|
||||
#include <assert.h>
|
||||
|
@ -230,7 +229,6 @@ void TextureCache_Init()
|
|||
cache.bottom = NULL;
|
||||
cache.numCached = 0;
|
||||
cache.cachedBytes = 0;
|
||||
cache.enable2xSaI = config.texture.enable2xSaI;
|
||||
cache.bitDepth = config.texture.textureBitDepth;
|
||||
|
||||
glGenTextures( 32, cache.glNoiseNames );
|
||||
|
@ -515,29 +513,8 @@ void TextureCache_LoadBackground( CachedTexture *texInfo )
|
|||
}
|
||||
}
|
||||
|
||||
if (cache.enable2xSaI)
|
||||
{
|
||||
texInfo->textureBytes <<= 2;
|
||||
|
||||
scaledDest = (u32*)malloc( texInfo->textureBytes );
|
||||
|
||||
if (glInternalFormat == GL_RGBA)
|
||||
_2xSaI8888( (u32*)dest, (u32*)scaledDest, texInfo->realWidth, texInfo->realHeight, texInfo->clampS, texInfo->clampT );
|
||||
else if (glInternalFormat == GL_RGBA4)
|
||||
_2xSaI4444( (u16*)dest, (u16*)scaledDest, texInfo->realWidth, texInfo->realHeight, texInfo->clampS, texInfo->clampT );
|
||||
else
|
||||
_2xSaI5551( (u16*)dest, (u16*)scaledDest, texInfo->realWidth, texInfo->realHeight, texInfo->clampS, texInfo->clampT );
|
||||
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, glInternalFormat, texInfo->realWidth << 1, texInfo->realHeight << 1, 0, GL_RGBA, glType, scaledDest );
|
||||
|
||||
free( dest );
|
||||
free( scaledDest );
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, glInternalFormat, texInfo->realWidth, texInfo->realHeight, 0, GL_RGBA, glType, dest );
|
||||
free( dest );
|
||||
}
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, glInternalFormat, texInfo->realWidth, texInfo->realHeight, 0, GL_RGBA, glType, dest );
|
||||
free( dest );
|
||||
}
|
||||
|
||||
void TextureCache_Load( CachedTexture *texInfo )
|
||||
|
@ -656,29 +633,8 @@ void TextureCache_Load( CachedTexture *texInfo )
|
|||
}
|
||||
}
|
||||
|
||||
if (cache.enable2xSaI)
|
||||
{
|
||||
texInfo->textureBytes <<= 2;
|
||||
|
||||
scaledDest = (u32*)malloc( texInfo->textureBytes );
|
||||
|
||||
if (glInternalFormat == GL_RGBA)
|
||||
_2xSaI8888( (u32*)dest, (u32*)scaledDest, texInfo->realWidth, texInfo->realHeight, 1, 1 );//texInfo->clampS, texInfo->clampT );
|
||||
else if (glInternalFormat == GL_RGBA4)
|
||||
_2xSaI4444( (u16*)dest, (u16*)scaledDest, texInfo->realWidth, texInfo->realHeight, 1, 1 );//texInfo->clampS, texInfo->clampT );
|
||||
else
|
||||
_2xSaI5551( (u16*)dest, (u16*)scaledDest, texInfo->realWidth, texInfo->realHeight, 1, 1 );//texInfo->clampS, texInfo->clampT );
|
||||
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, glInternalFormat, texInfo->realWidth << 1, texInfo->realHeight << 1, 0, GL_RGBA, glType, scaledDest );
|
||||
|
||||
free( dest );
|
||||
free( scaledDest );
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, glInternalFormat, texInfo->realWidth, texInfo->realHeight, 0, GL_RGBA, glType, dest );
|
||||
free( dest );
|
||||
}
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, glInternalFormat, texInfo->realWidth, texInfo->realHeight, 0, GL_RGBA, glType, dest );
|
||||
free( dest );
|
||||
}
|
||||
|
||||
struct TextureParams
|
||||
|
@ -859,12 +815,6 @@ void TextureCache_Update( u32 t )
|
|||
u32 tileWidth, maskWidth, loadWidth, lineWidth, clampWidth, height;
|
||||
u32 tileHeight, maskHeight, loadHeight, lineHeight, clampHeight, width;
|
||||
|
||||
if (cache.enable2xSaI != config.texture.enable2xSaI)
|
||||
{
|
||||
TextureCache_Destroy();
|
||||
TextureCache_Init();
|
||||
}
|
||||
|
||||
if (cache.bitDepth != config.texture.textureBitDepth)
|
||||
{
|
||||
TextureCache_Destroy();
|
||||
|
@ -1114,8 +1064,8 @@ void TextureCache_Update( u32 t )
|
|||
cache.current[t]->shiftScaleS = 1.0f;
|
||||
cache.current[t]->shiftScaleT = 1.0f;
|
||||
|
||||
cache.current[t]->offsetS = config.texture.enable2xSaI ? 0.25f : 0.5f;
|
||||
cache.current[t]->offsetT = config.texture.enable2xSaI ? 0.25f : 0.5f;
|
||||
cache.current[t]->offsetS = 0.5f;
|
||||
cache.current[t]->offsetT = 0.5f;
|
||||
|
||||
if (gSP.textureTile[t]->shifts > 10)
|
||||
cache.current[t]->shiftScaleS = (f32)(1 << (16 - gSP.textureTile[t]->shifts));
|
||||
|
|
|
@ -50,7 +50,7 @@ struct TextureCache
|
|||
GLuint glNoiseNames[32];
|
||||
//GLuint glDummyName;
|
||||
CachedTexture *dummy;
|
||||
u32 enable2xSaI, bitDepth;
|
||||
u32 bitDepth;
|
||||
};
|
||||
|
||||
extern TextureCache cache;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define IDC_WIREFRAME 1053
|
||||
#define IDC_FULLSCREENBITDEPTH 1054
|
||||
#define IDC_ALPHATESTSHARPNESS 1055
|
||||
#define IDC_ENABLE2XSAI 1061
|
||||
#define IDC_ENABLEDEPTHWRITE 1061
|
||||
#define IDC_COMBO1 1064
|
||||
#define IDC_COMBINER 1064
|
||||
#define IDC_TEXTUREBPP 1064
|
||||
|
|
Loading…
Reference in New Issue
Block a user