Add support for file includes from custom shaders. Closes #2275

This commit is contained in:
baldurk
2021-05-17 13:46:01 +01:00
parent 331db5b4ba
commit d8d6557feb
24 changed files with 265 additions and 121 deletions
+11 -1
View File
@@ -4326,12 +4326,22 @@ void TextureViewer::reloadCustomShaders(const QString &filter)
fileHandle.close();
rdcarray<rdcstr> dirs;
for(QDir d : getShaderDirectories())
{
if(d.exists())
dirs.push_back(d.absolutePath());
}
m_CustomShaders[key] = ResourceId();
m_CustomShadersBusy.push_back(key);
m_Ctx.Replay().AsyncInvoke(
[this, fn, key, shaderBytes, encoding, errors](IReplayController *r) {
[this, fn, dirs, key, shaderBytes, encoding, errors](IReplayController *r) {
rdcstr buildErrors;
r->SetCustomShaderIncludes(dirs);
ResourceId id;
rdctie(id, buildErrors) = r->BuildCustomShader(
"main", encoding, shaderBytes, ShaderCompileFlags(), ShaderStage::Pixel);