diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index a3b4c5cd9..feadb776d 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -4244,16 +4244,30 @@ void TextureViewer::reloadCustomShaders(const QString &filter) QTextStream stream(&fileHandle); QString source = stream.readAll(); - bytebuf shaderBytes(source.toUtf8()); + bytebuf shaderBytes; rdcarray supported = m_Ctx.CustomShaderEncodings(); rdcarray prefixes = m_Ctx.CustomShaderSourcePrefixes(); rdcstr errors; - // we don't accept this encoding directly, need to compile - if(!supported.contains(encoding)) + if(supported.contains(encoding)) { + // apply any prefix needed + for(const ShaderSourcePrefix &prefix : prefixes) + { + if(prefix.encoding == encoding) + { + source = QString(prefix.prefix) + source; + break; + } + } + + shaderBytes = bytebuf(source.toUtf8()); + } + else + { + // we don't accept this encoding directly, need to compile for(const ShaderProcessingTool &tool : m_Ctx.Config().ShaderProcessors) { // pick the first tool that can convert to an accepted format