<commit_before>#line 2 "togo/gfx/renderer/opengl.hpp"
/**
@copyright MIT license; see @ref index or the accompanying LICENSE file.
*/

#pragma once

#include <togo/config.hpp>
#include <togo/gfx/types.hpp>
#include <togo/utility/utility.hpp>
#include <togo/log/log.hpp>

#include <GL/glew.h>

namespace togo {
namespace gfx {

char const* gl_get_error();

#define TOGO_GLCE() \
	do { while (char const* gl_error__ = gfx::gl_get_error()) { \
		TOGO_LOG_ERRORF("OpenGL error: %s\n", gl_error__); \
	} } while (false)

#define TOGO_GLCE_X(expr_) do { (expr_); TOGO_GLCE(); } while (false)

enum : GLuint {
	BUFFER_HANDLE_NULL = 0,
	TEXTURE_HANDLE_NULL = 0,
	PROGRAM_HANDLE_NULL = 0,
};

enum : GLint {
	UNIFORM_HANDLE_NULL = -1,
};

static constexpr GLenum const g_gl_buffer_data_binding[]{
	// fixed
	GL_STATIC_DRAW,
	// dynamic
	GL_DYNAMIC_DRAW,
};

static_assert(
	array_extent(g_gl_buffer_data_binding),
	"g_gl_buffer_data_binding is malformed"
);

enum class GLBufferFlags : unsigned {
	none = 0,
	dynamic = 1 << 0,
};

struct VertexBuffer {
	gfx::VertexBufferID id;
	GLuint handle;
	gfx::GLBufferFlags flags;
	gfx::VertexFormat const* format;
};

struct IndexBuffer {
	gfx::IndexBufferID id;
	GLuint handle;
	gfx::GLBufferFlags flags;
};
<commit_msg>gfx/renderer/opengl: corrected bound assertion for g_gl_buffer_data_binding.<commit_after>#line 2 "togo/gfx/renderer/opengl.hpp"
/**
@copyright MIT license; see @ref index or the accompanying LICENSE file.
*/

#pragma once

#include <togo/config.hpp>
#include <togo/utility/utility.hpp>
#include <togo/log/log.hpp>
#include <togo/gfx/types.hpp>

#include <GL/glew.h>

namespace togo {
namespace gfx {

char const* gl_get_error();

#define TOGO_GLCE() \
	do { while (char const* gl_error__ = gfx::gl_get_error()) { \
		TOGO_LOG_ERRORF("OpenGL error: %s\n", gl_error__); \
	} } while (false)

#define TOGO_GLCE_X(expr_) do { (expr_); TOGO_GLCE(); } while (false)

enum : GLuint {
	BUFFER_HANDLE_NULL = 0,
	TEXTURE_HANDLE_NULL = 0,
	PROGRAM_HANDLE_NULL = 0,
};

enum : GLint {
	UNIFORM_HANDLE_NULL = -1,
};

static constexpr GLenum const g_gl_buffer_data_binding[]{
	// fixed
	GL_STATIC_DRAW,
	// dynamic
	GL_DYNAMIC_DRAW,
};
static_assert(
	array_extent(g_gl_buffer_data_binding)
	== unsigned_cast(gfx::BufferDataBinding::NUM),
	""
);

enum class GLBufferFlags : unsigned {
	none = 0,
	dynamic = 1 << 0,
};

struct VertexBuffer {
	gfx::VertexBufferID id;
	GLuint handle;
	gfx::GLBufferFlags flags;
	gfx::VertexFormat const* format;
};

struct IndexBuffer {
	gfx::IndexBufferID id;
	GLuint handle;
	gfx::GLBufferFlags flags;
};

{'fraction_non_alphanumeric': 0.13343677269200932, 'fraction_numerical': 0.0062063615205585725, 'mean_word_length': 4.956120092378753, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3496474', 'n_tokens_mistral': 1023, 'n_tokens_neox': 1016, 'n_words': 219}