From 11c2d4bdcc2dd385570d9423f9b4685cf4347609 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 17 Jan 2015 21:27:45 +0000 Subject: [PATCH] Add list of shader subroutine values --- renderdoc/api/replay/gl_pipestate.h | 2 ++ renderdoc/driver/gl/gl_replay.cpp | 14 ++++++++++++++ renderdocui/Interop/GLPipelineState.cs | 3 +++ 3 files changed, 19 insertions(+) diff --git a/renderdoc/api/replay/gl_pipestate.h b/renderdoc/api/replay/gl_pipestate.h index 22765f049..f5206a491 100644 --- a/renderdoc/api/replay/gl_pipestate.h +++ b/renderdoc/api/replay/gl_pipestate.h @@ -68,6 +68,8 @@ struct GLPipelineState ShaderBindpointMapping BindpointMapping; ShaderStageType stage; + + rdctype::array Subroutines; } m_VS, m_TCS, m_TES, m_GS, m_FS, m_CS; struct FixedVertexProcessing diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index e19f4cf83..e7d4b5192 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -1156,6 +1156,20 @@ void GLReplay::SavePipelineState() } } + for(int i=0; i < 6; i++) + { + size_t num = RDCMIN(128, rs.Subroutines[i].numSubroutines); + if(num == 0) + { + RDCEraseEl(stages[i]->Subroutines); + } + else + { + create_array_uninit(stages[i]->Subroutines, num); + memcpy(stages[i]->Subroutines.elems, rs.Subroutines[i].Values, num); + } + } + // GL is ass-backwards in its handling of texture units. When a shader is active // the types in the glsl samplers inform which targets are used from which texture units // diff --git a/renderdocui/Interop/GLPipelineState.cs b/renderdocui/Interop/GLPipelineState.cs index 56ad3fb1a..07a771f58 100644 --- a/renderdocui/Interop/GLPipelineState.cs +++ b/renderdocui/Interop/GLPipelineState.cs @@ -88,6 +88,9 @@ namespace renderdoc public ShaderBindpointMapping BindpointMapping; public ShaderStageType stage; + + [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] + public UInt32[] Subroutines; }; [CustomMarshalAs(CustomUnmanagedType.CustomClass)] public ShaderStage m_VS, m_TCS, m_TES, m_GS, m_FS, m_CS;