3#include "Foundation/HashFunctions.h"
6#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.");
13 struct NoConversion {};
20 template<
typename Type,
typename Convertible = NoConversion>
64 explicit operator bool()
const {
return handle != 0 &&
handle != -1; }
71 operator Convertible() {
return Convertible(this->
handle); };
83 template<
typename T,
typename U>
86 template<
typename T,
typename U>
95 template<
typename T,
typename U>
96 struct hash<
Cogs::Handle_t<T, U>>
100 return std::hash<typename Cogs::Handle_t<T, U>::handle_type>()(handle.
handle);
134 ControlPoint1PatchList,
135 ControlPoint2PatchList,
136 ControlPoint3PatchList,
137 ControlPoint4PatchList,
163 AlphaToCoverage = 1 << 0,
164 IndependentBlend = 1 << 1
202 struct InputLayoutTag {};
204 struct TextureTag {};
205 struct SamplerTag {};
208 struct RenderPipelineTag {};
209 struct ComputePipelineTag {};
210 struct RenderTargetTag {};
211 struct DepthStencilTag {};
212 struct ConstantBufferBindingTag {};
213 struct VariableBindingTag {};
214 struct TextureBindingTag {};
215 struct SamplerStateBindingTag {};
216 struct BufferBindingTag {};
217 struct TextureViewTag {};
218 struct VertexFormatTag {};
219 struct VertexArrayObjectTag {};
224 typedef Handle_t<struct RasterizerState> RasterizerStateHandle;
225 typedef Handle_t<struct DepthStencilState> DepthStencilStateHandle;
226 typedef Handle_t<struct BlendState> BlendStateHandle;
228 typedef Handle_t<InputLayoutTag> InputLayoutHandle;
230 typedef Handle_t<BufferTag> BufferHandle;
231 typedef Handle_t<BufferTag, BufferHandle> VertexBufferHandle;
232 typedef Handle_t<BufferTag, BufferHandle> IndexBufferHandle;
234 typedef Handle_t<VertexFormatTag> VertexFormatHandle;
236 typedef Handle_t<VertexArrayObjectTag> VertexArrayObjectHandle;
238 typedef intptr_t TextureNativeHandle;
239 typedef Handle_t<TextureTag> TextureHandle;
240 typedef Handle_t<SamplerTag> SamplerStateHandle;
242 typedef Handle_t<EffectTag> EffectHandle;
243 typedef Handle_t<ShaderTag> ShaderHandle;
244 typedef Handle_t<RenderPipelineTag> RenderPipelineHandle;
245 typedef Handle_t<ComputePipelineTag> ComputePipelineHandle;
247 typedef Handle_t<RenderTargetTag> RenderTargetHandle;
248 typedef Handle_t<DepthStencilTag> DepthStencilHandle;
250 typedef Handle_t<VariableBindingTag> EffectVariableHandle;
251 typedef Handle_t<ConstantBufferBindingTag> ConstantBufferBindingHandle;
252 typedef Handle_t<TextureBindingTag> TextureBindingHandle;
253 typedef Handle_t<SamplerStateBindingTag> SamplerStateBindingHandle;
254 typedef Handle_t<BufferBindingTag> BufferBindingHandle;
256 typedef Handle_t<TextureViewTag> TextureViewHandle;
258 typedef Handle_t<FenceTag> FenceHandle;
266 template<
typename T,
typename U>
272 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.
Framebuffers to select from when doing framebuffer operations.
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.
Flags controlling presentation.
EPresentFlags
Present flags enumeration.
@ NoSwap
Disables frame buffer swapping. This will leave the currently presented buffer as is.
@ Default
Default swap flags.
Primitive types for interpreting vertex data sent to the graphics pipeline.
EPrimitiveType
Primitive type enumeration.
@ LineStripAdjacency
Line strip with adjacency.
@ TriangleStrip
Triangle strip.
@ TriangleListAdjacency
List of triangles with adjacency.
@ PointList
List of points.
@ TriangleStripAdjacency
Triangle strip with adjacency.
@ LineListAdjacency
List of lines with adjacency.
@ TriangleList
List of triangles.