diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-01-23 12:16:53 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-02-01 20:59:51 +0000 |
commit | bb548a48c0e5f9e07ccc84c69b4e7e38c8c751cf (patch) | |
tree | 5890cfcb15caef64fba278a3fad0318a1e52a448 /tests | |
parent | 02ebfda6c3aaedd2becdc4f0ce4a39025e95b726 (diff) |
Compile failing shaders once only and avoid asserting on failure
This way a material with a broken shader will fail once (and won't be
retried unless the shader code gets changed), and the application will
continue gracefully, without asserting.
Task-number: QTBUG-65936
Change-Id: I7003e8c6f7d9094280d7757c1020b485f93e3b37
Reviewed-by: Svenn-Arne Dragly <svenn-arne.dragly@qt.io>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/render/shadercache/tst_shadercache.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/render/shadercache/tst_shadercache.cpp b/tests/auto/render/shadercache/tst_shadercache.cpp index 1c70d4405..49628ef0f 100644 --- a/tests/auto/render/shadercache/tst_shadercache.cpp +++ b/tests/auto/render/shadercache/tst_shadercache.cpp @@ -131,6 +131,19 @@ void tst_ShaderCache::value() auto dnaC = ProgramDNA(54321); auto uncachedProgram = cache.getShaderProgramAndAddRef(dnaC, nodeIdB); QVERIFY(uncachedProgram == nullptr); + + cache.clear(); + // Test inserting nullptr. + cache.insert(dnaA, nodeIdA, nullptr); + bool wasPresent = false; + cachedProgramA = cache.getShaderProgramAndAddRef(dnaA, nodeIdA, &wasPresent); + QCOMPARE(wasPresent, true); + QCOMPARE(cachedProgramA, nullptr); + cache.clear(); + // Test wasPresent==false. + cachedProgramB = cache.getShaderProgramAndAddRef(dnaB, nodeIdB, &wasPresent); + QCOMPARE(wasPresent, false); + QCOMPARE(cachedProgramB, nullptr); } void tst_ShaderCache::removeRef() |