aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
-rw-r--r--src/VkChess.cs27
-rw-r--r--ui/winOptions.crow1
2 files changed, 26 insertions, 2 deletions
diff --git a/src/VkChess.cs b/src/VkChess.cs
index 0e3f0d1..604a628 100644
--- a/src/VkChess.cs
+++ b/src/VkChess.cs
@@ -49,8 +49,6 @@ namespace vkChess
//Instance.RENDER_DOC_CAPTURE = true;
//SwapChain.PREFERED_FORMAT = VkFormat.B8g8r8a8Unorm;
DeferredPbrRendererBase.MAX_MATERIAL_COUNT = 3;
- DeferredPbrRendererBase.MRT_FORMAT = VkFormat.R16g16b16a16Sfloat;
- DeferredPbrRendererBase.HDR_FORMAT = VkFormat.R16g16b16a16Sfloat;
PbrModelTexArray.TEXTURE_DIM = 1024;
ShadowMapRenderer.SHADOWMAP_SIZE = 1024;
using (VkChess app = new VkChess ())
@@ -144,6 +142,13 @@ namespace vkChess
base.createQueues ();
transferQ = new Queue (dev, VkQueueFlags.Transfer);
}
+ public VkFormat GetSuitableGBuffImgFormat (params VkFormat[] formats) {
+ foreach (VkFormat f in formats) {
+ if (phy.GetFormatProperties (f).optimalTilingFeatures.HasFlag(VkFormatFeatureFlags.ColorAttachment | VkFormatFeatureFlags.SampledImage))
+ return f;
+ }
+ throw new InvalidOperationException ("No suitable image format for the GBuffer found.");
+ }
protected override void initVulkan () {
initLog ();
initCommands();
@@ -152,6 +157,14 @@ namespace vkChess
iFace.SetWindowIcon ("#Crow.Icons.crow.png");
+ VkFormat gbuffFormat = LowerGBuffFormat ?
+ GetSuitableGBuffImgFormat (VkFormat.R16g16b16a16Sfloat) :
+ GetSuitableGBuffImgFormat (VkFormat.R64g64b64a64Sfloat, VkFormat.R32g32b32a32Sfloat, VkFormat.R16g16b16a16Sfloat);
+
+ DeferredPbrRendererBase.MRT_FORMAT = gbuffFormat;
+ DeferredPbrRendererBase.HDR_FORMAT = gbuffFormat;
+
+
VkSampleCountFlags maxSamples = maxSampleCount;
if (SampleCount > maxSamples)
SampleCount = maxSamples;
@@ -844,6 +857,16 @@ namespace vkChess
NotifyValueChanged ("RestartRequired", true);
}
}
+ public bool LowerGBuffFormat {
+ get => Configuration.Global.Get<bool> ("LowerGBuffFormat", true);
+ set {
+ if (value == LowerGBuffFormat)
+ return;
+ Configuration.Global.Set ("LowerGBuffFormat", value);
+ NotifyValueChanged ("LowerGBuffFormat", value);
+ NotifyValueChanged ("RestartRequired", true);
+ }
+ }
public bool EnableTesselation {
get => Configuration.Global.Get<bool> ("EnableTesselation", false);
set {
diff --git a/ui/winOptions.crow b/ui/winOptions.crow
index 43d610b..3a876ff 100644
--- a/ui/winOptions.crow
+++ b/ui/winOptions.crow
@@ -77,6 +77,7 @@
<HorizontalStack >
<CheckBox Caption="Enable Reflections" IsChecked="{²EnableReflections}" />
<CheckBox Caption="Enable Tesselation" IsChecked="{²EnableTesselation}" />
+ <CheckBox Caption="Lower GBuffer texture format" IsChecked="{²LowerGBuffFormat}" />
</HorizontalStack >
<EnumSelector Caption="Sample count" ForceRadioButton="true" BitFieldExcludeMask="{AvailableSampleCount}" EnumValue="{²SampleCount}" Height="Fit" Width="Stretched">
<Template>