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);
209 struct InputLayoutTag {};
211 struct TextureTag {};
212 struct SamplerTag {};
215 struct RenderPipelineTag {};
216 struct ComputePipelineTag {};
217 struct RenderTargetTag {};
218 struct DepthStencilTag {};
219 struct ConstantBufferBindingTag {};
220 struct VariableBindingTag {};
221 struct TextureBindingTag {};
222 struct SamplerStateBindingTag {};
223 struct BindGroupConstantBufferBindingTag {};
224 struct BindGroupTextureBindingTag {};
225 struct BindGroupSamplerStateBindingTag {};
226 struct BufferBindingTag {};
227 struct BindGroupTag {};
228 struct TextureViewTag {};
229 struct VertexFormatTag {};
230 struct VertexArrayObjectTag {};
235 typedef Handle_t<struct RasterizerState> RasterizerStateHandle;
236 typedef Handle_t<struct DepthStencilState> DepthStencilStateHandle;
237 typedef Handle_t<struct BlendState> BlendStateHandle;
239 typedef Handle_t<InputLayoutTag> InputLayoutHandle;
241 typedef Handle_t<BufferTag> BufferHandle;
242 typedef Handle_t<BufferTag, BufferHandle> VertexBufferHandle;
243 typedef Handle_t<BufferTag, BufferHandle> IndexBufferHandle;
245 typedef Handle_t<VertexFormatTag> VertexFormatHandle;
247 typedef Handle_t<VertexArrayObjectTag> VertexArrayObjectHandle;
249 typedef intptr_t TextureNativeHandle;
250 typedef Handle_t<TextureTag> TextureHandle;
251 typedef Handle_t<SamplerTag> SamplerStateHandle;
253 typedef Handle_t<EffectTag> EffectHandle;
254 typedef Handle_t<ShaderTag> ShaderHandle;
255 typedef Handle_t<RenderPipelineTag> RenderPipelineHandle;
256 typedef Handle_t<ComputePipelineTag> ComputePipelineHandle;
258 typedef Handle_t<RenderTargetTag> RenderTargetHandle;
259 typedef Handle_t<DepthStencilTag> DepthStencilHandle;
261 typedef Handle_t<VariableBindingTag> EffectVariableHandle;
262 typedef Handle_t<ConstantBufferBindingTag> ConstantBufferBindingHandle;
263 typedef Handle_t<TextureBindingTag> TextureBindingHandle;
264 typedef Handle_t<SamplerStateBindingTag> SamplerStateBindingHandle;
265 typedef Handle_t<BufferBindingTag> BufferBindingHandle;
266 typedef Handle_t<BindGroupTag> BindGroupHandle;
267 typedef Handle_t<BindGroupConstantBufferBindingTag> BindGroupConstantBufferBindingHandle;
268 typedef Handle_t<BindGroupTextureBindingTag> BindGroupTextureBindingHandle;
269 typedef Handle_t<BindGroupSamplerStateBindingTag> BindGroupSamplerStateBindingHandle;
271 typedef Handle_t<TextureViewTag> TextureViewHandle;
273 typedef Handle_t<FenceTag> FenceHandle;
281 template<
typename T,
typename U>
287 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.
ResourceStatus
Status of an asynchronously loaded resource, such as an effect or a pipeline.
@ Pending
The resource is still loading.
@ Error
The resource failed to load.
@ Ready
The resource has loaded successfully and is ready for use.
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.