<commit_before>/* This file is part of magic-sdk, an sdk for the open source programming language magic.
 *
 * Copyright (C) 2016 magic-lang
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

version(!gpuOff) {
use base
use geometry
import ../egl/egl
import ../[GLContext, GLTexture, GLVertexArrayObject, GLIndexBufferObject]
import external/gles3
import Gles3Debug, Gles3Fence, Gles3FramebufferObject, Gles3Quad, Gles3Renderer, Gles3ShaderProgram, Gles3Texture, Gles3VolumeTexture, Gles3VertexArrayObject, Gles3IndexBufferObject

Gles3Context: class extends GLContext {
	_eglContext: Pointer
	_eglSurface: Pointer
	_contextCount := static 0
	_mutex := static Mutex new()
	init: func { super() }
	validate: static func (value, expectedValue: UInt, function: String) {
		if (value != expectedValue)
			Debug error(function + " failed! Expected status %u but got %u. eglError=%d" format(expectedValue, value, eglGetError()))
	}
	validate: static func ~expression (success: Bool, function: String) {
		if (!success)
			Debug error(function + " failed" format(eglGetError()))
	}
	free: override func {
		This validate(eglMakeCurrent(this _eglDisplay, null, null, null), EGL_TRUE, "eglMakeCurrent")
		This validate(eglDestroyContext(this _eglDisplay, this _eglContext), EGL_TRUE, "eglDestroyContext")
		This validate(eglDestroySurface(this _eglDisplay, this _eglSurface), EGL_TRUE, "eglDestroySurface")
		This _mutex with(||
			if (This _contextCount == 1)
				This validate(eglTerminate(this _eglDisplay), EGL_TRUE, "eglTerminate")
			This _contextCount -= 1
		)
		super()
	}
	makeCurrent: override func -> Bool {
		This validate(eglMakeCurrent(this _eglDisplay, this _eglSurface, this _eglSurface, this _eglContext), EGL_TRUE, "eglMakeCurrent")
		true
	}<commit_msg>Fixed print.<commit_after>/* This file is part of magic-sdk, an sdk for the open source programming language magic.
 *
 * Copyright (C) 2016 magic-lang
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

version(!gpuOff) {
use base
use geometry
import ../egl/egl
import ../[GLContext, GLTexture, GLVertexArrayObject, GLIndexBufferObject]
import external/gles3
import Gles3Debug, Gles3Fence, Gles3FramebufferObject, Gles3Quad, Gles3Renderer, Gles3ShaderProgram, Gles3Texture, Gles3VolumeTexture, Gles3VertexArrayObject, Gles3IndexBufferObject

Gles3Context: class extends GLContext {
	_eglContext: Pointer
	_eglSurface: Pointer
	_contextCount := static 0
	_mutex := static Mutex new()
	init: func { super() }
	validate: static func (value, expectedValue: UInt, function: String) {
		if (value != expectedValue)
			Debug error(function + " failed! Expected status %u but got %u. eglError=%d" format(expectedValue, value, eglGetError()))
	}
	validate: static func ~expression (success: Bool, function: String) {
		if (!success)
			Debug error(function + " failed with eglError=%d" format(eglGetError()))
	}
	free: override func {
		This validate(eglMakeCurrent(this _eglDisplay, null, null, null), EGL_TRUE, "eglMakeCurrent")
		This validate(eglDestroyContext(this _eglDisplay, this _eglContext), EGL_TRUE, "eglDestroyContext")
		This validate(eglDestroySurface(this _eglDisplay, this _eglSurface), EGL_TRUE, "eglDestroySurface")
		This _mutex with(||
			if (This _contextCount == 1)
				This validate(eglTerminate(this _eglDisplay), EGL_TRUE, "eglTerminate")
			This _contextCount -= 1
		)
		super()
	}
	makeCurrent: override func -> Bool {
		This validate(eglMakeCurrent(this _eglDisplay, this _eglSurface, this _eglSurface, this _eglContext), EGL_TRUE, "eglMakeCurrent")
		true
	}
{'fraction_non_alphanumeric': 0.09805510534846029, 'fraction_numerical': 0.010264721772015126, 'mean_word_length': 5.507908611599297, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '822484', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1170, 'n_words': 359}