Port some accessors over from #9255 to be able to catch these changes and dirty state later.

This commit is contained in:
Henrik Rydgård 2017-04-03 17:04:58 +02:00
parent 1faae8b6d6
commit 5a8e9c4f71
10 changed files with 40 additions and 28 deletions

View file

@ -1414,8 +1414,8 @@ void TextureCacheCommon::ApplyTexture() {
ApplyTextureFramebuffer(entry, entry->framebuffer);
} else {
BindTexture(entry);
gstate_c.textureFullAlpha = entry->GetAlphaStatus() == TexCacheEntry::STATUS_ALPHA_FULL;
gstate_c.textureSimpleAlpha = entry->GetAlphaStatus() != TexCacheEntry::STATUS_ALPHA_UNKNOWN;
gstate_c.SetTextureFullAlpha(entry->GetAlphaStatus() == TexCacheEntry::STATUS_ALPHA_FULL);
gstate_c.SetTextureSimpleAlpha(entry->GetAlphaStatus() != TexCacheEntry::STATUS_ALPHA_UNKNOWN);
}
}

View file

@ -139,7 +139,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
// Blend
{
gstate_c.allowShaderBlend = !g_Config.bDisableSlowFramebufEffects;
gstate_c.SetAllowShaderBlend(!g_Config.bDisableSlowFramebufEffects);
if (gstate.isModeClear()) {
keys_.blend.value = 0; // full wipe
keys_.blend.blendEnable = false;
@ -159,7 +159,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
} else {
// Until next time, force it off.
ResetShaderBlending();
gstate_c.allowShaderBlend = false;
gstate_c.SetAllowShaderBlend(false);
}
} else if (blendState.resetShaderBlending) {
ResetShaderBlending();

View file

@ -424,15 +424,15 @@ void TextureCacheD3D11::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFra
const u32 clutTotalColors = clutMaxBytes_ / bytesPerColor;
TexCacheEntry::Status alphaStatus = CheckAlpha(clutBuf_, GetClutDestFormatD3D11(clutFormat), clutTotalColors, clutTotalColors, 1);
gstate_c.textureFullAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL;
gstate_c.textureSimpleAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE;
gstate_c.SetTextureFullAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL);
gstate_c.SetTextureSimpleAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE);
} else {
entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE;
framebufferManagerD3D11_->BindFramebufferAsColorTexture(0, framebuffer, BINDFBCOLOR_MAY_COPY_WITH_UV | BINDFBCOLOR_APPLY_TEX_OFFSET);
gstate_c.textureFullAlpha = gstate.getTextureFormat() == GE_TFMT_5650;
gstate_c.textureSimpleAlpha = gstate_c.textureFullAlpha;
gstate_c.SetTextureFullAlpha(gstate.getTextureFormat() == GE_TFMT_5650);
gstate_c.SetTextureSimpleAlpha(gstate_c.textureFullAlpha);
framebufferManagerD3D11_->RebindFramebuffer();
}
SamplerCacheKey samplerKey;

View file

@ -117,7 +117,7 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
{
// Unfortunately, this isn't implemented yet.
gstate_c.allowShaderBlend = false;
gstate_c.SetAllowShaderBlend(false);
if (gstate.isModeClear()) {
dxstate.blend.disable();
@ -137,7 +137,7 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
} else {
// Until next time, force it off.
ResetShaderBlending();
gstate_c.allowShaderBlend = false;
gstate_c.SetAllowShaderBlend(false);
}
} else if (blendState.resetShaderBlending) {
ResetShaderBlending();

View file

@ -445,15 +445,15 @@ void TextureCacheDX9::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFrame
const u32 clutTotalColors = clutMaxBytes_ / bytesPerColor;
TexCacheEntry::Status alphaStatus = CheckAlpha(clutBuf_, getClutDestFormat(clutFormat), clutTotalColors, clutTotalColors, 1);
gstate_c.textureFullAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL;
gstate_c.textureSimpleAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE;
gstate_c.SetTextureFullAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL);
gstate_c.SetTextureSimpleAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE);
} else {
entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE;
framebufferManagerDX9_->BindFramebufferAsColorTexture(0, framebuffer, BINDFBCOLOR_MAY_COPY_WITH_UV | BINDFBCOLOR_APPLY_TEX_OFFSET);
gstate_c.textureFullAlpha = gstate.getTextureFormat() == GE_TFMT_5650;
gstate_c.textureSimpleAlpha = gstate_c.textureFullAlpha;
gstate_c.SetTextureFullAlpha(gstate.getTextureFormat() == GE_TFMT_5650);
gstate_c.SetTextureSimpleAlpha(gstate_c.textureFullAlpha);
}
framebufferManagerDX9_->RebindFramebuffer();

