mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-17 04:39:34 +00:00
Vulkan: Reload shaders if use flags change.
This commit is contained in:
parent
23d254ec21
commit
de3c2783f4
@ -581,7 +581,7 @@ struct GPUStateCache {
|
||||
void SetUseFlags(u32 newFlags) {
|
||||
if (newFlags != useFlags_) {
|
||||
useFlags_ = newFlags;
|
||||
// Recompile shaders and stuff?
|
||||
useFlagsChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,6 +612,7 @@ public:
|
||||
bool bgraTexture;
|
||||
bool needShaderTexClamp;
|
||||
bool arrayTexture;
|
||||
bool useFlagsChanged;
|
||||
|
||||
float morphWeights[8];
|
||||
u32 deferredVertTypeDirty;
|
||||
|
@ -135,6 +135,9 @@ void GPU_Vulkan::LoadCache(const Path &filename) {
|
||||
}
|
||||
if (result) {
|
||||
// Reload use flags in case LoadCacheFlags() changed them.
|
||||
if (drawEngineCommon_->EverUsedExactEqualDepth()) {
|
||||
sawExactEqualDepth_ = true;
|
||||
}
|
||||
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||
result = shaderManagerVulkan_->LoadCache(f);
|
||||
if (!result) {
|
||||
@ -304,6 +307,14 @@ void GPU_Vulkan::BeginHostFrame() {
|
||||
shaderManagerVulkan_->DirtyShader();
|
||||
gstate_c.Dirty(DIRTY_ALL);
|
||||
|
||||
if (gstate_c.useFlagsChanged) {
|
||||
// TODO: It'd be better to recompile them in the background, probably?
|
||||
// This most likely means that saw equal depth changed.
|
||||
WARN_LOG(G3D, "Shader use flags changed, clearing all shaders");
|
||||
shaderManagerVulkan_->ClearShaders();
|
||||
gstate_c.useFlagsChanged = false;
|
||||
}
|
||||
|
||||
if (dumpNextFrame_) {
|
||||
NOTICE_LOG(G3D, "DUMPING THIS FRAME");
|
||||
dumpThisFrame_ = true;
|
||||
|
@ -565,6 +565,9 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) {
|
||||
// This can simply be a result of sawExactEqualDepth_ having been flipped to true in the previous run.
|
||||
// Let's just keep going.
|
||||
WARN_LOG(G3D, "Shader cache useFlags mismatch, %08x, expected %08x", header.useFlags, gstate_c.GetUseFlags());
|
||||
} else {
|
||||
// We're compiling shaders now, so they haven't changed anymore.
|
||||
gstate_c.useFlagsChanged = false;
|
||||
}
|
||||
|
||||
int failCount = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user