21#define CE_GL_SAFE_CAST
28#define CE_GL_RENDER_API_OBJECT_FORWARD(N) \
30 using GL##N##Ptr = RC<GL##N>;
32#undef CE_GL_RENDER_API_OBJECT_FORWARD
34 template<
typename ChildTypeName,
typename ParentType =
void>
class GLObject {
41#if defined(CE_GL_SAFE_CAST)
59#if defined(CE_GL_SAFE_CAST)
71#if defined(CE_GL_SAFE_CAST)
83#if defined(CE_GL_SAFE_CAST)
95#if defined(CE_GL_SAFE_CAST)
117 template<
typename ChildTypeName,
typename ParentType =
void>
class GLDeviceObject :
public GLObject<ChildTypeName, ParentType> {
130 template<auto Alloc, auto Dealloc,
bool BatchAlloc = true,
bool BatchDealloc = BatchAlloc>
struct GLObjectHandle final {
136 (*Alloc)(1, &
raw, args...);
138 raw = (*Alloc)(args...);
#define GL_TRUE
Definition GLLoader.hpp:801
#define glGetError
Definition GLLoader.hpp:2176
unsigned int GLenum
Definition GLLoader.hpp:723
unsigned char GLboolean
Definition GLLoader.hpp:724
unsigned int GLuint
Definition GLLoader.hpp:733
#define GL_FALSE
Definition GLLoader.hpp:800
#define CE_GL_RENDER_API_OBJECT_FORWARD(N)
Definition OpenGL.hpp:28
#define CE_RENDER_API_OBJECT_EACH(F)
A macro that invokes the function-macro F for every RenderAPI object type.
Definition Forward.hpp:18
A retain-release type of smart pointer.
Definition SmartPtr.hpp:132
Pointer get() const noexcept
Definition SmartPtr.hpp:244
Definition GLDevice.hpp:29
Definition OpenGL.hpp:117
GLDeviceObject(GLDevicePtr device)
Creates a new GLDeviceObject from the given device.
Definition OpenGL.hpp:125
GLDevice & deviceGL
The owning GLDevice instance.
Definition OpenGL.hpp:120
static ChildTypeName * cast(ParentType *object)
Casts a object of type ParentType to a object of type ChildTypeName.
Definition OpenGL.hpp:82
static RC< ChildTypeName > safeCast(const RC< ParentType > &ptr)
Safely casts a RC containing a ParentType pointer to a pointer to a pointer to a ChildTypeName.
Definition OpenGL.hpp:52
static ChildTypeName * safeCast(ParentType *object)
Casts a object of type ParentType to a object of type ChildTypeName.
Definition OpenGL.hpp:106
static const ChildTypeName * cast(const ParentType *object)
Casts a object of type ParentType to a object of type ChildTypeName.
Definition OpenGL.hpp:94
static ChildTypeName & cast(ParentType &object)
Casts a object of type ParentType to a object of type ChildTypeName.
Definition OpenGL.hpp:58
static const ChildTypeName & cast(const ParentType &object)
Casts a object of type ParentType to a object of type ChildTypeName.
Definition OpenGL.hpp:70
static RC< ChildTypeName > cast(const RC< ParentType > &ptr)
Casts a RC containing a ParentType pointer to a pointer to a pointer to a ChildTypeName.
Definition OpenGL.hpp:40
static const ChildTypeName * safeCast(const ParentType *object)
Casts a object of type ParentType to a object of type ChildTypeName.
Definition OpenGL.hpp:112
Definition Application.hpp:19
GPUPolygonMode
Polygon filling modes enumeration.
Definition GPUGraphicsPipeline.hpp:143
void GLThrowIfFailed(const char *info)
GLenum toColorAttachment(UInt32 attachmentIndex) noexcept
Returns an enum in [GL_COLOR_ATTACHMENT0, ..., GL_COLOR_ATTACHMENT7].
GLenum GLMap(ShaderType shaderType)
GPUCullMode
Polygon culling modes enumeration.
Definition GPUGraphicsPipeline.hpp:153
GLenum GLMapOrZero(Format format)
constexpr GLboolean GLBoolean(const bool value) noexcept
Definition OpenGL.hpp:202
GPUSamplerAddressMode
Technique for resolving image coordinates that are outside of the range [0, 1].
Definition GPUSampler.hpp:29
GPUCompareOp
Compare operations enumeration.
Definition GPUGraphicsPipeline.hpp:37
GPUBlendOp
Blending operations enumeration.
Definition GPUGraphicsPipeline.hpp:84
Format
Definition TextureFormat.hpp:54
GLenum toImageCubeMap(UInt32 arrayLayer) noexcept
Returns an enum in [GL_TEXTURE_CUBE_MAP_POSITIVE_X, ..., GL_TEXTURE_CUBE_MAP_NEGATIVE_Z] for (arrayLa...
GPUBlendArithmetic
Blending arithmetic operations enumeration.
Definition GPUGraphicsPipeline.hpp:129
GPUStencilOp
Stencil operations enumeration.
Definition GPUGraphicsPipeline.hpp:63
GLenum GLMapInternalFormat(Format format)
GPUImageType
Definition GPUImage.hpp:36
GPUBufferType
Hardware buffer type enumeration.
Definition GPUBuffer.hpp:32
GPUSamplerFilter
Sampling filter enumeration.
Definition GPUSampler.hpp:49
DataType
Renderer data types enumeration.
Definition GPUFormat.hpp:109
std::uint32_t UInt32
Definition DataTypes.hpp:23
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
bool GLHasExtension(GLuint extension)
GPULogicOp
Logical pixel operation enumeration.
Definition GPUGraphicsPipeline.hpp:166
Definition OpenGL.hpp:130
GLObjectHandle & operator=(const GLObjectHandle &)=delete
GLObjectHandle(bool, const GLuint raw)
Definition OpenGL.hpp:151
GLObjectHandle(std::nullptr_t)
Definition OpenGL.hpp:150
GLObjectHandle(GLObjectHandle &&) noexcept=default
GLuint raw
Definition OpenGL.hpp:131
~GLObjectHandle()
Definition OpenGL.hpp:142
GLObjectHandle(const GLObjectHandle &)=delete
GLObjectHandle(Args &&... args)
Definition OpenGL.hpp:133
Definition IndexType.hpp:20
Primitive topology enumeration.
Definition PrimitiveTopology.hpp:21
Shader type enumeration.
Definition ShaderType.hpp:59
Determines the data type used for the each component of a VertexElement.
Definition VertexDeclaration.hpp:103