diff --git a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11DepthStencilTarget.bf b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11DepthStencilTarget.bf index e6107d5..334ef49 100644 --- a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11DepthStencilTarget.bf +++ b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11DepthStencilTarget.bf @@ -8,27 +8,6 @@ using internal GlitchyEngine.Platform.DX11; namespace GlitchyEngine.Renderer { - extension DepthStencilFormat - { - public static explicit operator Format(Self self) - { - switch(self) - { - case .D16_UNorm: - return .D16_UNorm; - case .D24_UNorm_S8_UInt: - return .D24_UNorm_S8_UInt; - case .D32_Float: - return .D32_Float; - case .D32_Float_S8X24_UInt: - return .D32_Float_S8X24_UInt; - case .None: - Log.EngineLogger.Assert(false, "None is not a valid depth stencil format"); - return .Unknown; - } - } - } - // TODO: Depth stencil target is technically just a RenderTarget extension DepthStencilTarget { @@ -39,7 +18,7 @@ namespace GlitchyEngine.Renderer Debug.Profiler.ProfileResourceFunction!(); Texture2DDescription desc = .(); - desc.Format = (.)_format; + desc.Format = (Format)_format; desc.ArraySize = 1; desc.BindFlags = .DepthStencil; desc.Width = _width; diff --git a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11RenderTarget.bf b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11RenderTarget.bf index 00aabfd..ef2be58 100644 --- a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11RenderTarget.bf +++ b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11RenderTarget.bf @@ -63,7 +63,7 @@ namespace GlitchyEngine.Renderer PlatformCreateTexture(); } - if(_description.DepthStencilFormat != .None) + if(_description.DepthStencilFormat != .Unknown) { _depthStenilTarget = new DepthStencilTarget(_description.Width, _description.Height, _description.DepthStencilFormat); } diff --git a/GlitchyEngine/src/Renderer/DepthStencilTarget.bf b/GlitchyEngine/src/Renderer/DepthStencilTarget.bf index 36b8971..1fdb929 100644 --- a/GlitchyEngine/src/Renderer/DepthStencilTarget.bf +++ b/GlitchyEngine/src/Renderer/DepthStencilTarget.bf @@ -4,11 +4,28 @@ namespace GlitchyEngine.Renderer { public enum DepthStencilFormat { + case Unknown, D16_UNorm, D24_UNorm_S8_UInt, D32_Float, - D32_Float_S8X24_UInt, - None + D32_Float_S8X24_UInt; + + public static Format operator explicit(Self depthFormat) + { + switch (depthFormat) + { + case D16_UNorm: + return .D16_UNorm; + case D24_UNorm_S8_UInt: + return .D24_UNorm_S8_UInt; + case D32_Float: + return .D32_Float; + case D32_Float_S8X24_UInt: + return .D32_Float_S8X24_UInt; + default: + return .Unknown; + } + } } // TODO: add all features. @@ -23,7 +40,7 @@ namespace GlitchyEngine.Renderer public this(uint32 width, uint32 height, DepthStencilFormat format = .D32_Float) { - Log.EngineLogger.Assert(format != .None, "DepthStencilFormat None is only valid for RenderTarget"); + Log.EngineLogger.Assert(format != .Unknown, "DepthStencilFormat None is only valid for RenderTarget"); _width = width; _height = height; diff --git a/GlitchyEngine/src/Renderer/RenderTarget.bf b/GlitchyEngine/src/Renderer/RenderTarget.bf index af11062..10d67a5 100644 --- a/GlitchyEngine/src/Renderer/RenderTarget.bf +++ b/GlitchyEngine/src/Renderer/RenderTarget.bf @@ -20,7 +20,7 @@ namespace GlitchyEngine.Renderer public bool IsSwapchainTarget; public this(Format pixelFormat, uint32 width, uint32 height, uint32 arraySize = 1, uint32 mipLevels = 1, - DepthStencilFormat depthStencilFormat = .None, CPUAccessFlags cpuAccess = .None, uint32 sampleCount = 1, uint32 sampleQuality = 0, bool isSwapchainTarget = false) + DepthStencilFormat depthStencilFormat = .Unknown, CPUAccessFlags cpuAccess = .None, uint32 sampleCount = 1, uint32 sampleQuality = 0, bool isSwapchainTarget = false) { PixelFormat = pixelFormat; Width = width; diff --git a/GlitchyEngine/src/Renderer/SamplerState.bf b/GlitchyEngine/src/Renderer/SamplerState.bf index c732ecb..385fe5d 100644 --- a/GlitchyEngine/src/Renderer/SamplerState.bf +++ b/GlitchyEngine/src/Renderer/SamplerState.bf @@ -148,7 +148,7 @@ namespace GlitchyEngine.Renderer * Clamping value used if FilterMode.Anisotropic is specified in the Filters. * Valid values are between 1 and 16. */ - public uint8 MaxAnisotropy = 1; // TODO: we could use a smaller int + public uint8 MaxAnisotropy = 1; /** * Border color to use if TextureAddressMode.Border is specified for AddressModeU, AddressModeV, or AddressModeW. diff --git a/GlitchyEngine/src/Renderer/SwapChain.bf b/GlitchyEngine/src/Renderer/SwapChain.bf index d930733..3a8c486 100644 --- a/GlitchyEngine/src/Renderer/SwapChain.bf +++ b/GlitchyEngine/src/Renderer/SwapChain.bf @@ -10,7 +10,7 @@ namespace GlitchyEngine.Renderer private Viewport _backBufferViewport; - private DepthStencilFormat _depthStencilFormat = .None; + private DepthStencilFormat _depthStencilFormat = .Unknown; public RenderTarget2D _backBuffer ~ _?.ReleaseRef();