From bf3327fa9f0fe22db5b516a7ccfbaea4165b560b Mon Sep 17 00:00:00 2001 From: Patrick Cozzi Date: Thu, 12 Sep 2013 17:13:03 -0400 Subject: [PATCH] Option to run tests with WebGL validation --- Specs/createContext.js | 38 ++++++++++++++++++++++++++++++++++---- index.html | 2 +- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Specs/createContext.js b/Specs/createContext.js index e045523c9994..a1981268b117 100644 --- a/Specs/createContext.js +++ b/Specs/createContext.js @@ -2,17 +2,43 @@ define([ 'Core/clone', 'Core/defaultValue', + 'Core/defined', 'Renderer/Context', 'Specs/createCanvas', 'Specs/createFrameState' ], function( clone, defaultValue, + defined, Context, createCanvas, createFrameState) { "use strict"; + function getQueryParameters() { + var queryParameters = {}; + + var search = window.location.search; + if (search.length > 1) { + search = search.substr(1); + var parameters = search.split('&'); + for (var i = 0; i < parameters.length; ++i) { + if (parameters[i].length > 0) { + var index = parameters[i].indexOf('='); + if (index !== -1) { + var key = parameters[i].substr(0, index); + var value = unescape(parameters[i].substr(index + 1)); + queryParameters[key] = value; + } else { + queryParameters[parameters[i]] = ''; + } + } + } + } + + return queryParameters; + } + function createContext(options) { // clone options so we can change properties options = clone(defaultValue(options, {})); @@ -20,10 +46,14 @@ define([ var canvas = createCanvas(); var context = new Context(canvas, options); - context.setValidateShaderProgram(true); - context.setValidateFramebuffer(true); - context.setLogShaderCompilation(true); - context.setThrowOnWebGLError(true); + + var parameters = getQueryParameters(); + if (!defined(parameters.skipWebGLValidation)) { + context.setValidateShaderProgram(true); + context.setValidateFramebuffer(true); + context.setLogShaderCompilation(true); + context.setThrowOnWebGLError(true); + } var us = context.getUniformState(); us.update(createFrameState()); diff --git a/index.html b/index.html index b2e67588d21f..1c98f07fbc77 100644 --- a/index.html +++ b/index.html @@ -39,7 +39,7 @@ Tests