2020* DEALINGS IN THE SOFTWARE.
2121*/
2222
23+ #include " imgui/imgui.h"
24+ #include " rtx_graph_batch.h"
2325#include " rtx_graph_gui.h"
24- #include " ../../imgui/imgui.h"
25- #include " ../rtx_scene_manager.h"
26- #include " ../rtx_context.h"
2726#include " rtx_graph_instance.h"
28- #include " rtx_graph_batch.h"
29- #include " ../../util/util_string.h"
27+ #include " rtx_render/rtx_context.h"
28+ #include " rtx_render/rtx_imgui.h"
29+ #include " rtx_render/rtx_scene_manager.h"
30+ #include " ../util/util_string.h"
3031#include < algorithm>
31- #include < sstream>
3232#include < iomanip>
33+ #include < sstream>
3334
3435namespace dxvk {
3536
3637void RtxGraphGUI::showGraphVisualization (const Rc<DxvkContext>& ctx) {
3738 RtxContext* rtxContext = static_cast <RtxContext*>(ctx.ptr ());
3839 const SceneManager& sceneManager = rtxContext->getSceneManager ();
39-
40- ImGui::Text (" RTX Graph Visualization" );
4140 ImGui::Separator ();
41+ ImGui::Checkbox (" Enable" , &GraphManager::enableObject ());
42+ ImGui::SameLine (0 .0f , 20 .f );
43+ ImGui::Checkbox (" Pause" , &GraphManager::pauseGraphUpdatesObject ());
44+ ImGui::SameLine (0 .0f , 20 .f );
45+ if (IMGUI_ADD_TOOLTIP (ImGui::Button (" Reset Graph State" ), " Destroys then recreates all graphs, clearing any stored state." )) {
46+ const GraphManager& graphManager = sceneManager.getGraphManager ();
47+ graphManager.resetGraphState ();
48+ }
4249
4350 // Graph selector
4451 showGraphSelector (sceneManager);
4552
4653 if (m_selectedInstanceId != kInvalidInstanceId ) {
47- ImGui::Separator ();
48-
4954 // Update graph data
5055 updateGraphData (sceneManager);
5156
@@ -126,6 +131,10 @@ void RtxGraphGUI::showGraphSelector(const SceneManager& sceneManager) {
126131 for (const auto & [name, id] : instanceList) {
127132 if (id == m_selectedInstanceId) {
128133 ImGui::Text (" Selected: %s" , name.c_str ());
134+ if (IMGUI_ADD_TOOLTIP (ImGui::Button (" Reset Instance" ), " Destroys then recreates this graph instance, clearing any stored state." )) {
135+ graphManager.queueInstanceReset (m_selectedInstanceId);
136+ m_selectedInstanceId = kInvalidInstanceId ; // Clear selection since instance will be removed
137+ }
129138 break ;
130139 }
131140 }
@@ -135,75 +144,73 @@ void RtxGraphGUI::showGraphSelector(const SceneManager& sceneManager) {
135144}
136145
137146void RtxGraphGUI::showComponentList () {
138- ImGui::Text (" Components:" );
139- ImGui::Separator ();
140-
141147 if (m_components.empty ()) {
142148 ImGui::Text (" No components in selected graph instance" );
143149 return ;
144150 }
145-
146- // Show components in a scrollable list with resizable height
147- ImGui::BeginChild (" ComponentList" , ImVec2 (0 , m_componentListHeight), true , ImGuiWindowFlags_AlwaysVerticalScrollbar);
148-
149- for (size_t i = 0 ; i < m_components.size (); ++i) {
150- const auto & component = m_components[i];
151-
152- // Component header with collapsible tree node
153- std::string headerText = component.typeName ;
151+ if (ImGui::CollapsingHeader (" Components:" , ImGuiTreeNodeFlags_DefaultOpen)) {
152+ // Show components in a scrollable list with resizable height
153+ ImGui::BeginChild (" ComponentList" , ImVec2 (0 , m_componentListHeight), true , ImGuiWindowFlags_AlwaysVerticalScrollbar);
154154
155- if (ImGui::CollapsingHeader (headerText.c_str (), ImGuiTreeNodeFlags_DefaultOpen)) {
156- // Show component description as tooltip on header hover
157- if (ImGui::IsItemHovered () && !component.docString .empty ()) {
158- ImGui::BeginTooltip ();
159- ImGui::PushTextWrapPos (ImGui::GetFontSize () * 35 .0f ); // Set wrap width
160- ImGui::TextWrapped (" %s" , component.docString .c_str ());
161- ImGui::PopTextWrapPos ();
162- ImGui::EndTooltip ();
163- }
155+ for (size_t i = 0 ; i < m_components.size (); ++i) {
156+ const auto & component = m_components[i];
164157
165- ImGui::Indent ();
158+ // Component header with collapsible tree node
159+ std::string headerText = component.typeName ;
166160
167- // Show properties
168- ImGui::Text (" Properties:" );
169- for (const auto & prop : component.properties ) {
170- // Display property with name, value, and index
171- std::string propText = " [" + std::to_string (prop.topologyIndex ) + " ] " + prop.name + " : " + prop.currentValue ;
172- ImGui::Text (" %s" , propText.c_str ());
173-
174- // Show tooltip with doc string and property paths on hover
175- if (ImGui::IsItemHovered () && (!prop.docString .empty () || !prop.propertyPaths .empty ())) {
161+ if (ImGui::CollapsingHeader (headerText.c_str ())) {
162+ // Show component description as tooltip on header hover
163+ if (ImGui::IsItemHovered () && !component.docString .empty ()) {
176164 ImGui::BeginTooltip ();
177165 ImGui::PushTextWrapPos (ImGui::GetFontSize () * 35 .0f ); // Set wrap width
166+ ImGui::TextWrapped (" %s" , component.docString .c_str ());
167+ ImGui::PopTextWrapPos ();
168+ ImGui::EndTooltip ();
169+ }
170+
171+ ImGui::Indent ();
172+
173+ // Show properties
174+ for (const auto & prop : component.properties ) {
175+ // Display property with name, value, and index
176+ std::string propText = " [" + std::to_string (prop.topologyIndex ) + " ] " + prop.name + " : " + prop.currentValue ;
177+ ImGui::Text (" %s" , propText.c_str ());
178178
179- // Show all property paths
180- if (!prop.propertyPaths .empty ()) {
181- if (prop.propertyPaths .size () == 1 ) {
182- ImGui::Text (" Path: %s" , prop.propertyPaths [0 ].c_str ());
183- } else {
184- ImGui::Text (" Paths:" );
185- for (const auto & path : prop.propertyPaths ) {
186- ImGui::Text (" %s" , path.c_str ());
179+ // Show tooltip with doc string and property paths on hover
180+ if (ImGui::IsItemHovered () && (!prop.docString .empty () || !prop.propertyPaths .empty ())) {
181+ ImGui::BeginTooltip ();
182+ ImGui::PushTextWrapPos (ImGui::GetFontSize () * 35 .0f ); // Set wrap width
183+
184+ // Show all property paths
185+ if (!prop.propertyPaths .empty ()) {
186+ if (prop.propertyPaths .size () == 1 ) {
187+ ImGui::Text (" Path: %s" , prop.propertyPaths [0 ].c_str ());
188+ } else {
189+ ImGui::Text (" Paths:" );
190+ for (const auto & path : prop.propertyPaths ) {
191+ ImGui::Text (" %s" , path.c_str ());
192+ }
193+ }
194+ if (!prop.docString .empty ()) {
195+ ImGui::Separator ();
187196 }
188197 }
198+
199+ // Show description
189200 if (!prop.docString .empty ()) {
190- ImGui::Separator ( );
201+ ImGui::TextWrapped ( " %s " , prop. docString . c_str () );
191202 }
203+
204+ ImGui::PopTextWrapPos ();
205+ ImGui::EndTooltip ();
192206 }
193-
194- // Show description
195- if (!prop.docString .empty ()) {
196- ImGui::TextWrapped (" %s" , prop.docString .c_str ());
197- }
198-
199- ImGui::PopTextWrapPos ();
200- ImGui::EndTooltip ();
201207 }
208+
209+ ImGui::Unindent ();
210+ ImGui::Spacing ();
202211 }
203-
204- ImGui::Unindent ();
205- ImGui::Spacing ();
206212 }
213+
207214 }
208215
209216 ImGui::EndChild ();
0 commit comments