Cogs.Core
Flags.h
1#pragma once
2
3#include "Base.h"
4
5#include <cstdint>
6
7// Require Max 32bit enums for Cogs.js support.
8#define COGS_RENDERING_ENABLE_ENUM_FLAGS(EnumType) \
9 static_assert(sizeof(EnumType) <= sizeof(uint32_t)); \
10 constexpr EnumType operator|(EnumType lhs, EnumType rhs) { return static_cast<EnumType>(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs)); } \
11 constexpr EnumType operator&(EnumType lhs, EnumType rhs) { return static_cast<EnumType>(static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs)); } \
12 constexpr EnumType & operator|=(EnumType & lhs, EnumType rhs) { lhs = static_cast<EnumType>(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs)); return lhs; }
13
14namespace Cogs
15{
20 struct Usage
21 {
23 enum EUsage
24 {
34 };
35 };
36
41 {
44 {
46 None = 0x00L,
48 Read = 0x01L,
50 Write = 0x02L,
54 };
55 };
56
60 struct BindFlags
61 {
64 {
66 None = 0x00L,
68 VertexBuffer = 0x01L,
70 IndexBuffer = 0x02L,
78 RawBuffer = 0x20L,
83 };
84 };
85
89 struct MapMode
90 {
93 {
96 Read = 0,
104 };
105 };
106
111 {
114 {
116 Default = 0x0000,
118 Texture = 0x0001,
120 RenderTarget = 0x0002,
122 DepthBuffer = 0x0004,
126 CubeMap = 0x0010,
134 UsageWriteStaging = 0x0100,
136 NoDelete = 0x0200
137 };
138 };
139
140 COGS_RENDERING_ENABLE_ENUM_FLAGS(TextureFlags::ETextureFlags);
141}
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
Access mode to buffers after creation.
Definition: Flags.h:41
EAccessMode
Access mode enumeration.
Definition: Flags.h:44
@ Read
The buffer can be mapped and read from by the CPU after creation.
Definition: Flags.h:48
@ Write
The buffer can be mapped and written to by the CPU after creation.
Definition: Flags.h:50
@ None
The buffer can not be either read from or written to by the CPU after creation.
Definition: Flags.h:46
Bind flags describe how a resource can be used by the graphics pipeline.
Definition: Flags.h:61
EBindFlags
Bind flags enumeration.
Definition: Flags.h:64
@ ConstantBuffer
The buffer can be bound as input to effects as a constant buffer.
Definition: Flags.h:72
@ StructuredBufferWithCounter
The buffer can be bound as a structured buffer and read or written from shaders, with an additional a...
Definition: Flags.h:82
@ StreamOutBuffer
The buffer can be bound as stream output to receive transform feedback results.
Definition: Flags.h:74
@ VertexBuffer
The buffer can be bound as input to the vertex shader stage as a vertex buffer.
Definition: Flags.h:68
@ RawBuffer
The buffer can be bound as a byte address buffer and read or written from shaders.
Definition: Flags.h:78
@ IndexBuffer
The buffer can be bound as input to the vertex shader stage as an index buffer.
Definition: Flags.h:70
@ None
The buffer will not be bound to the graphics pipeline. Suitable for staging resources.
Definition: Flags.h:66
@ ShaderResource
The buffer can be bound as a shader resource and read from shaders.
Definition: Flags.h:76
@ StructuredBuffer
The buffer can be bound as a structured buffer and read or written from shaders.
Definition: Flags.h:80
Mapping modes for resources managed by the graphics system.
Definition: Flags.h:90
EMapMode
Mapping mode enumeration.
Definition: Flags.h:93
@ WriteDiscard
Write access. When unmapping the graphics system will discard the old contents of the resource.
Definition: Flags.h:103
@ ReadWrite
Read and write access.
Definition: Flags.h:101
Texture flags describing valid usage for a texture object.
Definition: Flags.h:111
ETextureFlags
Texture flags enumeration.
Definition: Flags.h:114
@ DepthBuffer
The texture can be used as a depth target and have depth buffer values written into.
Definition: Flags.h:122
@ NoDelete
The ownership of the underlying texture resource is outside of cogs and cogs will not delete it.
Definition: Flags.h:136
@ RenderTarget
The texture can be used as a render target and drawn into.
Definition: Flags.h:120
@ GenerateMipMaps
The texture supports automatic mipmap generation performed by the graphics device.
Definition: Flags.h:124
@ Texture
Texture usage, see Default.
Definition: Flags.h:118
@ ReadWriteTexture
The texture can be used as a read/write texture. Can be used to output data from compute shaders.
Definition: Flags.h:128
@ UsageReadStaging
The texture is intended to be used as a staging texture.
Definition: Flags.h:133
@ CubeMap
The texture can be used as a cube map.
Definition: Flags.h:126
@ Default
Default usage, the texture can be loaded once and bound and sampled in shaders.
Definition: Flags.h:116
Usage flags for buffers.
Definition: Flags.h:21
EUsage
Usage enumeration.
Definition: Flags.h:24
@ Static
Buffer will be loaded once and used to render many subsequent frames without any updates.
Definition: Flags.h:28
@ Default
Default usage.
Definition: Flags.h:26
@ Dynamic
Buffer will be loaded and modified with some frequency.
Definition: Flags.h:30
@ Staging
Definition: Flags.h:33