mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 21:35:28 +00:00
BPMemory: Make use of BitField in a number of structures.
This commit is contained in:
parent
8941f19cdb
commit
16105db709
@ -10,7 +10,6 @@
|
||||
#include "VideoBackends/D3D/PSTextureEncoder.h"
|
||||
#include "VideoBackends/D3D/Render.h"
|
||||
#include "VideoBackends/D3D/TextureCache.h"
|
||||
#include "VideoCommon/BPMemory.h"
|
||||
|
||||
// "Static mode" will compile a new EFB encoder shader for every combination of
|
||||
// encoding configurations. It's compatible with Shader Model 4.
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "VideoCommon/BPMemory.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
|
||||
namespace DX11
|
||||
@ -111,8 +112,8 @@ public:
|
||||
virtual void Shutdown() = 0;
|
||||
// Returns size in bytes of encoded block of memory
|
||||
virtual size_t Encode(u8* dst, unsigned int dstFormat,
|
||||
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
|
||||
bool isIntensity, bool scaleByHalf) = 0;
|
||||
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
|
||||
bool isIntensity, bool scaleByHalf) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -1279,18 +1279,18 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
||||
// adjust alpha factors
|
||||
if (useDualSource)
|
||||
{
|
||||
srcidx = GX_BL_ONE;
|
||||
dstidx = GX_BL_ZERO;
|
||||
srcidx = BlendMode::ONE;
|
||||
dstidx = BlendMode::ZERO;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we can't use GL_DST_COLOR or GL_ONE_MINUS_DST_COLOR for source in alpha channel so use their alpha equivalent instead
|
||||
if (srcidx == GX_BL_DSTCLR) srcidx = GX_BL_DSTALPHA;
|
||||
if (srcidx == GX_BL_INVDSTCLR) srcidx = GX_BL_INVDSTALPHA;
|
||||
if (srcidx == BlendMode::DSTCLR) srcidx = BlendMode::DSTALPHA;
|
||||
if (srcidx == BlendMode::INVDSTCLR) srcidx = BlendMode::INVDSTALPHA;
|
||||
|
||||
// we can't use GL_SRC_COLOR or GL_ONE_MINUS_SRC_COLOR for destination in alpha channel so use their alpha equivalent instead
|
||||
if (dstidx == GX_BL_SRCCLR) dstidx = GX_BL_SRCALPHA;
|
||||
if (dstidx == GX_BL_INVSRCCLR) dstidx = GX_BL_INVSRCALPHA;
|
||||
if (dstidx == BlendMode::SRCCLR) dstidx = BlendMode::SRCALPHA;
|
||||
if (dstidx == BlendMode::INVSRCCLR) dstidx = BlendMode::INVSRCALPHA;
|
||||
}
|
||||
GLenum srcFactorAlpha = glSrcFactors[srcidx];
|
||||
GLenum dstFactorAlpha = glDestFactors[dstidx];
|
||||
|
@ -225,81 +225,83 @@ namespace EfbInterface
|
||||
return depth;
|
||||
}
|
||||
|
||||
u32 GetSourceFactor(u8 *srcClr, u8 *dstClr, int mode)
|
||||
u32 GetSourceFactor(u8 *srcClr, u8 *dstClr, BlendMode::BlendFactor mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case 0: // zero
|
||||
return 0;
|
||||
case 1: // one
|
||||
return 0xffffffff;
|
||||
case 2: // dstclr
|
||||
return *(u32*)dstClr;
|
||||
case 3: // invdstclr
|
||||
return 0xffffffff - *(u32*)dstClr;
|
||||
case 4: // srcalpha
|
||||
{
|
||||
u8 alpha = srcClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case 5: // invsrcalpha
|
||||
{
|
||||
u8 alpha = 0xff - srcClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case 6: // dstalpha
|
||||
{
|
||||
u8 alpha = dstClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case 7: // invdstalpha
|
||||
{
|
||||
u8 alpha = 0xff - dstClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
switch (mode)
|
||||
{
|
||||
case BlendMode::ZERO:
|
||||
return 0;
|
||||
case BlendMode::ONE:
|
||||
return 0xffffffff;
|
||||
case BlendMode::DSTCLR:
|
||||
return *(u32*)dstClr;
|
||||
case BlendMode::INVDSTCLR:
|
||||
return 0xffffffff - *(u32*)dstClr;
|
||||
case BlendMode::SRCALPHA:
|
||||
{
|
||||
u8 alpha = srcClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case BlendMode::INVSRCALPHA:
|
||||
{
|
||||
u8 alpha = 0xff - srcClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case BlendMode::DSTALPHA:
|
||||
{
|
||||
u8 alpha = dstClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case BlendMode::INVDSTALPHA:
|
||||
{
|
||||
u8 alpha = 0xff - dstClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 GetDestinationFactor(u8 *srcClr, u8 *dstClr, int mode)
|
||||
u32 GetDestinationFactor(u8 *srcClr, u8 *dstClr, BlendMode::BlendFactor mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case 0: // zero
|
||||
return 0;
|
||||
case 1: // one
|
||||
return 0xffffffff;
|
||||
case 2: // srcclr
|
||||
return *(u32*)srcClr;
|
||||
case 3: // invsrcclr
|
||||
return 0xffffffff - *(u32*)srcClr;
|
||||
case 4: // srcalpha
|
||||
{
|
||||
u8 alpha = srcClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case 5: // invsrcalpha
|
||||
{
|
||||
u8 alpha = 0xff - srcClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case 6: // dstalpha
|
||||
{
|
||||
u8 alpha = dstClr[ALP_C] & 0xff;
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case 7: // invdstalpha
|
||||
{
|
||||
u8 alpha = 0xff - dstClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
switch (mode)
|
||||
{
|
||||
case BlendMode::ZERO:
|
||||
return 0;
|
||||
case BlendMode::ONE:
|
||||
return 0xffffffff;
|
||||
case BlendMode::SRCCLR:
|
||||
return *(u32*)srcClr;
|
||||
case BlendMode::INVSRCCLR:
|
||||
return 0xffffffff - *(u32*)srcClr;
|
||||
case BlendMode::SRCALPHA:
|
||||
{
|
||||
u8 alpha = srcClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case BlendMode::INVSRCALPHA:
|
||||
{
|
||||
u8 alpha = 0xff - srcClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case BlendMode::DSTALPHA:
|
||||
{
|
||||
u8 alpha = dstClr[ALP_C] & 0xff;
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
case BlendMode::INVDSTALPHA:
|
||||
{
|
||||
u8 alpha = 0xff - dstClr[ALP_C];
|
||||
u32 factor = alpha << 24 | alpha << 16 | alpha << 8 | alpha;
|
||||
return factor;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -327,58 +329,58 @@ namespace EfbInterface
|
||||
}
|
||||
}
|
||||
|
||||
void LogicBlend(u32 srcClr, u32 &dstClr, int op)
|
||||
void LogicBlend(u32 srcClr, u32 &dstClr, BlendMode::LogicOp op)
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case 0: // clear
|
||||
dstClr = 0;
|
||||
break;
|
||||
case 1: // and
|
||||
dstClr = srcClr & dstClr;
|
||||
break;
|
||||
case 2: // revand
|
||||
dstClr = srcClr & (~dstClr);
|
||||
break;
|
||||
case 3: // copy
|
||||
dstClr = srcClr;
|
||||
break;
|
||||
case 4: // invand
|
||||
dstClr = (~srcClr) & dstClr;
|
||||
break;
|
||||
case 5: // noop
|
||||
// Do nothing
|
||||
break;
|
||||
case 6: // xor
|
||||
dstClr = srcClr ^ dstClr;
|
||||
break;
|
||||
case 7: // or
|
||||
dstClr = srcClr | dstClr;
|
||||
break;
|
||||
case 8: // nor
|
||||
dstClr = ~(srcClr | dstClr);
|
||||
break;
|
||||
case 9: // equiv
|
||||
dstClr = ~(srcClr ^ dstClr);
|
||||
break;
|
||||
case 10: // inv
|
||||
dstClr = ~dstClr;
|
||||
break;
|
||||
case 11: // revor
|
||||
dstClr = srcClr | (~dstClr);
|
||||
break;
|
||||
case 12: // invcopy
|
||||
dstClr = ~srcClr;
|
||||
break;
|
||||
case 13: // invor
|
||||
dstClr = (~srcClr) | dstClr;
|
||||
break;
|
||||
case 14: // nand
|
||||
dstClr = ~(srcClr & dstClr);
|
||||
break;
|
||||
case 15: // set
|
||||
dstClr = 0xffffffff;
|
||||
break;
|
||||
case BlendMode::CLEAR:
|
||||
dstClr = 0;
|
||||
break;
|
||||
case BlendMode::AND:
|
||||
dstClr = srcClr & dstClr;
|
||||
break;
|
||||
case BlendMode::AND_REVERSE:
|
||||
dstClr = srcClr & (~dstClr);
|
||||
break;
|
||||
case BlendMode::COPY:
|
||||
dstClr = srcClr;
|
||||
break;
|
||||
case BlendMode::AND_INVERTED:
|
||||
dstClr = (~srcClr) & dstClr;
|
||||
break;
|
||||
case BlendMode::NOOP:
|
||||
// Do nothing
|
||||
break;
|
||||
case BlendMode::XOR:
|
||||
dstClr = srcClr ^ dstClr;
|
||||
break;
|
||||
case BlendMode::OR:
|
||||
dstClr = srcClr | dstClr;
|
||||
break;
|
||||
case BlendMode::NOR:
|
||||
dstClr = ~(srcClr | dstClr);
|
||||
break;
|
||||
case BlendMode::EQUIV:
|
||||
dstClr = ~(srcClr ^ dstClr);
|
||||
break;
|
||||
case BlendMode::INVERT:
|
||||
dstClr = ~dstClr;
|
||||
break;
|
||||
case BlendMode::OR_REVERSE:
|
||||
dstClr = srcClr | (~dstClr);
|
||||
break;
|
||||
case BlendMode::COPY_INVERTED:
|
||||
dstClr = ~srcClr;
|
||||
break;
|
||||
case BlendMode::OR_INVERTED:
|
||||
dstClr = (~srcClr) | dstClr;
|
||||
break;
|
||||
case BlendMode::NAND:
|
||||
dstClr = ~(srcClr & dstClr);
|
||||
break;
|
||||
case BlendMode::SET:
|
||||
dstClr = 0xffffffff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,33 +586,33 @@ namespace EfbInterface
|
||||
|
||||
switch (bpmem.zmode.func)
|
||||
{
|
||||
case COMPARE_NEVER:
|
||||
pass = false;
|
||||
break;
|
||||
case COMPARE_LESS:
|
||||
pass = z < depth;
|
||||
break;
|
||||
case COMPARE_EQUAL:
|
||||
pass = z == depth;
|
||||
break;
|
||||
case COMPARE_LEQUAL:
|
||||
pass = z <= depth;
|
||||
break;
|
||||
case COMPARE_GREATER:
|
||||
pass = z > depth;
|
||||
break;
|
||||
case COMPARE_NEQUAL:
|
||||
pass = z != depth;
|
||||
break;
|
||||
case COMPARE_GEQUAL:
|
||||
pass = z >= depth;
|
||||
break;
|
||||
case COMPARE_ALWAYS:
|
||||
pass = true;
|
||||
break;
|
||||
default:
|
||||
pass = false;
|
||||
ERROR_LOG(VIDEO, "Bad Z compare mode %i", bpmem.zmode.func);
|
||||
case ZMode::NEVER:
|
||||
pass = false;
|
||||
break;
|
||||
case ZMode::LESS:
|
||||
pass = z < depth;
|
||||
break;
|
||||
case ZMode::EQUAL:
|
||||
pass = z == depth;
|
||||
break;
|
||||
case ZMode::LEQUAL:
|
||||
pass = z <= depth;
|
||||
break;
|
||||
case ZMode::GREATER:
|
||||
pass = z > depth;
|
||||
break;
|
||||
case ZMode::NEQUAL:
|
||||
pass = z != depth;
|
||||
break;
|
||||
case ZMode::GEQUAL:
|
||||
pass = z >= depth;
|
||||
break;
|
||||
case ZMode::ALWAYS:
|
||||
pass = true;
|
||||
break;
|
||||
default:
|
||||
pass = false;
|
||||
ERROR_LOG(VIDEO, "Bad Z compare mode %i", (int)bpmem.zmode.func);
|
||||
}
|
||||
|
||||
if (pass && bpmem.zmode.updateenable)
|
||||
|
@ -413,17 +413,17 @@ void Tev::DrawAlphaCompare(TevStageCombiner::AlphaCombiner &ac)
|
||||
}
|
||||
}
|
||||
|
||||
static bool AlphaCompare(int alpha, int ref, int comp)
|
||||
static bool AlphaCompare(int alpha, int ref, AlphaTest::CompareMode comp)
|
||||
{
|
||||
switch (comp) {
|
||||
case ALPHACMP_ALWAYS: return true;
|
||||
case ALPHACMP_NEVER: return false;
|
||||
case ALPHACMP_LEQUAL: return alpha <= ref;
|
||||
case ALPHACMP_LESS: return alpha < ref;
|
||||
case ALPHACMP_GEQUAL: return alpha >= ref;
|
||||
case ALPHACMP_GREATER: return alpha > ref;
|
||||
case ALPHACMP_EQUAL: return alpha == ref;
|
||||
case ALPHACMP_NEQUAL: return alpha != ref;
|
||||
case AlphaTest::ALWAYS: return true;
|
||||
case AlphaTest::NEVER: return false;
|
||||
case AlphaTest::LEQUAL: return alpha <= ref;
|
||||
case AlphaTest::LESS: return alpha < ref;
|
||||
case AlphaTest::GEQUAL: return alpha >= ref;
|
||||
case AlphaTest::GREATER: return alpha > ref;
|
||||
case AlphaTest::EQUAL: return alpha == ref;
|
||||
case AlphaTest::NEQUAL: return alpha != ref;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ void GetBPRegInfo(const u8* data, char* name, size_t name_size, char* desc, size
|
||||
snprintf(desc, desc_size, "test 1: %s (ref: %#02x)\n"
|
||||
"test 2: %s (ref: %#02x)\n"
|
||||
"logic: %s\n",
|
||||
functions[test.comp0], test.ref0, functions[test.comp1], test.ref1, logic[test.logic]);
|
||||
functions[test.comp0], (int)test.ref0, functions[test.comp1], (int)test.ref1, logic[test.logic]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -149,27 +149,6 @@
|
||||
#define GX_TEVREG1 2
|
||||
#define GX_TEVREG2 3
|
||||
|
||||
#define ALPHACMP_NEVER 0
|
||||
#define ALPHACMP_LESS 1
|
||||
#define ALPHACMP_EQUAL 2
|
||||
#define ALPHACMP_LEQUAL 3
|
||||
#define ALPHACMP_GREATER 4
|
||||
#define ALPHACMP_NEQUAL 5
|
||||
#define ALPHACMP_GEQUAL 6
|
||||
#define ALPHACMP_ALWAYS 7
|
||||
|
||||
enum Compare
|
||||
{
|
||||
COMPARE_NEVER = 0,
|
||||
COMPARE_LESS,
|
||||
COMPARE_EQUAL,
|
||||
COMPARE_LEQUAL,
|
||||
COMPARE_GREATER,
|
||||
COMPARE_NEQUAL,
|
||||
COMPARE_GEQUAL,
|
||||
COMPARE_ALWAYS
|
||||
};
|
||||
|
||||
#define ZTEXTURE_DISABLE 0
|
||||
#define ZTEXTURE_ADD 1
|
||||
#define ZTEXTURE_REPLACE 2
|
||||
@ -179,14 +158,6 @@ enum Compare
|
||||
#define TevBias_SUBHALF 2
|
||||
#define TevBias_COMPARE 3
|
||||
|
||||
enum AlphaOp
|
||||
{
|
||||
ALPHAOP_AND = 0,
|
||||
ALPHAOP_OR,
|
||||
ALPHAOP_XOR,
|
||||
ALPHAOP_XNOR,
|
||||
};
|
||||
|
||||
union IND_MTXA
|
||||
{
|
||||
struct
|
||||
@ -610,31 +581,52 @@ union X10Y10
|
||||
|
||||
// Framebuffer/pixel stuff (incl fog)
|
||||
|
||||
#define GX_BL_ZERO 0
|
||||
#define GX_BL_ONE 1
|
||||
#define GX_BL_SRCCLR 2 // for dst factor
|
||||
#define GX_BL_INVSRCCLR 3 // for dst factor
|
||||
#define GX_BL_SRCALPHA 4
|
||||
#define GX_BL_INVSRCALPHA 5
|
||||
#define GX_BL_DSTALPHA 6
|
||||
#define GX_BL_INVDSTALPHA 7
|
||||
#define GX_BL_DSTCLR GX_BL_SRCCLR // for src factor
|
||||
#define GX_BL_INVDSTCLR GX_BL_INVSRCCLR // for src factor
|
||||
|
||||
union BlendMode
|
||||
{
|
||||
struct
|
||||
enum BlendFactor : u32
|
||||
{
|
||||
u32 blendenable : 1;
|
||||
u32 logicopenable : 1;
|
||||
u32 dither : 1;
|
||||
u32 colorupdate : 1;
|
||||
u32 alphaupdate : 1;
|
||||
u32 dstfactor : 3; //BLEND_ONE, BLEND_INV_SRc etc
|
||||
u32 srcfactor : 3;
|
||||
u32 subtract : 1;
|
||||
u32 logicmode : 4;
|
||||
ZERO = 0,
|
||||
ONE = 1,
|
||||
SRCCLR = 2, // for dst factor
|
||||
INVSRCCLR = 3, // for dst factor
|
||||
DSTCLR = SRCCLR, // for src factor
|
||||
INVDSTCLR = INVSRCCLR, // for src factor
|
||||
SRCALPHA = 4,
|
||||
INVSRCALPHA = 5,
|
||||
DSTALPHA = 6,
|
||||
INVDSTALPHA = 7
|
||||
};
|
||||
|
||||
enum LogicOp : u32
|
||||
{
|
||||
CLEAR = 0,
|
||||
AND = 1,
|
||||
AND_REVERSE = 2,
|
||||
COPY = 3,
|
||||
AND_INVERTED = 4,
|
||||
NOOP = 5,
|
||||
XOR = 6,
|
||||
OR = 7,
|
||||
NOR = 8,
|
||||
EQUIV = 9,
|
||||
INVERT = 10,
|
||||
OR_REVERSE = 11,
|
||||
COPY_INVERTED = 12,
|
||||
OR_INVERTED = 13,
|
||||
NAND = 14,
|
||||
SET = 15
|
||||
};
|
||||
|
||||
BitField< 0,1,u32> blendenable;
|
||||
BitField< 1,1,u32> logicopenable;
|
||||
BitField< 2,1,u32> dither;
|
||||
BitField< 3,1,u32> colorupdate;
|
||||
BitField< 4,1,u32> alphaupdate;
|
||||
BitField< 5,3,BlendFactor> dstfactor;
|
||||
BitField< 8,3,BlendFactor> srcfactor;
|
||||
BitField<11,1,u32> subtract;
|
||||
BitField<12,4,LogicOp> logicmode;
|
||||
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
@ -734,12 +726,22 @@ struct FogParams
|
||||
|
||||
union ZMode
|
||||
{
|
||||
struct
|
||||
enum CompareMode : u32
|
||||
{
|
||||
u32 testenable : 1;
|
||||
u32 func : 3;
|
||||
u32 updateenable : 1; //size?
|
||||
NEVER = 0,
|
||||
LESS = 1,
|
||||
EQUAL = 2,
|
||||
LEQUAL = 3,
|
||||
GREATER = 4,
|
||||
NEQUAL = 5,
|
||||
GEQUAL = 6,
|
||||
ALWAYS = 7
|
||||
};
|
||||
|
||||
BitField<0,1,u32> testenable;
|
||||
BitField<1,3,CompareMode> func;
|
||||
BitField<4,1,u32> updateenable;
|
||||
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
@ -870,14 +872,32 @@ union TevKSel
|
||||
|
||||
union AlphaTest
|
||||
{
|
||||
struct
|
||||
enum CompareMode : u32
|
||||
{
|
||||
u32 ref0 : 8;
|
||||
u32 ref1 : 8;
|
||||
u32 comp0 : 3;
|
||||
u32 comp1 : 3;
|
||||
u32 logic : 2;
|
||||
NEVER = 0,
|
||||
LESS = 1,
|
||||
EQUAL = 2,
|
||||
LEQUAL = 3,
|
||||
GREATER = 4,
|
||||
NEQUAL = 5,
|
||||
GEQUAL = 6,
|
||||
ALWAYS = 7
|
||||
};
|
||||
|
||||
enum Op
|
||||
{
|
||||
AND = 0,
|
||||
OR = 1,
|
||||
XOR = 2,
|
||||
XNOR = 3
|
||||
};
|
||||
|
||||
BitField< 0,8, u32> ref0;
|
||||
BitField< 8,8, u32> ref1;
|
||||
BitField<16,3, CompareMode> comp0;
|
||||
BitField<19,3, CompareMode> comp1;
|
||||
BitField<22,2, Op> logic;
|
||||
|
||||
u32 hex;
|
||||
|
||||
enum TEST_RESULT
|
||||
@ -891,31 +911,31 @@ union AlphaTest
|
||||
{
|
||||
switch (logic)
|
||||
{
|
||||
case 0: // AND
|
||||
if (comp0 == ALPHACMP_ALWAYS && comp1 == ALPHACMP_ALWAYS)
|
||||
case AND:
|
||||
if (comp0 == ALWAYS && comp1 == ALWAYS)
|
||||
return PASS;
|
||||
if (comp0 == ALPHACMP_NEVER || comp1 == ALPHACMP_NEVER)
|
||||
if (comp0 == NEVER || comp1 == NEVER)
|
||||
return FAIL;
|
||||
break;
|
||||
|
||||
case 1: // OR
|
||||
if (comp0 == ALPHACMP_ALWAYS || comp1 == ALPHACMP_ALWAYS)
|
||||
case OR:
|
||||
if (comp0 == ALWAYS || comp1 == ALWAYS)
|
||||
return PASS;
|
||||
if (comp0 == ALPHACMP_NEVER && comp1 == ALPHACMP_NEVER)
|
||||
if (comp0 == NEVER && comp1 == NEVER)
|
||||
return FAIL;
|
||||
break;
|
||||
|
||||
case 2: // XOR
|
||||
if ((comp0 == ALPHACMP_ALWAYS && comp1 == ALPHACMP_NEVER) || (comp0 == ALPHACMP_NEVER && comp1 == ALPHACMP_ALWAYS))
|
||||
case XOR:
|
||||
if ((comp0 == ALWAYS && comp1 == NEVER) || (comp0 == NEVER && comp1 == ALWAYS))
|
||||
return PASS;
|
||||
if ((comp0 == ALPHACMP_ALWAYS && comp1 == ALPHACMP_ALWAYS) || (comp0 == ALPHACMP_NEVER && comp1 == ALPHACMP_NEVER))
|
||||
if ((comp0 == ALWAYS && comp1 == ALWAYS) || (comp0 == NEVER && comp1 == NEVER))
|
||||
return FAIL;
|
||||
break;
|
||||
|
||||
case 3: // XNOR
|
||||
if ((comp0 == ALPHACMP_ALWAYS && comp1 == ALPHACMP_NEVER) || (comp0 == ALPHACMP_NEVER && comp1 == ALPHACMP_ALWAYS))
|
||||
case XNOR:
|
||||
if ((comp0 == ALWAYS && comp1 == NEVER) || (comp0 == NEVER && comp1 == ALWAYS))
|
||||
return FAIL;
|
||||
if ((comp0 == ALPHACMP_ALWAYS && comp1 == ALPHACMP_ALWAYS) || (comp0 == ALPHACMP_NEVER && comp1 == ALPHACMP_NEVER))
|
||||
if ((comp0 == ALWAYS && comp1 == ALWAYS) || (comp0 == NEVER && comp1 == NEVER))
|
||||
return PASS;
|
||||
break;
|
||||
}
|
||||
|
@ -133,8 +133,8 @@ void BPWritten(const BPCmd& bp)
|
||||
SetLineWidth();
|
||||
break;
|
||||
case BPMEM_ZMODE: // Depth Control
|
||||
PRIM_LOG("zmode: test=%d, func=%d, upd=%d", bpmem.zmode.testenable, bpmem.zmode.func,
|
||||
bpmem.zmode.updateenable);
|
||||
PRIM_LOG("zmode: test=%d, func=%d, upd=%d", (int)bpmem.zmode.testenable,
|
||||
(int)bpmem.zmode.func, (int)bpmem.zmode.updateenable);
|
||||
SetDepthMode();
|
||||
break;
|
||||
case BPMEM_BLENDMODE: // Blending Control
|
||||
@ -142,8 +142,9 @@ void BPWritten(const BPCmd& bp)
|
||||
if (bp.changes & 0xFFFF)
|
||||
{
|
||||
PRIM_LOG("blendmode: en=%d, open=%d, colupd=%d, alphaupd=%d, dst=%d, src=%d, sub=%d, mode=%d",
|
||||
bpmem.blendmode.blendenable, bpmem.blendmode.logicopenable, bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate,
|
||||
bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode);
|
||||
(int)bpmem.blendmode.blendenable, (int)bpmem.blendmode.logicopenable, (int)bpmem.blendmode.colorupdate,
|
||||
(int)bpmem.blendmode.alphaupdate, (int)bpmem.blendmode.dstfactor, (int)bpmem.blendmode.srcfactor,
|
||||
(int)bpmem.blendmode.subtract, (int)bpmem.blendmode.logicmode);
|
||||
|
||||
// Set LogicOp Blending Mode
|
||||
if (bp.changes & 0xF002) // logicopenable | logicmode
|
||||
@ -304,8 +305,10 @@ void BPWritten(const BPCmd& bp)
|
||||
PixelShaderManager::SetFogColorChanged();
|
||||
break;
|
||||
case BPMEM_ALPHACOMPARE: // Compare Alpha Values
|
||||
PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d", bpmem.alpha_test.ref0,
|
||||
bpmem.alpha_test.ref1, bpmem.alpha_test.comp0, bpmem.alpha_test.comp1, bpmem.alpha_test.logic);
|
||||
PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d",
|
||||
(int)bpmem.alpha_test.ref0, (int)bpmem.alpha_test.ref1,
|
||||
(int)bpmem.alpha_test.comp0, (int)bpmem.alpha_test.comp1,
|
||||
(int)bpmem.alpha_test.logic);
|
||||
if (bp.changes & 0xFFFF)
|
||||
PixelShaderManager::SetAlpha();
|
||||
if (bp.changes)
|
||||
|
Loading…
x
Reference in New Issue
Block a user