mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 09:26:52 +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:
@@ -981,6 +981,7 @@ void CaptureContext::LoadCaptureThreaded(const QString &captureFile, const Repla
|
||||
m_APIProps = r->GetAPIProperties();
|
||||
|
||||
m_CustomEncodings = r->GetCustomShaderEncodings();
|
||||
m_CustomPrefixes = r->GetCustomShaderSourcePrefixes();
|
||||
m_TargetEncodings = r->GetTargetShaderEncodings();
|
||||
|
||||
m_PostloadProgress = 0.2f;
|
||||
|
||||
@@ -155,6 +155,7 @@ public:
|
||||
const FrameDescription &FrameInfo() override { return m_FrameInfo; }
|
||||
const APIProperties &APIProps() override { return m_APIProps; }
|
||||
rdcarray<ShaderEncoding> CustomShaderEncodings() override { return m_CustomEncodings; }
|
||||
rdcarray<ShaderSourcePrefix> CustomShaderSourcePrefixes() override { return m_CustomPrefixes; }
|
||||
rdcarray<ShaderEncoding> TargetShaderEncodings() override { return m_TargetEncodings; }
|
||||
uint32_t CurSelectedEvent() override { return m_SelectedEventID; }
|
||||
uint32_t CurEvent() override { return m_EventID; }
|
||||
@@ -362,6 +363,7 @@ private:
|
||||
rdcarray<ActionDescription> m_EmptyActions;
|
||||
|
||||
rdcarray<ShaderEncoding> m_CustomEncodings, m_TargetEncodings;
|
||||
rdcarray<ShaderSourcePrefix> m_CustomPrefixes;
|
||||
APIProperties m_APIProps;
|
||||
FrameDescription m_FrameInfo;
|
||||
const ActionDescription *m_FirstAction = NULL;
|
||||
|
||||
@@ -1945,6 +1945,15 @@ building custom shaders for the currently loaded capture. See
|
||||
)");
|
||||
virtual rdcarray<ShaderEncoding> CustomShaderEncodings() = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve the list of prefixes for each :class:`~renderdoc.ShaderEncoding` that should
|
||||
be added to custom compiled shaders. See
|
||||
:meth:`~renderdoc.ReplayController.GetCustomShaderSourcePrefixes`.
|
||||
|
||||
:return: A list of pairs, listing a prefix for each shader encoding referenced.
|
||||
:rtype: List[Tuple[ShaderEncoding,str]]
|
||||
)");
|
||||
virtual rdcarray<ShaderSourcePrefix> CustomShaderSourcePrefixes() = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve the currently selected :data:`eventId <renderdoc.APIEvent.eventId>`.
|
||||
|
||||
In most cases, prefer using :meth:`CurEvent`. See :meth:`CaptureViewer.OnSelectedEventChanged` for more
|
||||
|
||||
@@ -373,6 +373,7 @@ TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderMessage)
|
||||
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderResource)
|
||||
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderSampler)
|
||||
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderSourceFile)
|
||||
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderSourcePrefix)
|
||||
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderVariable)
|
||||
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderEncoding)
|
||||
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderVariableChange)
|
||||
|
||||
Reference in New Issue
Block a user