Skip to content

Commit

Permalink
Option to run tests with WebGL validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcozzi committed Sep 12, 2013
1 parent 74b0423 commit bf3327f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
38 changes: 34 additions & 4 deletions Specs/createContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,58 @@
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, {}));
options.alpha = defaultValue(options.alpha, true);

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());
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
Tests
<ul>
<li>
<a href="Specs/SpecRunner.html">Run all tests</a>
<a href="Specs/SpecRunner.html">Run all tests</a> &bullet; <a href="Specs/SpecRunner.html?skipWebGLValidation">Run all without WebGL validation</a> (faster)
</li>
<li>
<a href="Specs/SpecRunner.html?category=none">Select a test to run</a>
Expand Down

0 comments on commit bf3327f

Please sign in to comment.