View file

@ -159,7 +159,7 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
{
gstate_c.allowShaderBlend = !g_Config.bDisableSlowFramebufEffects;
gstate_c.SetAllowShaderBlend(!g_Config.bDisableSlowFramebufEffects);
if (gstate.isModeClear()) {
glstate.blend.disable();
@ -186,7 +186,7 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
} else {
// Until next time, force it off.
ResetShaderBlending();
gstate_c.allowShaderBlend = false;
gstate_c.SetAllowShaderBlend(false);
}
} else if (blendState.resetShaderBlending) {
ResetShaderBlending();

View file

@ -503,15 +503,15 @@ void TextureCacheGLES::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFram
const u32 clutTotalColors = clutMaxBytes_ / bytesPerColor;
TexCacheEntry::Status alphaStatus = CheckAlpha(clutBuf_, getClutDestFormat(clutFormat), clutTotalColors, clutTotalColors, 1);
gstate_c.textureFullAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL;
gstate_c.textureSimpleAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE;
gstate_c.SetTextureFullAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL);
gstate_c.SetTextureSimpleAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE);
} else {
entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE;
framebufferManagerGL_->BindFramebufferAsColorTexture(0, framebuffer, BINDFBCOLOR_MAY_COPY_WITH_UV | BINDFBCOLOR_APPLY_TEX_OFFSET);
gstate_c.textureFullAlpha = gstate.getTextureFormat() == GE_TFMT_5650;
gstate_c.textureSimpleAlpha = gstate_c.textureFullAlpha;
gstate_c.SetTextureFullAlpha(gstate.getTextureFormat() == GE_TFMT_5650);
gstate_c.SetTextureSimpleAlpha(gstate_c.textureFullAlpha);
}
framebufferManagerGL_->RebindFramebuffer();

View file

@ -501,6 +501,18 @@ struct GPUStateCache {
bool IsDirty(u64 what) const {
return (dirty & what) != 0ULL;
}
void SetTextureFullAlpha(bool fullAlpha) {
textureFullAlpha = fullAlpha;
}
void SetTextureSimpleAlpha(bool simpleAlpha) {
textureSimpleAlpha = simpleAlpha;
}
void SetNeedShaderTexclamp(bool need) {
needShaderTexClamp = need;
}
void SetAllowShaderBlend(bool allow) {
allowShaderBlend = allow;
}
u32 featureFlags;

View file

@ -136,7 +136,7 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
{
// Unfortunately, this isn't implemented yet.
gstate_c.allowShaderBlend = false;
gstate_c.SetAllowShaderBlend(false);
if (gstate.isModeClear()) {
key.logicOpEnable = false;
key.blendEnable = false;
@ -159,7 +159,7 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
} else {
// Until next time, force it off.
ResetShaderBlending();
gstate_c.allowShaderBlend = false;
gstate_c.SetAllowShaderBlend(false);
}
} else if (blendState.resetShaderBlending) {
ResetShaderBlending();

View file

@ -429,13 +429,13 @@ void TextureCacheVulkan::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFr
const u32 clutTotalColors = clutMaxBytes_ / bytesPerColor;
TexCacheEntry::Status alphaStatus = CheckAlpha(clutBuf_, getClutDestFormatVulkan(clutFormat), clutTotalColors, clutTotalColors, 1);
gstate_c.textureFullAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL;
gstate_c.textureSimpleAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE;
gstate_c.SetTextureFullAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_FULL);
gstate_c.SetTextureSimpleAlpha(alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE);
} else {
entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE;
gstate_c.textureFullAlpha = gstate.getTextureFormat() == GE_TFMT_5650;
gstate_c.textureSimpleAlpha = gstate_c.textureFullAlpha;
gstate_c.SetTextureFullAlpha(gstate.getTextureFormat() == GE_TFMT_5650);
gstate_c.SetTextureSimpleAlpha(gstate_c.textureFullAlpha);
}
/*
@ -683,8 +683,8 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry, bool replaceIm
entry->vkTex->texture_->EndCreate();
gstate_c.textureFullAlpha = entry->GetAlphaStatus() == TexCacheEntry::STATUS_ALPHA_FULL;
gstate_c.textureSimpleAlpha = entry->GetAlphaStatus() != TexCacheEntry::STATUS_ALPHA_UNKNOWN;
gstate_c.SetTextureFullAlpha(entry->GetAlphaStatus() == TexCacheEntry::STATUS_ALPHA_FULL);
gstate_c.SetTextureSimpleAlpha(entry->GetAlphaStatus() != TexCacheEntry::STATUS_ALPHA_UNKNOWN);
}
VkFormat TextureCacheVulkan::GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const {