Skip to content

Commit

Permalink
Quality of life updates from feedback after public release
Browse files Browse the repository at this point in the history
Morten:
* select node when created
* reminder to save in tutorial, and to build all projects
* Make editor say "Default" not "Dflt"
* PDF versions of docx files
* A/B button to toggle between last 2 viewed resoruces
* zoom to fit button

Also:
* Install to program files, not program files (x86)
* no imgui demo or struct parsing demo menu options in release
* vscyn off in same submenu as sync interval
* improve create node menu
  • Loading branch information
Atrix256 committed Aug 27, 2024
1 parent 0d003dd commit d4b83f4
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 38 deletions.
9 changes: 8 additions & 1 deletion GigiEdit/MakeUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -1598,8 +1598,15 @@ inline UIOverrideResult ShowUIOverride(RenderGraph& renderGraph, uint64_t _FLAGS

inline UIOverrideResult ShowUIOverride(RenderGraph& renderGraph, uint64_t _FLAGS, bool& dirtyFlag, const char* label, const char* tooltip, std::string& value, TypePathEntry path, ShowUIOverrideContext showUIOverrideContext)
{
// Show "Dflt" as "Default" in the editor, instead.
// default is a reserved word so we couldn't use it, but we can show it as a friendlier label!
if (!_stricmp(label, "Dflt"))
{
dirtyFlag |= ShowUI(renderGraph, "Default", tooltip, value, path);
return UIOverrideResult::Finished;
}
// Show a variable drop down for SubGraphVariableSettings.ReplaceWithStr, and call it "Replace With" instead.
if (!_stricmp(label, "Replace With Str"))
else if (!_stricmp(label, "Replace With Str"))
{
VariableReference dummyRef;
dummyRef.name = value;
Expand Down
34 changes: 19 additions & 15 deletions GigiEdit/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ bool g_openPreviewWindowPaused = false;
ed::NodeId g_contextMenuNodeId;
ed::LinkId g_contextMenuLinkId;

int g_createdNodeIndex = -1;

struct DataWindowState
{
bool show = true;
Expand Down Expand Up @@ -732,10 +734,11 @@ struct Example :

// very useful during development (e.g. find examples, find style name or tweak theme),
// could be compiled out in Release
#ifdef _DEBUG
ImGui::MenuItem("ImGui Demo", nullptr, &imguiDemoOpen);
ImGui::MenuItem("Struct Parser Test", nullptr, &structParserTest);

ImGui::Separator();
#endif

if (ImGui::MenuItem("Exit"))
{
Expand Down Expand Up @@ -2090,6 +2093,12 @@ struct Example :
ShowNodePropertiesWindow();
ShowNodesWindow();

if (g_createdNodeIndex != -1 && ed::NodeExists(g_createdNodeIndex))
{
ed::SelectNode(g_createdNodeIndex);
g_createdNodeIndex = -1;
}

ImGui::Begin("Graph");

ed::Begin("Graph", ImVec2(0.0, 0.0f));
Expand Down Expand Up @@ -2511,6 +2520,7 @@ struct Example :

ImGui::EndPopup();
}

if (ImGui::BeginPopup("Create New Node"))
{
auto newNodePostion = openPopupPosition;
Expand All @@ -2519,20 +2529,14 @@ struct Example :

ImGui::Separator();

ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 0, 255));

// to put separator between resources and actions
// -1:action, 0:unknown, 1:resource
int newType = 0, lastType = 0;

#include "external/df_serialize/_common.h"
#define VARIANT_SEP()
#define VARIANT_TYPE(_TYPE, _NAME, _DEFAULT, _DESCRIPTION) \
newType = _TYPE::c_isResourceNode ? 1 : -1;\
if(lastType && lastType != newType)\
ImGui::Separator();\
lastType = newType;\
if (_TYPE::c_showInEditor && ImGui::MenuItem(#_NAME)) \
if (_TYPE::c_isResourceNode) \
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(128, 128, 255, 255)); \
else \
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 128, 64, 255)); \
if (_TYPE::c_showInEditor && ImGui::MenuItem(_TYPE::c_editorName.c_str())) \
{ \
char newNodeName[64]; \
int nextNodeIndex = 0; \
Expand All @@ -2558,14 +2562,14 @@ struct Example :
g_renderGraph.nodes.push_back(newNode); \
m_newNodePositions[(int)g_renderGraph.nodes.size()] = newNodePostion; \
g_renderGraphDirty = true; \
}
g_createdNodeIndex = (int)g_renderGraph.nodes.size(); \
} \
ImGui::PopStyleColor();
// clang-format off
#include "external/df_serialize/_fillunsetdefines.h"
#include "Schemas/RenderGraphNodesVariant.h"
// clang-format on

ImGui::PopStyleColor();

ImGui::EndPopup();
}
ed::Resume();
Expand Down
63 changes: 53 additions & 10 deletions GigiViewerDX12/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,29 +340,49 @@ struct ResourceViewState
{
void Texture(int _nodeIndex, int _resourceIndex, RuntimeTypes::ViewableResource::Type textureType)
{
StoreLast();

type = textureType;
nodeIndex = _nodeIndex;
resourceIndex = _resourceIndex;
}

void ConstantBuffer(int _nodeIndex, int _resourceIndex)
{
StoreLast();

type = RuntimeTypes::ViewableResource::Type::ConstantBuffer;
nodeIndex = _nodeIndex;
resourceIndex = _resourceIndex;
}

void Buffer(int _nodeIndex, int _resourceIndex)
{
StoreLast();

type = RuntimeTypes::ViewableResource::Type::Buffer;
nodeIndex = _nodeIndex;
resourceIndex = _resourceIndex;
}

void ViewLast()
{
if (nodeIndex == -1 || lastNodeIndex == -1 || resourceIndex == -1 || lastResourceIndex == -1)
return;

std::swap(type, lastType);
std::swap(nodeIndex, lastNodeIndex);
std::swap(resourceIndex, lastResourceIndex);
}

RuntimeTypes::ViewableResource::Type type = RuntimeTypes::ViewableResource::Type::Texture2D;
int nodeIndex = -1;
int resourceIndex = -1;

RuntimeTypes::ViewableResource::Type lastType = RuntimeTypes::ViewableResource::Type::Texture2D;
int lastNodeIndex = -1;
int lastResourceIndex = -1;

int mousePosX = 0;
int mousePosY = 0;
int mouseClickX = 0;
Expand All @@ -372,6 +392,14 @@ struct ResourceViewState
float systemVarMouse[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
float systemVarMouseState[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
float systemVarMouseStateLastFrame[4] = { 0.0f, 0.0f, 0.0f, 0.0f };

private:
void StoreLast()
{
lastType = type;
lastNodeIndex = nodeIndex;
lastResourceIndex = resourceIndex;
}
};
static ResourceViewState g_resourceView;

Expand Down Expand Up @@ -409,7 +437,6 @@ std::string g_commandLineLoadGGFileName;
std::string g_runPyFileName;

int g_syncInterval = 1;
bool g_vsync = true;
bool g_debugLayerOn = DX12_VALIDATION_ON_BY_DEFAULT();
bool g_debugLayerShown = DX12_VALIDATION_LOG_ON_BY_DEFAULT();
bool g_GPUValidation = DX12_GPUVALIDATION_ON_BY_DEFAULT();
Expand Down Expand Up @@ -671,7 +698,6 @@ void SaveGGUserFile()
ggUserData.resourceViewType = (int)g_resourceView.type;
ggUserData.resourceViewNodeIndex = g_resourceView.nodeIndex;
ggUserData.resourceViewResourceIndex = g_resourceView.resourceIndex;
ggUserData.vsync = g_vsync;
ggUserData.syncInterval = g_syncInterval;
for (const auto& it : g_interpreter.m_importedResources)
ggUserData.importedResources.push_back(ImportedResourceDesc_To_GGUserFile_ImportedResource(it.first, it.second, renderGraphDir));
Expand Down Expand Up @@ -767,7 +793,6 @@ GGUserFile LoadGGUserFile()
g_resourceView.type = (RuntimeTypes::ViewableResource::Type)ggUserData.resourceViewType;
g_resourceView.nodeIndex = ggUserData.resourceViewNodeIndex;
g_resourceView.resourceIndex = ggUserData.resourceViewResourceIndex;
g_vsync = ggUserData.vsync;
g_syncInterval = ggUserData.syncInterval;
g_interpreter.m_importedResources.clear();
for (const GGUserFile_ImportedResource& inDesc : ggUserData.importedResources)
Expand Down Expand Up @@ -1061,23 +1086,26 @@ void HandleMainMenu()

ImGui::MenuItem("DX12 Capabilities", "", &g_showCapsWindow);

#ifdef _DEBUG
ImGui::Separator();

ImGui::MenuItem("ImGui Demo Window", "", &show_demo_window);
//ImGui::MenuItem("ImGui Simple Window", "", &show_simple_window);
//ImGui::MenuItem("ImGui Other Window", "", &show_another_window);
#endif

ImGui::EndMenu();
}

if (ImGui::BeginMenu("Settings"))
{
ImGui::MenuItem("VSync", "", &g_vsync);

if (ImGui::BeginMenu("Sync Interval"))
{
bool selected = false;

selected = (g_syncInterval == 0);
if (ImGui::MenuItem("0 (VSync Off)", "", &selected))
g_syncInterval = 0;

selected = (g_syncInterval == 1);
if (ImGui::MenuItem("1 (Full FPS)", "", &selected))
g_syncInterval = 1;
Expand Down Expand Up @@ -5257,6 +5285,13 @@ void ShowResourceView()
}
}

if (!g_hideUI)
{
ImGui::SameLine();
if (ImGui::Button("A/B"))
g_resourceView.ViewLast();
}

if (!g_hideUI)
{
const char* typeLabel = "";
Expand All @@ -5272,7 +5307,7 @@ void ShowResourceView()
ImGui::Text("%s: %s", typeLabel, res.m_displayName.empty() ? nodeName.c_str() : res.m_displayName.c_str());

// ImGui::SameLine();
if (ImGui::Button("Copy Name To ClipBoard"))
if (ImGui::Button("Copy Name"))
SetClipboardDataEx(CF_TEXT, (void*)res.m_displayName.c_str(), (DWORD)res.m_displayName.length() + 1);
}

Expand Down Expand Up @@ -5301,7 +5336,7 @@ void ShowResourceView()
static bool saveAllVertically = false;

ImGui::SameLine();
if (ImGui::Button("Copy Image To ClipBoard"))
if (ImGui::Button("Copy Image"))
{
CopyImageToClipBoard(res.m_resourceReadback, formatInfo, res.m_size[0], res.m_size[1], res.m_size[2], imageZ);
}
Expand Down Expand Up @@ -5566,6 +5601,14 @@ void ShowResourceView()
ImGui::SetNextItemWidth(50.0f);
ImGui::InputFloat("Zoom", &g_imageZoom);

ImGui::SameLine();
if (ImGui::Button("Fit"))
{
float scaleX = g_contentRegionSize.x / (float)res.m_size[0];
float scaleY = g_contentRegionSize.y / (float)res.m_size[1];
g_imageZoom = std::min(scaleX, scaleY);
}

ImGui::SameLine();
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
ImGui::SameLine();
Expand Down Expand Up @@ -6114,7 +6157,7 @@ class Python : public PythonInterface

void SetVSync(bool set) override final
{
g_vsync = set;
g_syncInterval = set ? 1 : 0;
}

void SetSyncInterval(int syncInterval) override final
Expand Down Expand Up @@ -7021,7 +7064,7 @@ void RenderFrame(bool forceExecute)
ImGui::RenderPlatformWindowsDefault(NULL, (void*)g_pd3dCommandList);
}

