diff options
author | Janne Kangas <janne.kangas@qt.io> | 2019-07-26 14:49:10 +0300 |
---|---|---|
committer | Janne Kangas <janne.kangas@qt.io> | 2019-09-30 11:35:54 +0300 |
commit | 2902563f2f97fe18e3a547e72e66ee57d443df4f (patch) | |
tree | 99edb279806189ee3f91b95d6adfb1b4ec2d0b1d /src/runtimerender/Qt3DSRenderShaderCache.cpp | |
parent | d7b5007145a82f9dd855a6417ad6ec9be960e422 (diff) |
Indicate effect shader errors in Editorv2.5.0-beta2
Show a pop-up if a shader fails to compile. Compilation takes place when
the effect is added to a object in timeline.
Requires both editor and runtime commits.
Task-id: QT3DS-3598
Change-Id: Ie9b5a960773c16e00ef99bd0a05e581daf008365
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/runtimerender/Qt3DSRenderShaderCache.cpp')
-rw-r--r-- | src/runtimerender/Qt3DSRenderShaderCache.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/runtimerender/Qt3DSRenderShaderCache.cpp b/src/runtimerender/Qt3DSRenderShaderCache.cpp index c642360..fd2c669 100644 --- a/src/runtimerender/Qt3DSRenderShaderCache.cpp +++ b/src/runtimerender/Qt3DSRenderShaderCache.cpp @@ -383,7 +383,7 @@ struct ShaderCache : public IShaderCache const char8_t *inTessCtrl, const char8_t *inTessEval, const char8_t *inGeom, const SShaderCacheProgramFlags &inFlags, NVConstDataRef<SShaderPreprocessorFeature> inFeatures, - bool separableProgram, bool fromDisk = false) override + QString &errors, bool separableProgram, bool fromDisk = false) override { if (m_ShaderCompilationEnabled == false) return nullptr; @@ -421,14 +421,15 @@ struct ShaderCache : public IShaderCache if (!fromDisk) addShaderPreprocessors(inKey, inFlags, inFeatures, separableProgram, false); - theInserter.first->second = - m_RenderContext + NVRenderVertFragCompilationResult res = m_RenderContext .CompileSource(inKey, m_VertexCode.c_str(), QT3DSU32(m_VertexCode.size()), m_FragmentCode.c_str(), QT3DSU32(m_FragmentCode.size()), m_TessCtrlCode.c_str(), QT3DSU32(m_TessCtrlCode.size()), m_TessEvalCode.c_str(), QT3DSU32(m_TessEvalCode.size()), m_GeometryCode.c_str(), QT3DSU32(m_GeometryCode.size()), - separableProgram).mShader; + separableProgram); + theInserter.first->second = res.mShader; + errors = res.errors; // This is unnecessary memory waste in final deployed product, so we don't store this // information when shaders were initialized from a cache. @@ -462,9 +463,10 @@ struct ShaderCache : public IShaderCache if (theProgram) return theProgram; + QString error; NVRenderShaderProgram *retval = ForceCompileProgram(inKey, inVert, inFrag, inTessCtrl, inTessEval, inGeom, inFlags, - inFeatures, separableProgram); + inFeatures, error, separableProgram); return retval; } @@ -622,6 +624,7 @@ struct ShaderCache : public IShaderCache if (!loadVertexData.isEmpty() && (!loadFragmentData.isEmpty() || !loadGeometryData.isEmpty())) { + QString error; theShader = ForceCompileProgram( theKey, loadVertexData.constData(), loadFragmentData.constData(), @@ -631,7 +634,7 @@ struct ShaderCache : public IShaderCache SShaderCacheProgramFlags(), qt3ds::foundation::toDataRef( features.data(), static_cast<QT3DSU32>(features.size())), - false, true); + error, false, true); } } // If something doesn't save or load correctly, get the runtime to re-generate. |