mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Moved CPUAccessFlags and Usage to seperate file
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user