From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../deqp/data/gles2/shaders/split-swizzles.js | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 dom/canvas/test/webgl-conf/checkout/deqp/data/gles2/shaders/split-swizzles.js (limited to 'dom/canvas/test/webgl-conf/checkout/deqp/data/gles2/shaders/split-swizzles.js') diff --git a/dom/canvas/test/webgl-conf/checkout/deqp/data/gles2/shaders/split-swizzles.js b/dom/canvas/test/webgl-conf/checkout/deqp/data/gles2/shaders/split-swizzles.js new file mode 100644 index 0000000000..4a67bfc7a4 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/deqp/data/gles2/shaders/split-swizzles.js @@ -0,0 +1,47 @@ +/* + +run with + node split-swizzles.js + +notes: + +swizzles.test is generated from the C++ based dEQP tests +https://github.com/KhronosGroup/VK-GL-CTS/blob/main/modules/gles2/scripts/gen-swizzles.py + +You need to manually add these tests to the 00_test_list.txt + +*/ + +const fs = require('fs'); + +process.chdir(__dirname); + +const testWarning = `\ +# WARNING: This file is auto-generated. Do NOT modify it manually, but rather +# modify the generating script file. Otherwise changes will be lost! +# See split-swizzles.js + +`; + +const swizzlesHTML = fs.readFileSync('swizzles.template', {encoding: 'utf8'}); +const swizzles = fs.readFileSync('swizzles.test', {encoding: 'utf8'}); +const caseMatches = swizzles.matchAll(/\scase (\w+)_(\w+)_(\w+)\n[\s\S]+?end\n/g); + +// quick sanity check +const numCases = swizzles.matchAll('\bcase\b').length; +if (caseMatches.length !== numCases) { + throw Error(`numCases(${numCases}) does not match caseMatches.length(${caseMatches.length})`); +} + +const byType = {} +for (const [str, precision, type, swizzle] of caseMatches) { + byType[type] = byType[type] || []; + byType[type].push(str); +} + +for (const [type, cases] of Object.entries(byType)) { + const baseName = `swizzles_${type}`; + const str = `group ${type}_swizzles "${type} swizzles"\n\n${cases.join('\n\n')}\n\nend # ${type}_swizzles`; + fs.writeFileSync(`${baseName}.test`, `${testWarning}${str}`); + fs.writeFileSync(`${baseName}.html`, `\n${swizzlesHTML.replace("'swizzles'", `'${baseName}'`)}`); +} -- cgit v1.2.3