g_pSwapChain->Present((g_vsync && !g_profileMode) ? g_syncInterval : 0, 0);
g_pSwapChain->Present((!g_profileMode) ? g_syncInterval : 0, 0);

UINT64 fenceValue = g_fenceLastSignaledValue + 1;
g_pd3dCommandQueue->Signal(g_fence, fenceValue);
Expand Down
5 changes: 3 additions & 2 deletions Install.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

!include "MUI2.nsh"
!include "logiclib.nsh"
!include "x64.nsh"

;--------------------------------
; Custom defines
!define APPNAME "Gigi"
!define DESCRIPTION "Rapid Graphics Development Platform"
!define VERSIONMAJOR 0
!define VERSIONMINOR 99
!define VERSIONBUILD 0
!define VERSIONBUILD 1
!define SLUG "${APPNAME} v${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}"

# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
Expand All @@ -24,7 +25,7 @@

Name "${APPNAME}"
OutFile "Gigi-${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}.x64.windows.installer.exe"
InstallDir "$PROGRAMFILES\${APPNAME}"
InstallDir "$PROGRAMFILES64\${APPNAME}"
InstallDirRegKey HKCU "Software\${APPNAME}" ""
RequestExecutionLevel admin

Expand Down
1 change: 0 additions & 1 deletion Schemas/PreviewWindow/PreviewWindowSchemas.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ STRUCT_BEGIN(GGUserFile, "The contents of a .gguser file")
STRUCT_FIELD(int, resourceViewType, 0, "The type of resource being viewed", 0)
STRUCT_FIELD(int, resourceViewNodeIndex, -1, "The index of the node bieng viewed", 0)
STRUCT_FIELD(int, resourceViewResourceIndex, -1, "The index of that resource within that node being used", 0)
STRUCT_FIELD(bool, vsync, true, "Whether or not vsync is on", 0)
STRUCT_FIELD(int, syncInterval, true, "IDXGISwapChain::Present() parameter: Synchronize presentation after the nth vertical blank.", 0)
STRUCT_DYNAMIC_ARRAY(GGUserFile_ImportedResource, importedResources, "", 0)
STRUCT_DYNAMIC_ARRAY(GGUserFile_SavedVariable, savedVariables, "", 0)
Expand Down
9 changes: 9 additions & 0 deletions Schemas/RenderGraphNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ STRUCT_END()
//========================================================

