mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-20 05:26:42 +00:00
Apply shader prefix even if encoding is directly accepted. Closes #2561
* The prefix, if available, must always be applied for custom shaders to compile correctly.
This commit is contained in:
@@ -4244,16 +4244,30 @@ void TextureViewer::reloadCustomShaders(const QString &filter)
|
||||
QTextStream stream(&fileHandle);
|
||||
QString source = stream.readAll();
|
||||
|
||||
bytebuf shaderBytes(source.toUtf8());
|
||||
bytebuf shaderBytes;
|
||||
|
||||
rdcarray<ShaderEncoding> supported = m_Ctx.CustomShaderEncodings();
|
||||
rdcarray<ShaderSourcePrefix> 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
|
||||
|
||||
Reference in New Issue
Block a user