From 60f9da39263a1d36f8a15a9a3e14af1b504c7cdb Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sat, 12 Jan 2013 12:51:09 +0100 Subject: [PATCH] Add support for color masking. Improves the look of Wipeout greatly. --- GPU/GLES/StateMapping.cpp | 8 ++++++++ GPU/GPUState.h | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index ba958bb513..cc2d54fe6e 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -155,6 +155,14 @@ void ApplyDrawState() glstate.depthFunc.set(ztests[depthTestFunc]); } + // PSP color/alpha mask is per bit but we can only support per byte. + // But let's do that, at least. And let's try a threshold. + bool rmask = (gstate.pmskc & 0xFF) < 128; + bool gmask = ((gstate.pmskc >> 8) & 0xFF) < 128; + bool bmask = ((gstate.pmskc >> 16) & 0xFF) < 128; + bool amask = (gstate.pmska & 0xFF) < 128; + glstate.colorMask.set(rmask, gmask, bmask, amask); + bool wantDepthWrite = gstate.isModeClear() || gstate.isDepthWriteEnabled(); glstate.depthWrite.set(wantDepthWrite ? GL_TRUE : GL_FALSE); diff --git a/GPU/GPUState.h b/GPU/GPUState.h index 2580d73518..3db977c7c1 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -177,8 +177,8 @@ struct GPUgstate dith4, lop, zmsk, - pmsk1, - pmsk2, + pmskc, + pmska, transferstart, transfersrcpos, transferdstpos,