<commit_before>/**
 * Deferred shading implementation
 */
var DeferredRenderStage = PostProcessRenderStage.extend({
	init: function() {
		this._super();

		this.debugActive = true;
		this.debugger = null;

		// TODO: check that the system can handle deferred rendering
	},

	getGeneratorStage: function() {
		return new DeferredShadingRenderStage();
	},

	debug: function(val) {
		this.debugActive = !(val === false);
	},

	initDebugger: function(context, scene) {
		this.debugger = {};

		function createQuad(x, y, width, height) {
			var vertices = [x,y,0, x,y+height,0, x+width,y+height,0, x+width,y,0];
			var quad = new TrianglesRenderBuffer(context, [0, 1, 2, 0, 2, 3]);
			quad.add('position', vertices, 3);
			quad.add("uv0", [0,0, 0,1, 1,1, 1,0], 2);
			return quad;
		}

		var buffer = this.generator.gbufferStage.buffer;


		this.debugger.quads = [];

		var size = 0.33;
		var x = -0.99;
		var y = -1;
<commit_msg>Add: DeferredRenderStage now checks required extensions<commit_after>/**
 * Deferred shading implementation
 */
var DeferredRenderStage = PostProcessRenderStage.extend({
	init: function() {
		this._super();

		this.debugActive = false;
		this.debugger = null;
	},

	onStart: function(context, engine, camera) {
		// Check that the device can handle deferred rendering
		if (!context.gl.getExtension('WEBGL_draw_buffers'))
			throw('DeferredRenderStage: WEBGL_draw_buffers not available.');
		if (!context.gl.getExtension('OES_texture_float'))
			throw('DeferredRenderStage: OES_texture_float not available.');
		if (!context.gl.getExtension('OES_standard_derivatives'))
			throw('DeferredRenderStage: OES_standard_derivatives not available.');

		this._super(context, engine, camera);
	},

	getGeneratorStage: function() {
		return new DeferredShadingRenderStage();
	},

	debug: function(val) {
		this.debugActive = !(val === false);
	},

	initDebugger: function(context, scene) {
		this.debugger = {};

		function createQuad(x, y, width, height) {
			var vertices = [x,y,0, x,y+height,0, x+width,y+height,0, x+width,y,0];
			var quad = new TrianglesRenderBuffer(context, [0, 1, 2, 0, 2, 3]);
			quad.add('position', vertices, 3);
			quad.add("uv0", [0,0, 0,1, 1,1, 1,0], 2);
			return quad;
		}

		var buffer = this.generator.gbufferStage.buffer;


		this.debugger.quads = [];

		var size = 0.33;
		var x = -0.99;
		var y = -1;

{'fraction_non_alphanumeric': 0.1546304163126593, 'fraction_numerical': 0.0237892948173322, 'mean_word_length': 4.280269058295964, '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': '5757548', 'n_tokens_mistral': 916, 'n_tokens_neox': 815, 'n_words': 193}