CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
GLBuffer.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "OpenGL.hpp"
11
13
14namespace CeresEngine {
15
17
18 class GLBuffer : public GPUBuffer, public GLDeviceObject<GLBuffer, GPUBuffer> {
19 private:
22
25
28
31
32 void* mData = nullptr;
33
34 public:
40
42 ~GLBuffer() override;
43
44 public:
47
49 void unmap() final;
50
53
55 void flush(GPUBufferSize offset = 0, GPUBufferSize size = whole) final;
56
59
60 public:
62 [[nodiscard]] GLuint handle() const { return mBuffer; }
63
65 [[nodiscard]] GLenum getType() const { return mType; };
66 };
67
75
83
91
99
100} // namespace CeresEngine
unsigned int GLenum
Definition GLLoader.hpp:723
int GLsizei
Definition GLLoader.hpp:734
unsigned int GLuint
Definition GLLoader.hpp:733
A retain-release type of smart pointer.
Definition SmartPtr.hpp:132
Definition GLBuffer.hpp:18
GPUBufferData map() final
GLenum mType
The buffer type.
Definition GLBuffer.hpp:24
GLuint mBuffer
The OpenGL buffer handle.
Definition GLBuffer.hpp:27
GLsizei mSize
The OpenGL buffer size.
Definition GLBuffer.hpp:30
const GPUBufferDescriptor descriptor
A structure that describes the buffer and it's properties.
Definition GLBuffer.hpp:21
GLBuffer(GLDevicePtr device, const GPUBufferDescriptor &descriptor, GLenum type)
Creates a new OpenGL buffer object.
void flush(GPUBufferSize offset=0, GPUBufferSize size=whole) final
~GLBuffer() override
Destroys the buffer object and releases the GPU memory.
void * mData
Definition GLBuffer.hpp:32
GLenum getType() const
Definition GLBuffer.hpp:65
GPUBufferSize getSize() const final
GLuint handle() const
Definition GLBuffer.hpp:62
void invalidate(GPUBufferSize offset=0, GPUBufferSize size=whole) final
Definition OpenGL.hpp:117
Definition GLBuffer.hpp:76
GLIndexBuffer(GLDevicePtr device, const GPUBufferDescriptor &descriptor)
Creates a new OpenGL index buffer object.
Definition GLBuffer.hpp:92
GLStorageBuffer(GLDevicePtr device, const GPUBufferDescriptor &descriptor)
Creates a new OpenGL storage buffer object.
Definition GLBuffer.hpp:84
GLUniformBuffer(GLDevicePtr device, const GPUBufferDescriptor &descriptor)
Creates a new OpenGL uniform buffer object.
Definition GLBuffer.hpp:68
GLVertexBuffer(GLDevicePtr device, const GPUBufferDescriptor &descriptor)
Creates a new OpenGL vertex buffer object.
Definition GPUBuffer.hpp:124
static const constexpr GPUBufferSize whole
A constant the represents the whole buffer length.
Definition GPUBuffer.hpp:127
GPUDevice & device
The owning device this object was created from.
Definition Common.hpp:55
Definition Application.hpp:19
GPUMemoryData GPUBufferData
A pointer type that represents the buffer raw data.
Definition GPUBuffer.hpp:89
GPUMemorySize GPUBufferSize
A type that represents a buffer size.
Definition GPUBuffer.hpp:86
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Hardware buffer descriptor structure.
Definition GPUBuffer.hpp:92