From 1f1b32e101cce9e937da8cc3960235cf43215be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Wed, 23 Jun 2021 19:10:04 +0200 Subject: [PATCH] Moved CPUAccessFlags and Usage to seperate file --- .../src/Platform/DX11/Renderer/Dx11Buffer.bf | 16 -------- .../DX11/Renderer/Dx11CPUAccessFlags.bf | 18 +++++++++ GlitchyEngine/src/Renderer/Buffer.bf | 40 ------------------- GlitchyEngine/src/Renderer/CPUAccessFlags.bf | 16 ++++++++ GlitchyEngine/src/Renderer/Usage.bf | 29 ++++++++++++++ 5 files changed, 63 insertions(+), 56 deletions(-) create mode 100644 GlitchyEngine/src/Platform/DX11/Renderer/Dx11CPUAccessFlags.bf create mode 100644 GlitchyEngine/src/Renderer/CPUAccessFlags.bf create mode 100644 GlitchyEngine/src/Renderer/Usage.bf diff --git a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11Buffer.bf b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11Buffer.bf index 67b67a6..9ba2bff 100644 --- a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11Buffer.bf +++ b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11Buffer.bf @@ -6,22 +6,6 @@ using internal GlitchyEngine.Renderer; namespace GlitchyEngine.Renderer { - extension CPUAccessFlags - { - public static explicit operator DirectX.D3D11.CpuAccessFlags(Self cpuAccessFlags) - { - DirectX.D3D11.CpuAccessFlags flags = .None; - - if(cpuAccessFlags.HasFlag(.Read)) - flags |= .Read; - - if(cpuAccessFlags.HasFlag(.Write)) - flags |= .Write; - - return flags; - } - } - extension BufferDescription { public static operator DirectX.D3D11.BufferDescription(Self desc) diff --git a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11CPUAccessFlags.bf b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11CPUAccessFlags.bf new file mode 100644 index 0000000..8dd5e76 --- /dev/null +++ b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11CPUAccessFlags.bf @@ -0,0 +1,18 @@ +namespace GlitchyEngine.Renderer +{ + extension CPUAccessFlags + { + public static explicit operator DirectX.D3D11.CpuAccessFlags(Self cpuAccessFlags) + { + DirectX.D3D11.CpuAccessFlags flags = .None; + + if(cpuAccessFlags.HasFlag(.Read)) + flags |= .Read; + + if(cpuAccessFlags.HasFlag(.Write)) + flags |= .Write; + + return flags; + } + } +} diff --git a/GlitchyEngine/src/Renderer/Buffer.bf b/GlitchyEngine/src/Renderer/Buffer.bf index 6a759cf..d503051 100644 --- a/GlitchyEngine/src/Renderer/Buffer.bf +++ b/GlitchyEngine/src/Renderer/Buffer.bf @@ -2,46 +2,6 @@ using System; namespace GlitchyEngine.Renderer { - /** - * Identifies expected resource use during rendering. - * The usage directly reflects whether a resource is accessible by the CPU and/or the graphics processing unit (GPU). - */ - public enum Usage - { - /** - * A resource that requires read and write access by the GPU. - * This is likely to be the most common usage choice. - */ - Default = 0, - /** - * A resource that can only be read by the GPU. It cannot be written by the GPU, and cannot be accessed at all by the CPU. - */ - Immutable = 1, - /** - * A resource that is accessible by both the GPU (read only) and the CPU (write only). - * A dynamic resource is a good choice for a resource that will be updated by the CPU at least once per frame. - * To update a dynamic resource, use a Map method. - */ - Dynamic = 2, - /** - * A resource that supports data transfer (copy) from the GPU to the CPU. - */ - Staging = 3 - } - - /** - * Defines how the CPU can access a resource. - */ - public enum CPUAccessFlags - { - /// The CPU has no access to the resource. - None = 0, - /// The CPU has read access to the resource. - Read = 1, - /// The CPU has write access to the resource. - Write = 2 - } - /** * Defines how to bind a buffer to the pipeline. */ diff --git a/GlitchyEngine/src/Renderer/CPUAccessFlags.bf b/GlitchyEngine/src/Renderer/CPUAccessFlags.bf new file mode 100644 index 0000000..6b728d4 --- /dev/null +++ b/GlitchyEngine/src/Renderer/CPUAccessFlags.bf @@ -0,0 +1,16 @@ +namespace GlitchyEngine.Renderer +{ + /** + * Defines how the CPU can access a resource. + */ + public enum CPUAccessFlags + { + /// The CPU has no access to the resource. + None = 0, + /// The CPU has read access to the resource. + Read = 1, + /// The CPU has write access to the resource. + Write = 2 + } + +} diff --git a/GlitchyEngine/src/Renderer/Usage.bf b/GlitchyEngine/src/Renderer/Usage.bf new file mode 100644 index 0000000..9dbbed3 --- /dev/null +++ b/GlitchyEngine/src/Renderer/Usage.bf @@ -0,0 +1,29 @@ +namespace GlitchyEngine.Renderer +{ + /** + * Identifies expected resource use during rendering. + * The usage directly reflects whether a resource is accessible by the CPU and/or the graphics processing unit (GPU). + */ + public enum Usage + { + /** + * A resource that requires read and write access by the GPU. + * This is likely to be the most common usage choice. + */ + Default = 0, + /** + * A resource that can only be read by the GPU. It cannot be written by the GPU, and cannot be accessed at all by the CPU. + */ + Immutable = 1, + /** + * A resource that is accessible by both the GPU (read only) and the CPU (write only). + * A dynamic resource is a good choice for a resource that will be updated by the CPU at least once per frame. + * To update a dynamic resource, use a Map method. + */ + Dynamic = 2, + /** + * A resource that supports data transfer (copy) from the GPU to the CPU. + */ + Staging = 3 + } +}