mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-14 18:19:36 +01:00
Merge pull request #15501 from hrydgard/split-second-simpler-alternative
Make the existing ReinterpretFramebuffers/ShaderColorBitmask path work for Split/Second
This commit is contained in:
9 files changed
+36
-16
No files matched your search
@@ -501,7 +501,7 @@ bool DrawEngineCommon::ApplyFramebufferRead(bool *fboTexNeedsBind) {
|
||||
lastFrameBlit = gpuStats.numFlips;
|
||||
}
|
||||
++blitsThisFrame;
|
||||
if (blitsThisFrame > MAX_REASONABLE_BLITS_PER_FRAME * 2) {
|
||||
if (blitsThisFrame > MAX_REASONABLE_BLITS_PER_FRAME * 4) {
|
||||
WARN_LOG_ONCE(blendingBlit2, G3D, "Skipping additional blits needed for obscure blending: %d per frame, blend %d/%d/%d", blitsThisFrame, gstate.getBlendFuncA(), gstate.getBlendFuncB(), gstate.getBlendEq());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1033,7 +1033,7 @@ void ConvertMaskState(GenericMaskState &maskState, bool allowFramebufferRead) {
|
||||
}
|
||||
|
||||
// Called even if AlphaBlendEnable == false - it also deals with stencil-related blend state.
|
||||
void ConvertBlendState(GenericBlendState &blendState, bool allowFramebufferRead) {
|
||||
void ConvertBlendState(GenericBlendState &blendState, bool allowFramebufferRead, bool forceReplaceBlend) {
|
||||
// Blending is a bit complex to emulate. This is due to several reasons:
|
||||
//
|
||||
// * Doubled blend modes (src, dst, inversed) aren't supported in OpenGL.
|
||||
@@ -1050,6 +1050,9 @@ void ConvertBlendState(GenericBlendState &blendState, bool allowFramebufferRead)
|
||||
blendState.replaceAlphaWithStencil = REPLACE_ALPHA_NO;
|
||||
|
||||
ReplaceBlendType replaceBlend = ReplaceBlendWithShader(allowFramebufferRead, gstate.FrameBufFormat());
|
||||
if (forceReplaceBlend) {
|
||||
replaceBlend = REPLACE_BLEND_COPY_FBO;
|
||||
}
|
||||
ReplaceAlphaType replaceAlphaWithStencil = ReplaceAlphaWithStencil(replaceBlend);
|
||||
bool usePreSrc = false;
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ struct GenericBlendState {
|
||||
}
|
||||
};
|
||||
|
||||
void ConvertBlendState(GenericBlendState &blendState, bool allowShaderBlend);
|
||||
void ConvertBlendState(GenericBlendState &blendState, bool allowShaderBlend, bool forceReplaceBlend);
|
||||
void ApplyStencilReplaceAndLogicOpIgnoreBlend(ReplaceAlphaType replaceAlphaWithStencil, GenericBlendState &blendState);
|
||||
|
||||
struct GenericMaskState {
|
||||
|
||||
@@ -253,6 +253,9 @@ void ComputeFragmentShaderID(FShaderID *id_out, const Draw::Bugs &bugs) {
|
||||
// Note how we here recompute some of the work already done in state mapping.
|
||||
// Not ideal! At least we share the code.
|
||||
ReplaceBlendType replaceBlend = ReplaceBlendWithShader(gstate_c.allowFramebufferRead, gstate.FrameBufFormat());
|
||||
if (colorWriteMask) {
|
||||
replaceBlend = REPLACE_BLEND_COPY_FBO;
|
||||
}
|
||||
ReplaceAlphaType stencilToAlpha = ReplaceAlphaWithStencil(replaceBlend);
|
||||
|
||||
// All texfuncs except replace are the same for RGB as for RGBA with full alpha.
|
||||
|
||||
@@ -155,13 +155,14 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
||||
keys_.blend.colorWriteMask = (colorMask ? (1 | 2 | 4) : 0) | (alphaMask ? 8 : 0);
|
||||
} else {
|
||||
keys_.blend.value = 0;
|
||||
// Set blend - unless we need to do it in the shader.
|
||||
GenericBlendState blendState;
|
||||
ConvertBlendState(blendState, gstate_c.allowFramebufferRead);
|
||||
|
||||
GenericMaskState maskState;
|
||||
ConvertMaskState(maskState, gstate_c.allowFramebufferRead);
|
||||
|
||||
// Set blend - unless we need to do it in the shader.
|
||||
GenericBlendState blendState;
|
||||
ConvertBlendState(blendState, gstate_c.allowFramebufferRead, maskState.applyFramebufferRead);
|
||||
|
||||
if (blendState.applyFramebufferRead || maskState.applyFramebufferRead) {
|
||||
if (ApplyFramebufferRead(&fboTexNeedsBind_)) {
|
||||
// The shader takes over the responsibility for blending, so recompute.
|
||||
|
||||
@@ -125,13 +125,13 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
|
||||
bool alphaMask = gstate.isClearModeAlphaMask();
|
||||
dxstate.colorMask.set(colorMask, colorMask, colorMask, alphaMask);
|
||||
} else {
|
||||
// Set blend - unless we need to do it in the shader.
|
||||
GenericBlendState blendState;
|
||||
ConvertBlendState(blendState, gstate_c.allowFramebufferRead);
|
||||
|
||||
GenericMaskState maskState;
|
||||
ConvertMaskState(maskState, gstate_c.allowFramebufferRead);
|
||||
|
||||
// Set blend - unless we need to do it in the shader.
|
||||
GenericBlendState blendState;
|
||||
ConvertBlendState(blendState, gstate_c.allowFramebufferRead, maskState.applyFramebufferRead);
|
||||
|
||||
if (blendState.applyFramebufferRead || maskState.applyFramebufferRead) {
|
||||
if (ApplyFramebufferRead(&fboTexNeedsBind_)) {
|
||||
// The shader takes over the responsibility for blending, so recompute.
|
||||
|
||||
@@ -155,12 +155,13 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
|
||||
} else {
|
||||
// Do the large chunks of state conversion. We might be able to hide these two behind a dirty-flag each,
|
||||
// to avoid recomputing heavy stuff unnecessarily every draw call.
|
||||
GenericBlendState blendState;
|
||||
ConvertBlendState(blendState, gstate_c.allowFramebufferRead);
|
||||
|
||||
GenericMaskState maskState;
|
||||
ConvertMaskState(maskState, gstate_c.allowFramebufferRead);
|
||||
|
||||
GenericBlendState blendState;
|
||||
ConvertBlendState(blendState, gstate_c.allowFramebufferRead, maskState.applyFramebufferRead);
|
||||
|
||||
if (blendState.applyFramebufferRead || maskState.applyFramebufferRead) {
|
||||
if (ApplyFramebufferRead(&fboTexNeedsBind_)) {
|
||||
// The shader takes over the responsibility for blending, so recompute.
|
||||
|
||||
@@ -161,13 +161,13 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
|
||||
key.logicOp = VK_LOGIC_OP_CLEAR;
|
||||
}
|
||||
|
||||
// Set blend - unless we need to do it in the shader.
|
||||
GenericBlendState blendState;
|
||||
ConvertBlendState(blendState, gstate_c.allowFramebufferRead);
|
||||
|
||||
GenericMaskState maskState;
|
||||
ConvertMaskState(maskState, gstate_c.allowFramebufferRead);
|
||||
|
||||
// Set blend - unless we need to do it in the shader.
|
||||
GenericBlendState blendState;
|
||||
ConvertBlendState(blendState, gstate_c.allowFramebufferRead, maskState.applyFramebufferRead);
|
||||
|
||||
if (blendState.applyFramebufferRead || maskState.applyFramebufferRead) {
|
||||
if (ApplyFramebufferRead(&fboTexNeedsBind_)) {
|
||||
// The shader takes over the responsibility for blending, so recompute.
|
||||
|
||||
@@ -1025,6 +1025,12 @@ ULES01441 = true
|
||||
ULJM05600 = true
|
||||
ULJM05775 = true
|
||||
|
||||
# Split/Second
|
||||
ULES01402 = true
|
||||
ULUS10513 = true
|
||||
ULJM05812 = true
|
||||
NPJH50371 = true
|
||||
|
||||
[ShaderColorBitmask]
|
||||
# Outrun 2006: Coast to Coast - issue #11358
|
||||
ULES00262 = true
|
||||
@@ -1037,6 +1043,12 @@ ULJM05533 = true
|
||||
NPJH50006 = true
|
||||
ULES01301 = true
|
||||
|
||||
# Split/Second
|
||||
ULES01402 = true
|
||||
ULUS10513 = true
|
||||
ULJM05812 = true
|
||||
NPJH50371 = true
|
||||
|
||||
[DisableFirstFrameReadback]
|
||||
# Wipeout Pure: Temporary workaround for lens flare flicker. See #13344
|
||||
UCUS98612 = true
|
||||
|
||||
Reference in new issue
Block a user