| 1997 | } |
| 1998 | |
| 1999 | void CaptureContext::LoadEdits(const QString &data) |
| 2000 | { |
| 2001 | QVariantMap root = JSONToVariant(data); |
| 2002 | |
| 2003 | QVariantList editors = root[lit("editors")].toList(); |
| 2004 | |
| 2005 | auto replaceSaveCallback = [this](ICaptureContext *ctx, IShaderViewer *viewer, ResourceId id, |
| 2006 | ShaderStage stage, ShaderEncoding shaderEncoding, |
| 2007 | ShaderCompileFlags flags, rdcstr entryFunc, bytebuf shaderBytes) { |
| 2008 | ApplyShaderEdit(viewer, id, stage, shaderEncoding, flags, entryFunc, shaderBytes); |
| 2009 | }; |
| 2010 | |
| 2011 | auto replaceRevertCallback = [this](ICaptureContext *ctx, IShaderViewer *view, ResourceId id) { |
| 2012 | RevertShaderEdit(view, id); |
| 2013 | }; |
| 2014 | |
| 2015 | for(QVariant e : editors) |
| 2016 | { |
| 2017 | ShaderViewer *edit = ShaderViewer::LoadEditor( |
| 2018 | *this, e.toMap(), replaceSaveCallback, replaceRevertCallback, |
| 2019 | [this](ShaderViewer *view, bool closed) { |
| 2020 | SetModification(CaptureModifications::EditedShaders); |
| 2021 | if(closed) |
| 2022 | m_ShaderEditors.removeOne(view); |
| 2023 | }, |
| 2024 | m_MainWindow->Widget()); |
| 2025 | |
| 2026 | if(edit) |
| 2027 | { |
| 2028 | AddDockWindow(edit->Widget(), DockReference::MainToolArea, NULL); |
| 2029 | m_ShaderEditors.push_back(edit); |
| 2030 | } |
| 2031 | } |
| 2032 | } |
| 2033 | |
| 2034 | void CaptureContext::ClearReplayCache() |
| 2035 | { |
nothing calls this directly
no test coverage detected