<commit_before>
function glBindBuffer(target, buffer) {

	if (target != GL_ARRAY_BUFFER && target != GL_ELEMENT_ARRAY_BUFFER) {
		cnvgl_throw_error(GL_INVALID_ENUM);
		return;
	}

	//@note: In the future, we probably should create the object here, not in glGenBuffers

	//Initialize buffer object if necessary
	if (buffer != 0) {
		var buffer_obj = cnvgl_objects[buffer];
		buffer_obj.target = target;
		buffer_obj.data = null;
		buffer_obj.usage = GL_STATIC_DRAW;
		//buffer_obj.access = GL_READ_WRITE;
	}	

	//Unbind old buffer
	var old_buffer = cnvgl_state.bound_buffers[target];
	if (old_buffer != 0) {
		var old_buffer_object = cnvgl_objects[old_buffer];
		old_buffer_object.target = null;
		old_buffer_object.data = null;
	}

	cnvgl_state.bound_buffers[target] = buffer;
}

<commit_msg>Buffer unbinding should not empty old buffer<commit_after>
function glBindBuffer(target, buffer) {

	if (target != GL_ARRAY_BUFFER && target != GL_ELEMENT_ARRAY_BUFFER) {
		cnvgl_throw_error(GL_INVALID_ENUM);
		return;
	}

	//@note: In the future, we probably should create the object here, not in glGenBuffers

	//Initialize buffer object if necessary
	/*
	if (buffer != 0) {
		var buffer_obj = cnvgl_objects[buffer];
		buffer_obj.target = target;
		buffer_obj.data = null;
		buffer_obj.usage = GL_STATIC_DRAW;
		//buffer_obj.access = GL_READ_WRITE;
	}
	*/

	cnvgl_state.bound_buffers[target] = buffer;
}


{'fraction_non_alphanumeric': 0.10364546104360257, 'fraction_numerical': 0.002144388849177984, 'mean_word_length': 4.577689243027889, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2952051', 'n_tokens_mistral': 524, 'n_tokens_neox': 495, 'n_words': 114}