mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-22 18:00:28 +00:00
Split TextureChanged into two bools, so we can later convert to dirtyflags
This commit is contained in:
parent
7d60ec73be
commit
c289a2c7bf
@ -313,7 +313,7 @@ void DrawEngineDX9::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim, in
|
||||
if (prim == GE_PRIM_RECTANGLES && (gstate.getTextureAddress(0) & 0x3FFFFFFF) == (gstate.getFrameBufAddress() & 0x3FFFFFFF)) {
|
||||
// Rendertarget == texture?
|
||||
if (!g_Config.bDisableSlowFramebufEffects) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ void GPU_DX9::CopyDisplayToOutputInternal() {
|
||||
// shaderManager_->EndFrame();
|
||||
shaderManagerDX9_->DirtyLastShader();
|
||||
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
}
|
||||
|
||||
// Maybe should write this in ASM...
|
||||
@ -890,7 +890,7 @@ void GPU_DX9::Execute_Spline(u32 op, u32 diff) {
|
||||
|
||||
void GPU_DX9::Execute_ViewportType(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
switch (op >> 24) {
|
||||
case GE_CMD_VIEWPORTZSCALE:
|
||||
case GE_CMD_VIEWPORTZCENTER:
|
||||
@ -901,17 +901,17 @@ void GPU_DX9::Execute_ViewportType(u32 op, u32 diff) {
|
||||
|
||||
void GPU_DX9::Execute_Region(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_Scissor(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_FramebufType(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_TexScaleU(u32 op, u32 diff) {
|
||||
@ -935,40 +935,40 @@ void GPU_DX9::Execute_TexOffsetV(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_TexAddr0(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
gstate_c.DirtyUniform(DIRTY_UVSCALEOFFSET);
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_TexAddrN(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_TexBufw0(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_TexBufwN(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_TexSize0(u32 op, u32 diff) {
|
||||
// Render to texture may have overridden the width/height.
|
||||
// Don't reset it unless the size is different / the texture has changed.
|
||||
if (diff || gstate_c.textureChanged != TEXCHANGE_UNCHANGED) {
|
||||
if (diff || (gstate_c.textureParamsChanged || gstate_c.textureImageChanged)) {
|
||||
gstate_c.curTextureWidth = gstate.getTextureWidth(0);
|
||||
gstate_c.curTextureHeight = gstate.getTextureHeight(0);
|
||||
gstate_c.DirtyUniform(DIRTY_UVSCALEOFFSET);
|
||||
// We will need to reset the texture now.
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_TexSizeN(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_TexFormat(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_TexMapMode(u32 op, u32 diff) {
|
||||
@ -976,7 +976,7 @@ void GPU_DX9::Execute_TexMapMode(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_TexParamType(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_TexEnvColor(u32 op, u32 diff) {
|
||||
@ -993,17 +993,17 @@ void GPU_DX9::Execute_TexLevel(u32 op, u32 diff) {
|
||||
gstate.texlevel ^= diff;
|
||||
}
|
||||
*/
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_LoadClut(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
textureCacheDX9_->LoadClut(gstate.getClutAddress(), gstate.getClutLoadBytes());
|
||||
// This could be used to "dirty" textures with clut.
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_ClutFormat(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
// This could be used to "dirty" textures with clut.
|
||||
}
|
||||
|
||||
@ -1116,7 +1116,7 @@ void GPU_DX9::Execute_Generic(u32 op, u32 diff) {
|
||||
|
||||
case GE_CMD_TEXTUREMAPENABLE:
|
||||
if (diff)
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
break;
|
||||
|
||||
case GE_CMD_LIGHTINGENABLE:
|
||||
@ -1599,7 +1599,7 @@ void GPU_DX9::DoState(PointerWrap &p) {
|
||||
textureCacheDX9_->Clear(true);
|
||||
drawEngine_.ClearTrackedVertexArrays();
|
||||
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
framebufferManagerDX9_->DestroyAllFBOs(true);
|
||||
shaderManagerDX9_->ClearCache(true);
|
||||
}
|
||||
|
@ -125,9 +125,10 @@ inline void DrawEngineDX9::ResetShaderBlending() {
|
||||
void DrawEngineDX9::ApplyDrawState(int prim) {
|
||||
// TODO: All this setup is soon so expensive that we'll need dirty flags, or simply do it in the command writes where we detect dirty by xoring. Silly to do all this work on every drawcall.
|
||||
|
||||
if (gstate_c.textureChanged != TEXCHANGE_UNCHANGED && !gstate.isModeClear() && gstate.isTextureMapEnabled()) {
|
||||
if ((gstate_c.textureImageChanged || gstate_c.textureParamsChanged) && !gstate.isModeClear() && gstate.isTextureMapEnabled()) {
|
||||
textureCache_->SetTexture();
|
||||
gstate_c.textureChanged = TEXCHANGE_UNCHANGED;
|
||||
gstate_c.textureImageChanged = false;
|
||||
gstate_c.textureParamsChanged = false;
|
||||
if (gstate_c.needShaderTexClamp) {
|
||||
// We will rarely need to set this, so let's do it every time on use rather than in runloop.
|
||||
// Most of the time non-framebuffer textures will be used which can be clamped themselves.
|
||||
|
@ -127,7 +127,7 @@ void TextureCacheDX9::DeleteTexture(TexCache::iterator it) {
|
||||
|
||||
void TextureCacheDX9::ForgetLastTexture() {
|
||||
lastBoundTexture = INVALID_TEX;
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
// Removes old textures.
|
||||
@ -931,7 +931,7 @@ void TextureCacheDX9::SetTexture(bool force) {
|
||||
// Always rehash in this case, if one changed the rest all probably did.
|
||||
rehash = true;
|
||||
entry->status &= ~TexCacheEntry::STATUS_CLUT_RECHECK;
|
||||
} else if ((gstate_c.textureChanged & TEXCHANGE_UPDATED) == 0) {
|
||||
} else if (!gstate_c.textureImageChanged) {
|
||||
// Okay, just some parameter change - the data didn't change, no need to rehash.
|
||||
rehash = false;
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ void DrawEngineGLES::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim, i
|
||||
if (prim == GE_PRIM_RECTANGLES && (gstate.getTextureAddress(0) & 0x3FFFFFFF) == (gstate.getFrameBufAddress() & 0x3FFFFFFF)) {
|
||||
// Rendertarget == texture?
|
||||
if (!g_Config.bDisableSlowFramebufEffects) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
|
@ -831,7 +831,8 @@ void GPU_GLES::CopyDisplayToOutputInternal() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
// Wait, why?
|
||||
gstate_c.textureImageChanged = true;
|
||||
}
|
||||
|
||||
// Maybe should write this in ASM...
|
||||
@ -1112,27 +1113,27 @@ void GPU_GLES::Execute_Spline(u32 op, u32 diff) {
|
||||
|
||||
void GPU_GLES::Execute_Region(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_Scissor(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_FramebufType(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_ViewportType(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_ViewportZType(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
gstate_c.DirtyUniform(DIRTY_DEPTHRANGE);
|
||||
}
|
||||
|
||||
@ -1157,40 +1158,40 @@ void GPU_GLES::Execute_TexOffsetV(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_TexAddr0(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
gstate_c.DirtyUniform(DIRTY_UVSCALEOFFSET);
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_TexAddrN(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_TexBufw0(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_TexBufwN(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_TexSize0(u32 op, u32 diff) {
|
||||
// Render to texture may have overridden the width/height.
|
||||
// Don't reset it unless the size is different / the texture has changed.
|
||||
if (diff || gstate_c.textureChanged != TEXCHANGE_UNCHANGED) {
|
||||
if (diff || (gstate_c.textureImageChanged || gstate_c.textureParamsChanged)) {
|
||||
gstate_c.curTextureWidth = gstate.getTextureWidth(0);
|
||||
gstate_c.curTextureHeight = gstate.getTextureHeight(0);
|
||||
gstate_c.DirtyUniform(DIRTY_UVSCALEOFFSET);
|
||||
// We will need to reset the texture now.
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_TexSizeN(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_TexFormat(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_TexMapMode(u32 op, u32 diff) {
|
||||
@ -1198,7 +1199,7 @@ void GPU_GLES::Execute_TexMapMode(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_TexParamType(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_TexEnvColor(u32 op, u32 diff) {
|
||||
@ -1215,18 +1216,16 @@ void GPU_GLES::Execute_TexLevel(u32 op, u32 diff) {
|
||||
gstate.texlevel ^= diff;
|
||||
}
|
||||
*/
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_LoadClut(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
textureCacheGL_->LoadClut(gstate.getClutAddress(), gstate.getClutLoadBytes());
|
||||
// This could be used to "dirty" textures with clut.
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_ClutFormat(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
// This could be used to "dirty" textures with clut.
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_Ambient(u32 op, u32 diff) {
|
||||
@ -1885,7 +1884,7 @@ void GPU_GLES::DoState(PointerWrap &p) {
|
||||
depalShaderCache_.Clear();
|
||||
drawEngine_.ClearTrackedVertexArrays();
|
||||
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
framebufferManagerGL_->DestroyAllFBOs(true);
|
||||
shaderManagerGL_->ClearCache(true);
|
||||
}
|
||||
|
@ -157,12 +157,12 @@ inline void DrawEngineGLES::ResetShaderBlending() {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: All this setup is so expensive that we'll need dirty flags, or simply do it in the command writes where we detect dirty by xoring. Silly to do all this work on every drawcall.
|
||||
void DrawEngineGLES::ApplyDrawState(int prim) {
|
||||
// TODO: All this setup is so expensive that we'll need dirty flags, or simply do it in the command writes where we detect dirty by xoring. Silly to do all this work on every drawcall.
|
||||
|
||||
if (gstate_c.textureChanged != TEXCHANGE_UNCHANGED && !gstate.isModeClear() && gstate.isTextureMapEnabled()) {
|
||||
if ((gstate_c.textureImageChanged || gstate_c.textureParamsChanged) && !gstate.isModeClear() && gstate.isTextureMapEnabled()) {
|
||||
textureCache_->SetTexture();
|
||||
gstate_c.textureChanged = TEXCHANGE_UNCHANGED;
|
||||
gstate_c.textureImageChanged = false;
|
||||
gstate_c.textureParamsChanged = false;
|
||||
if (gstate_c.needShaderTexClamp) {
|
||||
// We will rarely need to set this, so let's do it every time on use rather than in runloop.
|
||||
// Most of the time non-framebuffer textures will be used which can be clamped themselves.
|
||||
@ -174,18 +174,12 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
|
||||
PROFILE_THIS_SCOPE("applydrawstate");
|
||||
|
||||
bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
|
||||
|
||||
gstate_c.allowShaderBlend = !g_Config.bDisableSlowFramebufEffects;
|
||||
|
||||
// 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.allowShaderBlend);
|
||||
ViewportAndScissor vpAndScissor;
|
||||
ConvertViewportAndScissor(useBufferedRendering,
|
||||
framebufferManager_->GetRenderWidth(), framebufferManager_->GetRenderHeight(),
|
||||
framebufferManager_->GetTargetBufferWidth(), framebufferManager_->GetTargetBufferHeight(),
|
||||
vpAndScissor);
|
||||
|
||||
if (blendState.applyShaderBlending) {
|
||||
if (ApplyShaderBlending()) {
|
||||
@ -351,6 +345,12 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
|
||||
}
|
||||
}
|
||||
|
||||
ViewportAndScissor vpAndScissor;
|
||||
ConvertViewportAndScissor(useBufferedRendering,
|
||||
framebufferManager_->GetRenderWidth(), framebufferManager_->GetRenderHeight(),
|
||||
framebufferManager_->GetTargetBufferWidth(), framebufferManager_->GetTargetBufferHeight(),
|
||||
vpAndScissor);
|
||||
|
||||
if (vpAndScissor.scissorEnable) {
|
||||
glstate.scissorTest.enable();
|
||||
if (!useBufferedRendering) {
|
||||
|
@ -1034,7 +1034,7 @@ void TextureCacheGLES::SetTexture(bool force) {
|
||||
// Always rehash in this case, if one changed the rest all probably did.
|
||||
rehash = true;
|
||||
entry->status &= ~TexCacheEntry::STATUS_CLUT_RECHECK;
|
||||
} else if ((gstate_c.textureChanged & TEXCHANGE_UPDATED) == 0) {
|
||||
} else if (!gstate_c.textureImageChanged) {
|
||||
// Okay, just some parameter change - the data didn't change, no need to rehash.
|
||||
rehash = false;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
|
||||
void ForgetLastTexture() {
|
||||
lastBoundTexture = -1;
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
u32 AllocTextureName();
|
||||
|
@ -787,7 +787,8 @@ void GPUCommon::ProcessDLQueueInternal() {
|
||||
UpdateTickEstimate(std::max(busyTicks, startingTicks + cyclesExecuted));
|
||||
|
||||
// Game might've written new texture data.
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
|
||||
// Seems to be correct behaviour to process the list anyway?
|
||||
if (startingTicks < busyTicks) {
|
||||
@ -1193,7 +1194,7 @@ void GPUCommon::Execute_BlockTransferStart(u32 op, u32 diff) {
|
||||
DoBlockTransfer(gstate_c.skipDrawReason);
|
||||
|
||||
// Fixes Gran Turismo's funky text issue, since it overwrites the current texture.
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
}
|
||||
|
||||
void GPUCommon::Execute_WorldMtxNum(u32 op, u32 diff) {
|
||||
|
@ -216,7 +216,8 @@ void GPUStateCache::DoState(PointerWrap &p) {
|
||||
vertexAddr = old.vertexAddr;
|
||||
indexAddr = old.indexAddr;
|
||||
offsetAddr = old.offsetAddr;
|
||||
textureChanged = TEXCHANGE_UPDATED;
|
||||
textureImageChanged = true;
|
||||
textureParamsChanged = true;
|
||||
textureFullAlpha = old.textureFullAlpha;
|
||||
vertexFullAlpha = old.vertexFullAlpha;
|
||||
skipDrawReason = old.skipDrawReason;
|
||||
@ -226,19 +227,21 @@ void GPUStateCache::DoState(PointerWrap &p) {
|
||||
p.Do(indexAddr);
|
||||
p.Do(offsetAddr);
|
||||
|
||||
p.Do(textureChanged);
|
||||
int textureChanged = 0;
|
||||
p.Do(textureChanged); // legacy
|
||||
textureImageChanged = true;
|
||||
textureParamsChanged = true;
|
||||
p.Do(textureFullAlpha);
|
||||
p.Do(vertexFullAlpha);
|
||||
bool framebufChanged; // legacy
|
||||
bool framebufChanged = false; // legacy
|
||||
p.Do(framebufChanged);
|
||||
|
||||
p.Do(skipDrawReason);
|
||||
|
||||
p.Do(uv);
|
||||
|
||||
// No longer relevant. Remove when creating the next version.
|
||||
bool oldFlipTexture;
|
||||
p.Do(oldFlipTexture);
|
||||
bool oldFlipTexture = false;
|
||||
p.Do(oldFlipTexture); // legacy
|
||||
}
|
||||
|
||||
// needShaderTexClamp and bgraTexture don't need to be saved.
|
||||
|
@ -441,12 +441,6 @@ struct UVScale {
|
||||
float uOff, vOff;
|
||||
};
|
||||
|
||||
enum TextureChangeReason {
|
||||
TEXCHANGE_UNCHANGED = 0x00,
|
||||
TEXCHANGE_UPDATED = 0x01,
|
||||
TEXCHANGE_PARAMSONLY = 0x02,
|
||||
};
|
||||
|
||||
#define FLAG_BIT(x) (1 << x)
|
||||
|
||||
// Some of these are OpenGL-specific even though this file is neutral, unfortunately.
|
||||
@ -513,7 +507,9 @@ struct GPUStateCache {
|
||||
|
||||
uint64_t dirty;
|
||||
|
||||
u8 textureChanged;
|
||||
bool textureImageChanged;
|
||||
bool textureParamsChanged;
|
||||
|
||||
bool textureFullAlpha;
|
||||
bool textureSimpleAlpha;
|
||||
bool vertexFullAlpha;
|
||||
|
@ -214,7 +214,7 @@ void NullGPU::ExecuteOp(u32 op, u32 diff) {
|
||||
break;
|
||||
|
||||
case GE_CMD_TEXADDR0:
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
case GE_CMD_TEXADDR1:
|
||||
case GE_CMD_TEXADDR2:
|
||||
case GE_CMD_TEXADDR3:
|
||||
@ -226,7 +226,7 @@ void NullGPU::ExecuteOp(u32 op, u32 diff) {
|
||||
break;
|
||||
|
||||
case GE_CMD_TEXBUFWIDTH0:
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
case GE_CMD_TEXBUFWIDTH1:
|
||||
case GE_CMD_TEXBUFWIDTH2:
|
||||
case GE_CMD_TEXBUFWIDTH3:
|
||||
@ -342,7 +342,7 @@ void NullGPU::ExecuteOp(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
case GE_CMD_TEXSIZE0:
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
gstate_c.curTextureWidth = 1 << (gstate.texsize[0] & 0xf);
|
||||
gstate_c.curTextureHeight = 1 << ((gstate.texsize[0]>>8) & 0xf);
|
||||
//fall thru - ignoring the mipmap sizes for now
|
||||
|
@ -361,7 +361,7 @@ void DrawEngineVulkan::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim,
|
||||
if (prim == GE_PRIM_RECTANGLES && (gstate.getTextureAddress(0) & 0x3FFFFFFF) == (gstate.getFrameBufAddress() & 0x3FFFFFFF)) {
|
||||
// Rendertarget == texture?
|
||||
if (!g_Config.bDisableSlowFramebufEffects) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
Flush(cmd_);
|
||||
}
|
||||
}
|
||||
@ -600,7 +600,7 @@ void DrawEngineVulkan::DirtyAllUBOs() {
|
||||
dirtyUniforms_ = DIRTY_BASE_UNIFORMS | DIRTY_LIGHT_UNIFORMS | DIRTY_BONE_UNIFORMS;
|
||||
imageView = VK_NULL_HANDLE;
|
||||
sampler = VK_NULL_HANDLE;
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
}
|
||||
|
||||
//void DrawEngineVulkan::ApplyDrawStateLate() {
|
||||
@ -630,10 +630,11 @@ void DrawEngineVulkan::DoFlush(VkCommandBuffer cmd) {
|
||||
FrameData *frame = &frame_[curFrame_ & 1];
|
||||
|
||||
bool textureNeedsApply = false;
|
||||
if (gstate_c.textureChanged != TEXCHANGE_UNCHANGED && !gstate.isModeClear() && gstate.isTextureMapEnabled()) {
|
||||
if ((gstate_c.textureImageChanged || gstate_c.textureParamsChanged) && !gstate.isModeClear() && gstate.isTextureMapEnabled()) {
|
||||
textureCache_->SetTexture();
|
||||
textureNeedsApply = true;
|
||||
gstate_c.textureChanged = TEXCHANGE_UNCHANGED;
|
||||
gstate_c.textureImageChanged = false;
|
||||
gstate_c.textureParamsChanged = false;
|
||||
if (gstate_c.needShaderTexClamp) {
|
||||
// We will rarely need to set this, so let's do it every time on use rather than in runloop.
|
||||
// Most of the time non-framebuffer textures will be used which can be clamped themselves.
|
||||
|
@ -690,7 +690,7 @@ void GPU_Vulkan::CopyDisplayToOutputInternal() {
|
||||
|
||||
framebufferManagerVulkan_->CopyDisplayToOutput();
|
||||
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
}
|
||||
|
||||
// Maybe should write this in ASM...
|
||||
@ -918,27 +918,27 @@ void GPU_Vulkan::Execute_Spline(u32 op, u32 diff) {
|
||||
|
||||
void GPU_Vulkan::Execute_Region(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_Scissor(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_FramebufType(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_ViewportType(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true; // Why?
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_ViewportZType(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_FRAMEBUF);
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
gstate_c.DirtyUniform(DIRTY_DEPTHRANGE);
|
||||
}
|
||||
|
||||
@ -963,40 +963,40 @@ void GPU_Vulkan::Execute_TexOffsetV(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_TexAddr0(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
gstate_c.DirtyUniform(DIRTY_UVSCALEOFFSET);
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_TexAddrN(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_TexBufw0(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_TexBufwN(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_TexSize0(u32 op, u32 diff) {
|
||||
// Render to texture may have overridden the width/height.
|
||||
// Don't reset it unless the size is different / the texture has changed.
|
||||
if (diff || gstate_c.textureChanged != TEXCHANGE_UNCHANGED) {
|
||||
if (diff || (gstate_c.textureImageChanged || gstate_c.textureParamsChanged)) {
|
||||
gstate_c.curTextureWidth = gstate.getTextureWidth(0);
|
||||
gstate_c.curTextureHeight = gstate.getTextureHeight(0);
|
||||
gstate_c.DirtyUniform(DIRTY_UVSCALEOFFSET);
|
||||
// We will need to reset the texture now.
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_TexSizeN(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_TexFormat(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_TexMapMode(u32 op, u32 diff) {
|
||||
@ -1004,7 +1004,7 @@ void GPU_Vulkan::Execute_TexMapMode(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_TexParamType(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_TexEnvColor(u32 op, u32 diff) {
|
||||
@ -1021,18 +1021,16 @@ void GPU_Vulkan::Execute_TexLevel(u32 op, u32 diff) {
|
||||
gstate.texlevel ^= diff;
|
||||
}
|
||||
*/
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_LoadClut(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
textureCacheVulkan_->LoadClut(gstate.getClutAddress(), gstate.getClutLoadBytes());
|
||||
// This could be used to "dirty" textures with clut.
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_ClutFormat(u32 op, u32 diff) {
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
// This could be used to "dirty" textures with clut.
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_Ambient(u32 op, u32 diff) {
|
||||
@ -1769,7 +1767,7 @@ void GPU_Vulkan::DoState(PointerWrap &p) {
|
||||
textureCacheVulkan_->Clear(true);
|
||||
depalShaderCache_.Clear();
|
||||
|
||||
gstate_c.textureChanged = TEXCHANGE_UPDATED;
|
||||
gstate_c.textureImageChanged = true;
|
||||
framebufferManagerVulkan_->DestroyAllFBOs(true);
|
||||
shaderManagerVulkan_->ClearShaders();
|
||||
pipelineManager_->Clear();
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
|
||||
void ForgetLastTexture() {
|
||||
lastBoundTexture = nullptr;
|
||||
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
|
||||
gstate_c.textureParamsChanged = true;
|
||||
}
|
||||
|
||||
void ApplyTexture(VulkanPushBuffer *uploadBuffer, VkImageView &imageView, VkSampler &sampler);
|
||||
|
Loading…
x
Reference in New Issue
Block a user