diff --git a/Renderer.xml b/Renderer.xml index dedd81eea..9a29a43b4 100644 --- a/Renderer.xml +++ b/Renderer.xml @@ -14,7 +14,7 @@ - + diff --git a/data/Shaders/default/default.hlsl.h b/data/Shaders/default/default.hlsl.h index 359d1e7a4..2e0ecdd7a 100644 --- a/data/Shaders/default/default.hlsl.h +++ b/data/Shaders/default/default.hlsl.h @@ -7,15 +7,14 @@ namespace vg::gfx class DefaultHLSLDesc : public HLSLDesc { public: - //enum Flags : ShaderKey::Flags - //{ - // // Flags 0..12 are available - // - // // Flags 13..15 are reserved and should be common for all shaders - // ZOnly = HLSLDesc::Flags::ZOnly, - // RayTracing = HLSLDesc::Flags::RayTracing, - // Toolmode = HLSLDesc::Flags::Toolmode - //}; + enum Flags : ShaderKey::Flags + { + + // Last flags are common for all shaders + ZOnly = HLSLDesc::Flags::ZOnly, + RayTracing = HLSLDesc::Flags::RayTracing, + Toolmode = HLSLDesc::Flags::Toolmode + }; DefaultHLSLDesc() { diff --git a/data/Shaders/postprocess/postprocess.hlsl.h b/data/Shaders/postprocess/postprocess.hlsl.h index 2ac0b217a..3ac51eeaf 100644 --- a/data/Shaders/postprocess/postprocess.hlsl.h +++ b/data/Shaders/postprocess/postprocess.hlsl.h @@ -10,18 +10,18 @@ namespace vg::gfx enum Flags : ShaderKey::Flags { // Bits 0..1 for AA mode - AntiAliasingMode = 0, + AAPostProcess = 0, - // Flags 13..15 are reserved and should be common for all shaders - RayTracing = HLSLDesc::Flags::RayTracing, - Toolmode = HLSLDesc::Flags::Toolmode + // Last flags are common for all shaders + RayTracing = HLSLDesc::Flags::RayTracing, + Toolmode = HLSLDesc::Flags::Toolmode }; PostProcessHLSLDesc() { setFile("postprocess/postprocess.hlsl"); - declFlags(AntiAliasingMode, ShaderStageFlags::CS, { "", "_FXAA", "_SMAA" } ); + declFlags(AAPostProcess, ShaderStageFlags::CS, { "", "_FXAA", "_SMAA" } ); declFlag(RayTracing, ShaderStageFlags::CS, "_RAYTRACING"); declFlag(Toolmode, ShaderStageFlags::CS, "_TOOLMODE"); diff --git a/imgui.ini b/imgui.ini index 7569903cc..c05dda1f3 100644 --- a/imgui.ini +++ b/imgui.ini @@ -3095,6 +3095,12 @@ Column 0 Width=96 Column 1 Width=96 Column 2 Weight=1.0000 +[Table][0x170BBB16,3] +RefScale=14 +Column 0 Width=96 +Column 1 Width=96 +Column 2 Weight=1.0000 + [Docking][Data] DockNode ID=0x0000001B Pos=517,135 Size=821,613 Selected=0x766639F3 DockSpace ID=0x09EF459F Pos=0,24 Size=1920,1056 Split=X diff --git a/src/editor/ImGui/Window/ImGuiWindow.cpp b/src/editor/ImGui/Window/ImGuiWindow.cpp index c29810c3b..c94a1f7ad 100644 --- a/src/editor/ImGui/Window/ImGuiWindow.cpp +++ b/src/editor/ImGui/Window/ImGuiWindow.cpp @@ -538,11 +538,16 @@ namespace vg::editor } else { + auto enumVal = (T)enumPairs[_index].value; + const bool disabled = asBool(EnumValueFlags::Disabled & _prop->GetEnumValueFlags(enumVal)); + + if (disabled) + PushDisabledStyle(true); + if (ImGui::Selectable(_enumName.c_str())) { - if (!_propContext.m_readOnly) + if (!_propContext.m_readOnly && !disabled) { - auto enumVal = (T)enumPairs[_index].value; bool edited = true; auto editingState = undoRedoBeforeEdit(edited, _propContext, _object, _prop, (T *)&enumVal, _pEnum, InteractionType::Single); @@ -553,6 +558,9 @@ namespace vg::editor } } } + + if (disabled) + PopDisabledStyle(); } return changed; diff --git a/src/gfx/Device/Device_consts.h b/src/gfx/Device/Device_consts.h index 22ebb647c..6a00ef0fc 100644 --- a/src/gfx/Device/Device_consts.h +++ b/src/gfx/Device/Device_consts.h @@ -26,7 +26,12 @@ namespace vg::gfx VSync_4 ); - vg_enum_class(AntiAliasing, core::u8, + vg_enum_class(MSAA, core::u8, + None = 0, + MSAA4X + ); + + vg_enum_class(AAPostProcess, core::u8, None = 0, FXAA, SMAA diff --git a/src/renderer/IRendererOptions.h b/src/renderer/IRendererOptions.h index 789723f29..0d9dc6a51 100644 --- a/src/renderer/IRendererOptions.h +++ b/src/renderer/IRendererOptions.h @@ -5,7 +5,7 @@ namespace vg::gfx { enum class VSync : core::u8; enum class HDR : core::u8; - enum class AntiAliasing : core::u8; + enum class AAPostProcess : core::u8; } namespace vg::renderer @@ -21,8 +21,8 @@ namespace vg::renderer virtual gfx::VSync GetVSync () const = 0; virtual bool SetVSync (const gfx::VSync & _vsync) = 0; - virtual gfx::AntiAliasing GetAliasing () const = 0; - virtual bool SetAliasing (const gfx::AntiAliasing & _aa) = 0; + virtual gfx::AAPostProcess GetAAPostProcess () const = 0; + virtual bool SetAAPostProcess (const gfx::AAPostProcess & _aa) = 0; virtual gfx::HDR GetHDR () const = 0; virtual bool SetHDR (const gfx::HDR & _hdr) = 0; diff --git a/src/renderer/Options/RendererOptions.h b/src/renderer/Options/RendererOptions.h index 7bec2edc3..dfe79a7a1 100644 --- a/src/renderer/Options/RendererOptions.h +++ b/src/renderer/Options/RendererOptions.h @@ -36,8 +36,8 @@ namespace vg::renderer gfx::VSync GetVSync () const final override; bool SetVSync (const gfx::VSync & _vsync) final override; - gfx::AntiAliasing GetAliasing () const final override; - bool SetAliasing (const gfx::AntiAliasing & _aa) final override; + gfx::AAPostProcess GetAAPostProcess () const final override; + bool SetAAPostProcess (const gfx::AAPostProcess & _aa) final override; gfx::HDR GetHDR () const final override; bool SetHDR (const gfx::HDR & _hdr) final override; @@ -88,7 +88,8 @@ namespace vg::renderer bool m_postProcess = true; bool m_rayTracing = false; gfx::HDR m_HDRmode = gfx::HDR::None; - gfx::AntiAliasing m_antiAliasing = gfx::AntiAliasing::None; + gfx::MSAA m_msaa = gfx::MSAA::None; + gfx::AAPostProcess m_aaPostProcess = gfx::AAPostProcess::None; gfx::VSync m_VSync = gfx::VSync::VSync_1; LightingMode m_lightingMode = LightingMode::Forward; DisplayMode m_debugDisplayMode = DisplayMode::None; @@ -97,5 +98,6 @@ namespace vg::renderer core::IProperty * m_hdrProp = nullptr; core::IProperty * m_vsyncProp = nullptr; + core::IProperty * m_aaPostProcessProp = nullptr; }; } diff --git a/src/renderer/Options/RendererOptions.hpp b/src/renderer/Options/RendererOptions.hpp index 5e6688342..cff3c34fd 100644 --- a/src/renderer/Options/RendererOptions.hpp +++ b/src/renderer/Options/RendererOptions.hpp @@ -15,23 +15,62 @@ namespace vg::renderer { super::registerProperties(_desc); - registerPropertyEx(RendererOptions, m_toolMode, "Toolmode", PropertyFlags::SingleLine); + registerProperty(RendererOptions, m_toolMode, "Toolmode"); setPropertyDescription(LightDesc, m_toolMode, "Enable Toolmode in Game views"); - registerPropertyEx(RendererOptions, m_rayTracing, "RayTracing", PropertyFlags::SingleLine); - setPropertyDescription(LightDesc, m_rayTracing, "Enable Ray-Tracing features"); + //registerPropertyEnumEx(RendererOptions, DisplayMode, m_debugDisplayMode, "Debug", PropertyFlags::AlphabeticalOrder); + registerPropertyEnum(RendererOptions, DisplayMode, m_debugDisplayMode, "Debug"); - registerPropertyEx(RendererOptions, m_postProcess, "PostProcess", PropertyFlags::SingleLine); - setPropertyDescription(RendererOptions, m_postProcess, "Enable Post-Process features"); + registerPropertyGroupBegin(RendererOptions, "Lighting"); + { + registerPropertyEnum(RendererOptions, LightingMode, m_lightingMode, "Mode"); + setPropertyDescription(LightDesc, m_lightingMode, "Lighting monde will affect how lights are computed.\nIn \"Forward\" mode lighting is computed on the fly in pixel shader\nIn \"Defered\" mode lighting is computed in screen-space"); + } + registerPropertyGroupEnd(RendererOptions); - registerPropertyEnum(RendererOptions, LightingMode, m_lightingMode, "Lighting"); - setPropertyDescription(LightDesc, m_lightingMode, "Lighting monde will affect how lights are computed.\nIn \"Forward\" mode lighting is computed on the fly in pixel shader\nIn \"Defered\" mode lighting is computed in screen-space"); + registerPropertyGroupBegin(RendererOptions, "Presentation"); + { + registerPropertyEnum(RendererOptions, gfx::HDR, m_HDRmode, "HDR"); + setPropertyDescription(LightDesc, m_HDRmode, "High-dynamic range display mode"); - //registerPropertyEnumEx(RendererOptions, DisplayMode, m_debugDisplayMode, "Debug", PropertyFlags::AlphabeticalOrder); - registerPropertyEnum(RendererOptions, DisplayMode, m_debugDisplayMode, "Debug"); - registerPropertyEnumBitfield(RendererOptions, DisplayFlags, m_displayFlags, "Flags"); + registerPropertyEnumEx(RendererOptions, gfx::MSAA, m_msaa, "MSAA", PropertyFlags::ReadOnly); + setPropertyDescription(LightDesc, m_msaa, "Multisample anti-aliasing"); + + registerPropertyEnum(RendererOptions, gfx::VSync, m_VSync, "VSync"); + setPropertyDescription(LightDesc, m_VSync, "Sync display frequency with monitor refresh rate"); + } + registerPropertyGroupEnd(RendererOptions); - registerPropertyGroupBegin(RendererOptions, "Advanced"); + registerPropertyGroupBegin(RendererOptions, "Raytracing"); + { + registerProperty(RendererOptions, m_rayTracing, "Enable"); + setPropertyDescription(LightDesc, m_rayTracing, "Enable Raytracing"); + } + registerPropertyGroupEnd(RendererOptions); + + registerPropertyGroupBegin(RendererOptions, "Post-process"); + { + registerProperty(RendererOptions, m_postProcess, "Enable"); + setPropertyDescription(RendererOptions, m_postProcess, "Enable Post-Process"); + + registerPropertyEnum(RendererOptions, gfx::AAPostProcess, m_aaPostProcess, "Anti-aliasing"); + setPropertyDescription(LightDesc, m_aaPostProcess, "Post-Process anti-aliasing"); + } + registerPropertyGroupEnd(RendererOptions); + + registerPropertyGroupBegin(RendererOptions, "Framegraph"); + { + registerPropertyEnumBitfield(RendererOptions, RenderPassFlags, m_renderPassFlags, "Passes"); + } + registerPropertyGroupEnd(RendererOptions); + + registerPropertyGroupBegin(RendererOptions, "Materials"); + { + registerPropertyEnumBitfield(RendererOptions, DisplayFlags, m_displayFlags, "Features"); + } + registerPropertyGroupEnd(RendererOptions); + + registerPropertyGroupBegin(RendererOptions, "Misc"); { registerPropertyEx(RendererOptions, m_wireframe, "Wireframe", PropertyFlags::SingleLine); setPropertyDescription(LightDesc, m_wireframe, "Show Wireframe"); @@ -42,19 +81,8 @@ namespace vg::renderer registerPropertyEx(RendererOptions, m_debugUI, "Debug UI", PropertyFlags::SingleLine); setPropertyDescription(LightDesc, m_debugUI, "Show UI debug"); - registerPropertyEnum(RendererOptions, gfx::VSync, m_VSync, "VSync"); - setPropertyDescription(LightDesc, m_VSync, "Sync display frequency with monitor refresh rate"); - - registerPropertyEnum(RendererOptions, gfx::AntiAliasing, m_antiAliasing, "Anti-Aliasing"); - setPropertyDescription(LightDesc, m_antiAliasing, "Screen-space anti-aliasing technique"); - - registerPropertyEnum(RendererOptions, gfx::HDR, m_HDRmode, "HDR"); - setPropertyDescription(LightDesc, m_HDRmode, "High-dynamic range display mode"); - registerPropertyEx(RendererOptions, m_backgroundColor, "Background", PropertyFlags::Color); setPropertyDescription(LightDesc, m_backgroundColor, "Scene background color"); - - registerPropertyEnumBitfield(RendererOptions, RenderPassFlags, m_renderPassFlags, "Passes"); } registerPropertyGroupEnd(RendererOptions); @@ -76,6 +104,10 @@ namespace vg::renderer m_hdrProp = GetClassDesc()->GetPropertyByName("m_HDRmode"); m_vsyncProp = GetClassDesc()->GetPropertyByName("m_VSync"); + m_aaPostProcessProp = GetClassDesc()->GetPropertyByName("m_aaPostProcess"); + + // Temp: disable SMAA + m_aaPostProcessProp->SetEnumValueFlags((u64)gfx::AAPostProcess::SMAA, EnumValueFlags::Disabled, true); } //-------------------------------------------------------------------------------------- @@ -130,17 +162,17 @@ namespace vg::renderer } //-------------------------------------------------------------------------------------- - gfx::AntiAliasing RendererOptions::GetAliasing() const + gfx::AAPostProcess RendererOptions::GetAAPostProcess() const { - return m_antiAliasing; + return m_aaPostProcess; } //-------------------------------------------------------------------------------------- - bool RendererOptions::SetAliasing(const gfx::AntiAliasing & _aa) + bool RendererOptions::SetAAPostProcess(const gfx::AAPostProcess & _aa) { - if (m_antiAliasing != _aa) + if (m_aaPostProcess != _aa) { - m_antiAliasing = _aa; + m_aaPostProcess = _aa; return true; } diff --git a/src/renderer/RenderPass/Compute/ComputePostProcess/ComputePostProcessPass.hpp b/src/renderer/RenderPass/Compute/ComputePostProcess/ComputePostProcessPass.hpp index 560c8cb66..2f27166c3 100644 --- a/src/renderer/RenderPass/Compute/ComputePostProcess/ComputePostProcessPass.hpp +++ b/src/renderer/RenderPass/Compute/ComputePostProcess/ComputePostProcessPass.hpp @@ -72,21 +72,21 @@ namespace vg::renderer } const auto * options = RendererOptions::get(); - const auto aaMode = options->GetAliasing(); + const auto aaMode = options->GetAAPostProcess(); switch (aaMode) { default: VG_ASSERT_ENUM_NOT_IMPLEMENTED(aaMode); - case AntiAliasing::None: + case AAPostProcess::None: break; - case AntiAliasing::FXAA: - shaderKey.setFlag(PostProcessHLSLDesc::AntiAliasingMode, (uint)AntiAliasing::FXAA); + case AAPostProcess::FXAA: + shaderKey.setFlag(PostProcessHLSLDesc::AAPostProcess, (uint)AAPostProcess::FXAA); break; - case AntiAliasing::SMAA: - shaderKey.setFlag(PostProcessHLSLDesc::AntiAliasingMode, (uint)AntiAliasing::SMAA); + case AAPostProcess::SMAA: + shaderKey.setFlag(PostProcessHLSLDesc::AAPostProcess, (uint)AAPostProcess::SMAA); break; } diff --git a/src/renderer/View/Lit/LitView.hpp b/src/renderer/View/Lit/LitView.hpp index 7dd7223ed..d03220cb5 100644 --- a/src/renderer/View/Lit/LitView.hpp +++ b/src/renderer/View/Lit/LitView.hpp @@ -119,7 +119,8 @@ namespace vg::renderer break; } - _frameGraph.addUserPass(_renderPassContext, m_forwardTransparentPass, "ForwardTransparent"); + if (options->isTransparencyEnabled()) + _frameGraph.addUserPass(_renderPassContext, m_forwardTransparentPass, "ForwardTransparent"); // Render editor display to "Color" if (toolmode) diff --git a/src/renderer/renderer.vcxproj b/src/renderer/renderer.vcxproj index acb134ad9..3aeadc576 100644 --- a/src/renderer/renderer.vcxproj +++ b/src/renderer/renderer.vcxproj @@ -182,7 +182,9 @@ + + diff --git a/src/renderer/renderer.vcxproj.filters b/src/renderer/renderer.vcxproj.filters index 9bc76c284..6a73f3cf8 100644 --- a/src/renderer/renderer.vcxproj.filters +++ b/src/renderer/renderer.vcxproj.filters @@ -461,6 +461,12 @@ Importer\Naming + + Pass\ImGui + + + Pass\ImGui +