mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-10-17 01:29:19 +00:00
Refactor custom shaders to abstract binding differences. Closes #2458
* Newly written shaders and any updated shaders can now use pre-defined macros to abstract away binding differences between APIs, so custom shaders will be more portable in particular shaders written in HLSL for D3D or GLSL on OpenGL won't break on vulkan because they refer to incorrect binds.
This commit is contained in:
37 files changed
+1382
-613
No files matched your search
@@ -4246,7 +4246,8 @@ void TextureViewer::reloadCustomShaders(const QString &filter)
|
||||
|
||||
bytebuf shaderBytes(source.toUtf8());
|
||||
|
||||
rdcarray<ShaderEncoding> supported = m_Ctx.TargetShaderEncodings();
|
||||
rdcarray<ShaderEncoding> supported = m_Ctx.CustomShaderEncodings();
|
||||
rdcarray<ShaderSourcePrefix> prefixes = m_Ctx.CustomShaderSourcePrefixes();
|
||||
|
||||
rdcstr errors;
|
||||
|
||||
@@ -4258,6 +4259,16 @@ void TextureViewer::reloadCustomShaders(const QString &filter)
|
||||
// pick the first tool that can convert to an accepted format
|
||||
if(tool.input == encoding && supported.contains(tool.output))
|
||||
{
|
||||
// apply any prefix needed
|
||||
for(const ShaderSourcePrefix &prefix : prefixes)
|
||||
{
|
||||
if(prefix.encoding == encoding)
|
||||
{
|
||||
source = QString(prefix.prefix) + source;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ShaderToolOutput out =
|
||||
tool.CompileShader(this, source, "main", ShaderStage::Pixel, "");
|
||||
|
||||
|
||||
Reference in new issue
Block a user