STRUCT_INHERIT_BEGIN(RenderGraphNode_Resource_Buffer, RenderGraphNode_ResourceBase, "Declares a buffer")
STRUCT_CONST(std::string, c_editorName, "Buffer", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shortTypeName, "Buffer", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shorterTypeName, "Buff", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(bool, c_showInEditor, true, "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
Expand All @@ -296,6 +297,7 @@ STRUCT_INHERIT_BEGIN(RenderGraphNode_Resource_Buffer, RenderGraphNode_ResourceBa
STRUCT_END()

STRUCT_INHERIT_BEGIN(RenderGraphNode_Resource_ShaderConstants, RenderGraphNode_ResourceBase, "Declares a shader constant buffer")
STRUCT_CONST(std::string, c_editorName, "Constants", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shortTypeName, "Constants", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shorterTypeName, "Const", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(bool, c_showInEditor, false, "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
Expand All @@ -306,6 +308,7 @@ STRUCT_INHERIT_BEGIN(RenderGraphNode_Resource_ShaderConstants, RenderGraphNode_R
STRUCT_END()

STRUCT_INHERIT_BEGIN(RenderGraphNode_Resource_Texture, RenderGraphNode_ResourceBase, "Declares a texture")
STRUCT_CONST(std::string, c_editorName, "Texture", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shortTypeName, "Texture", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shorterTypeName, "Tex", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(bool, c_showInEditor, true, "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
Expand All @@ -325,6 +328,7 @@ STRUCT_END()
//========================================================

STRUCT_INHERIT_BEGIN(RenderGraphNode_Action_ComputeShader, RenderGraphNode_ActionBase, "Executes a compute shader")
STRUCT_CONST(std::string, c_editorName, "Compute Shader", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shortTypeName, "Compute", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shorterTypeName, "CS", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(bool, c_showInEditor, true, "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
Expand All @@ -337,6 +341,7 @@ STRUCT_INHERIT_BEGIN(RenderGraphNode_Action_ComputeShader, RenderGraphNode_Actio
STRUCT_END()

STRUCT_INHERIT_BEGIN(RenderGraphNode_Action_RayShader, RenderGraphNode_ActionBase, "Executes a dispatch rays shader")
STRUCT_CONST(std::string, c_editorName, "Ray Gen Shader", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shortTypeName, "RayGen", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shorterTypeName, "RGS", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(bool, c_showInEditor, true, "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
Expand All @@ -352,6 +357,7 @@ STRUCT_INHERIT_BEGIN(RenderGraphNode_Action_RayShader, RenderGraphNode_ActionBas
STRUCT_END()

STRUCT_INHERIT_BEGIN(RenderGraphNode_Action_CopyResource, RenderGraphNode_ActionBase, "Copies a resource to another resource")
STRUCT_CONST(std::string, c_editorName, "Copy Resource", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shortTypeName, "Copy", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shorterTypeName, "Copy", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(bool, c_showInEditor, true, "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
Expand All @@ -361,6 +367,7 @@ STRUCT_INHERIT_BEGIN(RenderGraphNode_Action_CopyResource, RenderGraphNode_Action
STRUCT_END()

STRUCT_INHERIT_BEGIN(RenderGraphNode_Action_DrawCall, RenderGraphNode_ActionBase, "Rasterization")
STRUCT_CONST(std::string, c_editorName, "Draw Call", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shortTypeName, "Draw", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shorterTypeName, "Draw", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(bool, c_showInEditor, true, "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
Expand Down Expand Up @@ -428,6 +435,7 @@ STRUCT_INHERIT_BEGIN(RenderGraphNode_Action_DrawCall, RenderGraphNode_ActionBase
STRUCT_END()

STRUCT_INHERIT_BEGIN(RenderGraphNode_Action_SubGraph, RenderGraphNode_ActionBase, "Runs another Gigi technique")
STRUCT_CONST(std::string, c_editorName, "Subgraph", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shortTypeName, "Subgraph", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shorterTypeName, "Sub", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(bool, c_showInEditor, true, "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
Expand All @@ -443,6 +451,7 @@ STRUCT_INHERIT_BEGIN(RenderGraphNode_Action_SubGraph, RenderGraphNode_ActionBase
STRUCT_END()

STRUCT_INHERIT_BEGIN(RenderGraphNode_Action_Barrier, RenderGraphNode_ActionBase, "Causes all input operations to be executed before anything plugged into the output")
STRUCT_CONST(std::string, c_editorName, "Barrier", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shortTypeName, "Barrier", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(std::string, c_shorterTypeName, "Bar", "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
STRUCT_CONST(bool, c_showInEditor, true, "Used by the editor.", SCHEMA_FLAG_NO_SERIALIZE)
Expand Down
Binary file modified UserDocumentation/GigiEditor.docx
Binary file not shown.
Binary file added UserDocumentation/GigiEditor.pdf
Binary file not shown.
Binary file modified UserDocumentation/GigiShaders_Documentation.docx
Binary file not shown.
Binary file added UserDocumentation/GigiShaders_Documentation.pdf
Binary file not shown.
Binary file not shown.
Binary file added UserDocumentation/UnrealTips.pdf
Binary file not shown.
Loading

0 comments on commit d4b83f4

Please sign in to comment.