summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2020-03-10 12:49:07 +0200
committerJanne Kangas <janne.kangas@qt.io>2020-03-10 13:48:11 +0200
commite97bf0e6be6a22a6f7feb074841058291b917d33 (patch)
treefc81888e6920b4dc3cd8cf5a01fe569d59dbd904
parentb22001700918b228bb4c46c7702c9fbbcacba0ac (diff)
Remove the old shader result if compilation fails
If shader is changed and compilation fails, remove the old result from shader cache. Task-id: QT3DS-4065 Change-Id: Ie5d13c0b3649dfb65f8053ff9d76b34c80ba9bcd Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/runtimerender/Qt3DSRenderCustomMaterialSystem.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/runtimerender/Qt3DSRenderCustomMaterialSystem.cpp b/src/runtimerender/Qt3DSRenderCustomMaterialSystem.cpp
index 5f54b4c..cb94534 100644
--- a/src/runtimerender/Qt3DSRenderCustomMaterialSystem.cpp
+++ b/src/runtimerender/Qt3DSRenderCustomMaterialSystem.cpp
@@ -1266,6 +1266,9 @@ struct SMaterialSystem : public ICustomMaterialSystem
if (theProgram) {
theInsertResult.first->second =
QT3DS_NEW(m_Allocator, SCustomMaterialShader)(*theProgram, theFlags);
+ } else {
+ // If a changed shader fails to compile, clean away the old result from cache
+ theInsertResult.first->second = NULL;
}
} else if (theInsertResult.first->second)
theProgram = theInsertResult.first->second->m_Shader;