<commit_before>
#include "Shader.h"
#include "Utilities.h"
#include <GL/glew.h>


namespace ion
{
	namespace GL
	{
		////////////
		// Shader //
		////////////

		void Shader::Source(std::vector<std::string> const & Source)
		{
			c8 const ** Lines = new c8 const *[Source.size()];
			for (u32 i = 0; i < Source.size(); ++ i)
				Lines[i] = Source[i].c_str();
			CheckedGLCall(glShaderSource(Handle, Source.size(), Lines, 0));
		}

		void Shader::Source(std::string const & Source)
		{
			c8 const * Line = Source.c_str();
			CheckedGLCall(glShaderSource(Handle, 1, & Line, 0));
		}

		bool Shader::Compile()
		{
			CheckedGLCall(glCompileShader(Handle));

			s32 Compiled;
			CheckedGLCall(glGetShaderiv(Handle, GL_COMPILE_STATUS, & Compiled));

			return Compiled != 0;
		}

		std::string Shader::InfoLog() const
		{
			std::string Log;
			int InfoLogLength = 0;
			int CharsWritten = 0;

			CheckedGLCall(glGetShaderiv(Handle, GL_INFO_LOG_LENGTH, & InfoLogLength));

			if (InfoLogLength > 0)
			{
				GLchar * InfoLog = new GLchar[InfoLogLength];
				glGetShaderInfoLog(Handle, InfoLogLength, & CharsWritten, InfoLog);
				Log = InfoLog;
				delete[] InfoLog;
			}

			return Log;
		}

		void Shader::Delete()
		{
			delete this;
		}

		Shader::~Shader()
		{
			glDeleteShader(Handle);
		}

		Shader::Shader(u32 const handle)
			: Handle(handle)
		{}


		//////////////
		// Variants //<commit_msg>Fix bug preventing shader error logs from showing<commit_after>
#include "Shader.h"
#include "Utilities.h"
#include <GL/glew.h>


namespace ion
{
	namespace GL
	{
		////////////
		// Shader //
		////////////

		void Shader::Source(std::vector<std::string> const & Source)
		{
			c8 const ** Lines = new c8 const *[Source.size()];
			for (u32 i = 0; i < Source.size(); ++ i)
				Lines[i] = Source[i].c_str();
			CheckedGLCall(glShaderSource(Handle, Source.size(), Lines, 0));
		}

		void Shader::Source(std::string const & Source)
		{
			c8 const * Line = Source.c_str();
			CheckedGLCall(glShaderSource(Handle, 1, & Line, 0));
		}

		bool Shader::Compile()
		{
			CheckedGLCall(glCompileShader(Handle));

			s32 Compiled;
			CheckedGLCall(glGetShaderiv(Handle, GL_COMPILE_STATUS, & Compiled));

			return Compiled != 0;
		}

		std::string Shader::InfoLog() const
		{
			std::string Log;
			int InfoLogLength = 0;
			int CharsWritten = 0;
			
			CheckExistingErrors(Shader::InfoLog);
			glGetShaderiv(Handle, GL_INFO_LOG_LENGTH, & InfoLogLength);

			if (OpenGLError())
			{
				cerr << "Error occured during glGetShaderiv: " << GetOpenGLError() << endl;
				cerr << "Handle is " << Handle << endl;
				cerr << endl;
			}
			else if (InfoLogLength > 0)
			{
				GLchar * InfoLog = new GLchar[InfoLogLength];
				glGetShaderInfoLog(Handle, InfoLogLength, & CharsWritten, InfoLog);
				Log = InfoLog;
				delete[] InfoLog;
			}

			return Log;
		}

		void Shader::Delete()
		{
			delete this;
		}

		Shader::~Shader()
		{
			glDeleteShader(Handle);
		}

		Shader::Shader(u32 const handle)
			: Handle(handle)
		{}


		//////////////
		// Variants //
{'fraction_non_alphanumeric': 0.16633858267716536, 'fraction_numerical': 0.01115485564304462, 'mean_word_length': 3.0013123359580054, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 9, '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': '3777860', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1061, 'n_words': 227}