mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 09:49:19 +02:00
pch migration to modules [wip]
This commit is contained in:
53
gl/buffer.cppm
Normal file
53
gl/buffer.cppm
Normal file
@@ -0,0 +1,53 @@
|
||||
module;
|
||||
#include "glad/glad.h"
|
||||
|
||||
export module eu07.gl.buffer;
|
||||
import eu07.gl.object;
|
||||
import eu07.gl.bindable;
|
||||
|
||||
export {
|
||||
|
||||
|
||||
namespace gl
|
||||
{
|
||||
class buffer : public object
|
||||
{
|
||||
thread_local static GLuint binding_points[13];
|
||||
|
||||
public:
|
||||
enum targets
|
||||
{
|
||||
ARRAY_BUFFER = 0,
|
||||
ATOMIC_COUNTER_BUFFER,
|
||||
COPY_READ_BUFFER,
|
||||
COPY_WRITE_BUFFER,
|
||||
DISPATCH_INDIRECT_BUFFER,
|
||||
DRAW_INDIRECT_BUFFER,
|
||||
ELEMENT_ARRAY_BUFFER, // ELEMENT_ARRAY_BUFFER is part of VAO and therefore shouldn't be managed by global tracker!
|
||||
PIXEL_PACK_BUFFER,
|
||||
PIXEL_UNPACK_BUFFER,
|
||||
SHADER_STORAGE_BUFFER,
|
||||
TEXTURE_BUFFER,
|
||||
TRANSFORM_FEEDBACK_BUFFER,
|
||||
UNIFORM_BUFFER
|
||||
};
|
||||
|
||||
protected:
|
||||
static GLenum glenum_target(targets target);
|
||||
|
||||
public:
|
||||
buffer();
|
||||
~buffer();
|
||||
|
||||
void bind(targets target);
|
||||
void bind_base(targets target, GLuint index);
|
||||
static void unbind(targets target);
|
||||
static void unbind();
|
||||
|
||||
void allocate(targets target, GLsizeiptr size, GLenum hint);
|
||||
void upload(targets target, const void *data, int offset, GLsizeiptr size);
|
||||
void download(targets target, void *data, int offset, GLsizeiptr size);
|
||||
};
|
||||
}
|
||||
|
||||
} // export
|
||||
Reference in New Issue
Block a user