michael@0: // Bug 977853 -- Pared down version of script exhibiting negative michael@0: // interaction with convert to doubles optimization. See bug for gory michael@0: // details. michael@0: michael@0: if (!getBuildConfiguration().parallelJS) michael@0: quit(); michael@0: michael@0: load(libdir + "parallelarray-helpers.js") michael@0: michael@0: var numIters = 5; michael@0: var golden_output; michael@0: michael@0: function PJS_div4(v, s) michael@0: { michael@0: return [ v[0]/s, v[1]/s, v[2]/s, v[3]/s ]; michael@0: } michael@0: michael@0: function PJS_normalized(v) michael@0: { michael@0: var d = Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); michael@0: d = d > 0.0 ? d : 1.0; michael@0: var result = [ v[0]/d, v[1]/d, v[2]/d, 1.0 ]; michael@0: return result; michael@0: } michael@0: michael@0: // This is the elemental function passed to mapPar michael@0: function PJS_displace(p) michael@0: { michael@0: var position = [p[0], p[1], p[2], 1.0]; michael@0: var normal = position; michael@0: var roughness = 0.025 / 0.35; michael@0: normal = PJS_normalized(PJS_div4(normal, roughness)); michael@0: return null; michael@0: } michael@0: var NUM_VERTEX_COMPONENTS = 3; michael@0: var initPos, nVertices; michael@0: var userData = { michael@0: nVertices : 25, //2880, michael@0: initPos : [], michael@0: }; michael@0: function setup() { michael@0: for(var k = 0; k < NUM_VERTEX_COMPONENTS*userData.nVertices; k++) { michael@0: userData.initPos[k] = k/1000; michael@0: } michael@0: nVertices = userData.nVertices; michael@0: initPos = new Array(nVertices); michael@0: for(var i=0, j=0; i