diff options
| author | Anthony <Helios747@users.noreply.github.com> | 2017-07-30 01:00:16 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-30 01:00:16 -0700 |
| commit | ba57605266b9ab178963bf56e146f355d1b93cd4 (patch) | |
| tree | 0ddc89cfca6db3d343d317c18b7c07c9ab83e9c4 /Source/Core/VideoCommon/BPStructs.cpp | |
| parent | 5bad2ee4a4129e734ff4f4d861cedc4cd573df55 (diff) | |
| parent | b154edb4fbdb327920a33b44f35f34cdf2636d6f (diff) | |
Merge pull request #5702 from stenzek/ubershaders
Ubershaders 2.0
Diffstat (limited to 'Source/Core/VideoCommon/BPStructs.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/BPStructs.cpp | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 204c637b94..c686d4ff01 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -93,6 +93,9 @@ static void BPWritten(const BPCmd& bp) (u32)bpmem.genMode.cullmode, (u32)bpmem.genMode.numindstages, (u32)bpmem.genMode.zfreeze); + if (bp.changes) + PixelShaderManager::SetGenModeChanged(); + // Only call SetGenerationMode when cull mode changes. if (bp.changes & 0xC000) SetGenerationMode(); @@ -155,12 +158,20 @@ static void BPWritten(const BPCmd& bp) // Set Color Mask if (bp.changes & 0x18) // colorupdate | alphaupdate SetColorMask(); + + // Dither + if (bp.changes & 0x04) + PixelShaderManager::SetBlendModeChanged(); } return; case BPMEM_CONSTANTALPHA: // Set Destination Alpha - PRIM_LOG("constalpha: alp=%d, en=%d", bpmem.dstalpha.alpha, bpmem.dstalpha.enable); - if (bp.changes & 0xFF) - PixelShaderManager::SetDestAlpha(); + PRIM_LOG("constalpha: alp=%d, en=%d", bpmem.dstalpha.alpha.Value(), + bpmem.dstalpha.enable.Value()); + if (bp.changes) + { + PixelShaderManager::SetAlpha(); + PixelShaderManager::SetDestAlphaChanged(); + } if (bp.changes & 0x100) SetBlendMode(); return; @@ -237,6 +248,7 @@ static void BPWritten(const BPCmd& bp) // the number of lines copied is determined by the y scale * source efb height BoundingBox::active = false; + PixelShaderManager::SetBoundingBoxActive(false); float yScale; if (PE_copy.scale_invert) @@ -317,12 +329,13 @@ static void BPWritten(const BPCmd& bp) PixelShaderManager::SetAlpha(); if (bp.changes) { + PixelShaderManager::SetAlphaTestChanged(); g_renderer->SetColorMask(); SetBlendMode(); } return; case BPMEM_BIAS: // BIAS - PRIM_LOG("ztex bias=0x%x", bpmem.ztex1.bias); + PRIM_LOG("ztex bias=0x%x", bpmem.ztex1.bias.Value()); if (bp.changes) PixelShaderManager::SetZTextureBias(); return; @@ -331,7 +344,7 @@ static void BPWritten(const BPCmd& bp) if (bp.changes & 3) PixelShaderManager::SetZTextureTypeChanged(); if (bp.changes & 12) - VertexShaderManager::SetViewportChanged(); + PixelShaderManager::SetZTextureOpChanged(); #if defined(_DEBUG) || defined(DEBUGFAST) const char* pzop[] = {"DISABLE", "ADD", "REPLACE", "?"}; const char* pztype[] = {"Z8", "Z16", "Z24", "?"}; @@ -389,6 +402,7 @@ static void BPWritten(const BPCmd& bp) { u8 offset = bp.address & 2; BoundingBox::active = true; + PixelShaderManager::SetBoundingBoxActive(true); if (g_ActiveConfig.backend_info.bSupportsBBox && g_ActiveConfig.bBBoxEnable) { @@ -425,6 +439,11 @@ static void BPWritten(const BPCmd& bp) * 3 BC0 - Ind. Tex Stage 0 NTexCoord * 0 BI0 - Ind. Tex Stage 0 NTexMap */ case BPMEM_IREF: + { + if (bp.changes) + PixelShaderManager::SetTevIndirectChanged(); + return; + } case BPMEM_TEV_KSEL: // Texture Environment Swap Mode Table 0 case BPMEM_TEV_KSEL + 1: // Texture Environment Swap Mode Table 1 @@ -434,6 +453,8 @@ static void BPWritten(const BPCmd& bp) case BPMEM_TEV_KSEL + 5: // Texture Environment Swap Mode Table 5 case BPMEM_TEV_KSEL + 6: // Texture Environment Swap Mode Table 6 case BPMEM_TEV_KSEL + 7: // Texture Environment Swap Mode Table 7 + PixelShaderManager::SetTevKSel(bp.address - BPMEM_TEV_KSEL, bp.newvalue); + return; /* This Register can be used to limit to which bits of BP registers is * actually written to. The mask is only valid for the next BP write, @@ -566,6 +587,7 @@ static void BPWritten(const BPCmd& bp) // ------------------------- case BPMEM_TREF: case BPMEM_TREF + 4: + PixelShaderManager::SetTevOrder(bp.address - BPMEM_TREF, bp.newvalue); return; // ---------------------- // Set wrap size @@ -629,15 +651,18 @@ static void BPWritten(const BPCmd& bp) // -------------- // Indirect Tev // -------------- - case BPMEM_IND_CMD: // Indirect 0-15 + case BPMEM_IND_CMD: + PixelShaderManager::SetTevIndirectChanged(); return; // -------------------------------------------------- // Set Color/Alpha of a Tev // BPMEM_TEV_COLOR_ENV - Dest, Shift, Clamp, Sub, Bias, Sel A, Sel B, Sel C, Sel D // BPMEM_TEV_ALPHA_ENV - Dest, Shift, Clamp, Sub, Bias, Sel A, Sel B, Sel C, Sel D, T Swap, R Swap // -------------------------------------------------- - case BPMEM_TEV_COLOR_ENV: // Texture Environment Color/Alpha 0-7 - case BPMEM_TEV_COLOR_ENV + 16: // Texture Environment Color/Alpha 8-15 + case BPMEM_TEV_COLOR_ENV: // Texture Environment 1 + case BPMEM_TEV_COLOR_ENV + 16: + PixelShaderManager::SetTevCombiner((bp.address - BPMEM_TEV_COLOR_ENV) >> 1, + (bp.address - BPMEM_TEV_COLOR_ENV) & 1, bp.newvalue); return; default: break; @@ -1281,7 +1306,7 @@ void GetBPRegInfo(const u8* data, std::string* name, std::string* desc) "Tex sel: %d\n", (data[0] - BPMEM_TEV_ALPHA_ENV) / 2, tevin[ac.a], tevin[ac.b], tevin[ac.c], tevin[ac.d], tevbias[ac.bias], tevop[ac.op], no_yes[ac.clamp], - tevscale[ac.shift], tevout[ac.dest], ac.rswap, ac.tswap); + tevscale[ac.shift], tevout[ac.dest], ac.rswap.Value(), ac.tswap.Value()); break; } |
