4#include "Foundation/HashFunctions.h"
7#define STATIC_ASSERT_MAPPING(mappingArray, sourceEnum) static_assert(sizeof(mappingArray) / sizeof(mappingArray[0]) == (int)sourceEnum, "Array size of " #mappingArray " must match number of enumerations in mapping array.");
14 struct NoConversion {};
21 template<
typename Type,
typename Convertible = NoConversion>
65 explicit operator bool()
const {
return handle != 0 &&
handle != -1; }
72 operator Convertible() {
return Convertible(this->
handle); };
84 template<
typename T,
typename U>
87 template<
typename T,
typename U>
96 template<
typename T,
typename U>
97 struct hash<
Cogs::Handle_t<T, U>>
101 return std::hash<typename Cogs::Handle_t<T, U>::handle_type>()(handle.
handle);
132 ControlPoint1PatchList,
133 ControlPoint2PatchList,
134 ControlPoint3PatchList,
135 ControlPoint4PatchList,
154 enum class BlendFlags
157 AlphaToCoverage = 1 << 0,
158 IndependentBlend = 1 << 1
160 COGS_RENDERING_ENABLE_ENUM_FLAGS(BlendFlags);
193 struct InputLayoutTag {};
195 struct TextureTag {};
196 struct SamplerTag {};
199 struct RenderPipelineTag {};
200 struct ComputePipelineTag {};
201 struct RenderTargetTag {};
202 struct DepthStencilTag {};
203 struct ConstantBufferBindingTag {};
204 struct VariableBindingTag {};
205 struct TextureBindingTag {};
206 struct SamplerStateBindingTag {};
207 struct BufferBindingTag {};
208 struct TextureViewTag {};
209 struct VertexFormatTag {};
210 struct VertexArrayObjectTag {};
215 typedef Handle_t<struct RasterizerState> RasterizerStateHandle;
216 typedef Handle_t<struct DepthStencilState> DepthStencilStateHandle;
217 typedef Handle_t<struct BlendState> BlendStateHandle;
219 typedef Handle_t<InputLayoutTag> InputLayoutHandle;
221 typedef Handle_t<BufferTag> BufferHandle;
222 typedef Handle_t<BufferTag, BufferHandle> VertexBufferHandle;
223 typedef Handle_t<BufferTag, BufferHandle> IndexBufferHandle;
225 typedef Handle_t<VertexFormatTag> VertexFormatHandle;
227 typedef Handle_t<VertexArrayObjectTag> VertexArrayObjectHandle;
229 typedef intptr_t TextureNativeHandle;
230 typedef Handle_t<TextureTag> TextureHandle;
231 typedef Handle_t<SamplerTag> SamplerStateHandle;
233 typedef Handle_t<EffectTag> EffectHandle;
234 typedef Handle_t<ShaderTag> ShaderHandle;
235 typedef Handle_t<RenderPipelineTag> RenderPipelineHandle;
236 typedef Handle_t<ComputePipelineTag> ComputePipelineHandle;
238 typedef Handle_t<RenderTargetTag> RenderTargetHandle;
239 typedef Handle_t<DepthStencilTag> DepthStencilHandle;
241 typedef Handle_t<VariableBindingTag> EffectVariableHandle;
242 typedef Handle_t<ConstantBufferBindingTag> ConstantBufferBindingHandle;
243 typedef Handle_t<TextureBindingTag> TextureBindingHandle;
244 typedef Handle_t<SamplerStateBindingTag> SamplerStateBindingHandle;
245 typedef Handle_t<BufferBindingTag> BufferBindingHandle;
247 typedef Handle_t<TextureViewTag> TextureViewHandle;
249 typedef Handle_t<FenceTag> FenceHandle;
257 template<
typename T,
typename U>
263 inline bool isDebug()
bool HandleIsValid(const ResourceHandle_t< T > &handle)
Check if the given resource is valid, that is not equal to NoHandle or InvalidHandle.
Contains all Cogs related functionality.
@ Default
Default type of graphics device, same as unknown.
Framebuffer
Framebuffers to select from when doing framebuffer operations.
PresentFlags
Flags controlling presentation.
@ NoSwap
Disables frame buffer swapping. This will leave the currently presented buffer as is.
PrimitiveType
Primitive types for interpreting vertex data sent to the graphics pipeline.
@ PointList
List of points.
@ TriangleStrip
Triangle strip.
@ TriangleStripAdjacency
Triangle strip with adjacency.
@ LineStripAdjacency
Line strip with adjacency.
@ LineListAdjacency
List of lines with adjacency.
@ TriangleListAdjacency
List of triangles with adjacency.
@ TriangleList
List of triangles.
Handle template class used to provide opaque, non-converting handles.
static const Handle_t NoHandle
Represents a handle to nothing.
Handle_t(const Handle_t &other)
Copy constructor.
Handle_t(const handle_type &handle)
Construct a handle with an explicit internal resource handle.
Handle_t(const Convertible &other)
Conversion constructor from Convertible type.
handle_type handle
Internal resource handle.
Handle_t()
Construct a handle.
int64_t handle_type
Internal handle storage type.
static const Handle_t InvalidHandle
Represents an invalid handle.
bool operator==(const Handle_t &other) const
Equality operator.
Handle_t & operator=(const Handle_t &other)
Assignment operator.