<commit_before>// Copyright (c) 2017 <NAME>
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#include "rendersystems/GL/indexbufferGL.h"
#include <glad/glad.h>

namespace CodeHero {

IndexBufferGL::IndexBufferGL() {
    glGenBuffers(1, &_GetGPUObjectHandle()->intHandle);
}

IndexBufferGL::~IndexBufferGL() {
    glDeleteBuffers(1, &_GetGPUObjectHandle()->intHandle);
}

void IndexBufferGL::Use() {
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, GetGPUObject().intHandle);
}

void IndexBufferGL::Unuse() {
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}

void IndexBufferGL::_SetDataImpl(const void* iData) {
    Use();

    glBufferData(
            GL_ELEMENT_ARRAY_BUFFER,
            m_IndexSize,
            iData,
            m_IsDynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
}

} // namespace CodeHero
<commit_msg>Fix wrong size for index buffer<commit_after>// Copyright (c) 2017 <NAME>
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#include "rendersystems/GL/indexbufferGL.h"
#include <glad/glad.h>

namespace CodeHero {

IndexBufferGL::IndexBufferGL() {
    glGenBuffers(1, &_GetGPUObjectHandle()->intHandle);
}

IndexBufferGL::~IndexBufferGL() {
    glDeleteBuffers(1, &_GetGPUObjectHandle()->intHandle);
}

void IndexBufferGL::Use() {
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, GetGPUObject().intHandle);
}

void IndexBufferGL::Unuse() {
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}

void IndexBufferGL::_SetDataImpl(const void* iData) {
    Use();

    // TODO(pierre) The sizeof should be more abstracted
    glBufferData(
            GL_ELEMENT_ARRAY_BUFFER,
            m_IndexSize * sizeof(unsigned int),
            iData,
            m_IsDynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
}

} // namespace CodeHero

{'fraction_non_alphanumeric': 0.11408296943231441, 'fraction_numerical': 0.007641921397379912, 'mean_word_length': 3.967479674796748, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '5703660', 'n_tokens_mistral': 624, 'n_tokens_neox': 610, 'n_words': 130}