@ludicon/spark.js 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -11
- package/dist/{index.esm.js → spark.esm.js} +128 -56
- package/dist/spark_bc1_rgb-L0ZV40FW.js +4 -0
- package/dist/spark_bc3_rgba-Dnm92V6z.js +4 -0
- package/dist/spark_bc4_r-B4cqoXVq.js +4 -0
- package/dist/{spark_bc5_rg-NX_OBH9I.js → spark_bc5_rg-boGe-kBy.js} +1 -1
- package/package.json +23 -11
- package/dist/spark_bc1_rgb-CRQwJRCp.js +0 -4
- package/dist/spark_bc3_rgba-CyRcvC8t.js +0 -4
- package/dist/spark_bc4_r-BSB9VB_w.js +0 -4
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ It enables the use of standard image formats in WebGPU applications transcoding
|
|
|
10
10
|
|
|
11
11
|
> [Try the demo viewer](https://ludicon.com/sparkjs/viewer/)
|
|
12
12
|
|
|
13
|
-
---
|
|
13
|
+
---
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
@@ -50,7 +50,7 @@ npm install
|
|
|
50
50
|
npm run build
|
|
51
51
|
|
|
52
52
|
# Development mode with watch
|
|
53
|
-
npm run
|
|
53
|
+
npm run watch
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
|
|
@@ -59,13 +59,18 @@ npm run dev
|
|
|
59
59
|
To run local examples:
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
|
-
npm run
|
|
63
|
-
npm run serve
|
|
62
|
+
npm run dev
|
|
64
63
|
```
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
This will open `http://localhost:5174/examples/index.thml` where you can browse the examples.
|
|
67
66
|
|
|
68
|
-
> Note: HTTPS is required to enable WebGPU features
|
|
67
|
+
> Note: Browsers treat http://localhost as a secure context, so HTTPS is not required when testing locally on the same machine. However, to access the dev server from another device you must enable HTTPS for WebGPU features to work.
|
|
68
|
+
>
|
|
69
|
+
> To run the server with HTTPS, set the environment variable `HTTPS` to `true` before starting the server:
|
|
70
|
+
>
|
|
71
|
+
> ```bash
|
|
72
|
+
> HTTPS=true npm run serve
|
|
73
|
+
> ```
|
|
69
74
|
|
|
70
75
|
|
|
71
76
|
## Documentation
|
|
@@ -76,15 +81,25 @@ Load an image and encode it to a compressed GPU texture.
|
|
|
76
81
|
|
|
77
82
|
#### Parameters
|
|
78
83
|
|
|
79
|
-
- **`source`** (`
|
|
80
|
-
The image to encode. Can be a
|
|
84
|
+
- **`source`** (`string | HTMLImageElement | ImageBitmap | GPUtexture`)
|
|
85
|
+
The image to encode. Can be a GPUTexture, URL, DOM image or ImageBitmap.
|
|
81
86
|
|
|
82
87
|
- **`options`** *(optional object)*
|
|
83
88
|
Configuration options for encoding:
|
|
84
89
|
|
|
85
90
|
- **`format`** (`string`)
|
|
86
|
-
Desired block compression format.
|
|
87
|
-
|
|
91
|
+
Desired block compression format. The format can be specified in several different ways:
|
|
92
|
+
|
|
93
|
+
- A channel mask indicating the number of channels in your input: `"rgba"`, `"rgb"`, `"rg"` or `"r"`, the actual format is selected based on the device capabilities.
|
|
94
|
+
|
|
95
|
+
- An explicit WebGPU BC, ETC or ASTC format name, or an abbreviated form such as `"bc7"` or `"astc"`. Note, spark.js only supports 4x4 and LDR formats. By default
|
|
96
|
+
|
|
97
|
+
- If you specify `auto`, the input texture is analyzed to detect the necessary number of channels. This has some overhead, it's always recommended to specify the format through one of the other methods.
|
|
98
|
+
|
|
99
|
+
Default: `rgb`.
|
|
100
|
+
|
|
101
|
+
- **`alpha`**
|
|
102
|
+
Hint for the format selector. When an explicit channel mask is not provided, the channel mask is assumed to be `"rgb"`, providing
|
|
88
103
|
|
|
89
104
|
- **`mips`** or **`generateMipmaps`** (`boolean`)
|
|
90
105
|
Whether to generate mipmaps. Currently mipmap generation uses a basic box filter in linear space. Default: `false`.
|
|
@@ -103,6 +118,38 @@ Load an image and encode it to a compressed GPU texture.
|
|
|
103
118
|
- `Promise<GPUTexture>` — the compressed GPU texture, ready for use in WebGPU.
|
|
104
119
|
|
|
105
120
|
|
|
121
|
+
## Integration with three.js
|
|
122
|
+
|
|
123
|
+
Using spark.js with [three.js](https://threejs.org/) is straightforward. You can encode textures with Spark and expose them to three.js as external textures:
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
// Load and encode texture using spark:
|
|
127
|
+
const gpuTexture = await spark.encodeTexture(textureUrl, { srgb: true, flipY: true });
|
|
128
|
+
|
|
129
|
+
// Wrap the GPUTexture for three.js
|
|
130
|
+
const externalTex = new THREE.ExternalTexture(gpuTexture);
|
|
131
|
+
|
|
132
|
+
// Then use as any other texture:
|
|
133
|
+
const material = new THREE.MeshBasicMaterial({ map: externalTex });
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
To facilitate the use of Spark when loading GLTF assets, import the provided helper:
|
|
138
|
+
|
|
139
|
+
```jsd
|
|
140
|
+
import { registerSparkLoader } from "@ludicon/spark.js/three-gltf";
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Then register Spark with an existing GLTFLoader instance:
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
const loader = new GLTFLoader()
|
|
147
|
+
registerSparkLoader(loader, spark)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
After registration, the loader will automatically encode textures with Spark whenever applicable.
|
|
151
|
+
|
|
152
|
+
|
|
106
153
|
## License
|
|
107
154
|
|
|
108
155
|
*spark.js* is free for non-commercial use.
|
|
@@ -112,4 +159,3 @@ Load an image and encode it to a compressed GPU texture.
|
|
|
112
159
|
|
|
113
160
|
See https://ludicon.com/sparkjs#Licensing for details on how to use *spark.js* in commercial projects.
|
|
114
161
|
|
|
115
|
-
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const modules = /* @__PURE__ */ Object.assign({ "./spark_astc_rgb.wgsl": () => import("./spark_astc_rgb-ylbf30mQ.js"), "./spark_astc_rgba.wgsl": () => import("./spark_astc_rgba-C4NuyfHw.js"), "./spark_bc1_rgb.wgsl": () => import("./spark_bc1_rgb-
|
|
1
|
+
const modules = /* @__PURE__ */ Object.assign({ "./spark_astc_rgb.wgsl": () => import("./spark_astc_rgb-ylbf30mQ.js"), "./spark_astc_rgba.wgsl": () => import("./spark_astc_rgba-C4NuyfHw.js"), "./spark_bc1_rgb.wgsl": () => import("./spark_bc1_rgb-L0ZV40FW.js"), "./spark_bc3_rgba.wgsl": () => import("./spark_bc3_rgba-Dnm92V6z.js"), "./spark_bc4_r.wgsl": () => import("./spark_bc4_r-B4cqoXVq.js"), "./spark_bc5_rg.wgsl": () => import("./spark_bc5_rg-boGe-kBy.js"), "./spark_bc7_rgb.wgsl": () => import("./spark_bc7_rgb-CYdL55pE.js"), "./spark_bc7_rgba.wgsl": () => import("./spark_bc7_rgba-BFgOyqos.js"), "./spark_eac_r.wgsl": () => import("./spark_eac_r-BFwH430b.js"), "./spark_eac_rg.wgsl": () => import("./spark_eac_rg--Gm5Gzmk.js"), "./spark_etc2_rgb.wgsl": () => import("./spark_etc2_rgb-CWjBHhHQ.js"), "./spark_etc2_rgba.wgsl": () => import("./spark_etc2_rgba-BRX5DwNI.js"), "./utils.wgsl": () => import("./utils-CnL93Jcx.js") });
|
|
2
2
|
const shaders = Object.fromEntries(
|
|
3
3
|
Object.entries(modules).map(([path, module]) => {
|
|
4
4
|
const name = path.replace("./", "");
|
|
@@ -412,17 +412,35 @@ function imageToByteArray(image) {
|
|
|
412
412
|
const imageData = ctx.getImageData(0, 0, image.width, image.height);
|
|
413
413
|
return new Uint8Array(imageData.data.buffer);
|
|
414
414
|
}
|
|
415
|
-
function
|
|
416
|
-
return
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
415
|
+
function isSvgUrl(url) {
|
|
416
|
+
return /\.svg(?:$|\?)/i.test(url) || /^data:image\/svg\+xml[,;]/i.test(url);
|
|
417
|
+
}
|
|
418
|
+
function loadImageElement(url) {
|
|
419
|
+
return new Promise((resolve, reject) => {
|
|
420
|
+
const img = new Image();
|
|
421
|
+
img.crossOrigin = "anonymous";
|
|
422
|
+
img.decoding = "async";
|
|
423
|
+
img.onload = () => resolve(img);
|
|
424
|
+
img.onerror = reject;
|
|
425
|
+
img.src = url;
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
async function loadImageBitmap(url, opts = {}) {
|
|
429
|
+
const res = await fetch(url, { mode: "cors" });
|
|
430
|
+
if (!res.ok) throw new Error(`HTTP ${res.status} for ${url}`);
|
|
431
|
+
const blob = await res.blob();
|
|
432
|
+
return createImageBitmap(blob, {
|
|
433
|
+
imageOrientation: opts.flipY ? "flipY" : "none",
|
|
434
|
+
colorSpaceConversion: opts.colorSpaceConversion ?? "none"
|
|
424
435
|
});
|
|
425
436
|
}
|
|
437
|
+
function loadImage(url) {
|
|
438
|
+
if (isSvgUrl(url)) {
|
|
439
|
+
return loadImageElement(url);
|
|
440
|
+
} else {
|
|
441
|
+
return loadImageBitmap(url);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
426
444
|
const BYTES_PER_ROW_ALIGNMENT = 256;
|
|
427
445
|
const MIN_MIP_SIZE = 4;
|
|
428
446
|
function computeMipmapLayout(w, h, blockSize, mipmaps) {
|
|
@@ -457,6 +475,7 @@ class Spark {
|
|
|
457
475
|
#querySet;
|
|
458
476
|
#queryBuffer;
|
|
459
477
|
#queryReadbackBuffer;
|
|
478
|
+
#encodeCounter = 0;
|
|
460
479
|
/**
|
|
461
480
|
* Initialize the encoder by detecting available compression formats.
|
|
462
481
|
* @param {GPUDevice} device - WebGPU device.
|
|
@@ -550,13 +569,14 @@ class Spark {
|
|
|
550
569
|
* Try to determine the best compression options automatically. Do not use this in production, this is
|
|
551
570
|
* for the convenience of the spark.js image viewer only.
|
|
552
571
|
*
|
|
553
|
-
* @param {string | HTMLImageElement |
|
|
572
|
+
* @param {string | HTMLImageElement | ImageBitmap | GPUTexture} source - Image input.
|
|
554
573
|
* @param {Object} options - Encoding options.
|
|
555
574
|
* @returns {Object} - Recommended encoding options with an explicit encoding format.
|
|
556
575
|
*/
|
|
557
576
|
async selectPreferredOptions(source, options = {}) {
|
|
558
577
|
if (options.format == void 0 || options.format == "auto") {
|
|
559
|
-
const image = source instanceof Image || source instanceof GPUTexture ? source : await loadImage(source);
|
|
578
|
+
const image = source instanceof Image || source instanceof ImageBitmap || source instanceof GPUTexture ? source : await loadImage(source);
|
|
579
|
+
options.format = "auto";
|
|
560
580
|
const format = await this.#getBestMatchingFormat(options, image);
|
|
561
581
|
options.format = SparkFormatName[format];
|
|
562
582
|
if (image instanceof GPUTexture) {
|
|
@@ -569,21 +589,50 @@ class Spark {
|
|
|
569
589
|
return options;
|
|
570
590
|
}
|
|
571
591
|
/**
|
|
572
|
-
* Load an image and
|
|
573
|
-
*
|
|
574
|
-
* @param {
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
* @param {
|
|
578
|
-
*
|
|
579
|
-
* @param {
|
|
580
|
-
*
|
|
592
|
+
* Load an image and encode it to a compressed GPU texture.
|
|
593
|
+
*
|
|
594
|
+
* @param {string | HTMLImageElement | ImageBitmap | GPUTexture} source
|
|
595
|
+
* The image to encode. Can be a GPUTexture, URL, DOM image or ImageBitmap.
|
|
596
|
+
*
|
|
597
|
+
* @param {Object} [options] - Optional configuration for encoding.
|
|
598
|
+
*
|
|
599
|
+
* @param {string} [options.format="rgb"]
|
|
600
|
+
* Desired block compression format. Can be specified in several ways:
|
|
601
|
+
* - A channel mask indicating the number of channels in your input:
|
|
602
|
+
* "rgba", "rgb", "rg", or "r". The actual GPU format is selected
|
|
603
|
+
* based on device capabilities.
|
|
604
|
+
* - An explicit WebGPU BC, ETC, or ASTC format name, or an abbreviated
|
|
605
|
+
* form such as "bc7" or "astc". Note: only 4x4 LDR formats are supported.
|
|
606
|
+
* - "auto" to analyze the input texture and detect the required channels.
|
|
607
|
+
* This has some overhead, so specifying a format explicitly is preferred.
|
|
608
|
+
*
|
|
609
|
+
* @param {boolean} [options.alpha]
|
|
610
|
+
* Hint for the automatic format selector. When no explicit format is provided,
|
|
611
|
+
* the format is assumed to be "rgb". Supplying `alpha: true` will favor RGBA formats.
|
|
612
|
+
*
|
|
613
|
+
* @param {boolean} [options.mips=false] | [options.generateMipmaps=false]
|
|
614
|
+
* Whether to generate mipmaps. Mipmaps are generated with a basic box filter
|
|
615
|
+
* in linear space.
|
|
616
|
+
*
|
|
617
|
+
* @param {boolean} [options.srgb=false]
|
|
618
|
+
* Whether to encode the image in an sRGB format. Also affects mipmap generation.
|
|
619
|
+
* The `srgb` mode can also be inferred from the `format`.
|
|
620
|
+
*
|
|
621
|
+
* @param {boolean} [options.normal=false]
|
|
622
|
+
* Interpret the image as a normal map. Affects automatic format selection,
|
|
623
|
+
* favoring "bc5" and "eac-rg" formats.
|
|
624
|
+
*
|
|
625
|
+
* @param {boolean} [options.flipY=false]
|
|
626
|
+
* Whether to vertically flip the image before encoding.
|
|
627
|
+
*
|
|
628
|
+
* @returns {Promise<GPUTexture>} A promise resolving to the encoded GPU texture.
|
|
581
629
|
*/
|
|
582
630
|
async encodeTexture(source, options = {}) {
|
|
583
631
|
assert(this.#device, "Spark is not initialized");
|
|
584
|
-
const image = source instanceof Image || source instanceof GPUTexture ? source : await loadImage(source);
|
|
632
|
+
const image = source instanceof Image || source instanceof ImageBitmap || source instanceof GPUTexture ? source : await loadImage(source);
|
|
585
633
|
console.log("Loaded image", image);
|
|
586
634
|
const format = await this.#getBestMatchingFormat(options, image);
|
|
635
|
+
const pipelinePromise = this.#loadPipeline(format);
|
|
587
636
|
const width = Math.ceil(image.width / 4) * 4;
|
|
588
637
|
const height = Math.ceil(image.height / 4) * 4;
|
|
589
638
|
const blockSize = SparkBlockSize[format];
|
|
@@ -592,13 +641,15 @@ class Spark {
|
|
|
592
641
|
const srgb = (options.srgb || options.format?.endsWith("srgb")) && SparkFormatIsRGB[format];
|
|
593
642
|
const webgpuFormat = SparkWebGPUFormats[format] + (srgb ? "-srgb" : "");
|
|
594
643
|
const viewFormats = srgb ? ["rgba8unorm", "rgba8unorm-srgb"] : ["rgba8unorm"];
|
|
595
|
-
|
|
644
|
+
const counter = this.#encodeCounter++;
|
|
645
|
+
console.time("create input texture #" + counter);
|
|
596
646
|
let inputUsage = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.STORAGE_BINDING;
|
|
597
647
|
const needsProcessing = options.flipY || width != image.width || height != image.height;
|
|
598
648
|
if (!needsProcessing && !(image instanceof GPUTexture)) {
|
|
599
649
|
inputUsage |= GPUTextureUsage.RENDER_ATTACHMENT;
|
|
600
650
|
}
|
|
601
651
|
const commandEncoder = this.#device.createCommandEncoder();
|
|
652
|
+
commandEncoder.pushDebugGroup?.("spark process texture");
|
|
602
653
|
if (this.#querySet && typeof commandEncoder.writeTimestamp === "function") {
|
|
603
654
|
commandEncoder.writeTimestamp(this.#querySet, 0);
|
|
604
655
|
}
|
|
@@ -646,7 +697,8 @@ class Spark {
|
|
|
646
697
|
if (mipmaps) {
|
|
647
698
|
this.#generateMipmaps(commandEncoder, inputTexture, mipmapCount, width, height, srgb);
|
|
648
699
|
}
|
|
649
|
-
|
|
700
|
+
commandEncoder.popDebugGroup?.();
|
|
701
|
+
console.timeEnd("create input texture #" + counter);
|
|
650
702
|
const outputTexture = this.#device.createTexture({
|
|
651
703
|
size: [width, height, 1],
|
|
652
704
|
mipLevelCount: mipmapCount,
|
|
@@ -657,10 +709,8 @@ class Spark {
|
|
|
657
709
|
size: outputSize,
|
|
658
710
|
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC
|
|
659
711
|
});
|
|
660
|
-
console.time("
|
|
661
|
-
|
|
662
|
-
console.timeEnd("loadPipeline");
|
|
663
|
-
console.time("dispatch compute shader");
|
|
712
|
+
console.time("dispatch compute shader #" + counter);
|
|
713
|
+
commandEncoder.pushDebugGroup?.("spark encode texture");
|
|
664
714
|
let args = {};
|
|
665
715
|
if (this.#querySet && typeof commandEncoder.writeTimestamp !== "function") {
|
|
666
716
|
args = {
|
|
@@ -671,6 +721,7 @@ class Spark {
|
|
|
671
721
|
}
|
|
672
722
|
};
|
|
673
723
|
}
|
|
724
|
+
const pipeline = await pipelinePromise;
|
|
674
725
|
const pass = commandEncoder.beginComputePass(args);
|
|
675
726
|
pass.setPipeline(pipeline);
|
|
676
727
|
for (let m = 0; m < mipmapCount; m++) {
|
|
@@ -724,8 +775,9 @@ class Spark {
|
|
|
724
775
|
if (this.#querySet && typeof commandEncoder.writeTimestamp === "function") {
|
|
725
776
|
commandEncoder.writeTimestamp(this.#querySet, 1);
|
|
726
777
|
}
|
|
778
|
+
commandEncoder.popDebugGroup?.();
|
|
727
779
|
this.#device.queue.submit([commandEncoder.finish()]);
|
|
728
|
-
console.timeEnd("dispatch compute shader");
|
|
780
|
+
console.timeEnd("dispatch compute shader #" + counter);
|
|
729
781
|
tmpTexture?.destroy();
|
|
730
782
|
if (inputTexture != image) {
|
|
731
783
|
inputTexture?.destroy();
|
|
@@ -813,8 +865,14 @@ class Spark {
|
|
|
813
865
|
this.#supportsFloat16 = this.#device.features.has("shader-f16");
|
|
814
866
|
await this.#loadUtilPipelines();
|
|
815
867
|
if (preload) {
|
|
816
|
-
|
|
817
|
-
|
|
868
|
+
let formatsToLoad;
|
|
869
|
+
if (Array.isArray(preload)) {
|
|
870
|
+
formatsToLoad = preload.map((n) => this.#getPreferredFormat(n));
|
|
871
|
+
} else {
|
|
872
|
+
formatsToLoad = this.#supportedFormats;
|
|
873
|
+
}
|
|
874
|
+
for (const format of formatsToLoad) {
|
|
875
|
+
if (format !== void 0 && !this.#pipelines[format]) {
|
|
818
876
|
this.#loadPipeline(format).catch((err) => {
|
|
819
877
|
console.error(`Failed to preload pipeline for format ${format}:`, err);
|
|
820
878
|
});
|
|
@@ -871,6 +929,7 @@ class Spark {
|
|
|
871
929
|
return this.#pipelines[format];
|
|
872
930
|
}
|
|
873
931
|
const pipelinePromise = (async () => {
|
|
932
|
+
console.time("loadPipeline " + SparkFormatName[format]);
|
|
874
933
|
const shaderFile = SparkShaderFiles[format];
|
|
875
934
|
assert(shaderFile, `No shader available for format ${SparkFormatName[format]}`);
|
|
876
935
|
let shaderCode = await shaders[shaderFile]();
|
|
@@ -898,6 +957,7 @@ class Spark {
|
|
|
898
957
|
entryPoint: "main"
|
|
899
958
|
}
|
|
900
959
|
});
|
|
960
|
+
console.timeEnd("loadPipeline " + SparkFormatName[format]);
|
|
901
961
|
return pipeline;
|
|
902
962
|
})();
|
|
903
963
|
this.#pipelines[format] = pipelinePromise;
|
|
@@ -906,8 +966,37 @@ class Spark {
|
|
|
906
966
|
#isFormatSupported(format) {
|
|
907
967
|
return this.#supportedFormats.has(format);
|
|
908
968
|
}
|
|
969
|
+
#getPreferredFormat(format) {
|
|
970
|
+
const explicitFormat = SparkFormatMap[format];
|
|
971
|
+
if (explicitFormat != void 0 && this.#isFormatSupported(explicitFormat)) {
|
|
972
|
+
return explicitFormat;
|
|
973
|
+
}
|
|
974
|
+
const preferenceOrder = [
|
|
975
|
+
"bc4-r",
|
|
976
|
+
"eac-r",
|
|
977
|
+
"bc5-rg",
|
|
978
|
+
"eac-rg",
|
|
979
|
+
"bc7-rgb",
|
|
980
|
+
"bc1-rgb",
|
|
981
|
+
"astc-rgb",
|
|
982
|
+
"astc-4x4-rgb",
|
|
983
|
+
"etc2-rgb",
|
|
984
|
+
"bc7-rgba",
|
|
985
|
+
"astc-rgba",
|
|
986
|
+
"astc-4x4-rgba",
|
|
987
|
+
"bc3-rgba",
|
|
988
|
+
"etc2-rgba"
|
|
989
|
+
];
|
|
990
|
+
for (const key of preferenceOrder) {
|
|
991
|
+
if (key.includes(format) && this.#isFormatSupported(SparkFormatMap[key])) {
|
|
992
|
+
return SparkFormatMap[key];
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
}
|
|
909
996
|
async #getBestMatchingFormat(options, image) {
|
|
910
|
-
if (
|
|
997
|
+
if (options.format == void 0) {
|
|
998
|
+
options.format = "rgb";
|
|
999
|
+
} else if (options.format == "auto") {
|
|
911
1000
|
if (options.alpha) {
|
|
912
1001
|
if (this.#isFormatSupported(SparkFormat.BC7_RGBA)) return SparkFormat.BC7_RGBA;
|
|
913
1002
|
if (this.#isFormatSupported(SparkFormat.ASTC_4x4_RGBA)) return SparkFormat.ASTC_4x4_RGBA;
|
|
@@ -918,6 +1007,9 @@ class Spark {
|
|
|
918
1007
|
if (this.#isFormatSupported(SparkFormat.ASTC_4x4_RGB)) return SparkFormat.ASTC_4x4_RGB;
|
|
919
1008
|
if (this.#isFormatSupported(SparkFormat.BC1_RGB)) return SparkFormat.BC1_RGB;
|
|
920
1009
|
if (this.#isFormatSupported(SparkFormat.ETC2_RGB)) return SparkFormat.ETC2_RGB;
|
|
1010
|
+
} else if (options.normal) {
|
|
1011
|
+
if (this.#isFormatSupported(SparkFormat.BC5_RG)) return SparkFormat.BC5_RG;
|
|
1012
|
+
if (this.#isFormatSupported(SparkFormat.EAC_RG)) return SparkFormat.EAC_RG;
|
|
921
1013
|
} else {
|
|
922
1014
|
let channelCount;
|
|
923
1015
|
if (image instanceof GPUTexture) {
|
|
@@ -950,31 +1042,11 @@ class Spark {
|
|
|
950
1042
|
}
|
|
951
1043
|
throw new Error("No supported format found.");
|
|
952
1044
|
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
const preferenceOrder = [
|
|
957
|
-
"bc4-r",
|
|
958
|
-
"eac-r",
|
|
959
|
-
"bc5-rg",
|
|
960
|
-
"eac-rg",
|
|
961
|
-
"bc7-rgb",
|
|
962
|
-
"bc1-rgb",
|
|
963
|
-
"astc-rgb",
|
|
964
|
-
"astc-4x4-rgb",
|
|
965
|
-
"etc2-rgb",
|
|
966
|
-
"bc7-rgba",
|
|
967
|
-
"astc-rgba",
|
|
968
|
-
"astc-4x4-rgba",
|
|
969
|
-
"bc3-rgba",
|
|
970
|
-
"etc2-rgba"
|
|
971
|
-
];
|
|
972
|
-
for (const key of preferenceOrder) {
|
|
973
|
-
if (key.includes(options.format) && this.#isFormatSupported(SparkFormatMap[key])) {
|
|
974
|
-
return SparkFormatMap[key];
|
|
975
|
-
}
|
|
1045
|
+
const format = this.#getPreferredFormat(options.format);
|
|
1046
|
+
if (format === void 0) {
|
|
1047
|
+
throw new Error(`Unsupported format: ${options.format}`);
|
|
976
1048
|
}
|
|
977
|
-
|
|
1049
|
+
return format;
|
|
978
1050
|
}
|
|
979
1051
|
#detectChannelCount(imageData) {
|
|
980
1052
|
let opaque = true;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const spark_bc1_rgb = "enable f16;alias RTArr=array<vec2u>;struct _1{_0:RTArr,}@binding(1) @group(0) var _2:sampler;@binding(0) @group(0) var _3:texture_2d<f32>;var<private>x_2118:vec3u;var<private>x_2124:vec3u;@binding(2) @group(0) var<storage,read_write>x_2214:_1;const _4=vec2i(2i,0i);const _5=vec2i(0i,2i);const _6=vec2i(2i);const _7=vec3h(1.0h);const _8=vec3h(0.85986328125h,1.7099609375h,0.429931640625h);const _9=array<u32,256u>(0u,0u,134283264u,134283264u,2049u,2049u,2049u,134285313u,134285313u,134285313u,268568577u,268568577u,134287362u,134287362u,134287362u,268570626u,268570626u,268570626u,402853890u,402853890u,402853890u,268572675u,537137154u,402855939u,402855939u,402855939u,537139203u,537139203u,537139203u,402857988u,402857988u,402857988u,537141252u,537141252u,537141252u,402860037u,671424516u,537143301u,537143301u,537143301u,671426565u,671426565u,671426565u,805709829u,805709829u,671428614u,671428614u,671428614u,805711878u,805711878u,805711878u,939995142u,939995142u,939995142u,805713927u,1074278406u,939997191u,939997191u,939997191u,1074280455u,1074280455u,1074280455u,939999240u,939999240u,939999240u,1074282504u,1074282504u,1074282504u,940001289u,1208565768u,1074284553u,1074284553u,1074284553u,1208567817u,1208567817u,1208567817u,1342851081u,1342851081u,1208569866u,1208569866u,1208569866u,1342853130u,1342853130u,1342853130u,1477136394u,1477136394u,1477136394u,1342855179u,1611419658u,1477138443u,1477138443u,1477138443u,1611421707u,1611421707u,1611421707u,1477140492u,1477140492u,1477140492u,1611423756u,1611423756u,1611423756u,1477142541u,1745707020u,1611425805u,1611425805u,1611425805u,1745709069u,1745709069u,1745709069u,1879992333u,1879992333u,1745711118u,1745711118u,1745711118u,1879994382u,1879994382u,1879994382u,2014277646u,2014277646u,2014277646u,1879996431u,2148560910u,2014279695u,2014279695u,2014279695u,2148562959u,2148562959u,2148562959u,2014281744u,2014281744u,2014281744u,2148565008u,2148565008u,2148565008u,2014283793u,2282848272u,2148567057u,2148567057u,2148567057u,2282850321u,2282850321u,2282850321u,2417133585u,2417133585u,2282852370u,2282852370u,2282852370u,2417135634u,2417135634u,2417135634u,2551418898u,2551418898u,2551418898u,2417137683u,2685702162u,2551420947u,2551420947u,2551420947u,2685704211u,2685704211u,2685704211u,2551422996u,2551422996u,2551422996u,2685706260u,2685706260u,2685706260u,2551425045u,2819989524u,2685708309u,2685708309u,2685708309u,2819991573u,2819991573u,2819991573u,2954274837u,2954274837u,2819993622u,2819993622u,2819993622u,2954276886u,2954276886u,2954276886u,3088560150u,3088560150u,3088560150u,2954278935u,3222843414u,3088562199u,3088562199u,3088562199u,3222845463u,3222845463u,3222845463u,3088564248u,3088564248u,3088564248u,3222847512u,3222847512u,3222847512u,3088566297u,3357130776u,3222849561u,3222849561u,3222849561u,3357132825u,3357132825u,3357132825u,3491416089u,3491416089u,3357134874u,3357134874u,3357134874u,3491418138u,3491418138u,3491418138u,3625701402u,3625701402u,3625701402u,3491420187u,3759984666u,3625703451u,3625703451u,3625703451u,3759986715u,3759986715u,3759986715u,3625705500u,3625705500u,3625705500u,3759988764u,3759988764u,3759988764u,3625707549u,3894272028u,3759990813u,3759990813u,3759990813u,3894274077u,3894274077u,3894274077u,4028557341u,4028557341u,3894276126u,3894276126u,3894276126u,4028559390u,4028559390u,4028559390u,4162842654u,4162842654u,4162842654u,4028561439u,4028561439u,4162844703u,4162844703u);fn _a(){var _b:array<u32,256u>;var _c:array<u32,256u>;var _d:array<u32,256u>;var _e:bool;var _f:bool;var _g:vec2u;var _h:vec2u;var _i:vec2u;switch(0u){default:{let _j=bitcast<vec2u>(vec2i(textureDimensions(_3,0i)));let _k=((_j.x+3u)/4u);let _l=x_2118;let _m=x_2118.xy;let _n=x_2118.x;let _o=(_n>=_k);_f=_o;if(!(_o)){_e=(_l.y>=((_j.y+3u)/4u));_f=_e;}if(_f){break;}var _p:vec3h;var _q:vec3h;var _r:vec3h;var _s:vec3h;var _t:vec3h;var _u:vec3h;var _v:vec3h;var _w:vec3h;var _x:vec3h;var _y:vec3h;var _z:vec3h;var _10:vec3h;var _11:vec3h;var _12:vec3h;var _13:vec3h;var _14:vec3h;var _15:f16;var _16:f16;var _17:f16;var _18:f16;var _19:vec3h;var _1a:vec3h;var _1b:vec3h;var _1c:vec3h;var _1d:bool;var _1e:u32;var _1f:u32;var _1g:u32;var _1h:u32;let _1i=(vec2f(1.0f)/vec2f(vec2i(textureDimensions(_3,0i))));let _1j=((vec2f(bitcast<vec2i>((_m*vec2u(4u))))*_1i)+_1i);let _1k=vec4h(textureGather(0i,_3,_2,_1j,vec2i()));let _1l=vec4h(textureGather(0i,_3,_2,_1j,_4));let _1m=vec4h(textureGather(0i,_3,_2,_1j,_5));let _1n=vec4h(textureGather(0i,_3,_2,_1j,_6));let _1o=vec4h(textureGather(1i,_3,_2,_1j,vec2i()));let _1p=vec4h(textureGather(1i,_3,_2,_1j,_4));let _1q=vec4h(textureGather(1i,_3,_2,_1j,_5));let _1r=vec4h(textureGather(1i,_3,_2,_1j,_6));let _1s=vec4h(textureGather(2i,_3,_2,_1j,vec2i()));let _1t=vec4h(textureGather(2i,_3,_2,_1j,_4));let _1u=vec4h(textureGather(2i,_3,_2,_1j,_5));let _1v=vec4h(textureGather(2i,_3,_2,_1j,_6));_p=vec3h(_1k.w,_1o.w,_1s.w);_q=vec3h(_1k.z,_1o.z,_1s.z);_r=vec3h(_1l.w,_1p.w,_1t.w);_s=vec3h(_1l.z,_1p.z,_1t.z);_t=vec3h(_1k.x,_1o.x,_1s.x);_u=vec3h(_1k.y,_1o.y,_1s.y);_v=vec3h(_1l.x,_1p.x,_1t.x);_w=vec3h(_1l.y,_1p.y,_1t.y);_x=vec3h(_1m.w,_1q.w,_1u.w);_y=vec3h(_1m.z,_1q.z,_1u.z);_z=vec3h(_1n.w,_1r.w,_1v.w);_10=vec3h(_1n.z,_1r.z,_1v.z);_11=vec3h(_1m.x,_1q.x,_1u.x);_12=vec3h(_1m.y,_1q.y,_1u.y);_13=vec3h(_1n.x,_1r.x,_1v.x);_14=vec3h(_1n.y,_1r.y,_1v.y);switch(0u){default:{let _1w=(((((((((((((((_p+_q)+_r)+_s)+_t)+_u)+_v)+_w)+_x)+_y)+_z)+_10)+_11)+_12)+_13)+_14);let _1x=((_p*16.0h)-_1w);let _1y=_1x.x;let _1z=_1x.y;let _20=_1x.z;let _21=((_q*16.0h)-_1w);let _22=_21.x;let _23=_21.y;let _24=_21.z;let _25=((_r*16.0h)-_1w);let _26=_25.x;let _27=_25.y;let _28=_25.z;let _29=((_s*16.0h)-_1w);let _2a=_29.x;let _2b=_29.y;let _2c=_29.z;let _2d=((_t*16.0h)-_1w);let _2e=_2d.x;let _2f=_2d.y;let _2g=_2d.z;let _2h=((_u*16.0h)-_1w);let _2i=_2h.x;let _2j=_2h.y;let _2k=_2h.z;let _2l=((_v*16.0h)-_1w);let _2m=_2l.x;let _2n=_2l.y;let _2o=_2l.z;let _2p=((_w*16.0h)-_1w);let _2q=_2p.x;let _2r=_2p.y;let _2s=_2p.z;let _2t=((_x*16.0h)-_1w);let _2u=_2t.x;let _2v=_2t.y;let _2w=_2t.z;let _2x=((_y*16.0h)-_1w);let _2y=_2x.x;let _2z=_2x.y;let _30=_2x.z;let _31=((_z*16.0h)-_1w);let _32=_31.x;let _33=_31.y;let _34=_31.z;let _35=((_10*16.0h)-_1w);let _36=_35.x;let _37=_35.y;let _38=_35.z;let _39=((_11*16.0h)-_1w);let _3a=_39.x;let _3b=_39.y;let _3c=_39.z;let _3d=((_12*16.0h)-_1w);let _3e=_3d.x;let _3f=_3d.y;let _3g=_3d.z;let _3h=((_13*16.0h)-_1w);let _3i=_3h.x;let _3j=_3h.y;let _3k=_3h.z;let _3l=((_14*16.0h)-_1w);let _3m=_3l.x;let _3n=((((((((((((((((_1y*_1y)+(_22*_22))+(_26*_26))+(_2a*_2a))+(_2e*_2e))+(_2i*_2i))+(_2m*_2m))+(_2q*_2q))+(_2u*_2u))+(_2y*_2y))+(_32*_32))+(_36*_36))+(_3a*_3a))+(_3e*_3e))+(_3i*_3i))+(_3m*_3m));let _3o=_3l.y;let _3p=_3l.z;let _3q=((((((((((((((((_1z*_1z)+(_23*_23))+(_27*_27))+(_2b*_2b))+(_2f*_2f))+(_2j*_2j))+(_2n*_2n))+(_2r*_2r))+(_2v*_2v))+(_2z*_2z))+(_33*_33))+(_37*_37))+(_3b*_3b))+(_3f*_3f))+(_3j*_3j))+(_3o*_3o));let _3r=((((((((((((((((_20*_20)+(_24*_24))+(_28*_28))+(_2c*_2c))+(_2g*_2g))+(_2k*_2k))+(_2o*_2o))+(_2s*_2s))+(_2w*_2w))+(_30*_30))+(_34*_34))+(_38*_38))+(_3c*_3c))+(_3g*_3g))+(_3k*_3k))+(_3p*_3p));let _3s=select(1.0h,0.015625h,(max(max(_3n,_3q),_3r)>64.0h));let _3t=(_3n*_3s);let _3u=(((((((((((((((((_1y*_1z)+(_22*_23))+(_26*_27))+(_2a*_2b))+(_2e*_2f))+(_2i*_2j))+(_2m*_2n))+(_2q*_2r))+(_2u*_2v))+(_2y*_2z))+(_32*_33))+(_36*_37))+(_3a*_3b))+(_3e*_3f))+(_3i*_3j))+(_3m*_3o))*_3s);let _3v=(((((((((((((((((_1y*_20)+(_22*_24))+(_26*_28))+(_2a*_2c))+(_2e*_2g))+(_2i*_2k))+(_2m*_2o))+(_2q*_2s))+(_2u*_2w))+(_2y*_30))+(_32*_34))+(_36*_38))+(_3a*_3c))+(_3e*_3g))+(_3i*_3k))+(_3m*_3p))*_3s);let _3w=(_3q*_3s);let _3x=(((((((((((((((((_1z*_20)+(_23*_24))+(_27*_28))+(_2b*_2c))+(_2f*_2g))+(_2j*_2k))+(_2n*_2o))+(_2r*_2s))+(_2v*_2w))+(_2z*_30))+(_33*_34))+(_37*_38))+(_3b*_3c))+(_3f*_3g))+(_3j*_3k))+(_3o*_3p))*_3s);let _3y=(_3r*_3s);let _3z=(vec3h(_3t,_3w,_3y)+vec3h(0.0001220703125h));let _40=vec3h((vec3f(_3z)*(1.0f/f32(max(max(_3z.x,_3z.y),_3z.z)))));let _41=_40.x;_16=_41;if((_3u<0.0h)){_15=-(_41);_16=_15;}let _42=_40.z;_18=_42;if((_3x<0.0h)){_17=-(_42);_18=_17;}let _43=_40.y;let _44=(((_16*_3t)+(_43*_3u))+(_18*_3v));let _45=(((_16*_3u)+(_43*_3w))+(_18*_3x));let _46=(((_16*_3v)+(_43*_3x))+(_18*_3y));let _47=max(max(abs(_44),abs(_45)),abs(_46));let _48=vec3h((vec3f(f32(_44),f32(_45),f32(_46))*(1.0f/f32(select(_47,1.0h,(_47==0.0h))))));let _49=_48.x;let _4a=_48.y;let _4b=_48.z;let _4c=(((_49*_3t)+(_4a*_3u))+(_4b*_3v));let _4d=(((_49*_3u)+(_4a*_3w))+(_4b*_3x));let _4e=(((_49*_3v)+(_4a*_3x))+(_4b*_3y));let _4f=max(max(abs(_4c),abs(_4d)),abs(_4e));let _4g=(_4f==0.0h);let _4h=select(vec3h((vec3f(f32(_4c),f32(_4d),f32(_4e))*(1.0f/f32(select(_4f,1.0h,_4g))))),_7,vec3<bool>(_4g));let _4i=(_1w*0.0625h);let _4j=(_4h*_8);let _4k=(1.0h/dot(_4j,_4j));let _4l=((_4j*_4k)*_8);let _4m=dot(_p,_4l);let _4n=dot(_q,_4l);let _4o=(_4n<_4m);let _4p=select(1u,0u,_4o);let _4q=select(_4m,_4n,_4o);let _4r=(_4n>_4m);let _4s=select(1u,0u,_4r);let _4t=select(_4m,_4n,_4r);let _4u=dot(_r,_4l);let _4v=(_4u<_4q);let _4w=select(select(_4p,(_4p+1u),(_4n==_4q)),0u,_4v);let _4x=select(_4q,_4u,_4v);let _4y=(_4u>_4t);let _4z=select(select(_4s,(_4s+1u),(_4n==_4t)),0u,_4y);let _50=select(_4t,_4u,_4y);let _51=dot(_s,_4l);let _52=(_51<_4x);let _53=select(select(_4w,(_4w+1u),(_4u==_4x)),0u,_52);let _54=select(_4x,_51,_52);let _55=(_51>_50);let _56=select(select(_4z,(_4z+1u),(_4u==_50)),0u,_55);let _57=select(_50,_51,_55);let _58=dot(_t,_4l);let _59=(_58<_54);let _5a=select(select(_53,(_53+1u),(_51==_54)),0u,_59);let _5b=select(_54,_58,_59);let _5c=(_58>_57);let _5d=select(select(_56,(_56+1u),(_51==_57)),0u,_5c);let _5e=select(_57,_58,_5c);let _5f=dot(_u,_4l);let _5g=(_5f<_5b);let _5h=select(select(_5a,(_5a+1u),(_58==_5b)),0u,_5g);let _5i=select(_5b,_5f,_5g);let _5j=(_5f>_5e);let _5k=select(select(_5d,(_5d+1u),(_58==_5e)),0u,_5j);let _5l=select(_5e,_5f,_5j);let _5m=dot(_v,_4l);let _5n=(_5m<_5i);let _5o=select(select(_5h,(_5h+1u),(_5f==_5i)),0u,_5n);let _5p=select(_5i,_5m,_5n);let _5q=(_5m>_5l);let _5r=select(select(_5k,(_5k+1u),(_5f==_5l)),0u,_5q);let _5s=select(_5l,_5m,_5q);let _5t=dot(_w,_4l);let _5u=(_5t<_5p);let _5v=select(select(_5o,(_5o+1u),(_5m==_5p)),0u,_5u);let _5w=select(_5p,_5t,_5u);let _5x=(_5t>_5s);let _5y=select(select(_5r,(_5r+1u),(_5m==_5s)),0u,_5x);let _5z=select(_5s,_5t,_5x);let _60=dot(_x,_4l);let _61=(_60<_5w);let _62=select(select(_5v,(_5v+1u),(_5t==_5w)),0u,_61);let _63=select(_5w,_60,_61);let _64=(_60>_5z);let _65=select(select(_5y,(_5y+1u),(_5t==_5z)),0u,_64);let _66=select(_5z,_60,_64);let _67=dot(_y,_4l);let _68=(_67<_63);let _69=select(select(_62,(_62+1u),(_60==_63)),0u,_68);let _6a=select(_63,_67,_68);let _6b=(_67>_66);let _6c=select(select(_65,(_65+1u),(_60==_66)),0u,_6b);let _6d=select(_66,_67,_6b);let _6e=dot(_z,_4l);let _6f=(_6e<_6a);let _6g=select(select(_69,(_69+1u),(_67==_6a)),0u,_6f);let _6h=select(_6a,_6e,_6f);let _6i=(_6e>_6d);let _6j=select(select(_6c,(_6c+1u),(_67==_6d)),0u,_6i);let _6k=select(_6d,_6e,_6i);let _6l=dot(_10,_4l);let _6m=(_6l<_6h);let _6n=select(select(_6g,(_6g+1u),(_6e==_6h)),0u,_6m);let _6o=select(_6h,_6l,_6m);let _6p=(_6l>_6k);let _6q=select(select(_6j,(_6j+1u),(_6e==_6k)),0u,_6p);let _6r=select(_6k,_6l,_6p);let _6s=dot(_11,_4l);let _6t=(_6s<_6o);let _6u=select(select(_6n,(_6n+1u),(_6l==_6o)),0u,_6t);let _6v=select(_6o,_6s,_6t);let _6w=(_6s>_6r);let _6x=select(select(_6q,(_6q+1u),(_6l==_6r)),0u,_6w);let _6y=select(_6r,_6s,_6w);let _6z=dot(_12,_4l);let _70=(_6z<_6v);let _71=select(select(_6u,(_6u+1u),(_6s==_6v)),0u,_70);let _72=select(_6v,_6z,_70);let _73=(_6z>_6y);let _74=select(select(_6x,(_6x+1u),(_6s==_6y)),0u,_73);let _75=select(_6y,_6z,_73);let _76=dot(_13,_4l);let _77=(_76<_72);let _78=select(select(_71,(_71+1u),(_6z==_72)),0u,_77);let _79=select(_72,_76,_77);let _7a=(_76>_75);let _7b=select(select(_74,(_74+1u),(_6z==_75)),0u,_7a);let _7c=select(_75,_76,_7a);let _7d=dot(_14,_4l);let _7e=(_7d<_79);let _7f=select(select(_78,(_78+1u),(_76==_79)),0u,_7e);let _7g=select(_79,_7d,_7e);let _7h=(_7d>_7c);let _7i=select(select(_7b,(_7b+1u),(_76==_7c)),0u,_7h);let _7j=select(_7c,_7d,_7h);let _7k=dot(_4i,_4l);let _7l=(_7g-_7k);let _7m=(_7j-_7k);let _7n=(((_7m-_7l)*0.0625h)*(1.0h-clamp((f16(((select(_7f,(_7f+1u),(_7d==_7g))+select(_7i,(_7i+1u),(_7d==_7j)))-2u))*0.0714111328125h),0.0h,1.0h)));let _7o=(_7l+_7n);let _7p=(_7m-_7n);let _7q=max(0.0h,(((((0.6357421875h*0.03125h)*_4k)+(0.36376953125h*0.03125h))-(_7p-_7o))*0.5h));let _7r=clamp(((_4h*(_7o-_7q))+_4i),vec3h(),_7);let _7s=clamp(((_4h*(_7p+_7q))+_4i),vec3h(),_7);let _7t=_7r.x;let _7u=(trunc((_7t*31.0h))*8.25h);let _7v=trunc(_7u);let _7w=min(255.0h,trunc((_7u+8.25h)));let _7x=_7r.y;let _7y=(trunc((_7x*63.0h))*4.0625h);let _7z=min(255.0h,trunc(_7y));let _80=min(255.0h,trunc((_7y+4.0625h)));let _81=_7r.z;let _82=(trunc((_81*31.0h))*8.25h);let _83=trunc(_82);let _84=min(255.0h,trunc((_82+8.25h)));let _85=vec3h(select(_7v,_7w,((255.0h*_7t)>(0.5h*(_7v+_7w)))),select(_7z,_80,((255.0h*_7x)>(0.5h*(_7z+_80)))),select(_83,_84,((255.0h*_81)>(0.5h*(_83+_84)))));let _86=_7s.x;let _87=(trunc((_86*31.0h))*8.25h);let _88=trunc(_87);let _89=min(255.0h,trunc((_87+8.25h)));let _8a=_7s.y;let _8b=(trunc((_8a*63.0h))*4.0625h);let _8c=min(255.0h,trunc(_8b));let _8d=min(255.0h,trunc((_8b+4.0625h)));let _8e=_7s.z;let _8f=(trunc((_8e*31.0h))*8.25h);let _8g=trunc(_8f);let _8h=min(255.0h,trunc((_8f+8.25h)));let _8i=vec3h(select(_88,_89,((255.0h*_86)>(0.5h*(_88+_89)))),select(_8c,_8d,((255.0h*_8a)>(0.5h*(_8c+_8d)))),select(_8g,_8h,((255.0h*_8e)>(0.5h*(_8g+_8h)))));let _8j=(((_8i-_85)*_8)*0.0039215087890625h);let _8k=((_8j*(1.0h/dot(_8j,_8j)))*_8);let _8l=(dot(_85,_8k)*0.0039215087890625h);let _8m=((((((((((((((((0u|(u32(((3.0h*clamp((dot(_p,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(0i)))|(u32(((3.0h*clamp((dot(_q,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(2i)))|(u32(((3.0h*clamp((dot(_r,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(4i)))|(u32(((3.0h*clamp((dot(_s,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(6i)))|(u32(((3.0h*clamp((dot(_t,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(8i)))|(u32(((3.0h*clamp((dot(_u,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(10i)))|(u32(((3.0h*clamp((dot(_v,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(12i)))|(u32(((3.0h*clamp((dot(_w,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(14i)))|(u32(((3.0h*clamp((dot(_x,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(16i)))|(u32(((3.0h*clamp((dot(_y,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(18i)))|(u32(((3.0h*clamp((dot(_z,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(20i)))|(u32(((3.0h*clamp((dot(_10,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(22i)))|(u32(((3.0h*clamp((dot(_11,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(24i)))|(u32(((3.0h*clamp((dot(_12,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(26i)))|(u32(((3.0h*clamp((dot(_13,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(28i)))|(u32(((3.0h*clamp((dot(_14,_8k)-_8l),0.0h,1.0h))+0.5h))<<bitcast<u32>(30i)));switch(0u){default:{if(((_8m^(_8m<<bitcast<u32>(2i)))<4u)){_1b=_8i;_1c=_85;_1d=false;break;}let _8n=(_8m>>bitcast<u32>(1i));let _8o=f16(bitcast<i32>(countOneBits(((1431655765u&~(_8n))&_8m))));let _8p=(1431655765u&_8n);let _8q=f16(bitcast<i32>(countOneBits((_8p&~(_8m)))));let _8r=f16(bitcast<i32>(countOneBits((_8p&_8m))));let _8s=(((3.0h*_8r)+(2.0h*_8q))+_8o);let _8t=(((9.0h*_8r)+(4.0h*_8q))+_8o);let _8u=((144.0h-(6.0h*_8s))+_8t);let _8v=((3.0h*_8s)-_8t);let _8w=(((((((((((((((((_p*f16(((_8m>>bitcast<u32>(0i))&3u)))+(_q*f16(((_8m>>bitcast<u32>(2i))&3u))))+(_r*f16(((_8m>>bitcast<u32>(4i))&3u))))+(_s*f16(((_8m>>bitcast<u32>(6i))&3u))))+(_t*f16(((_8m>>bitcast<u32>(8i))&3u))))+(_u*f16(((_8m>>bitcast<u32>(10i))&3u))))+(_v*f16(((_8m>>bitcast<u32>(12i))&3u))))+(_w*f16(((_8m>>bitcast<u32>(14i))&3u))))+(_x*f16(((_8m>>bitcast<u32>(16i))&3u))))+(_y*f16(((_8m>>bitcast<u32>(18i))&3u))))+(_z*f16(((_8m>>bitcast<u32>(20i))&3u))))+(_10*f16(((_8m>>bitcast<u32>(22i))&3u))))+(_11*f16(((_8m>>bitcast<u32>(24i))&3u))))+(_12*f16(((_8m>>bitcast<u32>(26i))&3u))))+(_13*f16(((_8m>>bitcast<u32>(28i))&3u))))+(_14*f16(((_8m>>bitcast<u32>(30i))&3u))))*3.0h);let _8x=((_1w*9.0h)-_8w);let _8y=(1.0f/f32(((_8u*_8t)-(_8v*_8v))));let _8z=f16((f32(_8v)*_8y));let _90=clamp(((_8x*f16((f32(_8t)*_8y)))-(_8w*_8z)),vec3h(),_7);let _91=clamp(((_8w*f16((f32(_8u)*_8y)))-(_8x*_8z)),vec3h(),_7);let _92=_90.x;let _93=(trunc((_92*31.0h))*8.25h);let _94=trunc(_93);let _95=min(255.0h,trunc((_93+8.25h)));let _96=_90.y;let _97=(trunc((_96*63.0h))*4.0625h);let _98=min(255.0h,trunc(_97));let _99=min(255.0h,trunc((_97+4.0625h)));let _9a=_90.z;let _9b=(trunc((_9a*31.0h))*8.25h);let _9c=trunc(_9b);let _9d=min(255.0h,trunc((_9b+8.25h)));_19=vec3h(select(_94,_95,((255.0h*_92)>(0.5h*(_94+_95)))),select(_98,_99,((255.0h*_96)>(0.5h*(_98+_99)))),select(_9c,_9d,((255.0h*_9a)>(0.5h*(_9c+_9d)))));let _9e=_91.x;let _9f=(trunc((_9e*31.0h))*8.25h);let _9g=trunc(_9f);let _9h=min(255.0h,trunc((_9f+8.25h)));let _9i=_91.y;let _9j=(trunc((_9i*63.0h))*4.0625h);let _9k=min(255.0h,trunc(_9j));let _9l=min(255.0h,trunc((_9j+4.0625h)));let _9m=_91.z;let _9n=(trunc((_9m*31.0h))*8.25h);let _9o=trunc(_9n);let _9p=min(255.0h,trunc((_9n+8.25h)));_1a=vec3h(select(_9g,_9h,((255.0h*_9e)>(0.5h*(_9g+_9h)))),select(_9k,_9l,((255.0h*_9i)>(0.5h*(_9k+_9l)))),select(_9o,_9p,((255.0h*_9m)>(0.5h*(_9o+_9p)))));_1b=_1a;_1c=_19;_1d=true;}}_1f=_8m;if(_1d){let _9q=(((_1b-_1c)*_8)*0.0039215087890625h);let _9r=((_9q*(1.0h/dot(_9q,_9q)))*_8);let _9s=(dot(_1c,_9r)*0.0039215087890625h);_1e=((((((((((((((((0u|(u32(((3.0h*clamp((dot(_p,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(0i)))|(u32(((3.0h*clamp((dot(_q,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(2i)))|(u32(((3.0h*clamp((dot(_r,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(4i)))|(u32(((3.0h*clamp((dot(_s,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(6i)))|(u32(((3.0h*clamp((dot(_t,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(8i)))|(u32(((3.0h*clamp((dot(_u,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(10i)))|(u32(((3.0h*clamp((dot(_v,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(12i)))|(u32(((3.0h*clamp((dot(_w,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(14i)))|(u32(((3.0h*clamp((dot(_x,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(16i)))|(u32(((3.0h*clamp((dot(_y,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(18i)))|(u32(((3.0h*clamp((dot(_z,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(20i)))|(u32(((3.0h*clamp((dot(_10,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(22i)))|(u32(((3.0h*clamp((dot(_11,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(24i)))|(u32(((3.0h*clamp((dot(_12,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(26i)))|(u32(((3.0h*clamp((dot(_13,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(28i)))|(u32(((3.0h*clamp((dot(_14,_9r)-_9s),0.0h,1.0h))+0.5h))<<bitcast<u32>(30i)));_1f=_1e;}if(((_1f^(_1f<<bitcast<u32>(2i)))<4u)){let _9t=(_1w*15.9375h);_b=_9;let _9u=_b[i32(_9t.x)];_c=_9;let _9v=_c[i32(_9t.z)];_d=array<u32,256u>(0u,0u,32u,2097184u,2097184u,2097184u,2097216u,4194368u,4194368u,4194368u,4194400u,6291552u,6291552u,6291552u,6291584u,8388736u,8388736u,8388736u,8388768u,10485920u,10485920u,10485920u,10485952u,12583104u,12583104u,12583104u,12583136u,14680288u,14680288u,14680288u,14680320u,16777472u,16777472u,16777472u,16777504u,18874656u,18874656u,18874656u,18874688u,20971840u,20971840u,20971840u,20971872u,23069024u,23069024u,23069024u,23069056u,25166208u,25166208u,25166208u,25166240u,27263392u,27263392u,27263392u,27263424u,29360576u,29360576u,29360576u,29360608u,31457760u,31457760u,31457760u,31457792u,31457792u,33554944u,33554944u,33554944u,33554976u,35652128u,35652128u,35652128u,35652160u,37749312u,37749312u,37749312u,37749344u,39846496u,39846496u,39846496u,39846528u,41943680u,41943680u,41943680u,41943712u,44040864u,44040864u,44040864u,44040896u,46138048u,46138048u,46138048u,46138080u,48235232u,48235232u,48235232u,48235264u,50332416u,50332416u,50332416u,50332448u,52429600u,52429600u,52429600u,52429632u,54526784u,54526784u,54526784u,54526816u,56623968u,56623968u,56623968u,56624000u,58721152u,58721152u,58721152u,58721184u,60818336u,60818336u,60818336u,60818368u,62915520u,62915520u,62915520u,62915552u,65012704u,65012704u,65012704u,65012736u,65012736u,67109888u,67109888u,67109888u,67109920u,69207072u,69207072u,69207072u,69207104u,71304256u,71304256u,71304256u,71304288u,73401440u,73401440u,73401440u,73401472u,75498624u,75498624u,75498624u,75498656u,77595808u,77595808u,77595808u,77595840u,79692992u,79692992u,79692992u,79693024u,81790176u,81790176u,81790176u,81790208u,83887360u,83887360u,83887360u,83887392u,85984544u,85984544u,85984544u,85984576u,88081728u,88081728u,88081728u,88081760u,90178912u,90178912u,90178912u,90178944u,92276096u,92276096u,92276096u,92276128u,94373280u,94373280u,94373280u,94373312u,96470464u,96470464u,96470464u,96470496u,98567648u,98567648u,98567648u,98567680u,98567680u,100664832u,100664832u,100664832u,100664864u,102762016u,102762016u,102762016u,102762048u,104859200u,104859200u,104859200u,104859232u,106956384u,106956384u,106956384u,106956416u,109053568u,109053568u,109053568u,109053600u,111150752u,111150752u,111150752u,111150784u,113247936u,113247936u,113247936u,113247968u,115345120u,115345120u,115345120u,115345152u,117442304u,117442304u,117442304u,117442336u,119539488u,119539488u,119539488u,119539520u,121636672u,121636672u,121636672u,121636704u,123733856u,123733856u,123733856u,123733888u,125831040u,125831040u,125831040u,125831072u,127928224u,127928224u,127928224u,127928256u,130025408u,130025408u,130025408u,130025440u,132122592u,132122592u);_g=vec2u((((_9u&4160813056u)|(_9v&2031647u))|_d[i32(_9t.y)]),2863311530u);_i=_g;break;}let _9w=((((u32(_1c.x)>>bitcast<u32>(3i))<<bitcast<u32>(11i))|((u32(_1c.y)>>bitcast<u32>(2i))<<bitcast<u32>(5i)))|(u32(_1c.z)>>bitcast<u32>(3i)));let _9x=((((u32(_1b.x)>>bitcast<u32>(3i))<<bitcast<u32>(11i))|((u32(_1b.y)>>bitcast<u32>(2i))<<bitcast<u32>(5i)))|(u32(_1b.z)>>bitcast<u32>(3i)));let _9y=(_9w<_9x);_1h=_1f;if(_9y){_1g=~(_1f);_1h=_1g;}let _9z=((_1h&2863311530u)>>bitcast<u32>(1i));_h=vec2u((select(_9w,_9x,_9y)|(select(_9x,_9w,_9y)<<bitcast<u32>(16i))),((((_1h&1431655765u)^_9z)<<bitcast<u32>(1i))|_9z));_i=_h;}}x_2214._0[((_l.y*((_k+31u)&4294967264u))+_n)]=_i;}}return;}@compute @workgroup_size(16i, 16i, 1i) fn main(@builtin(global_invocation_id) _a0:vec3u,@builtin(local_invocation_id) _a1:vec3u,@builtin(workgroup_id) _a2:vec3u){x_2118=_a0;x_2124=_a1;_a();}";
|
|
2
|
+
export {
|
|
3
|
+
spark_bc1_rgb as default
|
|
4
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const spark_bc3_rgba = "enable f16;alias RTArr=array<vec4u>;struct _1{_0:RTArr,}@binding(1) @group(0) var _2:sampler;@binding(0) @group(0) var _3:texture_2d<f32>;var<private>x_2795:vec3u;var<private>x_2801:vec3u;@binding(2) @group(0) var<storage,read_write>x_2891:_1;const _4=vec2i(2i,0i);const _5=vec2i(0i,2i);const _6=vec2i(2i);const _7=array<f32,8u>(0.0f,0.140625f,0.28125f,0.421875f,0.578125f,0.71875f,0.859375f,1.0f);const _8=vec3h(1.0h);const _9=vec3h(0.85986328125h,1.7099609375h,0.429931640625h);const _a=array<u32,256u>(0u,0u,134283264u,134283264u,2049u,2049u,2049u,134285313u,134285313u,134285313u,268568577u,268568577u,134287362u,134287362u,134287362u,268570626u,268570626u,268570626u,402853890u,402853890u,402853890u,268572675u,537137154u,402855939u,402855939u,402855939u,537139203u,537139203u,537139203u,402857988u,402857988u,402857988u,537141252u,537141252u,537141252u,402860037u,671424516u,537143301u,537143301u,537143301u,671426565u,671426565u,671426565u,805709829u,805709829u,671428614u,671428614u,671428614u,805711878u,805711878u,805711878u,939995142u,939995142u,939995142u,805713927u,1074278406u,939997191u,939997191u,939997191u,1074280455u,1074280455u,1074280455u,939999240u,939999240u,939999240u,1074282504u,1074282504u,1074282504u,940001289u,1208565768u,1074284553u,1074284553u,1074284553u,1208567817u,1208567817u,1208567817u,1342851081u,1342851081u,1208569866u,1208569866u,1208569866u,1342853130u,1342853130u,1342853130u,1477136394u,1477136394u,1477136394u,1342855179u,1611419658u,1477138443u,1477138443u,1477138443u,1611421707u,1611421707u,1611421707u,1477140492u,1477140492u,1477140492u,1611423756u,1611423756u,1611423756u,1477142541u,1745707020u,1611425805u,1611425805u,1611425805u,1745709069u,1745709069u,1745709069u,1879992333u,1879992333u,1745711118u,1745711118u,1745711118u,1879994382u,1879994382u,1879994382u,2014277646u,2014277646u,2014277646u,1879996431u,2148560910u,2014279695u,2014279695u,2014279695u,2148562959u,2148562959u,2148562959u,2014281744u,2014281744u,2014281744u,2148565008u,2148565008u,2148565008u,2014283793u,2282848272u,2148567057u,2148567057u,2148567057u,2282850321u,2282850321u,2282850321u,2417133585u,2417133585u,2282852370u,2282852370u,2282852370u,2417135634u,2417135634u,2417135634u,2551418898u,2551418898u,2551418898u,2417137683u,2685702162u,2551420947u,2551420947u,2551420947u,2685704211u,2685704211u,2685704211u,2551422996u,2551422996u,2551422996u,2685706260u,2685706260u,2685706260u,2551425045u,2819989524u,2685708309u,2685708309u,2685708309u,2819991573u,2819991573u,2819991573u,2954274837u,2954274837u,2819993622u,2819993622u,2819993622u,2954276886u,2954276886u,2954276886u,3088560150u,3088560150u,3088560150u,2954278935u,3222843414u,3088562199u,3088562199u,3088562199u,3222845463u,3222845463u,3222845463u,3088564248u,3088564248u,3088564248u,3222847512u,3222847512u,3222847512u,3088566297u,3357130776u,3222849561u,3222849561u,3222849561u,3357132825u,3357132825u,3357132825u,3491416089u,3491416089u,3357134874u,3357134874u,3357134874u,3491418138u,3491418138u,3491418138u,3625701402u,3625701402u,3625701402u,3491420187u,3759984666u,3625703451u,3625703451u,3625703451u,3759986715u,3759986715u,3759986715u,3625705500u,3625705500u,3625705500u,3759988764u,3759988764u,3759988764u,3625707549u,3894272028u,3759990813u,3759990813u,3759990813u,3894274077u,3894274077u,3894274077u,4028557341u,4028557341u,3894276126u,3894276126u,3894276126u,4028559390u,4028559390u,4028559390u,4162842654u,4162842654u,4162842654u,4028561439u,4028561439u,4162844703u,4162844703u);fn _b(){var _c:array<u32,256u>;var _d:array<u32,256u>;var _e:array<u32,256u>;var _f:array<f32,8u>;var _g:array<f32,8u>;var _h:bool;var _i:bool;var _j:f16;var _k:f16;var _l:f16;var _m:f16;var _n:f16;var _o:f16;var _p:vec2u;var _q:vec2u;var _r:f16;var _s:f16;var _t:bool;var _u:f16;var _v:f16;var _w:bool;var _x:vec2u;var _y:vec2u;var _z:vec2u;var _10:vec2u;var _11:vec2u;switch(0u){default:{let _12=bitcast<vec2u>(vec2i(textureDimensions(_3,0i)));let _13=((_12.x+3u)/4u);let _14=x_2795;let _15=x_2795.xy;let _16=x_2795.x;let _17=(_16>=_13);_i=_17;if(!(_17)){_h=(_14.y>=((_12.y+3u)/4u));_i=_h;}if(_i){break;}let _18=(vec2f(1.0f)/vec2f(vec2i(textureDimensions(_3,0i))));let _19=((vec2f(bitcast<vec2i>((_15*vec2u(4u))))*_18)+_18);let _1a=vec4h(textureGather(0i,_3,_2,_19,vec2i()));let _1b=vec4h(textureGather(0i,_3,_2,_19,_4));let _1c=vec4h(textureGather(0i,_3,_2,_19,_5));let _1d=vec4h(textureGather(0i,_3,_2,_19,_6));let _1e=vec4h(textureGather(1i,_3,_2,_19,vec2i()));let _1f=vec4h(textureGather(1i,_3,_2,_19,_4));let _1g=vec4h(textureGather(1i,_3,_2,_19,_5));let _1h=vec4h(textureGather(1i,_3,_2,_19,_6));let _1i=vec4h(textureGather(2i,_3,_2,_19,vec2i()));let _1j=vec4h(textureGather(2i,_3,_2,_19,_4));let _1k=vec4h(textureGather(2i,_3,_2,_19,_5));let _1l=vec4h(textureGather(2i,_3,_2,_19,_6));let _1m=vec4h(textureGather(3i,_3,_2,_19,vec2i()));let _1n=vec4h(textureGather(3i,_3,_2,_19,_4));let _1o=vec4h(textureGather(3i,_3,_2,_19,_5));let _1p=vec4h(textureGather(3i,_3,_2,_19,_6));let _1q=_1m.w;let _1r=_1m.z;let _1s=_1n.w;let _1t=_1n.z;let _1u=_1m.x;let _1v=_1m.y;let _1w=_1n.x;let _1x=_1n.y;let _1y=_1o.w;let _1z=_1o.z;let _20=_1p.w;let _21=_1p.z;let _22=_1o.x;let _23=_1o.y;let _24=_1p.x;let _25=_1p.y;let _26=vec4h(_1a.w,_1e.w,_1i.w,_1q).xyz;let _27=vec4h(_1a.z,_1e.z,_1i.z,_1r).xyz;let _28=vec4h(_1b.w,_1f.w,_1j.w,_1s).xyz;let _29=vec4h(_1b.z,_1f.z,_1j.z,_1t).xyz;let _2a=vec4h(_1a.x,_1e.x,_1i.x,_1u).xyz;let _2b=vec4h(_1a.y,_1e.y,_1i.y,_1v).xyz;let _2c=vec4h(_1b.x,_1f.x,_1j.x,_1w).xyz;let _2d=vec4h(_1b.y,_1f.y,_1j.y,_1x).xyz;let _2e=vec4h(_1c.w,_1g.w,_1k.w,_1y).xyz;let _2f=vec4h(_1c.z,_1g.z,_1k.z,_1z).xyz;let _2g=vec4h(_1d.w,_1h.w,_1l.w,_20).xyz;let _2h=vec4h(_1d.z,_1h.z,_1l.z,_21).xyz;let _2i=vec4h(_1c.x,_1g.x,_1k.x,_22).xyz;let _2j=vec4h(_1c.y,_1g.y,_1k.y,_23).xyz;let _2k=vec4h(_1d.x,_1h.x,_1l.x,_24).xyz;let _2l=vec4h(_1d.y,_1h.y,_1l.y,_25).xyz;let _2m=min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(1.0h,_1q),_1r),_1s),_1t),_1u),_1v),_1w),_1x),_1y),_1z),_20),_21),_22),_23),_24),_25);let _2n=max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(0.0h,_1q),_1r),_1s),_1t),_1u),_1v),_1w),_1x),_1y),_1z),_20),_21),_22),_23),_24),_25);let _2o=(_2n-_2m);let _2p=(_2o*0.03125h);_k=_2p;if((_2o<0.0625h)){_j=max(0.0h,((2.0h*_2p)-0.0625h));_k=_j;}_m=_2m;if((_2m>0.0h)){_l=(_2m+_k);_m=_l;}_o=_2n;if((_m<1.0h)){_n=(_2n-_k);_o=_n;}let _2q=trunc(((_o*255.0h)+0.5h));let _2r=trunc(((_m*255.0h)+0.5h));let _2s=select(_2r,127.0h,((_2r==128.0h)|(_2r==126.0h)));let _2t=select(_2q,127.0h,((_2q==128.0h)|(_2q==126.0h)));switch(0u){default:{if((_2t==_2s)){_q=vec2u();break;}let _2u=(1.0h/(_2s-_2t));let _2v=(_2t*-(_2u));let _2w=(_2u*255.0h);let _2x=(0u|(u32(((clamp(((_1y*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_p=vec2u(((((((((0u|(u32(((clamp(((_1q*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_1r*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1s*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1t*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1u*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_1v*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_1w*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_1x*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_2x);_p.y=(((((((_2x|(u32(((clamp(((_1z*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_20*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_21*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_22*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_23*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_24*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_25*_2w)+_2v),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_q=_p;}}switch(0u){default:{let _2y=_q.x;_f=_7;let _2z=_f[((_2y>>bitcast<u32>(0i))&7u)];let _30=(1.0f-_2z);let _31=f32(_1q);_f=_7;let _32=_f[((_2y>>bitcast<u32>(3i))&7u)];let _33=(1.0f-_32);let _34=f32(_1r);_f=_7;let _35=_f[((_2y>>bitcast<u32>(6i))&7u)];let _36=(1.0f-_35);let _37=f32(_1s);_f=_7;let _38=_f[((_2y>>bitcast<u32>(9i))&7u)];let _39=(1.0f-_38);let _3a=f32(_1t);_f=_7;let _3b=_f[((_2y>>bitcast<u32>(12i))&7u)];let _3c=(1.0f-_3b);let _3d=f32(_1u);_f=_7;let _3e=_f[((_2y>>bitcast<u32>(15i))&7u)];let _3f=(1.0f-_3e);let _3g=f32(_1v);_f=_7;let _3h=_f[((_2y>>bitcast<u32>(18i))&7u)];let _3i=(1.0f-_3h);let _3j=f32(_1w);_f=_7;let _3k=_f[((_2y>>bitcast<u32>(21i))&7u)];let _3l=(1.0f-_3k);let _3m=f32(_1x);let _3n=_q.y;_g=_7;let _3o=_g[((_3n>>bitcast<u32>(0i))&7u)];let _3p=(1.0f-_3o);let _3q=f32(_1y);_g=_7;let _3r=_g[((_3n>>bitcast<u32>(3i))&7u)];let _3s=(1.0f-_3r);let _3t=f32(_1z);_g=_7;let _3u=_g[((_3n>>bitcast<u32>(6i))&7u)];let _3v=(1.0f-_3u);let _3w=f32(_20);_g=_7;let _3x=_g[((_3n>>bitcast<u32>(9i))&7u)];let _3y=(1.0f-_3x);let _3z=f32(_21);_g=_7;let _40=_g[((_3n>>bitcast<u32>(12i))&7u)];let _41=(1.0f-_40);let _42=f32(_22);_g=_7;let _43=_g[((_3n>>bitcast<u32>(15i))&7u)];let _44=(1.0f-_43);let _45=f32(_23);_g=_7;let _46=_g[((_3n>>bitcast<u32>(18i))&7u)];let _47=(1.0f-_46);let _48=f32(_24);_g=_7;let _49=_g[((_3n>>bitcast<u32>(21i))&7u)];let _4a=(1.0f-_49);let _4b=((((((((((((((((_30*_30)+(_33*_33))+(_36*_36))+(_39*_39))+(_3c*_3c))+(_3f*_3f))+(_3i*_3i))+(_3l*_3l))+(_3p*_3p))+(_3s*_3s))+(_3v*_3v))+(_3y*_3y))+(_41*_41))+(_44*_44))+(_47*_47))+(_4a*_4a));let _4c=((((((((((((((((_2z*_2z)+(_32*_32))+(_35*_35))+(_38*_38))+(_3b*_3b))+(_3e*_3e))+(_3h*_3h))+(_3k*_3k))+(_3o*_3o))+(_3r*_3r))+(_3u*_3u))+(_3x*_3x))+(_40*_40))+(_43*_43))+(_46*_46))+(_49*_49));let _4d=((((((((((((((((_30*_2z)+(_33*_32))+(_36*_35))+(_39*_38))+(_3c*_3b))+(_3f*_3e))+(_3i*_3h))+(_3l*_3k))+(_3p*_3o))+(_3s*_3r))+(_3v*_3u))+(_3y*_3x))+(_41*_40))+(_44*_43))+(_47*_46))+(_4a*_49));let _4e=f32(_25);let _4f=((((((((((((((((_30*_31)+(_33*_34))+(_36*_37))+(_39*_3a))+(_3c*_3d))+(_3f*_3g))+(_3i*_3j))+(_3l*_3m))+(_3p*_3q))+(_3s*_3t))+(_3v*_3w))+(_3y*_3z))+(_41*_42))+(_44*_45))+(_47*_48))+(_4a*_4e));let _4g=((((((((((((((((_2z*_31)+(_32*_34))+(_35*_37))+(_38*_3a))+(_3b*_3d))+(_3e*_3g))+(_3h*_3j))+(_3k*_3m))+(_3o*_3q))+(_3r*_3t))+(_3u*_3w))+(_3x*_3z))+(_40*_42))+(_43*_45))+(_46*_48))+(_49*_4e));let _4h=((_4b*_4c)-(_4d*_4d));if((abs(_4h)<0.00009999999747378752f)){_u=_2s;_v=_2t;_w=false;break;}let _4i=(1.0f/_4h);let _4j=trunc(((f16(clamp((((_4f*_4c)-(_4g*_4d))*_4i),0.0f,1.0f))*255.0h)+0.5h));let _4k=trunc(((f16(clamp((((_4g*_4b)-(_4f*_4d))*_4i),0.0f,1.0f))*255.0h)+0.5h));_r=select(_4k,127.0h,((_4k==128.0h)|(_4k==126.0h)));_s=select(_4j,127.0h,((_4j==128.0h)|(_4j==126.0h)));_t=(!((_s==_2t))|!((_r==_2s)));_u=_r;_v=_s;_w=_t;}}var _4l:vec2u;_y=_q;if(_w){switch(0u){default:{if((_v==_u)){_x=vec2u();break;}let _4m=(1.0h/(_u-_v));let _4n=(_v*-(_4m));let _4o=(_4m*255.0h);let _4p=(0u|(u32(((clamp(((_1y*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_4l=vec2u(((((((((0u|(u32(((clamp(((_1q*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_1r*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1s*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1t*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1u*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_1v*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_1w*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_1x*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_4p);_4l.y=(((((((_4p|(u32(((clamp(((_1z*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_20*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_21*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_22*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_23*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_24*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_25*_4o)+_4n),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_x=_4l;}}_y=_x;}var _4q:f16;var _4r:f16;var _4s:f16;var _4t:f16;var _4u:vec3h;var _4v:vec3h;var _4w:vec3h;var _4x:vec3h;var _4y:bool;var _4z:u32;var _50:u32;var _51:u32;var _52:u32;let _53=_y.x;let _54=(((_53&7190235u)+2396745u)^(_53&9586980u));let _55=(_54^(((19173960u-(_54&14380470u))&19173960u)>>bitcast<u32>(3i)));let _56=_y.y;let _57=(((_56&7190235u)+2396745u)^(_56&9586980u));let _58=((u32(_v)|(u32(_u)<<bitcast<u32>(8i)))|(_55<<bitcast<u32>(16i)));let _59=((_55>>bitcast<u32>(16i))|((_57^(((19173960u-(_57&14380470u))&19173960u)>>bitcast<u32>(3i)))<<bitcast<u32>(8i)));switch(0u){default:{let _5a=(((((((((((((((_26+_27)+_28)+_29)+_2a)+_2b)+_2c)+_2d)+_2e)+_2f)+_2g)+_2h)+_2i)+_2j)+_2k)+_2l);let _5b=((_26*16.0h)-_5a);let _5c=_5b.x;let _5d=_5b.y;let _5e=_5b.z;let _5f=((_27*16.0h)-_5a);let _5g=_5f.x;let _5h=_5f.y;let _5i=_5f.z;let _5j=((_28*16.0h)-_5a);let _5k=_5j.x;let _5l=_5j.y;let _5m=_5j.z;let _5n=((_29*16.0h)-_5a);let _5o=_5n.x;let _5p=_5n.y;let _5q=_5n.z;let _5r=((_2a*16.0h)-_5a);let _5s=_5r.x;let _5t=_5r.y;let _5u=_5r.z;let _5v=((_2b*16.0h)-_5a);let _5w=_5v.x;let _5x=_5v.y;let _5y=_5v.z;let _5z=((_2c*16.0h)-_5a);let _60=_5z.x;let _61=_5z.y;let _62=_5z.z;let _63=((_2d*16.0h)-_5a);let _64=_63.x;let _65=_63.y;let _66=_63.z;let _67=((_2e*16.0h)-_5a);let _68=_67.x;let _69=_67.y;let _6a=_67.z;let _6b=((_2f*16.0h)-_5a);let _6c=_6b.x;let _6d=_6b.y;let _6e=_6b.z;let _6f=((_2g*16.0h)-_5a);let _6g=_6f.x;let _6h=_6f.y;let _6i=_6f.z;let _6j=((_2h*16.0h)-_5a);let _6k=_6j.x;let _6l=_6j.y;let _6m=_6j.z;let _6n=((_2i*16.0h)-_5a);let _6o=_6n.x;let _6p=_6n.y;let _6q=_6n.z;let _6r=((_2j*16.0h)-_5a);let _6s=_6r.x;let _6t=_6r.y;let _6u=_6r.z;let _6v=((_2k*16.0h)-_5a);let _6w=_6v.x;let _6x=_6v.y;let _6y=_6v.z;let _6z=((_2l*16.0h)-_5a);let _70=_6z.x;let _71=((((((((((((((((_5c*_5c)+(_5g*_5g))+(_5k*_5k))+(_5o*_5o))+(_5s*_5s))+(_5w*_5w))+(_60*_60))+(_64*_64))+(_68*_68))+(_6c*_6c))+(_6g*_6g))+(_6k*_6k))+(_6o*_6o))+(_6s*_6s))+(_6w*_6w))+(_70*_70));let _72=_6z.y;let _73=_6z.z;let _74=((((((((((((((((_5d*_5d)+(_5h*_5h))+(_5l*_5l))+(_5p*_5p))+(_5t*_5t))+(_5x*_5x))+(_61*_61))+(_65*_65))+(_69*_69))+(_6d*_6d))+(_6h*_6h))+(_6l*_6l))+(_6p*_6p))+(_6t*_6t))+(_6x*_6x))+(_72*_72));let _75=((((((((((((((((_5e*_5e)+(_5i*_5i))+(_5m*_5m))+(_5q*_5q))+(_5u*_5u))+(_5y*_5y))+(_62*_62))+(_66*_66))+(_6a*_6a))+(_6e*_6e))+(_6i*_6i))+(_6m*_6m))+(_6q*_6q))+(_6u*_6u))+(_6y*_6y))+(_73*_73));let _76=select(1.0h,0.015625h,(max(max(_71,_74),_75)>64.0h));let _77=(_71*_76);let _78=(((((((((((((((((_5c*_5d)+(_5g*_5h))+(_5k*_5l))+(_5o*_5p))+(_5s*_5t))+(_5w*_5x))+(_60*_61))+(_64*_65))+(_68*_69))+(_6c*_6d))+(_6g*_6h))+(_6k*_6l))+(_6o*_6p))+(_6s*_6t))+(_6w*_6x))+(_70*_72))*_76);let _79=(((((((((((((((((_5c*_5e)+(_5g*_5i))+(_5k*_5m))+(_5o*_5q))+(_5s*_5u))+(_5w*_5y))+(_60*_62))+(_64*_66))+(_68*_6a))+(_6c*_6e))+(_6g*_6i))+(_6k*_6m))+(_6o*_6q))+(_6s*_6u))+(_6w*_6y))+(_70*_73))*_76);let _7a=(_74*_76);let _7b=(((((((((((((((((_5d*_5e)+(_5h*_5i))+(_5l*_5m))+(_5p*_5q))+(_5t*_5u))+(_5x*_5y))+(_61*_62))+(_65*_66))+(_69*_6a))+(_6d*_6e))+(_6h*_6i))+(_6l*_6m))+(_6p*_6q))+(_6t*_6u))+(_6x*_6y))+(_72*_73))*_76);let _7c=(_75*_76);let _7d=(vec3h(_77,_7a,_7c)+vec3h(0.0001220703125h));let _7e=vec3h((vec3f(_7d)*(1.0f/f32(max(max(_7d.x,_7d.y),_7d.z)))));let _7f=_7e.x;_4r=_7f;if((_78<0.0h)){_4q=-(_7f);_4r=_4q;}let _7g=_7e.z;_4t=_7g;if((_7b<0.0h)){_4s=-(_7g);_4t=_4s;}let _7h=_7e.y;let _7i=(((_4r*_77)+(_7h*_78))+(_4t*_79));let _7j=(((_4r*_78)+(_7h*_7a))+(_4t*_7b));let _7k=(((_4r*_79)+(_7h*_7b))+(_4t*_7c));let _7l=max(max(abs(_7i),abs(_7j)),abs(_7k));let _7m=vec3h((vec3f(f32(_7i),f32(_7j),f32(_7k))*(1.0f/f32(select(_7l,1.0h,(_7l==0.0h))))));let _7n=_7m.x;let _7o=_7m.y;let _7p=_7m.z;let _7q=(((_7n*_77)+(_7o*_78))+(_7p*_79));let _7r=(((_7n*_78)+(_7o*_7a))+(_7p*_7b));let _7s=(((_7n*_79)+(_7o*_7b))+(_7p*_7c));let _7t=max(max(abs(_7q),abs(_7r)),abs(_7s));let _7u=(_7t==0.0h);let _7v=select(vec3h((vec3f(f32(_7q),f32(_7r),f32(_7s))*(1.0f/f32(select(_7t,1.0h,_7u))))),_8,vec3<bool>(_7u));let _7w=(_5a*0.0625h);let _7x=(_7v*_9);let _7y=(1.0h/dot(_7x,_7x));let _7z=((_7x*_7y)*_9);let _80=dot(_26,_7z);let _81=dot(_27,_7z);let _82=(_81<_80);let _83=select(1u,0u,_82);let _84=select(_80,_81,_82);let _85=(_81>_80);let _86=select(1u,0u,_85);let _87=select(_80,_81,_85);let _88=dot(_28,_7z);let _89=(_88<_84);let _8a=select(select(_83,(_83+1u),(_81==_84)),0u,_89);let _8b=select(_84,_88,_89);let _8c=(_88>_87);let _8d=select(select(_86,(_86+1u),(_81==_87)),0u,_8c);let _8e=select(_87,_88,_8c);let _8f=dot(_29,_7z);let _8g=(_8f<_8b);let _8h=select(select(_8a,(_8a+1u),(_88==_8b)),0u,_8g);let _8i=select(_8b,_8f,_8g);let _8j=(_8f>_8e);let _8k=select(select(_8d,(_8d+1u),(_88==_8e)),0u,_8j);let _8l=select(_8e,_8f,_8j);let _8m=dot(_2a,_7z);let _8n=(_8m<_8i);let _8o=select(select(_8h,(_8h+1u),(_8f==_8i)),0u,_8n);let _8p=select(_8i,_8m,_8n);let _8q=(_8m>_8l);let _8r=select(select(_8k,(_8k+1u),(_8f==_8l)),0u,_8q);let _8s=select(_8l,_8m,_8q);let _8t=dot(_2b,_7z);let _8u=(_8t<_8p);let _8v=select(select(_8o,(_8o+1u),(_8m==_8p)),0u,_8u);let _8w=select(_8p,_8t,_8u);let _8x=(_8t>_8s);let _8y=select(select(_8r,(_8r+1u),(_8m==_8s)),0u,_8x);let _8z=select(_8s,_8t,_8x);let _90=dot(_2c,_7z);let _91=(_90<_8w);let _92=select(select(_8v,(_8v+1u),(_8t==_8w)),0u,_91);let _93=select(_8w,_90,_91);let _94=(_90>_8z);let _95=select(select(_8y,(_8y+1u),(_8t==_8z)),0u,_94);let _96=select(_8z,_90,_94);let _97=dot(_2d,_7z);let _98=(_97<_93);let _99=select(select(_92,(_92+1u),(_90==_93)),0u,_98);let _9a=select(_93,_97,_98);let _9b=(_97>_96);let _9c=select(select(_95,(_95+1u),(_90==_96)),0u,_9b);let _9d=select(_96,_97,_9b);let _9e=dot(_2e,_7z);let _9f=(_9e<_9a);let _9g=select(select(_99,(_99+1u),(_97==_9a)),0u,_9f);let _9h=select(_9a,_9e,_9f);let _9i=(_9e>_9d);let _9j=select(select(_9c,(_9c+1u),(_97==_9d)),0u,_9i);let _9k=select(_9d,_9e,_9i);let _9l=dot(_2f,_7z);let _9m=(_9l<_9h);let _9n=select(select(_9g,(_9g+1u),(_9e==_9h)),0u,_9m);let _9o=select(_9h,_9l,_9m);let _9p=(_9l>_9k);let _9q=select(select(_9j,(_9j+1u),(_9e==_9k)),0u,_9p);let _9r=select(_9k,_9l,_9p);let _9s=dot(_2g,_7z);let _9t=(_9s<_9o);let _9u=select(select(_9n,(_9n+1u),(_9l==_9o)),0u,_9t);let _9v=select(_9o,_9s,_9t);let _9w=(_9s>_9r);let _9x=select(select(_9q,(_9q+1u),(_9l==_9r)),0u,_9w);let _9y=select(_9r,_9s,_9w);let _9z=dot(_2h,_7z);let _a0=(_9z<_9v);let _a1=select(select(_9u,(_9u+1u),(_9s==_9v)),0u,_a0);let _a2=select(_9v,_9z,_a0);let _a3=(_9z>_9y);let _a4=select(select(_9x,(_9x+1u),(_9s==_9y)),0u,_a3);let _a5=select(_9y,_9z,_a3);let _a6=dot(_2i,_7z);let _a7=(_a6<_a2);let _a8=select(select(_a1,(_a1+1u),(_9z==_a2)),0u,_a7);let _a9=select(_a2,_a6,_a7);let _aa=(_a6>_a5);let _ab=select(select(_a4,(_a4+1u),(_9z==_a5)),0u,_aa);let _ac=select(_a5,_a6,_aa);let _ad=dot(_2j,_7z);let _ae=(_ad<_a9);let _af=select(select(_a8,(_a8+1u),(_a6==_a9)),0u,_ae);let _ag=select(_a9,_ad,_ae);let _ah=(_ad>_ac);let _ai=select(select(_ab,(_ab+1u),(_a6==_ac)),0u,_ah);let _aj=select(_ac,_ad,_ah);let _ak=dot(_2k,_7z);let _al=(_ak<_ag);let _am=select(select(_af,(_af+1u),(_ad==_ag)),0u,_al);let _an=select(_ag,_ak,_al);let _ao=(_ak>_aj);let _ap=select(select(_ai,(_ai+1u),(_ad==_aj)),0u,_ao);let _aq=select(_aj,_ak,_ao);let _ar=dot(_2l,_7z);let _as=(_ar<_an);let _at=select(select(_am,(_am+1u),(_ak==_an)),0u,_as);let _au=select(_an,_ar,_as);let _av=(_ar>_aq);let _aw=select(select(_ap,(_ap+1u),(_ak==_aq)),0u,_av);let _ax=select(_aq,_ar,_av);let _ay=dot(_7w,_7z);let _az=(_au-_ay);let _b0=(_ax-_ay);let _b1=(((_b0-_az)*0.0625h)*(1.0h-clamp((f16(((select(_at,(_at+1u),(_ar==_au))+select(_aw,(_aw+1u),(_ar==_ax)))-2u))*0.0714111328125h),0.0h,1.0h)));let _b2=(_az+_b1);let _b3=(_b0-_b1);let _b4=max(0.0h,(((((0.6357421875h*0.03125h)*_7y)+(0.36376953125h*0.03125h))-(_b3-_b2))*0.5h));let _b5=clamp(((_7v*(_b2-_b4))+_7w),vec3h(),_8);let _b6=clamp(((_7v*(_b3+_b4))+_7w),vec3h(),_8);let _b7=_b5.x;let _b8=(trunc((_b7*31.0h))*8.25h);let _b9=trunc(_b8);let _ba=min(255.0h,trunc((_b8+8.25h)));let _bb=_b5.y;let _bc=(trunc((_bb*63.0h))*4.0625h);let _bd=min(255.0h,trunc(_bc));let _be=min(255.0h,trunc((_bc+4.0625h)));let _bf=_b5.z;let _bg=(trunc((_bf*31.0h))*8.25h);let _bh=trunc(_bg);let _bi=min(255.0h,trunc((_bg+8.25h)));let _bj=vec3h(select(_b9,_ba,((255.0h*_b7)>(0.5h*(_b9+_ba)))),select(_bd,_be,((255.0h*_bb)>(0.5h*(_bd+_be)))),select(_bh,_bi,((255.0h*_bf)>(0.5h*(_bh+_bi)))));let _bk=_b6.x;let _bl=(trunc((_bk*31.0h))*8.25h);let _bm=trunc(_bl);let _bn=min(255.0h,trunc((_bl+8.25h)));let _bo=_b6.y;let _bp=(trunc((_bo*63.0h))*4.0625h);let _bq=min(255.0h,trunc(_bp));let _br=min(255.0h,trunc((_bp+4.0625h)));let _bs=_b6.z;let _bt=(trunc((_bs*31.0h))*8.25h);let _bu=trunc(_bt);let _bv=min(255.0h,trunc((_bt+8.25h)));let _bw=vec3h(select(_bm,_bn,((255.0h*_bk)>(0.5h*(_bm+_bn)))),select(_bq,_br,((255.0h*_bo)>(0.5h*(_bq+_br)))),select(_bu,_bv,((255.0h*_bs)>(0.5h*(_bu+_bv)))));let _bx=(((_bw-_bj)*_9)*0.0039215087890625h);let _by=((_bx*(1.0h/dot(_bx,_bx)))*_9);let _bz=(dot(_bj,_by)*0.0039215087890625h);let _c0=((((((((((((((((0u|(u32(((3.0h*clamp((dot(_26,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(0i)))|(u32(((3.0h*clamp((dot(_27,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(2i)))|(u32(((3.0h*clamp((dot(_28,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(4i)))|(u32(((3.0h*clamp((dot(_29,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(6i)))|(u32(((3.0h*clamp((dot(_2a,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(8i)))|(u32(((3.0h*clamp((dot(_2b,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(10i)))|(u32(((3.0h*clamp((dot(_2c,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(12i)))|(u32(((3.0h*clamp((dot(_2d,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(14i)))|(u32(((3.0h*clamp((dot(_2e,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(16i)))|(u32(((3.0h*clamp((dot(_2f,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(18i)))|(u32(((3.0h*clamp((dot(_2g,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(20i)))|(u32(((3.0h*clamp((dot(_2h,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(22i)))|(u32(((3.0h*clamp((dot(_2i,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(24i)))|(u32(((3.0h*clamp((dot(_2j,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(26i)))|(u32(((3.0h*clamp((dot(_2k,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(28i)))|(u32(((3.0h*clamp((dot(_2l,_by)-_bz),0.0h,1.0h))+0.5h))<<bitcast<u32>(30i)));switch(0u){default:{if(((_c0^(_c0<<bitcast<u32>(2i)))<4u)){_4w=_bw;_4x=_bj;_4y=false;break;}let _c1=(_c0>>bitcast<u32>(1i));let _c2=f16(bitcast<i32>(countOneBits(((1431655765u&~(_c1))&_c0))));let _c3=(1431655765u&_c1);let _c4=f16(bitcast<i32>(countOneBits((_c3&~(_c0)))));let _c5=f16(bitcast<i32>(countOneBits((_c3&_c0))));let _c6=(((3.0h*_c5)+(2.0h*_c4))+_c2);let _c7=(((9.0h*_c5)+(4.0h*_c4))+_c2);let _c8=((144.0h-(6.0h*_c6))+_c7);let _c9=((3.0h*_c6)-_c7);let _ca=(((((((((((((((((_26*f16(((_c0>>bitcast<u32>(0i))&3u)))+(_27*f16(((_c0>>bitcast<u32>(2i))&3u))))+(_28*f16(((_c0>>bitcast<u32>(4i))&3u))))+(_29*f16(((_c0>>bitcast<u32>(6i))&3u))))+(_2a*f16(((_c0>>bitcast<u32>(8i))&3u))))+(_2b*f16(((_c0>>bitcast<u32>(10i))&3u))))+(_2c*f16(((_c0>>bitcast<u32>(12i))&3u))))+(_2d*f16(((_c0>>bitcast<u32>(14i))&3u))))+(_2e*f16(((_c0>>bitcast<u32>(16i))&3u))))+(_2f*f16(((_c0>>bitcast<u32>(18i))&3u))))+(_2g*f16(((_c0>>bitcast<u32>(20i))&3u))))+(_2h*f16(((_c0>>bitcast<u32>(22i))&3u))))+(_2i*f16(((_c0>>bitcast<u32>(24i))&3u))))+(_2j*f16(((_c0>>bitcast<u32>(26i))&3u))))+(_2k*f16(((_c0>>bitcast<u32>(28i))&3u))))+(_2l*f16(((_c0>>bitcast<u32>(30i))&3u))))*3.0h);let _cb=((_5a*9.0h)-_ca);let _cc=(1.0f/f32(((_c8*_c7)-(_c9*_c9))));let _cd=f16((f32(_c9)*_cc));let _ce=clamp(((_cb*f16((f32(_c7)*_cc)))-(_ca*_cd)),vec3h(),_8);let _cf=clamp(((_ca*f16((f32(_c8)*_cc)))-(_cb*_cd)),vec3h(),_8);let _cg=_ce.x;let _ch=(trunc((_cg*31.0h))*8.25h);let _ci=trunc(_ch);let _cj=min(255.0h,trunc((_ch+8.25h)));let _ck=_ce.y;let _cl=(trunc((_ck*63.0h))*4.0625h);let _cm=min(255.0h,trunc(_cl));let _cn=min(255.0h,trunc((_cl+4.0625h)));let _co=_ce.z;let _cp=(trunc((_co*31.0h))*8.25h);let _cq=trunc(_cp);let _cr=min(255.0h,trunc((_cp+8.25h)));_4u=vec3h(select(_ci,_cj,((255.0h*_cg)>(0.5h*(_ci+_cj)))),select(_cm,_cn,((255.0h*_ck)>(0.5h*(_cm+_cn)))),select(_cq,_cr,((255.0h*_co)>(0.5h*(_cq+_cr)))));let _cs=_cf.x;let _ct=(trunc((_cs*31.0h))*8.25h);let _cu=trunc(_ct);let _cv=min(255.0h,trunc((_ct+8.25h)));let _cw=_cf.y;let _cx=(trunc((_cw*63.0h))*4.0625h);let _cy=min(255.0h,trunc(_cx));let _cz=min(255.0h,trunc((_cx+4.0625h)));let _d0=_cf.z;let _d1=(trunc((_d0*31.0h))*8.25h);let _d2=trunc(_d1);let _d3=min(255.0h,trunc((_d1+8.25h)));_4v=vec3h(select(_cu,_cv,((255.0h*_cs)>(0.5h*(_cu+_cv)))),select(_cy,_cz,((255.0h*_cw)>(0.5h*(_cy+_cz)))),select(_d2,_d3,((255.0h*_d0)>(0.5h*(_d2+_d3)))));_4w=_4v;_4x=_4u;_4y=true;}}_50=_c0;if(_4y){let _d4=(((_4w-_4x)*_9)*0.0039215087890625h);let _d5=((_d4*(1.0h/dot(_d4,_d4)))*_9);let _d6=(dot(_4x,_d5)*0.0039215087890625h);_4z=((((((((((((((((0u|(u32(((3.0h*clamp((dot(_26,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(0i)))|(u32(((3.0h*clamp((dot(_27,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(2i)))|(u32(((3.0h*clamp((dot(_28,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(4i)))|(u32(((3.0h*clamp((dot(_29,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(6i)))|(u32(((3.0h*clamp((dot(_2a,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(8i)))|(u32(((3.0h*clamp((dot(_2b,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(10i)))|(u32(((3.0h*clamp((dot(_2c,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(12i)))|(u32(((3.0h*clamp((dot(_2d,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(14i)))|(u32(((3.0h*clamp((dot(_2e,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(16i)))|(u32(((3.0h*clamp((dot(_2f,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(18i)))|(u32(((3.0h*clamp((dot(_2g,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(20i)))|(u32(((3.0h*clamp((dot(_2h,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(22i)))|(u32(((3.0h*clamp((dot(_2i,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(24i)))|(u32(((3.0h*clamp((dot(_2j,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(26i)))|(u32(((3.0h*clamp((dot(_2k,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(28i)))|(u32(((3.0h*clamp((dot(_2l,_d5)-_d6),0.0h,1.0h))+0.5h))<<bitcast<u32>(30i)));_50=_4z;}if(((_50^(_50<<bitcast<u32>(2i)))<4u)){let _d7=(_5a*15.9375h);_c=_a;let _d8=_c[i32(_d7.x)];_d=_a;let _d9=_d[i32(_d7.z)];_e=array<u32,256u>(0u,0u,32u,2097184u,2097184u,2097184u,2097216u,4194368u,4194368u,4194368u,4194400u,6291552u,6291552u,6291552u,6291584u,8388736u,8388736u,8388736u,8388768u,10485920u,10485920u,10485920u,10485952u,12583104u,12583104u,12583104u,12583136u,14680288u,14680288u,14680288u,14680320u,16777472u,16777472u,16777472u,16777504u,18874656u,18874656u,18874656u,18874688u,20971840u,20971840u,20971840u,20971872u,23069024u,23069024u,23069024u,23069056u,25166208u,25166208u,25166208u,25166240u,27263392u,27263392u,27263392u,27263424u,29360576u,29360576u,29360576u,29360608u,31457760u,31457760u,31457760u,31457792u,31457792u,33554944u,33554944u,33554944u,33554976u,35652128u,35652128u,35652128u,35652160u,37749312u,37749312u,37749312u,37749344u,39846496u,39846496u,39846496u,39846528u,41943680u,41943680u,41943680u,41943712u,44040864u,44040864u,44040864u,44040896u,46138048u,46138048u,46138048u,46138080u,48235232u,48235232u,48235232u,48235264u,50332416u,50332416u,50332416u,50332448u,52429600u,52429600u,52429600u,52429632u,54526784u,54526784u,54526784u,54526816u,56623968u,56623968u,56623968u,56624000u,58721152u,58721152u,58721152u,58721184u,60818336u,60818336u,60818336u,60818368u,62915520u,62915520u,62915520u,62915552u,65012704u,65012704u,65012704u,65012736u,65012736u,67109888u,67109888u,67109888u,67109920u,69207072u,69207072u,69207072u,69207104u,71304256u,71304256u,71304256u,71304288u,73401440u,73401440u,73401440u,73401472u,75498624u,75498624u,75498624u,75498656u,77595808u,77595808u,77595808u,77595840u,79692992u,79692992u,79692992u,79693024u,81790176u,81790176u,81790176u,81790208u,83887360u,83887360u,83887360u,83887392u,85984544u,85984544u,85984544u,85984576u,88081728u,88081728u,88081728u,88081760u,90178912u,90178912u,90178912u,90178944u,92276096u,92276096u,92276096u,92276128u,94373280u,94373280u,94373280u,94373312u,96470464u,96470464u,96470464u,96470496u,98567648u,98567648u,98567648u,98567680u,98567680u,100664832u,100664832u,100664832u,100664864u,102762016u,102762016u,102762016u,102762048u,104859200u,104859200u,104859200u,104859232u,106956384u,106956384u,106956384u,106956416u,109053568u,109053568u,109053568u,109053600u,111150752u,111150752u,111150752u,111150784u,113247936u,113247936u,113247936u,113247968u,115345120u,115345120u,115345120u,115345152u,117442304u,117442304u,117442304u,117442336u,119539488u,119539488u,119539488u,119539520u,121636672u,121636672u,121636672u,121636704u,123733856u,123733856u,123733856u,123733888u,125831040u,125831040u,125831040u,125831072u,127928224u,127928224u,127928224u,127928256u,130025408u,130025408u,130025408u,130025440u,132122592u,132122592u);_z=vec2u((((_d8&4160813056u)|(_d9&2031647u))|_e[i32(_d7.y)]),2863311530u);_11=_z;break;}let _da=((((u32(_4x.x)>>bitcast<u32>(3i))<<bitcast<u32>(11i))|((u32(_4x.y)>>bitcast<u32>(2i))<<bitcast<u32>(5i)))|(u32(_4x.z)>>bitcast<u32>(3i)));let _db=((((u32(_4w.x)>>bitcast<u32>(3i))<<bitcast<u32>(11i))|((u32(_4w.y)>>bitcast<u32>(2i))<<bitcast<u32>(5i)))|(u32(_4w.z)>>bitcast<u32>(3i)));let _dc=(_da<_db);_52=_50;if(_dc){_51=~(_50);_52=_51;}let _dd=((_52&2863311530u)>>bitcast<u32>(1i));_10=vec2u((select(_da,_db,_dc)|(select(_db,_da,_dc)<<bitcast<u32>(16i))),((((_52&1431655765u)^_dd)<<bitcast<u32>(1i))|_dd));_11=_10;}}x_2891._0[((_14.y*((_13+15u)&4294967280u))+_16)]=vec4u(_58,_59,_11.x,_11.y);}}return;}@compute @workgroup_size(16i, 16i, 1i) fn main(@builtin(global_invocation_id) _de:vec3u,@builtin(local_invocation_id) _df:vec3u,@builtin(workgroup_id) _dg:vec3u){x_2795=_de;x_2801=_df;_b();}";
|
|
2
|
+
export {
|
|
3
|
+
spark_bc3_rgba as default
|
|
4
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const spark_bc4_r = "enable f16;alias RTArr=array<vec2u>;struct _1{_0:RTArr,}@binding(1) @group(0) var _2:sampler;@binding(0) @group(0) var _3:texture_2d<f32>;var<private>x_781:vec3u;var<private>x_787:vec3u;@binding(2) @group(0) var<storage,read_write>x_879:_1;const _4=vec2f(1.0f);const _5=array<f32,8u>(0.0f,0.140625f,0.28125f,0.421875f,0.578125f,0.71875f,0.859375f,1.0f);fn _6(){var _7:array<f32,8u>;var _8:array<f32,8u>;var _9:bool;var _a:bool;var _b:f16;var _c:f16;var _d:f16;var _e:f16;var _f:f16;var _g:f16;var _h:vec2u;var _i:vec2u;var _j:f16;var _k:f16;var _l:bool;var _m:f16;var _n:f16;var _o:bool;var _p:vec2u;var _q:vec2u;switch(0u){default:{let _r=bitcast<vec2u>(vec2i(textureDimensions(_3,0i)));let _s=((_r.x+3u)/4u);let _t=x_781;let _u=x_781.xy;let _v=x_781.x;let _w=(_v>=_s);_a=_w;if(!(_w)){_9=(_t.y>=((_r.y+3u)/4u));_a=_9;}if(_a){break;}let _x=((vec2f(bitcast<vec2i>((_u*vec2u(4u))))+_4)*(_4/vec2f(vec2i(textureDimensions(_3,0i)))));let _y=vec4h(textureGather(0i,_3,_2,_x,vec2i()));let _z=vec4h(textureGather(0i,_3,_2,_x,vec2i(2i,0i)));let _10=vec4h(textureGather(0i,_3,_2,_x,vec2i(0i,2i)));let _11=vec4h(textureGather(0i,_3,_2,_x,vec2i(2i)));let _12=_y.w;let _13=_y.z;let _14=_z.w;let _15=_z.z;let _16=_y.x;let _17=_y.y;let _18=_z.x;let _19=_z.y;let _1a=_10.w;let _1b=_10.z;let _1c=_11.w;let _1d=_11.z;let _1e=_10.x;let _1f=_10.y;let _1g=_11.x;let _1h=_11.y;let _1i=min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(1.0h,_12),_13),_14),_15),_16),_17),_18),_19),_1a),_1b),_1c),_1d),_1e),_1f),_1g),_1h);let _1j=max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(0.0h,_12),_13),_14),_15),_16),_17),_18),_19),_1a),_1b),_1c),_1d),_1e),_1f),_1g),_1h);let _1k=(_1j-_1i);let _1l=(_1k*0.03125h);_c=_1l;if((_1k<0.0625h)){_b=max(0.0h,((2.0h*_1l)-0.0625h));_c=_b;}_e=_1i;if((_1i>0.0h)){_d=(_1i+_c);_e=_d;}_g=_1j;if((_e<1.0h)){_f=(_1j-_c);_g=_f;}let _1m=trunc(((_g*255.0h)+0.5h));let _1n=trunc(((_e*255.0h)+0.5h));let _1o=select(_1n,127.0h,((_1n==128.0h)|(_1n==126.0h)));let _1p=select(_1m,127.0h,((_1m==128.0h)|(_1m==126.0h)));switch(0u){default:{if((_1p==_1o)){_i=vec2u();break;}let _1q=(1.0h/(_1o-_1p));let _1r=(_1p*-(_1q));let _1s=(_1q*255.0h);let _1t=(0u|(u32(((clamp(((_1a*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_h=vec2u(((((((((0u|(u32(((clamp(((_12*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_13*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_14*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_15*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_16*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_17*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_18*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_19*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_1t);_h.y=(((((((_1t|(u32(((clamp(((_1b*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1c*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1d*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1e*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_1f*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_1g*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_1h*_1s)+_1r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_i=_h;}}switch(0u){default:{let _1u=_i.x;_7=_5;let _1v=_7[((_1u>>bitcast<u32>(0i))&7u)];let _1w=(1.0f-_1v);let _1x=f32(_12);_7=_5;let _1y=_7[((_1u>>bitcast<u32>(3i))&7u)];let _1z=(1.0f-_1y);let _20=f32(_13);_7=_5;let _21=_7[((_1u>>bitcast<u32>(6i))&7u)];let _22=(1.0f-_21);let _23=f32(_14);_7=_5;let _24=_7[((_1u>>bitcast<u32>(9i))&7u)];let _25=(1.0f-_24);let _26=f32(_15);_7=_5;let _27=_7[((_1u>>bitcast<u32>(12i))&7u)];let _28=(1.0f-_27);let _29=f32(_16);_7=_5;let _2a=_7[((_1u>>bitcast<u32>(15i))&7u)];let _2b=(1.0f-_2a);let _2c=f32(_17);_7=_5;let _2d=_7[((_1u>>bitcast<u32>(18i))&7u)];let _2e=(1.0f-_2d);let _2f=f32(_18);_7=_5;let _2g=_7[((_1u>>bitcast<u32>(21i))&7u)];let _2h=(1.0f-_2g);let _2i=f32(_19);let _2j=_i.y;_8=_5;let _2k=_8[((_2j>>bitcast<u32>(0i))&7u)];let _2l=(1.0f-_2k);let _2m=f32(_1a);_8=_5;let _2n=_8[((_2j>>bitcast<u32>(3i))&7u)];let _2o=(1.0f-_2n);let _2p=f32(_1b);_8=_5;let _2q=_8[((_2j>>bitcast<u32>(6i))&7u)];let _2r=(1.0f-_2q);let _2s=f32(_1c);_8=_5;let _2t=_8[((_2j>>bitcast<u32>(9i))&7u)];let _2u=(1.0f-_2t);let _2v=f32(_1d);_8=_5;let _2w=_8[((_2j>>bitcast<u32>(12i))&7u)];let _2x=(1.0f-_2w);let _2y=f32(_1e);_8=_5;let _2z=_8[((_2j>>bitcast<u32>(15i))&7u)];let _30=(1.0f-_2z);let _31=f32(_1f);_8=_5;let _32=_8[((_2j>>bitcast<u32>(18i))&7u)];let _33=(1.0f-_32);let _34=f32(_1g);_8=_5;let _35=_8[((_2j>>bitcast<u32>(21i))&7u)];let _36=(1.0f-_35);let _37=((((((((((((((((_1w*_1w)+(_1z*_1z))+(_22*_22))+(_25*_25))+(_28*_28))+(_2b*_2b))+(_2e*_2e))+(_2h*_2h))+(_2l*_2l))+(_2o*_2o))+(_2r*_2r))+(_2u*_2u))+(_2x*_2x))+(_30*_30))+(_33*_33))+(_36*_36));let _38=((((((((((((((((_1v*_1v)+(_1y*_1y))+(_21*_21))+(_24*_24))+(_27*_27))+(_2a*_2a))+(_2d*_2d))+(_2g*_2g))+(_2k*_2k))+(_2n*_2n))+(_2q*_2q))+(_2t*_2t))+(_2w*_2w))+(_2z*_2z))+(_32*_32))+(_35*_35));let _39=((((((((((((((((_1w*_1v)+(_1z*_1y))+(_22*_21))+(_25*_24))+(_28*_27))+(_2b*_2a))+(_2e*_2d))+(_2h*_2g))+(_2l*_2k))+(_2o*_2n))+(_2r*_2q))+(_2u*_2t))+(_2x*_2w))+(_30*_2z))+(_33*_32))+(_36*_35));let _3a=f32(_1h);let _3b=((((((((((((((((_1w*_1x)+(_1z*_20))+(_22*_23))+(_25*_26))+(_28*_29))+(_2b*_2c))+(_2e*_2f))+(_2h*_2i))+(_2l*_2m))+(_2o*_2p))+(_2r*_2s))+(_2u*_2v))+(_2x*_2y))+(_30*_31))+(_33*_34))+(_36*_3a));let _3c=((((((((((((((((_1v*_1x)+(_1y*_20))+(_21*_23))+(_24*_26))+(_27*_29))+(_2a*_2c))+(_2d*_2f))+(_2g*_2i))+(_2k*_2m))+(_2n*_2p))+(_2q*_2s))+(_2t*_2v))+(_2w*_2y))+(_2z*_31))+(_32*_34))+(_35*_3a));let _3d=((_37*_38)-(_39*_39));if((abs(_3d)<0.00009999999747378752f)){_m=_1o;_n=_1p;_o=false;break;}let _3e=(1.0f/_3d);let _3f=trunc(((f16(clamp((((_3b*_38)-(_3c*_39))*_3e),0.0f,1.0f))*255.0h)+0.5h));let _3g=trunc(((f16(clamp((((_3c*_37)-(_3b*_39))*_3e),0.0f,1.0f))*255.0h)+0.5h));_j=select(_3g,127.0h,((_3g==128.0h)|(_3g==126.0h)));_k=select(_3f,127.0h,((_3f==128.0h)|(_3f==126.0h)));_l=(!((_k==_1p))|!((_j==_1o)));_m=_j;_n=_k;_o=_l;}}var _3h:vec2u;_q=_i;if(_o){switch(0u){default:{if((_n==_m)){_p=vec2u();break;}let _3i=(1.0h/(_m-_n));let _3j=(_n*-(_3i));let _3k=(_3i*255.0h);let _3l=(0u|(u32(((clamp(((_1a*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_3h=vec2u(((((((((0u|(u32(((clamp(((_12*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_13*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_14*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_15*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_16*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_17*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_18*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_19*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_3l);_3h.y=(((((((_3l|(u32(((clamp(((_1b*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1c*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1d*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1e*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_1f*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_1g*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_1h*_3k)+_3j),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_p=_3h;}}_q=_p;}let _3m=_q.x;let _3n=(((_3m&7190235u)+2396745u)^(_3m&9586980u));let _3o=(_3n^(((19173960u-(_3n&14380470u))&19173960u)>>bitcast<u32>(3i)));let _3p=_q.y;let _3q=(((_3p&7190235u)+2396745u)^(_3p&9586980u));let _3r=(_3o>>bitcast<u32>(16i));var _3s=vec2u(((u32(_n)|(u32(_m)<<bitcast<u32>(8i)))|(_3o<<bitcast<u32>(16i))),_3r);_3s.y=(_3r|((_3q^(((19173960u-(_3q&14380470u))&19173960u)>>bitcast<u32>(3i)))<<bitcast<u32>(8i)));x_879._0[((_t.y*((_s+31u)&4294967264u))+_v)]=_3s;}}return;}@compute @workgroup_size(16i, 16i, 1i) fn main(@builtin(global_invocation_id) _3t:vec3u,@builtin(local_invocation_id) _3u:vec3u,@builtin(workgroup_id) _3v:vec3u){x_781=_3t;x_787=_3u;_6();}";
|
|
2
|
+
export {
|
|
3
|
+
spark_bc4_r as default
|
|
4
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const spark_bc5_rg = "enable f16;alias RTArr=array<vec4u>;struct _1{_0:RTArr,}@binding(1) @group(0) var _2:sampler;@binding(0) @group(0) var _3:texture_2d<f32>;var<private>x_883:vec3u;var<private>x_889:vec3u;@binding(2) @group(0) var<storage,read_write>x_980:_1;const _4=vec2f(1.0f);const _5=vec2i(2i,0i);const _6=vec2i(0i,2i);const _7=vec2i(2i);const _8=array<f32,8u>(0.0f,0.140625f,0.28125f,0.421875f,0.578125f,0.71875f,0.859375f,1.0f);fn _9(){var _a:array<f32,8u>;var _b:array<f32,8u>;var _c:array<f32,8u>;var _d:array<f32,8u>;var _e:bool;var _f:bool;var _g:f16;var _h:f16;var _i:f16;var _j:f16;var _k:f16;var _l:f16;var _m:vec2u;var _n:vec2u;var _o:f16;var _p:f16;var _q:bool;var _r:f16;var _s:f16;var _t:bool;var _u:vec2u;var _v:vec2u;var _w:f16;var _x:f16;var _y:f16;var _z:f16;var _10:f16;var _11:f16;var _12:vec2u;var _13:vec2u;var _14:f16;var _15:f16;var _16:bool;var _17:f16;var _18:f16;var _19:bool;var _1a:vec2u;var _1b:vec2u;switch(0u){default:{let _1c=bitcast<vec2u>(vec2i(textureDimensions(_3,0i)));let _1d=((_1c.x+3u)/4u);let _1e=x_883;let _1f=x_883.xy;let _1g=x_883.x;let _1h=(_1g>=_1d);_f=_1h;if(!(_1h)){_e=(_1e.y>=((_1c.y+3u)/4u));_f=_e;}if(_f){break;}let _1i=((vec2f(bitcast<vec2i>((_1f*vec2u(4u))))+_4)*(_4/vec2f(vec2i(textureDimensions(_3,0i)))));let _1j=vec4h(textureGather(0i,_3,_2,_1i,vec2i()));let _1k=vec4h(textureGather(0i,_3,_2,_1i,_5));let _1l=vec4h(textureGather(0i,_3,_2,_1i,_6));let _1m=vec4h(textureGather(0i,_3,_2,_1i,_7));let _1n=_1j.w;let _1o=_1j.z;let _1p=_1k.w;let _1q=_1k.z;let _1r=_1j.x;let _1s=_1j.y;let _1t=_1k.x;let _1u=_1k.y;let _1v=_1l.w;let _1w=_1l.z;let _1x=_1m.w;let _1y=_1m.z;let _1z=_1l.x;let _20=_1l.y;let _21=_1m.x;let _22=_1m.y;let _23=vec4h(textureGather(1i,_3,_2,_1i,vec2i()));let _24=vec4h(textureGather(1i,_3,_2,_1i,_5));let _25=vec4h(textureGather(1i,_3,_2,_1i,_6));let _26=vec4h(textureGather(1i,_3,_2,_1i,_7));let _27=_23.w;let _28=_23.z;let _29=_24.w;let _2a=_24.z;let _2b=_23.x;let _2c=_23.y;let _2d=_24.x;let _2e=_24.y;let _2f=_25.w;let _2g=_25.z;let _2h=_26.w;let _2i=_26.z;let _2j=_25.x;let _2k=_25.y;let _2l=_26.x;let _2m=_26.y;let _2n=min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(1.0h,_1n),_1o),_1p),_1q),_1r),_1s),_1t),_1u),_1v),_1w),_1x),_1y),_1z),_20),_21),_22);let _2o=max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(0.0h,_1n),_1o),_1p),_1q),_1r),_1s),_1t),_1u),_1v),_1w),_1x),_1y),_1z),_20),_21),_22);let _2p=(_2o-_2n);let _2q=(_2p*0.03125h);_h=_2q;if((_2p<0.0625h)){_g=max(0.0h,((2.0h*_2q)-0.0625h));_h=_g;}_j=_2n;if((_2n>0.0h)){_i=(_2n+_h);_j=_i;}_l=_2o;if((_j<1.0h)){_k=(_2o-_h);_l=_k;}let _2r=trunc(((_l*255.0h)+0.5h));let _2s=trunc(((_j*255.0h)+0.5h));switch(0u){default:{if((_2r==_2s)){_n=vec2u();break;}let _2t=(1.0h/(_2s-_2r));let _2u=(_2r*-(_2t));let _2v=(_2t*255.0h);let _2w=(0u|(u32(((clamp(((_1v*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_m=vec2u(((((((((0u|(u32(((clamp(((_1n*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_1o*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1p*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1q*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1r*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_1s*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_1t*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_1u*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_2w);_m.y=(((((((_2w|(u32(((clamp(((_1w*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1x*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1y*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1z*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_20*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_21*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_22*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_n=_m;}}switch(0u){default:{let _2x=_n.x;_c=_8;let _2y=_c[((_2x>>bitcast<u32>(0i))&7u)];let _2z=(1.0f-_2y);let _30=f32(_1n);_c=_8;let _31=_c[((_2x>>bitcast<u32>(3i))&7u)];let _32=(1.0f-_31);let _33=f32(_1o);_c=_8;let _34=_c[((_2x>>bitcast<u32>(6i))&7u)];let _35=(1.0f-_34);let _36=f32(_1p);_c=_8;let _37=_c[((_2x>>bitcast<u32>(9i))&7u)];let _38=(1.0f-_37);let _39=f32(_1q);_c=_8;let _3a=_c[((_2x>>bitcast<u32>(12i))&7u)];let _3b=(1.0f-_3a);let _3c=f32(_1r);_c=_8;let _3d=_c[((_2x>>bitcast<u32>(15i))&7u)];let _3e=(1.0f-_3d);let _3f=f32(_1s);_c=_8;let _3g=_c[((_2x>>bitcast<u32>(18i))&7u)];let _3h=(1.0f-_3g);let _3i=f32(_1t);_c=_8;let _3j=_c[((_2x>>bitcast<u32>(21i))&7u)];let _3k=(1.0f-_3j);let _3l=f32(_1u);let _3m=_n.y;_d=_8;let _3n=_d[((_3m>>bitcast<u32>(0i))&7u)];let _3o=(1.0f-_3n);let _3p=f32(_1v);_d=_8;let _3q=_d[((_3m>>bitcast<u32>(3i))&7u)];let _3r=(1.0f-_3q);let _3s=f32(_1w);_d=_8;let _3t=_d[((_3m>>bitcast<u32>(6i))&7u)];let _3u=(1.0f-_3t);let _3v=f32(_1x);_d=_8;let _3w=_d[((_3m>>bitcast<u32>(9i))&7u)];let _3x=(1.0f-_3w);let _3y=f32(_1y);_d=_8;let _3z=_d[((_3m>>bitcast<u32>(12i))&7u)];let _40=(1.0f-_3z);let _41=f32(_1z);_d=_8;let _42=_d[((_3m>>bitcast<u32>(15i))&7u)];let _43=(1.0f-_42);let _44=f32(_20);_d=_8;let _45=_d[((_3m>>bitcast<u32>(18i))&7u)];let _46=(1.0f-_45);let _47=f32(_21);_d=_8;let _48=_d[((_3m>>bitcast<u32>(21i))&7u)];let _49=(1.0f-_48);let _4a=((((((((((((((((_2z*_2z)+(_32*_32))+(_35*_35))+(_38*_38))+(_3b*_3b))+(_3e*_3e))+(_3h*_3h))+(_3k*_3k))+(_3o*_3o))+(_3r*_3r))+(_3u*_3u))+(_3x*_3x))+(_40*_40))+(_43*_43))+(_46*_46))+(_49*_49));let _4b=((((((((((((((((_2y*_2y)+(_31*_31))+(_34*_34))+(_37*_37))+(_3a*_3a))+(_3d*_3d))+(_3g*_3g))+(_3j*_3j))+(_3n*_3n))+(_3q*_3q))+(_3t*_3t))+(_3w*_3w))+(_3z*_3z))+(_42*_42))+(_45*_45))+(_48*_48));let _4c=((((((((((((((((_2z*_2y)+(_32*_31))+(_35*_34))+(_38*_37))+(_3b*_3a))+(_3e*_3d))+(_3h*_3g))+(_3k*_3j))+(_3o*_3n))+(_3r*_3q))+(_3u*_3t))+(_3x*_3w))+(_40*_3z))+(_43*_42))+(_46*_45))+(_49*_48));let _4d=f32(_22);let _4e=((((((((((((((((_2z*_30)+(_32*_33))+(_35*_36))+(_38*_39))+(_3b*_3c))+(_3e*_3f))+(_3h*_3i))+(_3k*_3l))+(_3o*_3p))+(_3r*_3s))+(_3u*_3v))+(_3x*_3y))+(_40*_41))+(_43*_44))+(_46*_47))+(_49*_4d));let _4f=((((((((((((((((_2y*_30)+(_31*_33))+(_34*_36))+(_37*_39))+(_3a*_3c))+(_3d*_3f))+(_3g*_3i))+(_3j*_3l))+(_3n*_3p))+(_3q*_3s))+(_3t*_3v))+(_3w*_3y))+(_3z*_41))+(_42*_44))+(_45*_47))+(_48*_4d));let _4g=((_4a*_4b)-(_4c*_4c));if((abs(_4g)<0.00009999999747378752f)){_r=_2s;_s=_2r;_t=false;break;}let _4h=(1.0f/_4g);_o=trunc(((f16(clamp((((_4e*_4b)-(_4f*_4c))*_4h),0.0f,1.0f))*255.0h)+0.5h));_p=trunc(((f16(clamp((((_4f*_4a)-(_4e*_4c))*_4h),0.0f,1.0f))*255.0h)+0.5h));_q=(!((_o==_2r))|!((_p==_2s)));_r=_p;_s=_o;_t=_q;}}var _4i:vec2u;_v=_n;if(_t){switch(0u){default:{if((_s==_r)){_u=vec2u();break;}let _4j=(1.0h/(_r-_s));let _4k=(_s*-(_4j));let _4l=(_4j*255.0h);let _4m=(0u|(u32(((clamp(((_1v*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_4i=vec2u(((((((((0u|(u32(((clamp(((_1n*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_1o*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1p*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1q*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1r*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_1s*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_1t*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_1u*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_4m);_4i.y=(((((((_4m|(u32(((clamp(((_1w*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1x*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1y*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1z*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_20*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_21*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_22*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_u=_4i;}}_v=_u;}let _4n=_v.x;let _4o=(((_4n&7190235u)+2396745u)^(_4n&9586980u));let _4p=(_4o^(((19173960u-(_4o&14380470u))&19173960u)>>bitcast<u32>(3i)));let _4q=_v.y;let _4r=(((_4q&7190235u)+2396745u)^(_4q&9586980u));let _4s=((u32(_s)|(u32(_r)<<bitcast<u32>(8i)))|(_4p<<bitcast<u32>(16i)));let _4t=((_4p>>bitcast<u32>(16i))|((_4r^(((19173960u-(_4r&14380470u))&19173960u)>>bitcast<u32>(3i)))<<bitcast<u32>(8i)));let _4u=min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(1.0h,_27),_28),_29),_2a),_2b),_2c),_2d),_2e),_2f),_2g),_2h),_2i),_2j),_2k),_2l),_2m);let _4v=max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(0.0h,_27),_28),_29),_2a),_2b),_2c),_2d),_2e),_2f),_2g),_2h),_2i),_2j),_2k),_2l),_2m);let _4w=(_4v-_4u);let _4x=(_4w*0.03125h);_x=_4x;if((_4w<0.0625h)){_w=max(0.0h,((2.0h*_4x)-0.0625h));_x=_w;}_z=_4u;if((_4u>0.0h)){_y=(_4u+_x);_z=_y;}_11=_4v;if((_z<1.0h)){_10=(_4v-_x);_11=_10;}let _4y=trunc(((_11*255.0h)+0.5h));let _4z=trunc(((_z*255.0h)+0.5h));switch(0u){default:{if((_4y==_4z)){_13=vec2u();break;}let _50=(1.0h/(_4z-_4y));let _51=(_4y*-(_50));let _52=(_50*255.0h);let _53=(0u|(u32(((clamp(((_2f*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_12=vec2u(((((((((0u|(u32(((clamp(((_27*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_28*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_29*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_2a*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_2b*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_2c*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_2d*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_2e*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_53);_12.y=(((((((_53|(u32(((clamp(((_2g*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_2h*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_2i*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_2j*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_2k*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_2l*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_2m*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_13=_12;}}switch(0u){default:{let _54=_13.x;_a=_8;let _55=_a[((_54>>bitcast<u32>(0i))&7u)];let _56=(1.0f-_55);let _57=f32(_27);_a=_8;let _58=_a[((_54>>bitcast<u32>(3i))&7u)];let _59=(1.0f-_58);let _5a=f32(_28);_a=_8;let _5b=_a[((_54>>bitcast<u32>(6i))&7u)];let _5c=(1.0f-_5b);let _5d=f32(_29);_a=_8;let _5e=_a[((_54>>bitcast<u32>(9i))&7u)];let _5f=(1.0f-_5e);let _5g=f32(_2a);_a=_8;let _5h=_a[((_54>>bitcast<u32>(12i))&7u)];let _5i=(1.0f-_5h);let _5j=f32(_2b);_a=_8;let _5k=_a[((_54>>bitcast<u32>(15i))&7u)];let _5l=(1.0f-_5k);let _5m=f32(_2c);_a=_8;let _5n=_a[((_54>>bitcast<u32>(18i))&7u)];let _5o=(1.0f-_5n);let _5p=f32(_2d);_a=_8;let _5q=_a[((_54>>bitcast<u32>(21i))&7u)];let _5r=(1.0f-_5q);let _5s=f32(_2e);let _5t=_13.y;_b=_8;let _5u=_b[((_5t>>bitcast<u32>(0i))&7u)];let _5v=(1.0f-_5u);let _5w=f32(_2f);_b=_8;let _5x=_b[((_5t>>bitcast<u32>(3i))&7u)];let _5y=(1.0f-_5x);let _5z=f32(_2g);_b=_8;let _60=_b[((_5t>>bitcast<u32>(6i))&7u)];let _61=(1.0f-_60);let _62=f32(_2h);_b=_8;let _63=_b[((_5t>>bitcast<u32>(9i))&7u)];let _64=(1.0f-_63);let _65=f32(_2i);_b=_8;let _66=_b[((_5t>>bitcast<u32>(12i))&7u)];let _67=(1.0f-_66);let _68=f32(_2j);_b=_8;let _69=_b[((_5t>>bitcast<u32>(15i))&7u)];let _6a=(1.0f-_69);let _6b=f32(_2k);_b=_8;let _6c=_b[((_5t>>bitcast<u32>(18i))&7u)];let _6d=(1.0f-_6c);let _6e=f32(_2l);_b=_8;let _6f=_b[((_5t>>bitcast<u32>(21i))&7u)];let _6g=(1.0f-_6f);let _6h=((((((((((((((((_56*_56)+(_59*_59))+(_5c*_5c))+(_5f*_5f))+(_5i*_5i))+(_5l*_5l))+(_5o*_5o))+(_5r*_5r))+(_5v*_5v))+(_5y*_5y))+(_61*_61))+(_64*_64))+(_67*_67))+(_6a*_6a))+(_6d*_6d))+(_6g*_6g));let _6i=((((((((((((((((_55*_55)+(_58*_58))+(_5b*_5b))+(_5e*_5e))+(_5h*_5h))+(_5k*_5k))+(_5n*_5n))+(_5q*_5q))+(_5u*_5u))+(_5x*_5x))+(_60*_60))+(_63*_63))+(_66*_66))+(_69*_69))+(_6c*_6c))+(_6f*_6f));let _6j=((((((((((((((((_56*_55)+(_59*_58))+(_5c*_5b))+(_5f*_5e))+(_5i*_5h))+(_5l*_5k))+(_5o*_5n))+(_5r*_5q))+(_5v*_5u))+(_5y*_5x))+(_61*_60))+(_64*_63))+(_67*_66))+(_6a*_69))+(_6d*_6c))+(_6g*_6f));let _6k=f32(_2m);let _6l=((((((((((((((((_56*_57)+(_59*_5a))+(_5c*_5d))+(_5f*_5g))+(_5i*_5j))+(_5l*_5m))+(_5o*_5p))+(_5r*_5s))+(_5v*_5w))+(_5y*_5z))+(_61*_62))+(_64*_65))+(_67*_68))+(_6a*_6b))+(_6d*_6e))+(_6g*_6k));let _6m=((((((((((((((((_55*_57)+(_58*_5a))+(_5b*_5d))+(_5e*_5g))+(_5h*_5j))+(_5k*_5m))+(_5n*_5p))+(_5q*_5s))+(_5u*_5w))+(_5x*_5z))+(_60*_62))+(_63*_65))+(_66*_68))+(_69*_6b))+(_6c*_6e))+(_6f*_6k));let _6n=((_6h*_6i)-(_6j*_6j));if((abs(_6n)<0.00009999999747378752f)){_17=_4z;_18=_4y;_19=false;break;}let _6o=(1.0f/_6n);_14=trunc(((f16(clamp((((_6l*_6i)-(_6m*_6j))*_6o),0.0f,1.0f))*255.0h)+0.5h));_15=trunc(((f16(clamp((((_6m*_6h)-(_6l*_6j))*_6o),0.0f,1.0f))*255.0h)+0.5h));_16=(!((_14==_4y))|!((_15==_4z)));_17=_15;_18=_14;_19=_16;}}var _6p:vec2u;_1b=_13;if(_19){switch(0u){default:{if((_18==_17)){_1a=vec2u();break;}let _6q=(1.0h/(_17-_18));let _6r=(_18*-(_6q));let _6s=(_6q*255.0h);let _6t=(0u|(u32(((clamp(((_2f*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_6p=vec2u(((((((((0u|(u32(((clamp(((_27*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_28*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_29*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_2a*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_2b*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_2c*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_2d*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_2e*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_6t);_6p.y=(((((((_6t|(u32(((clamp(((_2g*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_2h*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_2i*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_2j*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_2k*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_2l*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_2m*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_1a=_6p;}}_1b=_1a;}let _6u=_1b.x;let _6v=(((_6u&7190235u)+2396745u)^(_6u&9586980u));let _6w=(_6v^(((19173960u-(_6v&14380470u))&19173960u)>>bitcast<u32>(3i)));let _6x=_1b.y;let _6y=(((_6x&7190235u)+2396745u)^(_6x&9586980u));x_980._0[((_1e.y*((_1d+15u)&4294967280u))+_1g)]=vec4u(_4s,_4t,((u32(_18)|(u32(_17)<<bitcast<u32>(8i)))|(_6w<<bitcast<u32>(16i))),((_6w>>bitcast<u32>(16i))|((_6y^(((19173960u-(_6y&14380470u))&19173960u)>>bitcast<u32>(3i)))<<bitcast<u32>(8i))));}}return;}@compute @workgroup_size(16i, 16i, 1i) fn main(@builtin(global_invocation_id) _6z:vec3u,@builtin(local_invocation_id) _70:vec3u,@builtin(workgroup_id) _71:vec3u){x_883=_6z;x_889=_70;_9();}";
|
|
1
|
+
const spark_bc5_rg = "enable f16;alias RTArr=array<vec4u>;struct _1{_0:RTArr,}@binding(1) @group(0) var _2:sampler;@binding(0) @group(0) var _3:texture_2d<f32>;var<private>x_901:vec3u;var<private>x_907:vec3u;@binding(2) @group(0) var<storage,read_write>x_998:_1;const _4=vec2f(1.0f);const _5=vec2i(2i,0i);const _6=vec2i(0i,2i);const _7=vec2i(2i);const _8=array<f32,8u>(0.0f,0.140625f,0.28125f,0.421875f,0.578125f,0.71875f,0.859375f,1.0f);fn _9(){var _a:array<f32,8u>;var _b:array<f32,8u>;var _c:array<f32,8u>;var _d:array<f32,8u>;var _e:bool;var _f:bool;var _g:f16;var _h:f16;var _i:f16;var _j:f16;var _k:f16;var _l:f16;var _m:vec2u;var _n:vec2u;var _o:f16;var _p:f16;var _q:bool;var _r:f16;var _s:f16;var _t:bool;var _u:vec2u;var _v:vec2u;var _w:f16;var _x:f16;var _y:f16;var _z:f16;var _10:f16;var _11:f16;var _12:vec2u;var _13:vec2u;var _14:f16;var _15:f16;var _16:bool;var _17:f16;var _18:f16;var _19:bool;var _1a:vec2u;var _1b:vec2u;switch(0u){default:{let _1c=bitcast<vec2u>(vec2i(textureDimensions(_3,0i)));let _1d=((_1c.x+3u)/4u);let _1e=x_901;let _1f=x_901.xy;let _1g=x_901.x;let _1h=(_1g>=_1d);_f=_1h;if(!(_1h)){_e=(_1e.y>=((_1c.y+3u)/4u));_f=_e;}if(_f){break;}let _1i=((vec2f(bitcast<vec2i>((_1f*vec2u(4u))))+_4)*(_4/vec2f(vec2i(textureDimensions(_3,0i)))));let _1j=vec4h(textureGather(0i,_3,_2,_1i,vec2i()));let _1k=vec4h(textureGather(0i,_3,_2,_1i,_5));let _1l=vec4h(textureGather(0i,_3,_2,_1i,_6));let _1m=vec4h(textureGather(0i,_3,_2,_1i,_7));let _1n=_1j.w;let _1o=_1j.z;let _1p=_1k.w;let _1q=_1k.z;let _1r=_1j.x;let _1s=_1j.y;let _1t=_1k.x;let _1u=_1k.y;let _1v=_1l.w;let _1w=_1l.z;let _1x=_1m.w;let _1y=_1m.z;let _1z=_1l.x;let _20=_1l.y;let _21=_1m.x;let _22=_1m.y;let _23=vec4h(textureGather(1i,_3,_2,_1i,vec2i()));let _24=vec4h(textureGather(1i,_3,_2,_1i,_5));let _25=vec4h(textureGather(1i,_3,_2,_1i,_6));let _26=vec4h(textureGather(1i,_3,_2,_1i,_7));let _27=_23.w;let _28=_23.z;let _29=_24.w;let _2a=_24.z;let _2b=_23.x;let _2c=_23.y;let _2d=_24.x;let _2e=_24.y;let _2f=_25.w;let _2g=_25.z;let _2h=_26.w;let _2i=_26.z;let _2j=_25.x;let _2k=_25.y;let _2l=_26.x;let _2m=_26.y;let _2n=min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(1.0h,_1n),_1o),_1p),_1q),_1r),_1s),_1t),_1u),_1v),_1w),_1x),_1y),_1z),_20),_21),_22);let _2o=max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(0.0h,_1n),_1o),_1p),_1q),_1r),_1s),_1t),_1u),_1v),_1w),_1x),_1y),_1z),_20),_21),_22);let _2p=(_2o-_2n);let _2q=(_2p*0.03125h);_h=_2q;if((_2p<0.0625h)){_g=max(0.0h,((2.0h*_2q)-0.0625h));_h=_g;}_j=_2n;if((_2n>0.0h)){_i=(_2n+_h);_j=_i;}_l=_2o;if((_j<1.0h)){_k=(_2o-_h);_l=_k;}let _2r=trunc(((_l*255.0h)+0.5h));let _2s=trunc(((_j*255.0h)+0.5h));switch(0u){default:{if((_2r==_2s)){_n=vec2u();break;}let _2t=(1.0h/(_2s-_2r));let _2u=(_2r*-(_2t));let _2v=(_2t*255.0h);let _2w=(0u|(u32(((clamp(((_1v*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_m=vec2u(((((((((0u|(u32(((clamp(((_1n*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_1o*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1p*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1q*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1r*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_1s*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_1t*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_1u*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_2w);_m.y=(((((((_2w|(u32(((clamp(((_1w*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1x*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1y*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1z*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_20*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_21*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_22*_2v)+_2u),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_n=_m;}}switch(0u){default:{let _2x=_n.x;_c=_8;let _2y=_c[((_2x>>bitcast<u32>(0i))&7u)];let _2z=(1.0f-_2y);let _30=f32(_1n);_c=_8;let _31=_c[((_2x>>bitcast<u32>(3i))&7u)];let _32=(1.0f-_31);let _33=f32(_1o);_c=_8;let _34=_c[((_2x>>bitcast<u32>(6i))&7u)];let _35=(1.0f-_34);let _36=f32(_1p);_c=_8;let _37=_c[((_2x>>bitcast<u32>(9i))&7u)];let _38=(1.0f-_37);let _39=f32(_1q);_c=_8;let _3a=_c[((_2x>>bitcast<u32>(12i))&7u)];let _3b=(1.0f-_3a);let _3c=f32(_1r);_c=_8;let _3d=_c[((_2x>>bitcast<u32>(15i))&7u)];let _3e=(1.0f-_3d);let _3f=f32(_1s);_c=_8;let _3g=_c[((_2x>>bitcast<u32>(18i))&7u)];let _3h=(1.0f-_3g);let _3i=f32(_1t);_c=_8;let _3j=_c[((_2x>>bitcast<u32>(21i))&7u)];let _3k=(1.0f-_3j);let _3l=f32(_1u);let _3m=_n.y;_d=_8;let _3n=_d[((_3m>>bitcast<u32>(0i))&7u)];let _3o=(1.0f-_3n);let _3p=f32(_1v);_d=_8;let _3q=_d[((_3m>>bitcast<u32>(3i))&7u)];let _3r=(1.0f-_3q);let _3s=f32(_1w);_d=_8;let _3t=_d[((_3m>>bitcast<u32>(6i))&7u)];let _3u=(1.0f-_3t);let _3v=f32(_1x);_d=_8;let _3w=_d[((_3m>>bitcast<u32>(9i))&7u)];let _3x=(1.0f-_3w);let _3y=f32(_1y);_d=_8;let _3z=_d[((_3m>>bitcast<u32>(12i))&7u)];let _40=(1.0f-_3z);let _41=f32(_1z);_d=_8;let _42=_d[((_3m>>bitcast<u32>(15i))&7u)];let _43=(1.0f-_42);let _44=f32(_20);_d=_8;let _45=_d[((_3m>>bitcast<u32>(18i))&7u)];let _46=(1.0f-_45);let _47=f32(_21);_d=_8;let _48=_d[((_3m>>bitcast<u32>(21i))&7u)];let _49=(1.0f-_48);let _4a=((((((((((((((((_2z*_2z)+(_32*_32))+(_35*_35))+(_38*_38))+(_3b*_3b))+(_3e*_3e))+(_3h*_3h))+(_3k*_3k))+(_3o*_3o))+(_3r*_3r))+(_3u*_3u))+(_3x*_3x))+(_40*_40))+(_43*_43))+(_46*_46))+(_49*_49));let _4b=((((((((((((((((_2y*_2y)+(_31*_31))+(_34*_34))+(_37*_37))+(_3a*_3a))+(_3d*_3d))+(_3g*_3g))+(_3j*_3j))+(_3n*_3n))+(_3q*_3q))+(_3t*_3t))+(_3w*_3w))+(_3z*_3z))+(_42*_42))+(_45*_45))+(_48*_48));let _4c=((((((((((((((((_2z*_2y)+(_32*_31))+(_35*_34))+(_38*_37))+(_3b*_3a))+(_3e*_3d))+(_3h*_3g))+(_3k*_3j))+(_3o*_3n))+(_3r*_3q))+(_3u*_3t))+(_3x*_3w))+(_40*_3z))+(_43*_42))+(_46*_45))+(_49*_48));let _4d=f32(_22);let _4e=((((((((((((((((_2z*_30)+(_32*_33))+(_35*_36))+(_38*_39))+(_3b*_3c))+(_3e*_3f))+(_3h*_3i))+(_3k*_3l))+(_3o*_3p))+(_3r*_3s))+(_3u*_3v))+(_3x*_3y))+(_40*_41))+(_43*_44))+(_46*_47))+(_49*_4d));let _4f=((((((((((((((((_2y*_30)+(_31*_33))+(_34*_36))+(_37*_39))+(_3a*_3c))+(_3d*_3f))+(_3g*_3i))+(_3j*_3l))+(_3n*_3p))+(_3q*_3s))+(_3t*_3v))+(_3w*_3y))+(_3z*_41))+(_42*_44))+(_45*_47))+(_48*_4d));let _4g=((_4a*_4b)-(_4c*_4c));if((abs(_4g)<0.00009999999747378752f)){_r=_2s;_s=_2r;_t=false;break;}let _4h=(1.0f/_4g);_o=trunc(((f16(clamp((((_4e*_4b)-(_4f*_4c))*_4h),0.0f,1.0f))*255.0h)+0.5h));_p=trunc(((f16(clamp((((_4f*_4a)-(_4e*_4c))*_4h),0.0f,1.0f))*255.0h)+0.5h));_q=(!((_o==_2r))|!((_p==_2s)));_r=_p;_s=_o;_t=_q;}}var _4i:vec2u;_v=_n;if(_t){switch(0u){default:{if((_s==_r)){_u=vec2u();break;}let _4j=(1.0h/(_r-_s));let _4k=(_s*-(_4j));let _4l=(_4j*255.0h);let _4m=(0u|(u32(((clamp(((_1v*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_4i=vec2u(((((((((0u|(u32(((clamp(((_1n*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_1o*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1p*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1q*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1r*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_1s*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_1t*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_1u*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_4m);_4i.y=(((((((_4m|(u32(((clamp(((_1w*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1x*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1y*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1z*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_20*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_21*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_22*_4l)+_4k),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_u=_4i;}}_v=_u;}let _4n=_v.x;let _4o=(((_4n&7190235u)+2396745u)^(_4n&9586980u));let _4p=(_4o^(((19173960u-(_4o&14380470u))&19173960u)>>bitcast<u32>(3i)));let _4q=_v.y;let _4r=(((_4q&7190235u)+2396745u)^(_4q&9586980u));let _4s=((u32(_s)|(u32(_r)<<bitcast<u32>(8i)))|(_4p<<bitcast<u32>(16i)));let _4t=((_4p>>bitcast<u32>(16i))|((_4r^(((19173960u-(_4r&14380470u))&19173960u)>>bitcast<u32>(3i)))<<bitcast<u32>(8i)));let _4u=min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(1.0h,_27),_28),_29),_2a),_2b),_2c),_2d),_2e),_2f),_2g),_2h),_2i),_2j),_2k),_2l),_2m);let _4v=max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(0.0h,_27),_28),_29),_2a),_2b),_2c),_2d),_2e),_2f),_2g),_2h),_2i),_2j),_2k),_2l),_2m);let _4w=(_4v-_4u);let _4x=(_4w*0.03125h);_x=_4x;if((_4w<0.0625h)){_w=max(0.0h,((2.0h*_4x)-0.0625h));_x=_w;}_z=_4u;if((_4u>0.0h)){_y=(_4u+_x);_z=_y;}_11=_4v;if((_z<1.0h)){_10=(_4v-_x);_11=_10;}let _4y=trunc(((_11*255.0h)+0.5h));let _4z=trunc(((_z*255.0h)+0.5h));switch(0u){default:{if((_4y==_4z)){_13=vec2u();break;}let _50=(1.0h/(_4z-_4y));let _51=(_4y*-(_50));let _52=(_50*255.0h);let _53=(0u|(u32(((clamp(((_2f*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_12=vec2u(((((((((0u|(u32(((clamp(((_27*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_28*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_29*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_2a*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_2b*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_2c*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_2d*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_2e*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_53);_12.y=(((((((_53|(u32(((clamp(((_2g*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_2h*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_2i*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_2j*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_2k*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_2l*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_2m*_52)+_51),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_13=_12;}}switch(0u){default:{let _54=_13.x;_a=_8;let _55=_a[((_54>>bitcast<u32>(0i))&7u)];let _56=(1.0f-_55);let _57=f32(_27);_a=_8;let _58=_a[((_54>>bitcast<u32>(3i))&7u)];let _59=(1.0f-_58);let _5a=f32(_28);_a=_8;let _5b=_a[((_54>>bitcast<u32>(6i))&7u)];let _5c=(1.0f-_5b);let _5d=f32(_29);_a=_8;let _5e=_a[((_54>>bitcast<u32>(9i))&7u)];let _5f=(1.0f-_5e);let _5g=f32(_2a);_a=_8;let _5h=_a[((_54>>bitcast<u32>(12i))&7u)];let _5i=(1.0f-_5h);let _5j=f32(_2b);_a=_8;let _5k=_a[((_54>>bitcast<u32>(15i))&7u)];let _5l=(1.0f-_5k);let _5m=f32(_2c);_a=_8;let _5n=_a[((_54>>bitcast<u32>(18i))&7u)];let _5o=(1.0f-_5n);let _5p=f32(_2d);_a=_8;let _5q=_a[((_54>>bitcast<u32>(21i))&7u)];let _5r=(1.0f-_5q);let _5s=f32(_2e);let _5t=_13.y;_b=_8;let _5u=_b[((_5t>>bitcast<u32>(0i))&7u)];let _5v=(1.0f-_5u);let _5w=f32(_2f);_b=_8;let _5x=_b[((_5t>>bitcast<u32>(3i))&7u)];let _5y=(1.0f-_5x);let _5z=f32(_2g);_b=_8;let _60=_b[((_5t>>bitcast<u32>(6i))&7u)];let _61=(1.0f-_60);let _62=f32(_2h);_b=_8;let _63=_b[((_5t>>bitcast<u32>(9i))&7u)];let _64=(1.0f-_63);let _65=f32(_2i);_b=_8;let _66=_b[((_5t>>bitcast<u32>(12i))&7u)];let _67=(1.0f-_66);let _68=f32(_2j);_b=_8;let _69=_b[((_5t>>bitcast<u32>(15i))&7u)];let _6a=(1.0f-_69);let _6b=f32(_2k);_b=_8;let _6c=_b[((_5t>>bitcast<u32>(18i))&7u)];let _6d=(1.0f-_6c);let _6e=f32(_2l);_b=_8;let _6f=_b[((_5t>>bitcast<u32>(21i))&7u)];let _6g=(1.0f-_6f);let _6h=((((((((((((((((_56*_56)+(_59*_59))+(_5c*_5c))+(_5f*_5f))+(_5i*_5i))+(_5l*_5l))+(_5o*_5o))+(_5r*_5r))+(_5v*_5v))+(_5y*_5y))+(_61*_61))+(_64*_64))+(_67*_67))+(_6a*_6a))+(_6d*_6d))+(_6g*_6g));let _6i=((((((((((((((((_55*_55)+(_58*_58))+(_5b*_5b))+(_5e*_5e))+(_5h*_5h))+(_5k*_5k))+(_5n*_5n))+(_5q*_5q))+(_5u*_5u))+(_5x*_5x))+(_60*_60))+(_63*_63))+(_66*_66))+(_69*_69))+(_6c*_6c))+(_6f*_6f));let _6j=((((((((((((((((_56*_55)+(_59*_58))+(_5c*_5b))+(_5f*_5e))+(_5i*_5h))+(_5l*_5k))+(_5o*_5n))+(_5r*_5q))+(_5v*_5u))+(_5y*_5x))+(_61*_60))+(_64*_63))+(_67*_66))+(_6a*_69))+(_6d*_6c))+(_6g*_6f));let _6k=f32(_2m);let _6l=((((((((((((((((_56*_57)+(_59*_5a))+(_5c*_5d))+(_5f*_5g))+(_5i*_5j))+(_5l*_5m))+(_5o*_5p))+(_5r*_5s))+(_5v*_5w))+(_5y*_5z))+(_61*_62))+(_64*_65))+(_67*_68))+(_6a*_6b))+(_6d*_6e))+(_6g*_6k));let _6m=((((((((((((((((_55*_57)+(_58*_5a))+(_5b*_5d))+(_5e*_5g))+(_5h*_5j))+(_5k*_5m))+(_5n*_5p))+(_5q*_5s))+(_5u*_5w))+(_5x*_5z))+(_60*_62))+(_63*_65))+(_66*_68))+(_69*_6b))+(_6c*_6e))+(_6f*_6k));let _6n=((_6h*_6i)-(_6j*_6j));if((abs(_6n)<0.00009999999747378752f)){_17=_4z;_18=_4y;_19=false;break;}let _6o=(1.0f/_6n);_14=trunc(((f16(clamp((((_6l*_6i)-(_6m*_6j))*_6o),0.0f,1.0f))*255.0h)+0.5h));_15=trunc(((f16(clamp((((_6m*_6h)-(_6l*_6j))*_6o),0.0f,1.0f))*255.0h)+0.5h));_16=(!((_14==_4y))|!((_15==_4z)));_17=_15;_18=_14;_19=_16;}}var _6p:vec2u;_1b=_13;if(_19){switch(0u){default:{if((_18==_17)){_1a=vec2u();break;}let _6q=(1.0h/(_17-_18));let _6r=(_18*-(_6q));let _6s=(_6q*255.0h);let _6t=(0u|(u32(((clamp(((_2f*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_6p=vec2u(((((((((0u|(u32(((clamp(((_27*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_28*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_29*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_2a*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_2b*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_2c*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_2d*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_2e*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_6t);_6p.y=(((((((_6t|(u32(((clamp(((_2g*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_2h*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_2i*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_2j*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_2k*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_2l*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_2m*_6s)+_6r),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_1a=_6p;}}_1b=_1a;}let _6u=_1b.x;let _6v=(((_6u&7190235u)+2396745u)^(_6u&9586980u));let _6w=(_6v^(((19173960u-(_6v&14380470u))&19173960u)>>bitcast<u32>(3i)));let _6x=_1b.y;let _6y=(((_6x&7190235u)+2396745u)^(_6x&9586980u));x_998._0[((_1e.y*((_1d+15u)&4294967280u))+_1g)]=vec4u(_4s,_4t,((u32(_18)|(u32(_17)<<bitcast<u32>(8i)))|(_6w<<bitcast<u32>(16i))),((_6w>>bitcast<u32>(16i))|((_6y^(((19173960u-(_6y&14380470u))&19173960u)>>bitcast<u32>(3i)))<<bitcast<u32>(8i))));}}return;}@compute @workgroup_size(16i, 16i, 1i) fn main(@builtin(global_invocation_id) _6z:vec3u,@builtin(local_invocation_id) _70:vec3u,@builtin(workgroup_id) _71:vec3u){x_901=_6z;x_907=_70;_9();}";
|
|
2
2
|
export {
|
|
3
3
|
spark_bc5_rg as default
|
|
4
4
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ludicon/spark.js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Real-Time GPU Texture Codecs for the Web",
|
|
5
|
-
"main": "dist/
|
|
6
|
-
"module": "dist/
|
|
5
|
+
"main": "dist/spark.esm.js",
|
|
6
|
+
"module": "dist/spark.esm.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"import": "./dist/
|
|
11
|
-
}
|
|
10
|
+
"import": "./dist/spark.esm.js"
|
|
11
|
+
},
|
|
12
|
+
"./three-gltf": "./src/three-gltf.js"
|
|
12
13
|
},
|
|
13
14
|
"files": [
|
|
14
15
|
"dist",
|
|
@@ -17,8 +18,9 @@
|
|
|
17
18
|
],
|
|
18
19
|
"scripts": {
|
|
19
20
|
"build": "vite build",
|
|
20
|
-
"
|
|
21
|
-
"serve": "vite --host",
|
|
21
|
+
"watch": "vite build --watch",
|
|
22
|
+
"serve": "vite --host --open /examples/index.html",
|
|
23
|
+
"dev": "run-p watch serve",
|
|
22
24
|
"lint": "eslint .",
|
|
23
25
|
"lint:fix": "eslint . --fix",
|
|
24
26
|
"format": "prettier --write \"src/**/*.{js,jsx}\"",
|
|
@@ -28,6 +30,7 @@
|
|
|
28
30
|
"keywords": [
|
|
29
31
|
"gpu",
|
|
30
32
|
"webgpu",
|
|
33
|
+
"spark",
|
|
31
34
|
"texture",
|
|
32
35
|
"compression",
|
|
33
36
|
"transcoding",
|
|
@@ -43,10 +46,9 @@
|
|
|
43
46
|
"wgsl",
|
|
44
47
|
"image",
|
|
45
48
|
"codec",
|
|
46
|
-
"real-time"
|
|
47
|
-
"spark"
|
|
49
|
+
"real-time"
|
|
48
50
|
],
|
|
49
|
-
"author": "
|
|
51
|
+
"author": "Ludicon LLC (https://ludicon.com/)",
|
|
50
52
|
"license": "See LICENSE",
|
|
51
53
|
"repository": {
|
|
52
54
|
"type": "git",
|
|
@@ -57,10 +59,20 @@
|
|
|
57
59
|
"@vitejs/plugin-basic-ssl": "^2.1.0",
|
|
58
60
|
"eslint": "^9.0.0",
|
|
59
61
|
"globals": "^15.0.0",
|
|
62
|
+
"npm-run-all": "^4.1.5",
|
|
60
63
|
"prettier": "^3.0.0",
|
|
61
64
|
"rimraf": "^5.0.0",
|
|
65
|
+
"three": "^0.180.0",
|
|
62
66
|
"vite": "^7.0.0"
|
|
63
67
|
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"three": "^0.180.0"
|
|
70
|
+
},
|
|
71
|
+
"peerDependenciesMeta": {
|
|
72
|
+
"three": {
|
|
73
|
+
"optional": true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
64
76
|
"publishConfig": {
|
|
65
77
|
"access": "public"
|
|
66
78
|
},
|
|
@@ -70,5 +82,5 @@
|
|
|
70
82
|
"bugs": {
|
|
71
83
|
"url": "https://github.com/ludicon/spark.js/issues"
|
|
72
84
|
},
|
|
73
|
-
"homepage": "https://ludicon.com/
|
|
85
|
+
"homepage": "https://ludicon.com/sparkjs"
|
|
74
86
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const spark_bc1_rgb = "enable f16;alias RTArr=array<vec2u>;struct _1{_0:RTArr,}@binding(1) @group(0) var _2:sampler;@binding(0) @group(0) var _3:texture_2d<f32>;var<private>x_2270:vec3u;var<private>x_2276:vec3u;@binding(2) @group(0) var<storage,read_write>x_2367:_1;const _4=vec2i(2i,0i);const _5=vec2i(0i,2i);const _6=vec2i(2i);const _7=vec3h(1.0h);const _8=vec3h(0.85986328125h,1.7099609375h,0.429931640625h);const _9=vec2h(0.0h,8.0h);const _a=vec2h(8.0h,0.0h);const _b=vec2h(8.0h);const _c=vec2h(8.0h,16.0h);const _d=vec2h(16.0h);const _e=vec2h(16.0h,24.0h);const _f=vec2h(24.0h);const _g=vec2h(24.0h,32.0h);const _h=vec2h(32.0h,24.0h);const _i=vec2h(32.0h);const _j=vec2h(32.0h,40.0h);const _k=vec2h(40.0h,32.0h);const _l=vec2h(40.0h);const _m=vec2h(40.0h,48.0h);const _n=vec2h(48.0h);const _o=vec2h(48.0h,56.0h);const _p=vec2h(56.0h);const _q=vec2h(56.0h,64.0h);const _r=vec2h(64.0h,56.0h);const _s=vec2h(64.0h);const _t=vec2h(64.0h,72.0h);const _u=vec2h(72.0h,64.0h);const _v=vec2h(72.0h);const _w=vec2h(72.0h,80.0h);const _x=vec2h(80.0h);const _y=vec2h(80.0h,88.0h);const _z=vec2h(88.0h);const _10=vec2h(88.0h,96.0h);const _11=vec2h(96.0h,88.0h);const _12=vec2h(96.0h);const _13=vec2h(96.0h,104.0h);const _14=vec2h(104.0h,96.0h);const _15=vec2h(104.0h);const _16=vec2h(104.0h,112.0h);const _17=vec2h(112.0h);const _18=vec2h(112.0h,120.0h);const _19=vec2h(120.0h);const _1a=vec2h(120.0h,128.0h);const _1b=vec2h(128.0h,120.0h);const _1c=vec2h(128.0h);const _1d=vec2h(128.0h,136.0h);const _1e=vec2h(136.0h,128.0h);const _1f=vec2h(136.0h);const _1g=vec2h(136.0h,144.0h);const _1h=vec2h(144.0h);const _1i=vec2h(144.0h,152.0h);const _1j=vec2h(152.0h);const _1k=vec2h(152.0h,160.0h);const _1l=vec2h(160.0h,152.0h);const _1m=vec2h(160.0h);const _1n=vec2h(160.0h,168.0h);const _1o=vec2h(168.0h,160.0h);const _1p=vec2h(168.0h);const _1q=vec2h(168.0h,176.0h);const _1r=vec2h(176.0h);const _1s=vec2h(176.0h,184.0h);const _1t=vec2h(184.0h);const _1u=vec2h(184.0h,192.0h);const _1v=vec2h(192.0h,184.0h);const _1w=vec2h(192.0h);const _1x=vec2h(192.0h,200.0h);const _1y=vec2h(200.0h,192.0h);const _1z=vec2h(200.0h);const _20=vec2h(200.0h,208.0h);const _21=vec2h(208.0h);const _22=vec2h(208.0h,216.0h);const _23=vec2h(216.0h);const _24=vec2h(216.0h,224.0h);const _25=vec2h(224.0h,216.0h);const _26=vec2h(224.0h);const _27=vec2h(224.0h,232.0h);const _28=vec2h(232.0h,224.0h);const _29=vec2h(232.0h);const _2a=vec2h(232.0h,240.0h);const _2b=vec2h(240.0h,232.0h);const _2c=vec2h(240.0h);const _2d=vec2h(240.0h,248.0h);const _2e=vec2h(248.0h,240.0h);const _2f=vec2h(248.0h);const _2g=array<vec2h,256u>(vec2h(),vec2h(),_9,_9,_9,_a,_a,_b,_b,_b,_c,_c,_c,vec2h(16.0h,8.0h),vec2h(0.0h,40.0h),_d,_d,_d,_e,_e,_e,vec2h(24.0h,16.0h),vec2h(16.0h,32.0h),_f,_f,vec2h(32.0h,8.0h),_g,_g,_g,_h,_h,_h,vec2h(24.0h,48.0h),_i,_i,vec2h(40.0h,24.0h),_j,_j,_k,_k,_l,_l,_l,vec2h(56.0h,16.0h),_m,_m,vec2h(48.0h,40.0h),vec2h(32.0h,72.0h),_n,_n,_n,_o,_o,_o,vec2h(56.0h,48.0h),vec2h(48.0h,64.0h),_p,_p,vec2h(64.0h,40.0h),_q,_q,_q,_r,_r,_r,vec2h(56.0h,80.0h),_s,_s,vec2h(72.0h,56.0h),_t,_t,_u,_u,_v,_v,_v,vec2h(88.0h,48.0h),_w,_w,vec2h(80.0h,72.0h),vec2h(64.0h,104.0h),_x,_x,_x,_y,_y,_y,vec2h(88.0h,80.0h),vec2h(80.0h,96.0h),_z,_z,vec2h(96.0h,72.0h),_10,_10,_10,_11,_11,_11,vec2h(88.0h,112.0h),_12,_12,vec2h(104.0h,88.0h),_13,_13,_14,_14,_15,_15,_15,vec2h(120.0h,80.0h),_16,_16,vec2h(112.0h,104.0h),vec2h(96.0h,136.0h),_17,_17,_17,_18,_18,_18,vec2h(120.0h,112.0h),vec2h(112.0h,128.0h),_19,_19,vec2h(128.0h,104.0h),_1a,_1a,_1a,_1b,_1b,_1b,vec2h(120.0h,144.0h),_1c,_1c,vec2h(136.0h,120.0h),_1d,_1d,_1e,_1e,_1f,_1f,_1f,vec2h(152.0h,112.0h),_1g,_1g,vec2h(144.0h,136.0h),vec2h(128.0h,168.0h),_1h,_1h,_1h,_1i,_1i,_1i,vec2h(152.0h,144.0h),vec2h(144.0h,160.0h),_1j,_1j,vec2h(160.0h,136.0h),_1k,_1k,_1k,_1l,_1l,_1l,vec2h(152.0h,176.0h),_1m,_1m,vec2h(168.0h,152.0h),_1n,_1n,_1o,_1o,_1p,_1p,_1p,vec2h(184.0h,144.0h),_1q,_1q,vec2h(176.0h,168.0h),vec2h(160.0h,200.0h),_1r,_1r,_1r,_1s,_1s,_1s,vec2h(184.0h,176.0h),vec2h(176.0h,192.0h),_1t,_1t,vec2h(192.0h,168.0h),_1u,_1u,_1u,_1v,_1v,_1v,vec2h(184.0h,208.0h),_1w,_1w,vec2h(200.0h,184.0h),_1x,_1x,_1y,_1y,_1z,_1z,_1z,vec2h(216.0h,176.0h),_20,_20,vec2h(208.0h,200.0h),vec2h(192.0h,232.0h),_21,_21,_21,_22,_22,_22,vec2h(216.0h,208.0h),vec2h(208.0h,224.0h),_23,_23,vec2h(224.0h,200.0h),_24,_24,_24,_25,_25,_25,vec2h(216.0h,240.0h),_26,_26,vec2h(232.0h,216.0h),_27,_27,_28,_28,_29,_29,_29,vec2h(248.0h,208.0h),_2a,_2a,_2b,_2b,_2c,_2c,_2c,_2d,_2d,_2d,_2e,_2e,_2f,_2f);const _2h=vec2h(4.0h);const _2i=vec2h(12.0h);const _2j=vec2h(20.0h);const _2k=vec2h(28.0h);const _2l=vec2h(36.0h);const _2m=vec2h(84.0h);const _2n=vec2h(92.0h);const _2o=vec2h(100.0h);const _2p=vec2h(148.0h);const _2q=vec2h(156.0h);const _2r=vec2h(164.0h);const _2s=vec2h(212.0h);const _2t=vec2h(220.0h);const _2u=vec2h(228.0h);const _2v=vec2h(236.0h);const _2w=vec2h(244.0h);const _2x=vec2h(252.0h);const _2y=array<vec2h,256u>(vec2h(),vec2h(0.0h,4.0h),vec2h(4.0h,0.0h),_2h,_2h,vec2h(4.0h,8.0h),vec2h(8.0h,4.0h),_b,_b,vec2h(8.0h,12.0h),vec2h(12.0h,8.0h),_2i,_2i,vec2h(12.0h,16.0h),vec2h(16.0h,12.0h),_d,_d,vec2h(16.0h,20.0h),vec2h(20.0h,16.0h),_2j,_2j,vec2h(20.0h,24.0h),vec2h(24.0h,20.0h),_f,_f,vec2h(24.0h,28.0h),vec2h(28.0h,24.0h),_2k,_2k,vec2h(28.0h,32.0h),vec2h(32.0h,28.0h),_i,_i,vec2h(32.0h,36.0h),vec2h(36.0h,32.0h),_2l,_2l,vec2h(36.0h,40.0h),vec2h(40.0h,36.0h),_l,_l,vec2h(40.0h,44.0h),vec2h(44.0h,40.0h),vec2h(32.0h,64.0h),vec2h(44.0h),vec2h(44.0h,48.0h),vec2h(48.0h,44.0h),vec2h(36.0h,68.0h),_n,vec2h(48.0h,52.0h),vec2h(52.0h,48.0h),vec2h(44.0h,64.0h),vec2h(52.0h),vec2h(52.0h,56.0h),vec2h(56.0h,52.0h),vec2h(48.0h,68.0h),_p,vec2h(56.0h,60.0h),vec2h(60.0h,56.0h),_q,vec2h(60.0h),vec2h(60.0h,64.0h),_r,vec2h(64.0h,60.0h),vec2h(68.0h,56.0h),_s,vec2h(64.0h,68.0h),vec2h(68.0h,64.0h),vec2h(72.0h,60.0h),vec2h(68.0h),vec2h(68.0h,72.0h),vec2h(72.0h,68.0h),vec2h(80.0h,56.0h),_v,vec2h(72.0h,76.0h),vec2h(76.0h,72.0h),vec2h(84.0h,60.0h),vec2h(76.0h),vec2h(76.0h,80.0h),vec2h(80.0h,76.0h),_x,_x,vec2h(80.0h,84.0h),vec2h(84.0h,80.0h),_2m,_2m,vec2h(84.0h,88.0h),vec2h(88.0h,84.0h),_z,_z,vec2h(88.0h,92.0h),vec2h(92.0h,88.0h),_2n,_2n,vec2h(92.0h,96.0h),vec2h(96.0h,92.0h),_12,_12,vec2h(96.0h,100.0h),vec2h(100.0h,96.0h),_2o,_2o,vec2h(100.0h,104.0h),vec2h(104.0h,100.0h),_15,_15,vec2h(104.0h,108.0h),vec2h(108.0h,104.0h),vec2h(96.0h,128.0h),vec2h(108.0h),vec2h(108.0h,112.0h),vec2h(112.0h,108.0h),vec2h(100.0h,132.0h),_17,vec2h(112.0h,116.0h),vec2h(116.0h,112.0h),vec2h(108.0h,128.0h),vec2h(116.0h),vec2h(116.0h,120.0h),vec2h(120.0h,116.0h),vec2h(112.0h,132.0h),_19,vec2h(120.0h,124.0h),vec2h(124.0h,120.0h),_1a,vec2h(124.0h),vec2h(124.0h,128.0h),_1b,vec2h(128.0h,124.0h),vec2h(132.0h,120.0h),_1c,vec2h(128.0h,132.0h),vec2h(132.0h,128.0h),vec2h(136.0h,124.0h),vec2h(132.0h),vec2h(132.0h,136.0h),vec2h(136.0h,132.0h),vec2h(144.0h,120.0h),_1f,vec2h(136.0h,140.0h),vec2h(140.0h,136.0h),vec2h(148.0h,124.0h),vec2h(140.0h),vec2h(140.0h,144.0h),vec2h(144.0h,140.0h),_1h,_1h,vec2h(144.0h,148.0h),vec2h(148.0h,144.0h),_2p,_2p,vec2h(148.0h,152.0h),vec2h(152.0h,148.0h),_1j,_1j,vec2h(152.0h,156.0h),vec2h(156.0h,152.0h),_2q,_2q,vec2h(156.0h,160.0h),vec2h(160.0h,156.0h),_1m,_1m,vec2h(160.0h,164.0h),vec2h(164.0h,160.0h),_2r,_2r,vec2h(164.0h,168.0h),vec2h(168.0h,164.0h),_1p,_1p,vec2h(168.0h,172.0h),vec2h(172.0h,168.0h),vec2h(160.0h,192.0h),vec2h(172.0h),vec2h(172.0h,176.0h),vec2h(176.0h,172.0h),vec2h(164.0h,196.0h),_1r,vec2h(176.0h,180.0h),vec2h(180.0h,176.0h),vec2h(172.0h,192.0h),vec2h(180.0h),vec2h(180.0h,184.0h),vec2h(184.0h,180.0h),vec2h(176.0h,196.0h),_1t,vec2h(184.0h,188.0h),vec2h(188.0h,184.0h),_1u,vec2h(188.0h),vec2h(188.0h,192.0h),_1v,vec2h(192.0h,188.0h),vec2h(196.0h,184.0h),_1w,vec2h(192.0h,196.0h),vec2h(196.0h,192.0h),vec2h(200.0h,188.0h),vec2h(196.0h),vec2h(196.0h,200.0h),vec2h(200.0h,196.0h),vec2h(208.0h,184.0h),_1z,vec2h(200.0h,204.0h),vec2h(204.0h,200.0h),vec2h(212.0h,188.0h),vec2h(204.0h),vec2h(204.0h,208.0h),vec2h(208.0h,204.0h),_21,_21,vec2h(208.0h,212.0h),vec2h(212.0h,208.0h),_2s,_2s,vec2h(212.0h,216.0h),vec2h(216.0h,212.0h),_23,_23,vec2h(216.0h,220.0h),vec2h(220.0h,216.0h),_2t,_2t,vec2h(220.0h,224.0h),vec2h(224.0h,220.0h),_26,_26,vec2h(224.0h,228.0h),vec2h(228.0h,224.0h),_2u,_2u,vec2h(228.0h,232.0h),vec2h(232.0h,228.0h),_29,_29,vec2h(232.0h,236.0h),vec2h(236.0h,232.0h),_2v,_2v,vec2h(236.0h,240.0h),vec2h(240.0h,236.0h),_2c,_2c,vec2h(240.0h,244.0h),vec2h(244.0h,240.0h),_2w,_2w,vec2h(244.0h,248.0h),vec2h(248.0h,244.0h),_2f,_2f,vec2h(248.0h,252.0h),vec2h(252.0h,248.0h),_2x,_2x);fn _2z(){var _30:array<vec2h,256u>;var _31:array<vec2h,256u>;var _32:array<vec2h,256u>;var _33:array<vec2h,256u>;var _34:array<vec2h,256u>;var _35:array<vec2h,256u>;var _36:bool;var _37:bool;var _38:f16;var _39:f16;var _3a:f16;var _3b:f16;var _3c:vec3h;var _3d:vec3h;var _3e:vec3h;var _3f:vec3h;var _3g:bool;var _3h:u32;var _3i:u32;var _3j:vec3h;var _3k:vec3h;var _3l:vec3h;var _3m:vec3h;var _3n:u32;var _3o:u32;switch(0u){default:{let _3p=bitcast<vec2u>(vec2i(textureDimensions(_3,0i)));let _3q=((_3p.x+3u)/4u);let _3r=x_2270;let _3s=x_2270.xy;let _3t=x_2270.x;let _3u=(_3t>=_3q);_37=_3u;if(!(_3u)){_36=(_3r.y>=((_3p.y+3u)/4u));_37=_36;}if(_37){break;}let _3v=(vec2f(1.0f)/vec2f(vec2i(textureDimensions(_3,0i))));let _3w=((vec2f(bitcast<vec2i>((_3s*vec2u(4u))))*_3v)+_3v);let _3x=vec4h(textureGather(0i,_3,_2,_3w,vec2i()));let _3y=vec4h(textureGather(0i,_3,_2,_3w,_4));let _3z=vec4h(textureGather(0i,_3,_2,_3w,_5));let _40=vec4h(textureGather(0i,_3,_2,_3w,_6));let _41=vec4h(textureGather(1i,_3,_2,_3w,vec2i()));let _42=vec4h(textureGather(1i,_3,_2,_3w,_4));let _43=vec4h(textureGather(1i,_3,_2,_3w,_5));let _44=vec4h(textureGather(1i,_3,_2,_3w,_6));let _45=vec4h(textureGather(2i,_3,_2,_3w,vec2i()));let _46=vec4h(textureGather(2i,_3,_2,_3w,_4));let _47=vec4h(textureGather(2i,_3,_2,_3w,_5));let _48=vec4h(textureGather(2i,_3,_2,_3w,_6));let _49=vec3h(_3x.w,_41.w,_45.w);let _4a=vec3h(_3x.z,_41.z,_45.z);let _4b=vec3h(_3y.w,_42.w,_46.w);let _4c=vec3h(_3y.z,_42.z,_46.z);let _4d=vec3h(_3x.x,_41.x,_45.x);let _4e=vec3h(_3x.y,_41.y,_45.y);let _4f=vec3h(_3y.x,_42.x,_46.x);let _4g=vec3h(_3y.y,_42.y,_46.y);let _4h=vec3h(_3z.w,_43.w,_47.w);let _4i=vec3h(_3z.z,_43.z,_47.z);let _4j=vec3h(_40.w,_44.w,_48.w);let _4k=vec3h(_40.z,_44.z,_48.z);let _4l=vec3h(_3z.x,_43.x,_47.x);let _4m=vec3h(_3z.y,_43.y,_47.y);let _4n=vec3h(_40.x,_44.x,_48.x);let _4o=vec3h(_40.y,_44.y,_48.y);let _4p=(((((((((((((((_49+_4a)+_4b)+_4c)+_4d)+_4e)+_4f)+_4g)+_4h)+_4i)+_4j)+_4k)+_4l)+_4m)+_4n)+_4o);let _4q=((_49*16.0h)-_4p);let _4r=_4q.x;let _4s=_4q.y;let _4t=_4q.z;let _4u=((_4a*16.0h)-_4p);let _4v=_4u.x;let _4w=_4u.y;let _4x=_4u.z;let _4y=((_4b*16.0h)-_4p);let _4z=_4y.x;let _50=_4y.y;let _51=_4y.z;let _52=((_4c*16.0h)-_4p);let _53=_52.x;let _54=_52.y;let _55=_52.z;let _56=((_4d*16.0h)-_4p);let _57=_56.x;let _58=_56.y;let _59=_56.z;let _5a=((_4e*16.0h)-_4p);let _5b=_5a.x;let _5c=_5a.y;let _5d=_5a.z;let _5e=((_4f*16.0h)-_4p);let _5f=_5e.x;let _5g=_5e.y;let _5h=_5e.z;let _5i=((_4g*16.0h)-_4p);let _5j=_5i.x;let _5k=_5i.y;let _5l=_5i.z;let _5m=((_4h*16.0h)-_4p);let _5n=_5m.x;let _5o=_5m.y;let _5p=_5m.z;let _5q=((_4i*16.0h)-_4p);let _5r=_5q.x;let _5s=_5q.y;let _5t=_5q.z;let _5u=((_4j*16.0h)-_4p);let _5v=_5u.x;let _5w=_5u.y;let _5x=_5u.z;let _5y=((_4k*16.0h)-_4p);let _5z=_5y.x;let _60=_5y.y;let _61=_5y.z;let _62=((_4l*16.0h)-_4p);let _63=_62.x;let _64=_62.y;let _65=_62.z;let _66=((_4m*16.0h)-_4p);let _67=_66.x;let _68=_66.y;let _69=_66.z;let _6a=((_4n*16.0h)-_4p);let _6b=_6a.x;let _6c=_6a.y;let _6d=_6a.z;let _6e=((_4o*16.0h)-_4p);let _6f=_6e.x;let _6g=((((((((((((((((_4r*_4r)+(_4v*_4v))+(_4z*_4z))+(_53*_53))+(_57*_57))+(_5b*_5b))+(_5f*_5f))+(_5j*_5j))+(_5n*_5n))+(_5r*_5r))+(_5v*_5v))+(_5z*_5z))+(_63*_63))+(_67*_67))+(_6b*_6b))+(_6f*_6f));let _6h=_6e.y;let _6i=_6e.z;let _6j=((((((((((((((((_4s*_4s)+(_4w*_4w))+(_50*_50))+(_54*_54))+(_58*_58))+(_5c*_5c))+(_5g*_5g))+(_5k*_5k))+(_5o*_5o))+(_5s*_5s))+(_5w*_5w))+(_60*_60))+(_64*_64))+(_68*_68))+(_6c*_6c))+(_6h*_6h));let _6k=((((((((((((((((_4t*_4t)+(_4x*_4x))+(_51*_51))+(_55*_55))+(_59*_59))+(_5d*_5d))+(_5h*_5h))+(_5l*_5l))+(_5p*_5p))+(_5t*_5t))+(_5x*_5x))+(_61*_61))+(_65*_65))+(_69*_69))+(_6d*_6d))+(_6i*_6i));let _6l=select(1.0h,0.015625h,(max(max(_6g,_6j),_6k)>64.0h));let _6m=(_6g*_6l);let _6n=(((((((((((((((((_4r*_4s)+(_4v*_4w))+(_4z*_50))+(_53*_54))+(_57*_58))+(_5b*_5c))+(_5f*_5g))+(_5j*_5k))+(_5n*_5o))+(_5r*_5s))+(_5v*_5w))+(_5z*_60))+(_63*_64))+(_67*_68))+(_6b*_6c))+(_6f*_6h))*_6l);let _6o=(((((((((((((((((_4r*_4t)+(_4v*_4x))+(_4z*_51))+(_53*_55))+(_57*_59))+(_5b*_5d))+(_5f*_5h))+(_5j*_5l))+(_5n*_5p))+(_5r*_5t))+(_5v*_5x))+(_5z*_61))+(_63*_65))+(_67*_69))+(_6b*_6d))+(_6f*_6i))*_6l);let _6p=(_6j*_6l);let _6q=(((((((((((((((((_4s*_4t)+(_4w*_4x))+(_50*_51))+(_54*_55))+(_58*_59))+(_5c*_5d))+(_5g*_5h))+(_5k*_5l))+(_5o*_5p))+(_5s*_5t))+(_5w*_5x))+(_60*_61))+(_64*_65))+(_68*_69))+(_6c*_6d))+(_6h*_6i))*_6l);let _6r=(_6k*_6l);let _6s=(vec3h(_6m,_6p,_6r)+vec3h(0.0001220703125h));let _6t=vec3h((vec3f(_6s)*(1.0f/f32(max(max(_6s.x,_6s.y),_6s.z)))));let _6u=_6t.x;_39=_6u;if((_6n<0.0h)){_38=-(_6u);_39=_38;}let _6v=_6t.z;_3b=_6v;if((_6q<0.0h)){_3a=-(_6v);_3b=_3a;}let _6w=_6t.y;let _6x=(((_39*_6m)+(_6w*_6n))+(_3b*_6o));let _6y=(((_39*_6n)+(_6w*_6p))+(_3b*_6q));let _6z=(((_39*_6o)+(_6w*_6q))+(_3b*_6r));let _70=max(max(abs(_6x),abs(_6y)),abs(_6z));let _71=vec3h((vec3f(f32(_6x),f32(_6y),f32(_6z))*(1.0f/f32(select(_70,1.0h,(_70==0.0h))))));let _72=_71.x;let _73=_71.y;let _74=_71.z;let _75=(((_72*_6m)+(_73*_6n))+(_74*_6o));let _76=(((_72*_6n)+(_73*_6p))+(_74*_6q));let _77=(((_72*_6o)+(_73*_6q))+(_74*_6r));let _78=max(max(abs(_75),abs(_76)),abs(_77));let _79=(_78==0.0h);let _7a=select(vec3h((vec3f(f32(_75),f32(_76),f32(_77))*(1.0f/f32(select(_78,1.0h,_79))))),_7,vec3<bool>(_79));let _7b=(_4p*0.0625h);let _7c=(_7a*_8);let _7d=(1.0h/dot(_7c,_7c));let _7e=((_7c*_7d)*_8);let _7f=dot(_49,_7e);let _7g=dot(_4a,_7e);let _7h=(_7g<_7f);let _7i=select(1u,0u,_7h);let _7j=select(_7f,_7g,_7h);let _7k=(_7g>_7f);let _7l=select(1u,0u,_7k);let _7m=select(_7f,_7g,_7k);let _7n=dot(_4b,_7e);let _7o=(_7n<_7j);let _7p=select(select(_7i,(_7i+1u),(_7g==_7j)),0u,_7o);let _7q=select(_7j,_7n,_7o);let _7r=(_7n>_7m);let _7s=select(select(_7l,(_7l+1u),(_7g==_7m)),0u,_7r);let _7t=select(_7m,_7n,_7r);let _7u=dot(_4c,_7e);let _7v=(_7u<_7q);let _7w=select(select(_7p,(_7p+1u),(_7n==_7q)),0u,_7v);let _7x=select(_7q,_7u,_7v);let _7y=(_7u>_7t);let _7z=select(select(_7s,(_7s+1u),(_7n==_7t)),0u,_7y);let _80=select(_7t,_7u,_7y);let _81=dot(_4d,_7e);let _82=(_81<_7x);let _83=select(select(_7w,(_7w+1u),(_7u==_7x)),0u,_82);let _84=select(_7x,_81,_82);let _85=(_81>_80);let _86=select(select(_7z,(_7z+1u),(_7u==_80)),0u,_85);let _87=select(_80,_81,_85);let _88=dot(_4e,_7e);let _89=(_88<_84);let _8a=select(select(_83,(_83+1u),(_81==_84)),0u,_89);let _8b=select(_84,_88,_89);let _8c=(_88>_87);let _8d=select(select(_86,(_86+1u),(_81==_87)),0u,_8c);let _8e=select(_87,_88,_8c);let _8f=dot(_4f,_7e);let _8g=(_8f<_8b);let _8h=select(select(_8a,(_8a+1u),(_88==_8b)),0u,_8g);let _8i=select(_8b,_8f,_8g);let _8j=(_8f>_8e);let _8k=select(select(_8d,(_8d+1u),(_88==_8e)),0u,_8j);let _8l=select(_8e,_8f,_8j);let _8m=dot(_4g,_7e);let _8n=(_8m<_8i);let _8o=select(select(_8h,(_8h+1u),(_8f==_8i)),0u,_8n);let _8p=select(_8i,_8m,_8n);let _8q=(_8m>_8l);let _8r=select(select(_8k,(_8k+1u),(_8f==_8l)),0u,_8q);let _8s=select(_8l,_8m,_8q);let _8t=dot(_4h,_7e);let _8u=(_8t<_8p);let _8v=select(select(_8o,(_8o+1u),(_8m==_8p)),0u,_8u);let _8w=select(_8p,_8t,_8u);let _8x=(_8t>_8s);let _8y=select(select(_8r,(_8r+1u),(_8m==_8s)),0u,_8x);let _8z=select(_8s,_8t,_8x);let _90=dot(_4i,_7e);let _91=(_90<_8w);let _92=select(select(_8v,(_8v+1u),(_8t==_8w)),0u,_91);let _93=select(_8w,_90,_91);let _94=(_90>_8z);let _95=select(select(_8y,(_8y+1u),(_8t==_8z)),0u,_94);let _96=select(_8z,_90,_94);let _97=dot(_4j,_7e);let _98=(_97<_93);let _99=select(select(_92,(_92+1u),(_90==_93)),0u,_98);let _9a=select(_93,_97,_98);let _9b=(_97>_96);let _9c=select(select(_95,(_95+1u),(_90==_96)),0u,_9b);let _9d=select(_96,_97,_9b);let _9e=dot(_4k,_7e);let _9f=(_9e<_9a);let _9g=select(select(_99,(_99+1u),(_97==_9a)),0u,_9f);let _9h=select(_9a,_9e,_9f);let _9i=(_9e>_9d);let _9j=select(select(_9c,(_9c+1u),(_97==_9d)),0u,_9i);let _9k=select(_9d,_9e,_9i);let _9l=dot(_4l,_7e);let _9m=(_9l<_9h);let _9n=select(select(_9g,(_9g+1u),(_9e==_9h)),0u,_9m);let _9o=select(_9h,_9l,_9m);let _9p=(_9l>_9k);let _9q=select(select(_9j,(_9j+1u),(_9e==_9k)),0u,_9p);let _9r=select(_9k,_9l,_9p);let _9s=dot(_4m,_7e);let _9t=(_9s<_9o);let _9u=select(select(_9n,(_9n+1u),(_9l==_9o)),0u,_9t);let _9v=select(_9o,_9s,_9t);let _9w=(_9s>_9r);let _9x=select(select(_9q,(_9q+1u),(_9l==_9r)),0u,_9w);let _9y=select(_9r,_9s,_9w);let _9z=dot(_4n,_7e);let _a0=(_9z<_9v);let _a1=select(select(_9u,(_9u+1u),(_9s==_9v)),0u,_a0);let _a2=select(_9v,_9z,_a0);let _a3=(_9z>_9y);let _a4=select(select(_9x,(_9x+1u),(_9s==_9y)),0u,_a3);let _a5=select(_9y,_9z,_a3);let _a6=dot(_4o,_7e);let _a7=(_a6<_a2);let _a8=select(select(_a1,(_a1+1u),(_9z==_a2)),0u,_a7);let _a9=select(_a2,_a6,_a7);let _aa=(_a6>_a5);let _ab=select(select(_a4,(_a4+1u),(_9z==_a5)),0u,_aa);let _ac=select(_a5,_a6,_aa);let _ad=dot(_7b,_7e);let _ae=(_a9-_ad);let _af=(_ac-_ad);let _ag=(((_af-_ae)*0.0625h)*(1.0h-clamp((f16(((select(_a8,(_a8+1u),(_a6==_a9))+select(_ab,(_ab+1u),(_a6==_ac)))-2u))*0.0714111328125h),0.0h,1.0h)));let _ah=(_ae+_ag);let _ai=(_af-_ag);let _aj=max(0.0h,(((((0.6357421875h*0.03125h)*_7d)+(0.36376953125h*0.03125h))-(_ai-_ah))*0.5h));let _ak=clamp(((_7a*(_ah-_aj))+_7b),vec3h(),_7);let _al=clamp(((_7a*(_ai+_aj))+_7b),vec3h(),_7);let _am=_ak.x;let _an=(trunc((_am*31.0h))*8.25h);let _ao=trunc(_an);let _ap=min(255.0h,trunc((_an+8.25h)));let _aq=_ak.y;let _ar=(trunc((_aq*63.0h))*4.0625h);let _as=min(255.0h,trunc(_ar));let _at=min(255.0h,trunc((_ar+4.0625h)));let _au=_ak.z;let _av=(trunc((_au*31.0h))*8.25h);let _aw=trunc(_av);let _ax=min(255.0h,trunc((_av+8.25h)));let _ay=vec3h(select(_ao,_ap,((255.0h*_am)>(0.5h*(_ao+_ap)))),select(_as,_at,((255.0h*_aq)>(0.5h*(_as+_at)))),select(_aw,_ax,((255.0h*_au)>(0.5h*(_aw+_ax)))));let _az=_al.x;let _b0=(trunc((_az*31.0h))*8.25h);let _b1=trunc(_b0);let _b2=min(255.0h,trunc((_b0+8.25h)));let _b3=_al.y;let _b4=(trunc((_b3*63.0h))*4.0625h);let _b5=min(255.0h,trunc(_b4));let _b6=min(255.0h,trunc((_b4+4.0625h)));let _b7=_al.z;let _b8=(trunc((_b7*31.0h))*8.25h);let _b9=trunc(_b8);let _ba=min(255.0h,trunc((_b8+8.25h)));let _bb=vec3h(select(_b1,_b2,((255.0h*_az)>(0.5h*(_b1+_b2)))),select(_b5,_b6,((255.0h*_b3)>(0.5h*(_b5+_b6)))),select(_b9,_ba,((255.0h*_b7)>(0.5h*(_b9+_ba)))));let _bc=(((_bb-_ay)*_8)*0.0039215087890625h);let _bd=((_bc*(1.0h/dot(_bc,_bc)))*_8);let _be=(dot(_ay,_bd)*0.0039215087890625h);let _bf=((((((((((((((((0u|(u32(((3.0h*clamp((dot(_49,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(0i)))|(u32(((3.0h*clamp((dot(_4a,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(2i)))|(u32(((3.0h*clamp((dot(_4b,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(4i)))|(u32(((3.0h*clamp((dot(_4c,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(6i)))|(u32(((3.0h*clamp((dot(_4d,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(8i)))|(u32(((3.0h*clamp((dot(_4e,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(10i)))|(u32(((3.0h*clamp((dot(_4f,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(12i)))|(u32(((3.0h*clamp((dot(_4g,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(14i)))|(u32(((3.0h*clamp((dot(_4h,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(16i)))|(u32(((3.0h*clamp((dot(_4i,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(18i)))|(u32(((3.0h*clamp((dot(_4j,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(20i)))|(u32(((3.0h*clamp((dot(_4k,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(22i)))|(u32(((3.0h*clamp((dot(_4l,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(24i)))|(u32(((3.0h*clamp((dot(_4m,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(26i)))|(u32(((3.0h*clamp((dot(_4n,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(28i)))|(u32(((3.0h*clamp((dot(_4o,_bd)-_be),0.0h,1.0h))+0.5h))<<bitcast<u32>(30i)));switch(0u){default:{if(((_bf^(_bf<<bitcast<u32>(2i)))<4u)){_3e=_bb;_3f=_ay;_3g=false;break;}let _bg=(_bf>>bitcast<u32>(1i));let _bh=f16(bitcast<i32>(countOneBits(((1431655765u&~(_bg))&_bf))));let _bi=(1431655765u&_bg);let _bj=f16(bitcast<i32>(countOneBits((_bi&~(_bf)))));let _bk=f16(bitcast<i32>(countOneBits((_bi&_bf))));let _bl=(((3.0h*_bk)+(2.0h*_bj))+_bh);let _bm=(((9.0h*_bk)+(4.0h*_bj))+_bh);let _bn=((144.0h-(6.0h*_bl))+_bm);let _bo=((3.0h*_bl)-_bm);let _bp=(((((((((((((((((_49*f16(((_bf>>bitcast<u32>(0i))&3u)))+(_4a*f16(((_bf>>bitcast<u32>(2i))&3u))))+(_4b*f16(((_bf>>bitcast<u32>(4i))&3u))))+(_4c*f16(((_bf>>bitcast<u32>(6i))&3u))))+(_4d*f16(((_bf>>bitcast<u32>(8i))&3u))))+(_4e*f16(((_bf>>bitcast<u32>(10i))&3u))))+(_4f*f16(((_bf>>bitcast<u32>(12i))&3u))))+(_4g*f16(((_bf>>bitcast<u32>(14i))&3u))))+(_4h*f16(((_bf>>bitcast<u32>(16i))&3u))))+(_4i*f16(((_bf>>bitcast<u32>(18i))&3u))))+(_4j*f16(((_bf>>bitcast<u32>(20i))&3u))))+(_4k*f16(((_bf>>bitcast<u32>(22i))&3u))))+(_4l*f16(((_bf>>bitcast<u32>(24i))&3u))))+(_4m*f16(((_bf>>bitcast<u32>(26i))&3u))))+(_4n*f16(((_bf>>bitcast<u32>(28i))&3u))))+(_4o*f16(((_bf>>bitcast<u32>(30i))&3u))))*3.0h);let _bq=((_4p*9.0h)-_bp);let _br=(1.0f/f32(((_bn*_bm)-(_bo*_bo))));let _bs=f16((f32(_bo)*_br));let _bt=clamp(((_bq*f16((f32(_bm)*_br)))-(_bp*_bs)),vec3h(),_7);let _bu=clamp(((_bp*f16((f32(_bn)*_br)))-(_bq*_bs)),vec3h(),_7);let _bv=_bt.x;let _bw=(trunc((_bv*31.0h))*8.25h);let _bx=trunc(_bw);let _by=min(255.0h,trunc((_bw+8.25h)));let _bz=_bt.y;let _c0=(trunc((_bz*63.0h))*4.0625h);let _c1=min(255.0h,trunc(_c0));let _c2=min(255.0h,trunc((_c0+4.0625h)));let _c3=_bt.z;let _c4=(trunc((_c3*31.0h))*8.25h);let _c5=trunc(_c4);let _c6=min(255.0h,trunc((_c4+8.25h)));_3c=vec3h(select(_bx,_by,((255.0h*_bv)>(0.5h*(_bx+_by)))),select(_c1,_c2,((255.0h*_bz)>(0.5h*(_c1+_c2)))),select(_c5,_c6,((255.0h*_c3)>(0.5h*(_c5+_c6)))));let _c7=_bu.x;let _c8=(trunc((_c7*31.0h))*8.25h);let _c9=trunc(_c8);let _ca=min(255.0h,trunc((_c8+8.25h)));let _cb=_bu.y;let _cc=(trunc((_cb*63.0h))*4.0625h);let _cd=min(255.0h,trunc(_cc));let _ce=min(255.0h,trunc((_cc+4.0625h)));let _cf=_bu.z;let _cg=(trunc((_cf*31.0h))*8.25h);let _ch=trunc(_cg);let _ci=min(255.0h,trunc((_cg+8.25h)));_3d=vec3h(select(_c9,_ca,((255.0h*_c7)>(0.5h*(_c9+_ca)))),select(_cd,_ce,((255.0h*_cb)>(0.5h*(_cd+_ce)))),select(_ch,_ci,((255.0h*_cf)>(0.5h*(_ch+_ci)))));_3e=_3d;_3f=_3c;_3g=true;}}_3i=_bf;if(_3g){let _cj=(((_3e-_3f)*_8)*0.0039215087890625h);let _ck=((_cj*(1.0h/dot(_cj,_cj)))*_8);let _cl=(dot(_3f,_ck)*0.0039215087890625h);_3h=((((((((((((((((0u|(u32(((3.0h*clamp((dot(_49,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(0i)))|(u32(((3.0h*clamp((dot(_4a,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(2i)))|(u32(((3.0h*clamp((dot(_4b,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(4i)))|(u32(((3.0h*clamp((dot(_4c,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(6i)))|(u32(((3.0h*clamp((dot(_4d,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(8i)))|(u32(((3.0h*clamp((dot(_4e,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(10i)))|(u32(((3.0h*clamp((dot(_4f,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(12i)))|(u32(((3.0h*clamp((dot(_4g,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(14i)))|(u32(((3.0h*clamp((dot(_4h,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(16i)))|(u32(((3.0h*clamp((dot(_4i,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(18i)))|(u32(((3.0h*clamp((dot(_4j,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(20i)))|(u32(((3.0h*clamp((dot(_4k,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(22i)))|(u32(((3.0h*clamp((dot(_4l,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(24i)))|(u32(((3.0h*clamp((dot(_4m,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(26i)))|(u32(((3.0h*clamp((dot(_4n,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(28i)))|(u32(((3.0h*clamp((dot(_4o,_ck)-_cl),0.0h,1.0h))+0.5h))<<bitcast<u32>(30i)));_3i=_3h;}let _cm=((_3i^(_3i<<bitcast<u32>(2i)))<4u);_3l=_3e;_3m=_3f;if(_cm){let _cn=(_4p*15.9375h);let _co=i32(_cn.x);_30=_2g;let _cp=_30[_co].x;_31=_2g;let _cq=_31[_co].y;let _cr=i32(_cn.y);_32=_2y;let _cs=_32[_cr].x;_33=_2y;let _ct=_33[_cr].y;let _cu=i32(_cn.z);_34=_2g;_3j=vec3h(_cp,_cs,_34[_cu].x);_35=_2g;_3k=vec3h(_cq,_ct,_35[_cu].y);_3l=_3k;_3m=_3j;}let _cv=select(_3i,1431655765u,_cm);let _cw=((((u32(_3m.x)>>bitcast<u32>(3i))<<bitcast<u32>(11i))|((u32(_3m.y)>>bitcast<u32>(2i))<<bitcast<u32>(5i)))|(u32(_3m.z)>>bitcast<u32>(3i)));let _cx=((((u32(_3l.x)>>bitcast<u32>(3i))<<bitcast<u32>(11i))|((u32(_3l.y)>>bitcast<u32>(2i))<<bitcast<u32>(5i)))|(u32(_3l.z)>>bitcast<u32>(3i)));let _cy=(_cw<_cx);_3o=_cv;if(_cy){_3n=~(_cv);_3o=_3n;}let _cz=((_3o&2863311530u)>>bitcast<u32>(1i));x_2367._0[((_3r.y*((_3q+31u)&4294967264u))+_3t)]=vec2u((select(_cw,_cx,_cy)|(select(_cx,_cw,_cy)<<bitcast<u32>(16i))),((((_3o&1431655765u)^_cz)<<bitcast<u32>(1i))|_cz));}}return;}@compute @workgroup_size(16i, 16i, 1i) fn main(@builtin(global_invocation_id) _d0:vec3u,@builtin(local_invocation_id) _d1:vec3u,@builtin(workgroup_id) _d2:vec3u){x_2270=_d0;x_2276=_d1;_2z();}";
|
|
2
|
-
export {
|
|
3
|
-
spark_bc1_rgb as default
|
|
4
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const spark_bc3_rgba = "enable f16;alias RTArr=array<vec4u>;struct _1{_0:RTArr,}@binding(1) @group(0) var _2:sampler;@binding(0) @group(0) var _3:texture_2d<f32>;var<private>x_2912:vec3u;var<private>x_2918:vec3u;@binding(2) @group(0) var<storage,read_write>x_3008:_1;const _4=vec2i(2i,0i);const _5=vec2i(0i,2i);const _6=vec2i(2i);const _7=array<f32,8u>(0.0f,0.140625f,0.28125f,0.421875f,0.578125f,0.71875f,0.859375f,1.0f);const _8=vec3h(1.0h);const _9=vec3h(0.85986328125h,1.7099609375h,0.429931640625h);const _a=vec2h(0.0h,8.0h);const _b=vec2h(8.0h,0.0h);const _c=vec2h(8.0h);const _d=vec2h(8.0h,16.0h);const _e=vec2h(16.0h);const _f=vec2h(16.0h,24.0h);const _g=vec2h(24.0h);const _h=vec2h(24.0h,32.0h);const _i=vec2h(32.0h,24.0h);const _j=vec2h(32.0h);const _k=vec2h(32.0h,40.0h);const _l=vec2h(40.0h,32.0h);const _m=vec2h(40.0h);const _n=vec2h(40.0h,48.0h);const _o=vec2h(48.0h);const _p=vec2h(48.0h,56.0h);const _q=vec2h(56.0h);const _r=vec2h(56.0h,64.0h);const _s=vec2h(64.0h,56.0h);const _t=vec2h(64.0h);const _u=vec2h(64.0h,72.0h);const _v=vec2h(72.0h,64.0h);const _w=vec2h(72.0h);const _x=vec2h(72.0h,80.0h);const _y=vec2h(80.0h);const _z=vec2h(80.0h,88.0h);const _10=vec2h(88.0h);const _11=vec2h(88.0h,96.0h);const _12=vec2h(96.0h,88.0h);const _13=vec2h(96.0h);const _14=vec2h(96.0h,104.0h);const _15=vec2h(104.0h,96.0h);const _16=vec2h(104.0h);const _17=vec2h(104.0h,112.0h);const _18=vec2h(112.0h);const _19=vec2h(112.0h,120.0h);const _1a=vec2h(120.0h);const _1b=vec2h(120.0h,128.0h);const _1c=vec2h(128.0h,120.0h);const _1d=vec2h(128.0h);const _1e=vec2h(128.0h,136.0h);const _1f=vec2h(136.0h,128.0h);const _1g=vec2h(136.0h);const _1h=vec2h(136.0h,144.0h);const _1i=vec2h(144.0h);const _1j=vec2h(144.0h,152.0h);const _1k=vec2h(152.0h);const _1l=vec2h(152.0h,160.0h);const _1m=vec2h(160.0h,152.0h);const _1n=vec2h(160.0h);const _1o=vec2h(160.0h,168.0h);const _1p=vec2h(168.0h,160.0h);const _1q=vec2h(168.0h);const _1r=vec2h(168.0h,176.0h);const _1s=vec2h(176.0h);const _1t=vec2h(176.0h,184.0h);const _1u=vec2h(184.0h);const _1v=vec2h(184.0h,192.0h);const _1w=vec2h(192.0h,184.0h);const _1x=vec2h(192.0h);const _1y=vec2h(192.0h,200.0h);const _1z=vec2h(200.0h,192.0h);const _20=vec2h(200.0h);const _21=vec2h(200.0h,208.0h);const _22=vec2h(208.0h);const _23=vec2h(208.0h,216.0h);const _24=vec2h(216.0h);const _25=vec2h(216.0h,224.0h);const _26=vec2h(224.0h,216.0h);const _27=vec2h(224.0h);const _28=vec2h(224.0h,232.0h);const _29=vec2h(232.0h,224.0h);const _2a=vec2h(232.0h);const _2b=vec2h(232.0h,240.0h);const _2c=vec2h(240.0h,232.0h);const _2d=vec2h(240.0h);const _2e=vec2h(240.0h,248.0h);const _2f=vec2h(248.0h,240.0h);const _2g=vec2h(248.0h);const _2h=array<vec2h,256u>(vec2h(),vec2h(),_a,_a,_a,_b,_b,_c,_c,_c,_d,_d,_d,vec2h(16.0h,8.0h),vec2h(0.0h,40.0h),_e,_e,_e,_f,_f,_f,vec2h(24.0h,16.0h),vec2h(16.0h,32.0h),_g,_g,vec2h(32.0h,8.0h),_h,_h,_h,_i,_i,_i,vec2h(24.0h,48.0h),_j,_j,vec2h(40.0h,24.0h),_k,_k,_l,_l,_m,_m,_m,vec2h(56.0h,16.0h),_n,_n,vec2h(48.0h,40.0h),vec2h(32.0h,72.0h),_o,_o,_o,_p,_p,_p,vec2h(56.0h,48.0h),vec2h(48.0h,64.0h),_q,_q,vec2h(64.0h,40.0h),_r,_r,_r,_s,_s,_s,vec2h(56.0h,80.0h),_t,_t,vec2h(72.0h,56.0h),_u,_u,_v,_v,_w,_w,_w,vec2h(88.0h,48.0h),_x,_x,vec2h(80.0h,72.0h),vec2h(64.0h,104.0h),_y,_y,_y,_z,_z,_z,vec2h(88.0h,80.0h),vec2h(80.0h,96.0h),_10,_10,vec2h(96.0h,72.0h),_11,_11,_11,_12,_12,_12,vec2h(88.0h,112.0h),_13,_13,vec2h(104.0h,88.0h),_14,_14,_15,_15,_16,_16,_16,vec2h(120.0h,80.0h),_17,_17,vec2h(112.0h,104.0h),vec2h(96.0h,136.0h),_18,_18,_18,_19,_19,_19,vec2h(120.0h,112.0h),vec2h(112.0h,128.0h),_1a,_1a,vec2h(128.0h,104.0h),_1b,_1b,_1b,_1c,_1c,_1c,vec2h(120.0h,144.0h),_1d,_1d,vec2h(136.0h,120.0h),_1e,_1e,_1f,_1f,_1g,_1g,_1g,vec2h(152.0h,112.0h),_1h,_1h,vec2h(144.0h,136.0h),vec2h(128.0h,168.0h),_1i,_1i,_1i,_1j,_1j,_1j,vec2h(152.0h,144.0h),vec2h(144.0h,160.0h),_1k,_1k,vec2h(160.0h,136.0h),_1l,_1l,_1l,_1m,_1m,_1m,vec2h(152.0h,176.0h),_1n,_1n,vec2h(168.0h,152.0h),_1o,_1o,_1p,_1p,_1q,_1q,_1q,vec2h(184.0h,144.0h),_1r,_1r,vec2h(176.0h,168.0h),vec2h(160.0h,200.0h),_1s,_1s,_1s,_1t,_1t,_1t,vec2h(184.0h,176.0h),vec2h(176.0h,192.0h),_1u,_1u,vec2h(192.0h,168.0h),_1v,_1v,_1v,_1w,_1w,_1w,vec2h(184.0h,208.0h),_1x,_1x,vec2h(200.0h,184.0h),_1y,_1y,_1z,_1z,_20,_20,_20,vec2h(216.0h,176.0h),_21,_21,vec2h(208.0h,200.0h),vec2h(192.0h,232.0h),_22,_22,_22,_23,_23,_23,vec2h(216.0h,208.0h),vec2h(208.0h,224.0h),_24,_24,vec2h(224.0h,200.0h),_25,_25,_25,_26,_26,_26,vec2h(216.0h,240.0h),_27,_27,vec2h(232.0h,216.0h),_28,_28,_29,_29,_2a,_2a,_2a,vec2h(248.0h,208.0h),_2b,_2b,_2c,_2c,_2d,_2d,_2d,_2e,_2e,_2e,_2f,_2f,_2g,_2g);const _2i=vec2h(4.0h);const _2j=vec2h(12.0h);const _2k=vec2h(20.0h);const _2l=vec2h(28.0h);const _2m=vec2h(36.0h);const _2n=vec2h(84.0h);const _2o=vec2h(92.0h);const _2p=vec2h(100.0h);const _2q=vec2h(148.0h);const _2r=vec2h(156.0h);const _2s=vec2h(164.0h);const _2t=vec2h(212.0h);const _2u=vec2h(220.0h);const _2v=vec2h(228.0h);const _2w=vec2h(236.0h);const _2x=vec2h(244.0h);const _2y=vec2h(252.0h);const _2z=array<vec2h,256u>(vec2h(),vec2h(0.0h,4.0h),vec2h(4.0h,0.0h),_2i,_2i,vec2h(4.0h,8.0h),vec2h(8.0h,4.0h),_c,_c,vec2h(8.0h,12.0h),vec2h(12.0h,8.0h),_2j,_2j,vec2h(12.0h,16.0h),vec2h(16.0h,12.0h),_e,_e,vec2h(16.0h,20.0h),vec2h(20.0h,16.0h),_2k,_2k,vec2h(20.0h,24.0h),vec2h(24.0h,20.0h),_g,_g,vec2h(24.0h,28.0h),vec2h(28.0h,24.0h),_2l,_2l,vec2h(28.0h,32.0h),vec2h(32.0h,28.0h),_j,_j,vec2h(32.0h,36.0h),vec2h(36.0h,32.0h),_2m,_2m,vec2h(36.0h,40.0h),vec2h(40.0h,36.0h),_m,_m,vec2h(40.0h,44.0h),vec2h(44.0h,40.0h),vec2h(32.0h,64.0h),vec2h(44.0h),vec2h(44.0h,48.0h),vec2h(48.0h,44.0h),vec2h(36.0h,68.0h),_o,vec2h(48.0h,52.0h),vec2h(52.0h,48.0h),vec2h(44.0h,64.0h),vec2h(52.0h),vec2h(52.0h,56.0h),vec2h(56.0h,52.0h),vec2h(48.0h,68.0h),_q,vec2h(56.0h,60.0h),vec2h(60.0h,56.0h),_r,vec2h(60.0h),vec2h(60.0h,64.0h),_s,vec2h(64.0h,60.0h),vec2h(68.0h,56.0h),_t,vec2h(64.0h,68.0h),vec2h(68.0h,64.0h),vec2h(72.0h,60.0h),vec2h(68.0h),vec2h(68.0h,72.0h),vec2h(72.0h,68.0h),vec2h(80.0h,56.0h),_w,vec2h(72.0h,76.0h),vec2h(76.0h,72.0h),vec2h(84.0h,60.0h),vec2h(76.0h),vec2h(76.0h,80.0h),vec2h(80.0h,76.0h),_y,_y,vec2h(80.0h,84.0h),vec2h(84.0h,80.0h),_2n,_2n,vec2h(84.0h,88.0h),vec2h(88.0h,84.0h),_10,_10,vec2h(88.0h,92.0h),vec2h(92.0h,88.0h),_2o,_2o,vec2h(92.0h,96.0h),vec2h(96.0h,92.0h),_13,_13,vec2h(96.0h,100.0h),vec2h(100.0h,96.0h),_2p,_2p,vec2h(100.0h,104.0h),vec2h(104.0h,100.0h),_16,_16,vec2h(104.0h,108.0h),vec2h(108.0h,104.0h),vec2h(96.0h,128.0h),vec2h(108.0h),vec2h(108.0h,112.0h),vec2h(112.0h,108.0h),vec2h(100.0h,132.0h),_18,vec2h(112.0h,116.0h),vec2h(116.0h,112.0h),vec2h(108.0h,128.0h),vec2h(116.0h),vec2h(116.0h,120.0h),vec2h(120.0h,116.0h),vec2h(112.0h,132.0h),_1a,vec2h(120.0h,124.0h),vec2h(124.0h,120.0h),_1b,vec2h(124.0h),vec2h(124.0h,128.0h),_1c,vec2h(128.0h,124.0h),vec2h(132.0h,120.0h),_1d,vec2h(128.0h,132.0h),vec2h(132.0h,128.0h),vec2h(136.0h,124.0h),vec2h(132.0h),vec2h(132.0h,136.0h),vec2h(136.0h,132.0h),vec2h(144.0h,120.0h),_1g,vec2h(136.0h,140.0h),vec2h(140.0h,136.0h),vec2h(148.0h,124.0h),vec2h(140.0h),vec2h(140.0h,144.0h),vec2h(144.0h,140.0h),_1i,_1i,vec2h(144.0h,148.0h),vec2h(148.0h,144.0h),_2q,_2q,vec2h(148.0h,152.0h),vec2h(152.0h,148.0h),_1k,_1k,vec2h(152.0h,156.0h),vec2h(156.0h,152.0h),_2r,_2r,vec2h(156.0h,160.0h),vec2h(160.0h,156.0h),_1n,_1n,vec2h(160.0h,164.0h),vec2h(164.0h,160.0h),_2s,_2s,vec2h(164.0h,168.0h),vec2h(168.0h,164.0h),_1q,_1q,vec2h(168.0h,172.0h),vec2h(172.0h,168.0h),vec2h(160.0h,192.0h),vec2h(172.0h),vec2h(172.0h,176.0h),vec2h(176.0h,172.0h),vec2h(164.0h,196.0h),_1s,vec2h(176.0h,180.0h),vec2h(180.0h,176.0h),vec2h(172.0h,192.0h),vec2h(180.0h),vec2h(180.0h,184.0h),vec2h(184.0h,180.0h),vec2h(176.0h,196.0h),_1u,vec2h(184.0h,188.0h),vec2h(188.0h,184.0h),_1v,vec2h(188.0h),vec2h(188.0h,192.0h),_1w,vec2h(192.0h,188.0h),vec2h(196.0h,184.0h),_1x,vec2h(192.0h,196.0h),vec2h(196.0h,192.0h),vec2h(200.0h,188.0h),vec2h(196.0h),vec2h(196.0h,200.0h),vec2h(200.0h,196.0h),vec2h(208.0h,184.0h),_20,vec2h(200.0h,204.0h),vec2h(204.0h,200.0h),vec2h(212.0h,188.0h),vec2h(204.0h),vec2h(204.0h,208.0h),vec2h(208.0h,204.0h),_22,_22,vec2h(208.0h,212.0h),vec2h(212.0h,208.0h),_2t,_2t,vec2h(212.0h,216.0h),vec2h(216.0h,212.0h),_24,_24,vec2h(216.0h,220.0h),vec2h(220.0h,216.0h),_2u,_2u,vec2h(220.0h,224.0h),vec2h(224.0h,220.0h),_27,_27,vec2h(224.0h,228.0h),vec2h(228.0h,224.0h),_2v,_2v,vec2h(228.0h,232.0h),vec2h(232.0h,228.0h),_2a,_2a,vec2h(232.0h,236.0h),vec2h(236.0h,232.0h),_2w,_2w,vec2h(236.0h,240.0h),vec2h(240.0h,236.0h),_2d,_2d,vec2h(240.0h,244.0h),vec2h(244.0h,240.0h),_2x,_2x,vec2h(244.0h,248.0h),vec2h(248.0h,244.0h),_2g,_2g,vec2h(248.0h,252.0h),vec2h(252.0h,248.0h),_2y,_2y);fn _30(){var _31:array<vec2h,256u>;var _32:array<vec2h,256u>;var _33:array<vec2h,256u>;var _34:array<vec2h,256u>;var _35:array<vec2h,256u>;var _36:array<vec2h,256u>;var _37:array<f32,8u>;var _38:array<f32,8u>;var _39:bool;var _3a:bool;var _3b:f16;var _3c:f16;var _3d:f16;var _3e:f16;var _3f:f16;var _3g:f16;var _3h:vec2u;var _3i:vec2u;var _3j:f16;var _3k:f16;var _3l:bool;var _3m:f16;var _3n:f16;var _3o:bool;var _3p:vec2u;var _3q:vec2u;var _3r:f16;var _3s:f16;var _3t:f16;var _3u:f16;var _3v:vec3h;var _3w:vec3h;var _3x:vec3h;var _3y:vec3h;var _3z:bool;var _40:u32;var _41:u32;var _42:vec3h;var _43:vec3h;var _44:vec3h;var _45:vec3h;var _46:u32;var _47:u32;switch(0u){default:{let _48=bitcast<vec2u>(vec2i(textureDimensions(_3,0i)));let _49=((_48.x+3u)/4u);let _4a=x_2912;let _4b=x_2912.xy;let _4c=x_2912.x;let _4d=(_4c>=_49);_3a=_4d;if(!(_4d)){_39=(_4a.y>=((_48.y+3u)/4u));_3a=_39;}if(_3a){break;}let _4e=(vec2f(1.0f)/vec2f(vec2i(textureDimensions(_3,0i))));let _4f=((vec2f(bitcast<vec2i>((_4b*vec2u(4u))))*_4e)+_4e);let _4g=vec4h(textureGather(0i,_3,_2,_4f,vec2i()));let _4h=vec4h(textureGather(0i,_3,_2,_4f,_4));let _4i=vec4h(textureGather(0i,_3,_2,_4f,_5));let _4j=vec4h(textureGather(0i,_3,_2,_4f,_6));let _4k=vec4h(textureGather(1i,_3,_2,_4f,vec2i()));let _4l=vec4h(textureGather(1i,_3,_2,_4f,_4));let _4m=vec4h(textureGather(1i,_3,_2,_4f,_5));let _4n=vec4h(textureGather(1i,_3,_2,_4f,_6));let _4o=vec4h(textureGather(2i,_3,_2,_4f,vec2i()));let _4p=vec4h(textureGather(2i,_3,_2,_4f,_4));let _4q=vec4h(textureGather(2i,_3,_2,_4f,_5));let _4r=vec4h(textureGather(2i,_3,_2,_4f,_6));let _4s=vec4h(textureGather(3i,_3,_2,_4f,vec2i()));let _4t=vec4h(textureGather(3i,_3,_2,_4f,_4));let _4u=vec4h(textureGather(3i,_3,_2,_4f,_5));let _4v=vec4h(textureGather(3i,_3,_2,_4f,_6));let _4w=_4s.w;let _4x=_4s.z;let _4y=_4t.w;let _4z=_4t.z;let _50=_4s.x;let _51=_4s.y;let _52=_4t.x;let _53=_4t.y;let _54=_4u.w;let _55=_4u.z;let _56=_4v.w;let _57=_4v.z;let _58=_4u.x;let _59=_4u.y;let _5a=_4v.x;let _5b=_4v.y;let _5c=vec4h(_4g.w,_4k.w,_4o.w,_4w).xyz;let _5d=vec4h(_4g.z,_4k.z,_4o.z,_4x).xyz;let _5e=vec4h(_4h.w,_4l.w,_4p.w,_4y).xyz;let _5f=vec4h(_4h.z,_4l.z,_4p.z,_4z).xyz;let _5g=vec4h(_4g.x,_4k.x,_4o.x,_50).xyz;let _5h=vec4h(_4g.y,_4k.y,_4o.y,_51).xyz;let _5i=vec4h(_4h.x,_4l.x,_4p.x,_52).xyz;let _5j=vec4h(_4h.y,_4l.y,_4p.y,_53).xyz;let _5k=vec4h(_4i.w,_4m.w,_4q.w,_54).xyz;let _5l=vec4h(_4i.z,_4m.z,_4q.z,_55).xyz;let _5m=vec4h(_4j.w,_4n.w,_4r.w,_56).xyz;let _5n=vec4h(_4j.z,_4n.z,_4r.z,_57).xyz;let _5o=vec4h(_4i.x,_4m.x,_4q.x,_58).xyz;let _5p=vec4h(_4i.y,_4m.y,_4q.y,_59).xyz;let _5q=vec4h(_4j.x,_4n.x,_4r.x,_5a).xyz;let _5r=vec4h(_4j.y,_4n.y,_4r.y,_5b).xyz;let _5s=min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(1.0h,_4w),_4x),_4y),_4z),_50),_51),_52),_53),_54),_55),_56),_57),_58),_59),_5a),_5b);let _5t=max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(0.0h,_4w),_4x),_4y),_4z),_50),_51),_52),_53),_54),_55),_56),_57),_58),_59),_5a),_5b);let _5u=(_5t-_5s);let _5v=(_5u*0.03125h);_3c=_5v;if((_5u<0.0625h)){_3b=max(0.0h,((2.0h*_5v)-0.0625h));_3c=_3b;}_3e=_5s;if((_5s>0.0h)){_3d=(_5s+_3c);_3e=_3d;}_3g=_5t;if((_3e<1.0h)){_3f=(_5t-_3c);_3g=_3f;}let _5w=trunc(((_3g*255.0h)+0.5h));let _5x=trunc(((_3e*255.0h)+0.5h));switch(0u){default:{if((_5w==_5x)){_3i=vec2u();break;}let _5y=(1.0h/(_5x-_5w));let _5z=(_5w*-(_5y));let _60=(_5y*255.0h);let _61=(0u|(u32(((clamp(((_54*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_3h=vec2u(((((((((0u|(u32(((clamp(((_4w*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_4x*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_4y*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_4z*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_50*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_51*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_52*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_53*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_61);_3h.y=(((((((_61|(u32(((clamp(((_55*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_56*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_57*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_58*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_59*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_5a*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_5b*_60)+_5z),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_3i=_3h;}}switch(0u){default:{let _62=_3i.x;_37=_7;let _63=_37[((_62>>bitcast<u32>(0i))&7u)];let _64=(1.0f-_63);let _65=f32(_4w);_37=_7;let _66=_37[((_62>>bitcast<u32>(3i))&7u)];let _67=(1.0f-_66);let _68=f32(_4x);_37=_7;let _69=_37[((_62>>bitcast<u32>(6i))&7u)];let _6a=(1.0f-_69);let _6b=f32(_4y);_37=_7;let _6c=_37[((_62>>bitcast<u32>(9i))&7u)];let _6d=(1.0f-_6c);let _6e=f32(_4z);_37=_7;let _6f=_37[((_62>>bitcast<u32>(12i))&7u)];let _6g=(1.0f-_6f);let _6h=f32(_50);_37=_7;let _6i=_37[((_62>>bitcast<u32>(15i))&7u)];let _6j=(1.0f-_6i);let _6k=f32(_51);_37=_7;let _6l=_37[((_62>>bitcast<u32>(18i))&7u)];let _6m=(1.0f-_6l);let _6n=f32(_52);_37=_7;let _6o=_37[((_62>>bitcast<u32>(21i))&7u)];let _6p=(1.0f-_6o);let _6q=f32(_53);let _6r=_3i.y;_38=_7;let _6s=_38[((_6r>>bitcast<u32>(0i))&7u)];let _6t=(1.0f-_6s);let _6u=f32(_54);_38=_7;let _6v=_38[((_6r>>bitcast<u32>(3i))&7u)];let _6w=(1.0f-_6v);let _6x=f32(_55);_38=_7;let _6y=_38[((_6r>>bitcast<u32>(6i))&7u)];let _6z=(1.0f-_6y);let _70=f32(_56);_38=_7;let _71=_38[((_6r>>bitcast<u32>(9i))&7u)];let _72=(1.0f-_71);let _73=f32(_57);_38=_7;let _74=_38[((_6r>>bitcast<u32>(12i))&7u)];let _75=(1.0f-_74);let _76=f32(_58);_38=_7;let _77=_38[((_6r>>bitcast<u32>(15i))&7u)];let _78=(1.0f-_77);let _79=f32(_59);_38=_7;let _7a=_38[((_6r>>bitcast<u32>(18i))&7u)];let _7b=(1.0f-_7a);let _7c=f32(_5a);_38=_7;let _7d=_38[((_6r>>bitcast<u32>(21i))&7u)];let _7e=(1.0f-_7d);let _7f=((((((((((((((((_64*_64)+(_67*_67))+(_6a*_6a))+(_6d*_6d))+(_6g*_6g))+(_6j*_6j))+(_6m*_6m))+(_6p*_6p))+(_6t*_6t))+(_6w*_6w))+(_6z*_6z))+(_72*_72))+(_75*_75))+(_78*_78))+(_7b*_7b))+(_7e*_7e));let _7g=((((((((((((((((_63*_63)+(_66*_66))+(_69*_69))+(_6c*_6c))+(_6f*_6f))+(_6i*_6i))+(_6l*_6l))+(_6o*_6o))+(_6s*_6s))+(_6v*_6v))+(_6y*_6y))+(_71*_71))+(_74*_74))+(_77*_77))+(_7a*_7a))+(_7d*_7d));let _7h=((((((((((((((((_64*_63)+(_67*_66))+(_6a*_69))+(_6d*_6c))+(_6g*_6f))+(_6j*_6i))+(_6m*_6l))+(_6p*_6o))+(_6t*_6s))+(_6w*_6v))+(_6z*_6y))+(_72*_71))+(_75*_74))+(_78*_77))+(_7b*_7a))+(_7e*_7d));let _7i=f32(_5b);let _7j=((((((((((((((((_64*_65)+(_67*_68))+(_6a*_6b))+(_6d*_6e))+(_6g*_6h))+(_6j*_6k))+(_6m*_6n))+(_6p*_6q))+(_6t*_6u))+(_6w*_6x))+(_6z*_70))+(_72*_73))+(_75*_76))+(_78*_79))+(_7b*_7c))+(_7e*_7i));let _7k=((((((((((((((((_63*_65)+(_66*_68))+(_69*_6b))+(_6c*_6e))+(_6f*_6h))+(_6i*_6k))+(_6l*_6n))+(_6o*_6q))+(_6s*_6u))+(_6v*_6x))+(_6y*_70))+(_71*_73))+(_74*_76))+(_77*_79))+(_7a*_7c))+(_7d*_7i));let _7l=((_7f*_7g)-(_7h*_7h));if((abs(_7l)<0.00009999999747378752f)){_3m=_5x;_3n=_5w;_3o=false;break;}let _7m=(1.0f/_7l);_3j=trunc(((f16(clamp((((_7j*_7g)-(_7k*_7h))*_7m),0.0f,1.0f))*255.0h)+0.5h));_3k=trunc(((f16(clamp((((_7k*_7f)-(_7j*_7h))*_7m),0.0f,1.0f))*255.0h)+0.5h));_3l=(!((_3j==_5w))|!((_3k==_5x)));_3m=_3k;_3n=_3j;_3o=_3l;}}var _7n:vec2u;_3q=_3i;if(_3o){switch(0u){default:{if((_3n==_3m)){_3p=vec2u();break;}let _7o=(1.0h/(_3m-_3n));let _7p=(_3n*-(_7o));let _7q=(_7o*255.0h);let _7r=(0u|(u32(((clamp(((_54*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_7n=vec2u(((((((((0u|(u32(((clamp(((_4w*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_4x*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_4y*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_4z*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_50*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_51*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_52*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_53*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_7r);_7n.y=(((((((_7r|(u32(((clamp(((_55*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_56*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_57*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_58*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_59*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_5a*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_5b*_7q)+_7p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_3p=_7n;}}_3q=_3p;}let _7s=_3q.x;let _7t=(((_7s&7190235u)+2396745u)^(_7s&9586980u));let _7u=(_7t^(((19173960u-(_7t&14380470u))&19173960u)>>bitcast<u32>(3i)));let _7v=_3q.y;let _7w=(((_7v&7190235u)+2396745u)^(_7v&9586980u));let _7x=((u32(_3n)|(u32(_3m)<<bitcast<u32>(8i)))|(_7u<<bitcast<u32>(16i)));let _7y=((_7u>>bitcast<u32>(16i))|((_7w^(((19173960u-(_7w&14380470u))&19173960u)>>bitcast<u32>(3i)))<<bitcast<u32>(8i)));let _7z=(((((((((((((((_5c+_5d)+_5e)+_5f)+_5g)+_5h)+_5i)+_5j)+_5k)+_5l)+_5m)+_5n)+_5o)+_5p)+_5q)+_5r);let _80=((_5c*16.0h)-_7z);let _81=_80.x;let _82=_80.y;let _83=_80.z;let _84=((_5d*16.0h)-_7z);let _85=_84.x;let _86=_84.y;let _87=_84.z;let _88=((_5e*16.0h)-_7z);let _89=_88.x;let _8a=_88.y;let _8b=_88.z;let _8c=((_5f*16.0h)-_7z);let _8d=_8c.x;let _8e=_8c.y;let _8f=_8c.z;let _8g=((_5g*16.0h)-_7z);let _8h=_8g.x;let _8i=_8g.y;let _8j=_8g.z;let _8k=((_5h*16.0h)-_7z);let _8l=_8k.x;let _8m=_8k.y;let _8n=_8k.z;let _8o=((_5i*16.0h)-_7z);let _8p=_8o.x;let _8q=_8o.y;let _8r=_8o.z;let _8s=((_5j*16.0h)-_7z);let _8t=_8s.x;let _8u=_8s.y;let _8v=_8s.z;let _8w=((_5k*16.0h)-_7z);let _8x=_8w.x;let _8y=_8w.y;let _8z=_8w.z;let _90=((_5l*16.0h)-_7z);let _91=_90.x;let _92=_90.y;let _93=_90.z;let _94=((_5m*16.0h)-_7z);let _95=_94.x;let _96=_94.y;let _97=_94.z;let _98=((_5n*16.0h)-_7z);let _99=_98.x;let _9a=_98.y;let _9b=_98.z;let _9c=((_5o*16.0h)-_7z);let _9d=_9c.x;let _9e=_9c.y;let _9f=_9c.z;let _9g=((_5p*16.0h)-_7z);let _9h=_9g.x;let _9i=_9g.y;let _9j=_9g.z;let _9k=((_5q*16.0h)-_7z);let _9l=_9k.x;let _9m=_9k.y;let _9n=_9k.z;let _9o=((_5r*16.0h)-_7z);let _9p=_9o.x;let _9q=((((((((((((((((_81*_81)+(_85*_85))+(_89*_89))+(_8d*_8d))+(_8h*_8h))+(_8l*_8l))+(_8p*_8p))+(_8t*_8t))+(_8x*_8x))+(_91*_91))+(_95*_95))+(_99*_99))+(_9d*_9d))+(_9h*_9h))+(_9l*_9l))+(_9p*_9p));let _9r=_9o.y;let _9s=_9o.z;let _9t=((((((((((((((((_82*_82)+(_86*_86))+(_8a*_8a))+(_8e*_8e))+(_8i*_8i))+(_8m*_8m))+(_8q*_8q))+(_8u*_8u))+(_8y*_8y))+(_92*_92))+(_96*_96))+(_9a*_9a))+(_9e*_9e))+(_9i*_9i))+(_9m*_9m))+(_9r*_9r));let _9u=((((((((((((((((_83*_83)+(_87*_87))+(_8b*_8b))+(_8f*_8f))+(_8j*_8j))+(_8n*_8n))+(_8r*_8r))+(_8v*_8v))+(_8z*_8z))+(_93*_93))+(_97*_97))+(_9b*_9b))+(_9f*_9f))+(_9j*_9j))+(_9n*_9n))+(_9s*_9s));let _9v=select(1.0h,0.015625h,(max(max(_9q,_9t),_9u)>64.0h));let _9w=(_9q*_9v);let _9x=(((((((((((((((((_81*_82)+(_85*_86))+(_89*_8a))+(_8d*_8e))+(_8h*_8i))+(_8l*_8m))+(_8p*_8q))+(_8t*_8u))+(_8x*_8y))+(_91*_92))+(_95*_96))+(_99*_9a))+(_9d*_9e))+(_9h*_9i))+(_9l*_9m))+(_9p*_9r))*_9v);let _9y=(((((((((((((((((_81*_83)+(_85*_87))+(_89*_8b))+(_8d*_8f))+(_8h*_8j))+(_8l*_8n))+(_8p*_8r))+(_8t*_8v))+(_8x*_8z))+(_91*_93))+(_95*_97))+(_99*_9b))+(_9d*_9f))+(_9h*_9j))+(_9l*_9n))+(_9p*_9s))*_9v);let _9z=(_9t*_9v);let _a0=(((((((((((((((((_82*_83)+(_86*_87))+(_8a*_8b))+(_8e*_8f))+(_8i*_8j))+(_8m*_8n))+(_8q*_8r))+(_8u*_8v))+(_8y*_8z))+(_92*_93))+(_96*_97))+(_9a*_9b))+(_9e*_9f))+(_9i*_9j))+(_9m*_9n))+(_9r*_9s))*_9v);let _a1=(_9u*_9v);let _a2=(vec3h(_9w,_9z,_a1)+vec3h(0.0001220703125h));let _a3=vec3h((vec3f(_a2)*(1.0f/f32(max(max(_a2.x,_a2.y),_a2.z)))));let _a4=_a3.x;_3s=_a4;if((_9x<0.0h)){_3r=-(_a4);_3s=_3r;}let _a5=_a3.z;_3u=_a5;if((_a0<0.0h)){_3t=-(_a5);_3u=_3t;}let _a6=_a3.y;let _a7=(((_3s*_9w)+(_a6*_9x))+(_3u*_9y));let _a8=(((_3s*_9x)+(_a6*_9z))+(_3u*_a0));let _a9=(((_3s*_9y)+(_a6*_a0))+(_3u*_a1));let _aa=max(max(abs(_a7),abs(_a8)),abs(_a9));let _ab=vec3h((vec3f(f32(_a7),f32(_a8),f32(_a9))*(1.0f/f32(select(_aa,1.0h,(_aa==0.0h))))));let _ac=_ab.x;let _ad=_ab.y;let _ae=_ab.z;let _af=(((_ac*_9w)+(_ad*_9x))+(_ae*_9y));let _ag=(((_ac*_9x)+(_ad*_9z))+(_ae*_a0));let _ah=(((_ac*_9y)+(_ad*_a0))+(_ae*_a1));let _ai=max(max(abs(_af),abs(_ag)),abs(_ah));let _aj=(_ai==0.0h);let _ak=select(vec3h((vec3f(f32(_af),f32(_ag),f32(_ah))*(1.0f/f32(select(_ai,1.0h,_aj))))),_8,vec3<bool>(_aj));let _al=(_7z*0.0625h);let _am=(_ak*_9);let _an=(1.0h/dot(_am,_am));let _ao=((_am*_an)*_9);let _ap=dot(_5c,_ao);let _aq=dot(_5d,_ao);let _ar=(_aq<_ap);let _as=select(1u,0u,_ar);let _at=select(_ap,_aq,_ar);let _au=(_aq>_ap);let _av=select(1u,0u,_au);let _aw=select(_ap,_aq,_au);let _ax=dot(_5e,_ao);let _ay=(_ax<_at);let _az=select(select(_as,(_as+1u),(_aq==_at)),0u,_ay);let _b0=select(_at,_ax,_ay);let _b1=(_ax>_aw);let _b2=select(select(_av,(_av+1u),(_aq==_aw)),0u,_b1);let _b3=select(_aw,_ax,_b1);let _b4=dot(_5f,_ao);let _b5=(_b4<_b0);let _b6=select(select(_az,(_az+1u),(_ax==_b0)),0u,_b5);let _b7=select(_b0,_b4,_b5);let _b8=(_b4>_b3);let _b9=select(select(_b2,(_b2+1u),(_ax==_b3)),0u,_b8);let _ba=select(_b3,_b4,_b8);let _bb=dot(_5g,_ao);let _bc=(_bb<_b7);let _bd=select(select(_b6,(_b6+1u),(_b4==_b7)),0u,_bc);let _be=select(_b7,_bb,_bc);let _bf=(_bb>_ba);let _bg=select(select(_b9,(_b9+1u),(_b4==_ba)),0u,_bf);let _bh=select(_ba,_bb,_bf);let _bi=dot(_5h,_ao);let _bj=(_bi<_be);let _bk=select(select(_bd,(_bd+1u),(_bb==_be)),0u,_bj);let _bl=select(_be,_bi,_bj);let _bm=(_bi>_bh);let _bn=select(select(_bg,(_bg+1u),(_bb==_bh)),0u,_bm);let _bo=select(_bh,_bi,_bm);let _bp=dot(_5i,_ao);let _bq=(_bp<_bl);let _br=select(select(_bk,(_bk+1u),(_bi==_bl)),0u,_bq);let _bs=select(_bl,_bp,_bq);let _bt=(_bp>_bo);let _bu=select(select(_bn,(_bn+1u),(_bi==_bo)),0u,_bt);let _bv=select(_bo,_bp,_bt);let _bw=dot(_5j,_ao);let _bx=(_bw<_bs);let _by=select(select(_br,(_br+1u),(_bp==_bs)),0u,_bx);let _bz=select(_bs,_bw,_bx);let _c0=(_bw>_bv);let _c1=select(select(_bu,(_bu+1u),(_bp==_bv)),0u,_c0);let _c2=select(_bv,_bw,_c0);let _c3=dot(_5k,_ao);let _c4=(_c3<_bz);let _c5=select(select(_by,(_by+1u),(_bw==_bz)),0u,_c4);let _c6=select(_bz,_c3,_c4);let _c7=(_c3>_c2);let _c8=select(select(_c1,(_c1+1u),(_bw==_c2)),0u,_c7);let _c9=select(_c2,_c3,_c7);let _ca=dot(_5l,_ao);let _cb=(_ca<_c6);let _cc=select(select(_c5,(_c5+1u),(_c3==_c6)),0u,_cb);let _cd=select(_c6,_ca,_cb);let _ce=(_ca>_c9);let _cf=select(select(_c8,(_c8+1u),(_c3==_c9)),0u,_ce);let _cg=select(_c9,_ca,_ce);let _ch=dot(_5m,_ao);let _ci=(_ch<_cd);let _cj=select(select(_cc,(_cc+1u),(_ca==_cd)),0u,_ci);let _ck=select(_cd,_ch,_ci);let _cl=(_ch>_cg);let _cm=select(select(_cf,(_cf+1u),(_ca==_cg)),0u,_cl);let _cn=select(_cg,_ch,_cl);let _co=dot(_5n,_ao);let _cp=(_co<_ck);let _cq=select(select(_cj,(_cj+1u),(_ch==_ck)),0u,_cp);let _cr=select(_ck,_co,_cp);let _cs=(_co>_cn);let _ct=select(select(_cm,(_cm+1u),(_ch==_cn)),0u,_cs);let _cu=select(_cn,_co,_cs);let _cv=dot(_5o,_ao);let _cw=(_cv<_cr);let _cx=select(select(_cq,(_cq+1u),(_co==_cr)),0u,_cw);let _cy=select(_cr,_cv,_cw);let _cz=(_cv>_cu);let _d0=select(select(_ct,(_ct+1u),(_co==_cu)),0u,_cz);let _d1=select(_cu,_cv,_cz);let _d2=dot(_5p,_ao);let _d3=(_d2<_cy);let _d4=select(select(_cx,(_cx+1u),(_cv==_cy)),0u,_d3);let _d5=select(_cy,_d2,_d3);let _d6=(_d2>_d1);let _d7=select(select(_d0,(_d0+1u),(_cv==_d1)),0u,_d6);let _d8=select(_d1,_d2,_d6);let _d9=dot(_5q,_ao);let _da=(_d9<_d5);let _db=select(select(_d4,(_d4+1u),(_d2==_d5)),0u,_da);let _dc=select(_d5,_d9,_da);let _dd=(_d9>_d8);let _de=select(select(_d7,(_d7+1u),(_d2==_d8)),0u,_dd);let _df=select(_d8,_d9,_dd);let _dg=dot(_5r,_ao);let _dh=(_dg<_dc);let _di=select(select(_db,(_db+1u),(_d9==_dc)),0u,_dh);let _dj=select(_dc,_dg,_dh);let _dk=(_dg>_df);let _dl=select(select(_de,(_de+1u),(_d9==_df)),0u,_dk);let _dm=select(_df,_dg,_dk);let _dn=dot(_al,_ao);let _do=(_dj-_dn);let _dp=(_dm-_dn);let _dq=(((_dp-_do)*0.0625h)*(1.0h-clamp((f16(((select(_di,(_di+1u),(_dg==_dj))+select(_dl,(_dl+1u),(_dg==_dm)))-2u))*0.0714111328125h),0.0h,1.0h)));let _dr=(_do+_dq);let _ds=(_dp-_dq);let _dt=max(0.0h,(((((0.6357421875h*0.03125h)*_an)+(0.36376953125h*0.03125h))-(_ds-_dr))*0.5h));let _du=clamp(((_ak*(_dr-_dt))+_al),vec3h(),_8);let _dv=clamp(((_ak*(_ds+_dt))+_al),vec3h(),_8);let _dw=_du.x;let _dx=(trunc((_dw*31.0h))*8.25h);let _dy=trunc(_dx);let _dz=min(255.0h,trunc((_dx+8.25h)));let _e0=_du.y;let _e1=(trunc((_e0*63.0h))*4.0625h);let _e2=min(255.0h,trunc(_e1));let _e3=min(255.0h,trunc((_e1+4.0625h)));let _e4=_du.z;let _e5=(trunc((_e4*31.0h))*8.25h);let _e6=trunc(_e5);let _e7=min(255.0h,trunc((_e5+8.25h)));let _e8=vec3h(select(_dy,_dz,((255.0h*_dw)>(0.5h*(_dy+_dz)))),select(_e2,_e3,((255.0h*_e0)>(0.5h*(_e2+_e3)))),select(_e6,_e7,((255.0h*_e4)>(0.5h*(_e6+_e7)))));let _e9=_dv.x;let _ea=(trunc((_e9*31.0h))*8.25h);let _eb=trunc(_ea);let _ec=min(255.0h,trunc((_ea+8.25h)));let _ed=_dv.y;let _ee=(trunc((_ed*63.0h))*4.0625h);let _ef=min(255.0h,trunc(_ee));let _eg=min(255.0h,trunc((_ee+4.0625h)));let _eh=_dv.z;let _ei=(trunc((_eh*31.0h))*8.25h);let _ej=trunc(_ei);let _ek=min(255.0h,trunc((_ei+8.25h)));let _el=vec3h(select(_eb,_ec,((255.0h*_e9)>(0.5h*(_eb+_ec)))),select(_ef,_eg,((255.0h*_ed)>(0.5h*(_ef+_eg)))),select(_ej,_ek,((255.0h*_eh)>(0.5h*(_ej+_ek)))));let _em=(((_el-_e8)*_9)*0.0039215087890625h);let _en=((_em*(1.0h/dot(_em,_em)))*_9);let _eo=(dot(_e8,_en)*0.0039215087890625h);let _ep=((((((((((((((((0u|(u32(((3.0h*clamp((dot(_5c,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(0i)))|(u32(((3.0h*clamp((dot(_5d,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(2i)))|(u32(((3.0h*clamp((dot(_5e,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(4i)))|(u32(((3.0h*clamp((dot(_5f,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(6i)))|(u32(((3.0h*clamp((dot(_5g,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(8i)))|(u32(((3.0h*clamp((dot(_5h,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(10i)))|(u32(((3.0h*clamp((dot(_5i,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(12i)))|(u32(((3.0h*clamp((dot(_5j,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(14i)))|(u32(((3.0h*clamp((dot(_5k,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(16i)))|(u32(((3.0h*clamp((dot(_5l,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(18i)))|(u32(((3.0h*clamp((dot(_5m,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(20i)))|(u32(((3.0h*clamp((dot(_5n,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(22i)))|(u32(((3.0h*clamp((dot(_5o,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(24i)))|(u32(((3.0h*clamp((dot(_5p,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(26i)))|(u32(((3.0h*clamp((dot(_5q,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(28i)))|(u32(((3.0h*clamp((dot(_5r,_en)-_eo),0.0h,1.0h))+0.5h))<<bitcast<u32>(30i)));switch(0u){default:{if(((_ep^(_ep<<bitcast<u32>(2i)))<4u)){_3x=_el;_3y=_e8;_3z=false;break;}let _eq=(_ep>>bitcast<u32>(1i));let _er=f16(bitcast<i32>(countOneBits(((1431655765u&~(_eq))&_ep))));let _es=(1431655765u&_eq);let _et=f16(bitcast<i32>(countOneBits((_es&~(_ep)))));let _eu=f16(bitcast<i32>(countOneBits((_es&_ep))));let _ev=(((3.0h*_eu)+(2.0h*_et))+_er);let _ew=(((9.0h*_eu)+(4.0h*_et))+_er);let _ex=((144.0h-(6.0h*_ev))+_ew);let _ey=((3.0h*_ev)-_ew);let _ez=(((((((((((((((((_5c*f16(((_ep>>bitcast<u32>(0i))&3u)))+(_5d*f16(((_ep>>bitcast<u32>(2i))&3u))))+(_5e*f16(((_ep>>bitcast<u32>(4i))&3u))))+(_5f*f16(((_ep>>bitcast<u32>(6i))&3u))))+(_5g*f16(((_ep>>bitcast<u32>(8i))&3u))))+(_5h*f16(((_ep>>bitcast<u32>(10i))&3u))))+(_5i*f16(((_ep>>bitcast<u32>(12i))&3u))))+(_5j*f16(((_ep>>bitcast<u32>(14i))&3u))))+(_5k*f16(((_ep>>bitcast<u32>(16i))&3u))))+(_5l*f16(((_ep>>bitcast<u32>(18i))&3u))))+(_5m*f16(((_ep>>bitcast<u32>(20i))&3u))))+(_5n*f16(((_ep>>bitcast<u32>(22i))&3u))))+(_5o*f16(((_ep>>bitcast<u32>(24i))&3u))))+(_5p*f16(((_ep>>bitcast<u32>(26i))&3u))))+(_5q*f16(((_ep>>bitcast<u32>(28i))&3u))))+(_5r*f16(((_ep>>bitcast<u32>(30i))&3u))))*3.0h);let _f0=((_7z*9.0h)-_ez);let _f1=(1.0f/f32(((_ex*_ew)-(_ey*_ey))));let _f2=f16((f32(_ey)*_f1));let _f3=clamp(((_f0*f16((f32(_ew)*_f1)))-(_ez*_f2)),vec3h(),_8);let _f4=clamp(((_ez*f16((f32(_ex)*_f1)))-(_f0*_f2)),vec3h(),_8);let _f5=_f3.x;let _f6=(trunc((_f5*31.0h))*8.25h);let _f7=trunc(_f6);let _f8=min(255.0h,trunc((_f6+8.25h)));let _f9=_f3.y;let _fa=(trunc((_f9*63.0h))*4.0625h);let _fb=min(255.0h,trunc(_fa));let _fc=min(255.0h,trunc((_fa+4.0625h)));let _fd=_f3.z;let _fe=(trunc((_fd*31.0h))*8.25h);let _ff=trunc(_fe);let _fg=min(255.0h,trunc((_fe+8.25h)));_3v=vec3h(select(_f7,_f8,((255.0h*_f5)>(0.5h*(_f7+_f8)))),select(_fb,_fc,((255.0h*_f9)>(0.5h*(_fb+_fc)))),select(_ff,_fg,((255.0h*_fd)>(0.5h*(_ff+_fg)))));let _fh=_f4.x;let _fi=(trunc((_fh*31.0h))*8.25h);let _fj=trunc(_fi);let _fk=min(255.0h,trunc((_fi+8.25h)));let _fl=_f4.y;let _fm=(trunc((_fl*63.0h))*4.0625h);let _fn=min(255.0h,trunc(_fm));let _fo=min(255.0h,trunc((_fm+4.0625h)));let _fp=_f4.z;let _fq=(trunc((_fp*31.0h))*8.25h);let _fr=trunc(_fq);let _fs=min(255.0h,trunc((_fq+8.25h)));_3w=vec3h(select(_fj,_fk,((255.0h*_fh)>(0.5h*(_fj+_fk)))),select(_fn,_fo,((255.0h*_fl)>(0.5h*(_fn+_fo)))),select(_fr,_fs,((255.0h*_fp)>(0.5h*(_fr+_fs)))));_3x=_3w;_3y=_3v;_3z=true;}}_41=_ep;if(_3z){let _ft=(((_3x-_3y)*_9)*0.0039215087890625h);let _fu=((_ft*(1.0h/dot(_ft,_ft)))*_9);let _fv=(dot(_3y,_fu)*0.0039215087890625h);_40=((((((((((((((((0u|(u32(((3.0h*clamp((dot(_5c,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(0i)))|(u32(((3.0h*clamp((dot(_5d,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(2i)))|(u32(((3.0h*clamp((dot(_5e,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(4i)))|(u32(((3.0h*clamp((dot(_5f,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(6i)))|(u32(((3.0h*clamp((dot(_5g,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(8i)))|(u32(((3.0h*clamp((dot(_5h,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(10i)))|(u32(((3.0h*clamp((dot(_5i,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(12i)))|(u32(((3.0h*clamp((dot(_5j,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(14i)))|(u32(((3.0h*clamp((dot(_5k,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(16i)))|(u32(((3.0h*clamp((dot(_5l,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(18i)))|(u32(((3.0h*clamp((dot(_5m,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(20i)))|(u32(((3.0h*clamp((dot(_5n,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(22i)))|(u32(((3.0h*clamp((dot(_5o,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(24i)))|(u32(((3.0h*clamp((dot(_5p,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(26i)))|(u32(((3.0h*clamp((dot(_5q,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(28i)))|(u32(((3.0h*clamp((dot(_5r,_fu)-_fv),0.0h,1.0h))+0.5h))<<bitcast<u32>(30i)));_41=_40;}let _fw=((_41^(_41<<bitcast<u32>(2i)))<4u);_44=_3x;_45=_3y;if(_fw){let _fx=(_7z*15.9375h);let _fy=i32(_fx.x);_31=_2h;let _fz=_31[_fy].x;_32=_2h;let _g0=_32[_fy].y;let _g1=i32(_fx.y);_33=_2z;let _g2=_33[_g1].x;_34=_2z;let _g3=_34[_g1].y;let _g4=i32(_fx.z);_35=_2h;_42=vec3h(_fz,_g2,_35[_g4].x);_36=_2h;_43=vec3h(_g0,_g3,_36[_g4].y);_44=_43;_45=_42;}let _g5=select(_41,1431655765u,_fw);let _g6=((((u32(_45.x)>>bitcast<u32>(3i))<<bitcast<u32>(11i))|((u32(_45.y)>>bitcast<u32>(2i))<<bitcast<u32>(5i)))|(u32(_45.z)>>bitcast<u32>(3i)));let _g7=((((u32(_44.x)>>bitcast<u32>(3i))<<bitcast<u32>(11i))|((u32(_44.y)>>bitcast<u32>(2i))<<bitcast<u32>(5i)))|(u32(_44.z)>>bitcast<u32>(3i)));let _g8=(_g6<_g7);_47=_g5;if(_g8){_46=~(_g5);_47=_46;}let _g9=((_47&2863311530u)>>bitcast<u32>(1i));x_3008._0[((_4a.y*((_49+15u)&4294967280u))+_4c)]=vec4u(_7x,_7y,(select(_g6,_g7,_g8)|(select(_g7,_g6,_g8)<<bitcast<u32>(16i))),((((_47&1431655765u)^_g9)<<bitcast<u32>(1i))|_g9));}}return;}@compute @workgroup_size(16i, 16i, 1i) fn main(@builtin(global_invocation_id) _ga:vec3u,@builtin(local_invocation_id) _gb:vec3u,@builtin(workgroup_id) _gc:vec3u){x_2912=_ga;x_2918=_gb;_30();}";
|
|
2
|
-
export {
|
|
3
|
-
spark_bc3_rgba as default
|
|
4
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const spark_bc4_r = "enable f16;alias RTArr=array<vec2u>;struct _1{_0:RTArr,}@binding(1) @group(0) var _2:sampler;@binding(0) @group(0) var _3:texture_2d<f32>;var<private>x_746:vec3u;var<private>x_752:vec3u;@binding(2) @group(0) var<storage,read_write>x_844:_1;const _4=vec2f(1.0f);const _5=array<f32,8u>(0.0f,0.140625f,0.28125f,0.421875f,0.578125f,0.71875f,0.859375f,1.0f);fn _6(){var _7:array<f32,8u>;var _8:array<f32,8u>;var _9:bool;var _a:bool;var _b:f16;var _c:f16;var _d:f16;var _e:f16;var _f:f16;var _g:f16;var _h:vec2u;var _i:vec2u;var _j:f16;var _k:f16;var _l:bool;var _m:f16;var _n:f16;var _o:bool;var _p:vec2u;var _q:vec2u;switch(0u){default:{let _r=bitcast<vec2u>(vec2i(textureDimensions(_3,0i)));let _s=((_r.x+3u)/4u);let _t=x_746;let _u=x_746.xy;let _v=x_746.x;let _w=(_v>=_s);_a=_w;if(!(_w)){_9=(_t.y>=((_r.y+3u)/4u));_a=_9;}if(_a){break;}let _x=((vec2f(bitcast<vec2i>((_u*vec2u(4u))))+_4)*(_4/vec2f(vec2i(textureDimensions(_3,0i)))));let _y=vec4h(textureGather(0i,_3,_2,_x,vec2i()));let _z=vec4h(textureGather(0i,_3,_2,_x,vec2i(2i,0i)));let _10=vec4h(textureGather(0i,_3,_2,_x,vec2i(0i,2i)));let _11=vec4h(textureGather(0i,_3,_2,_x,vec2i(2i)));let _12=_y.w;let _13=_y.z;let _14=_z.w;let _15=_z.z;let _16=_y.x;let _17=_y.y;let _18=_z.x;let _19=_z.y;let _1a=_10.w;let _1b=_10.z;let _1c=_11.w;let _1d=_11.z;let _1e=_10.x;let _1f=_10.y;let _1g=_11.x;let _1h=_11.y;let _1i=min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(1.0h,_12),_13),_14),_15),_16),_17),_18),_19),_1a),_1b),_1c),_1d),_1e),_1f),_1g),_1h);let _1j=max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(max(0.0h,_12),_13),_14),_15),_16),_17),_18),_19),_1a),_1b),_1c),_1d),_1e),_1f),_1g),_1h);let _1k=(_1j-_1i);let _1l=(_1k*0.03125h);_c=_1l;if((_1k<0.0625h)){_b=max(0.0h,((2.0h*_1l)-0.0625h));_c=_b;}_e=_1i;if((_1i>0.0h)){_d=(_1i+_c);_e=_d;}_g=_1j;if((_e<1.0h)){_f=(_1j-_c);_g=_f;}let _1m=trunc(((_g*255.0h)+0.5h));let _1n=trunc(((_e*255.0h)+0.5h));switch(0u){default:{if((_1m==_1n)){_i=vec2u();break;}let _1o=(1.0h/(_1n-_1m));let _1p=(_1m*-(_1o));let _1q=(_1o*255.0h);let _1r=(0u|(u32(((clamp(((_1a*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_h=vec2u(((((((((0u|(u32(((clamp(((_12*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_13*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_14*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_15*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_16*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_17*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_18*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_19*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_1r);_h.y=(((((((_1r|(u32(((clamp(((_1b*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1c*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1d*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1e*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_1f*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_1g*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_1h*_1q)+_1p),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_i=_h;}}switch(0u){default:{let _1s=_i.x;_7=_5;let _1t=_7[((_1s>>bitcast<u32>(0i))&7u)];let _1u=(1.0f-_1t);let _1v=f32(_12);_7=_5;let _1w=_7[((_1s>>bitcast<u32>(3i))&7u)];let _1x=(1.0f-_1w);let _1y=f32(_13);_7=_5;let _1z=_7[((_1s>>bitcast<u32>(6i))&7u)];let _20=(1.0f-_1z);let _21=f32(_14);_7=_5;let _22=_7[((_1s>>bitcast<u32>(9i))&7u)];let _23=(1.0f-_22);let _24=f32(_15);_7=_5;let _25=_7[((_1s>>bitcast<u32>(12i))&7u)];let _26=(1.0f-_25);let _27=f32(_16);_7=_5;let _28=_7[((_1s>>bitcast<u32>(15i))&7u)];let _29=(1.0f-_28);let _2a=f32(_17);_7=_5;let _2b=_7[((_1s>>bitcast<u32>(18i))&7u)];let _2c=(1.0f-_2b);let _2d=f32(_18);_7=_5;let _2e=_7[((_1s>>bitcast<u32>(21i))&7u)];let _2f=(1.0f-_2e);let _2g=f32(_19);let _2h=_i.y;_8=_5;let _2i=_8[((_2h>>bitcast<u32>(0i))&7u)];let _2j=(1.0f-_2i);let _2k=f32(_1a);_8=_5;let _2l=_8[((_2h>>bitcast<u32>(3i))&7u)];let _2m=(1.0f-_2l);let _2n=f32(_1b);_8=_5;let _2o=_8[((_2h>>bitcast<u32>(6i))&7u)];let _2p=(1.0f-_2o);let _2q=f32(_1c);_8=_5;let _2r=_8[((_2h>>bitcast<u32>(9i))&7u)];let _2s=(1.0f-_2r);let _2t=f32(_1d);_8=_5;let _2u=_8[((_2h>>bitcast<u32>(12i))&7u)];let _2v=(1.0f-_2u);let _2w=f32(_1e);_8=_5;let _2x=_8[((_2h>>bitcast<u32>(15i))&7u)];let _2y=(1.0f-_2x);let _2z=f32(_1f);_8=_5;let _30=_8[((_2h>>bitcast<u32>(18i))&7u)];let _31=(1.0f-_30);let _32=f32(_1g);_8=_5;let _33=_8[((_2h>>bitcast<u32>(21i))&7u)];let _34=(1.0f-_33);let _35=((((((((((((((((_1u*_1u)+(_1x*_1x))+(_20*_20))+(_23*_23))+(_26*_26))+(_29*_29))+(_2c*_2c))+(_2f*_2f))+(_2j*_2j))+(_2m*_2m))+(_2p*_2p))+(_2s*_2s))+(_2v*_2v))+(_2y*_2y))+(_31*_31))+(_34*_34));let _36=((((((((((((((((_1t*_1t)+(_1w*_1w))+(_1z*_1z))+(_22*_22))+(_25*_25))+(_28*_28))+(_2b*_2b))+(_2e*_2e))+(_2i*_2i))+(_2l*_2l))+(_2o*_2o))+(_2r*_2r))+(_2u*_2u))+(_2x*_2x))+(_30*_30))+(_33*_33));let _37=((((((((((((((((_1u*_1t)+(_1x*_1w))+(_20*_1z))+(_23*_22))+(_26*_25))+(_29*_28))+(_2c*_2b))+(_2f*_2e))+(_2j*_2i))+(_2m*_2l))+(_2p*_2o))+(_2s*_2r))+(_2v*_2u))+(_2y*_2x))+(_31*_30))+(_34*_33));let _38=f32(_1h);let _39=((((((((((((((((_1u*_1v)+(_1x*_1y))+(_20*_21))+(_23*_24))+(_26*_27))+(_29*_2a))+(_2c*_2d))+(_2f*_2g))+(_2j*_2k))+(_2m*_2n))+(_2p*_2q))+(_2s*_2t))+(_2v*_2w))+(_2y*_2z))+(_31*_32))+(_34*_38));let _3a=((((((((((((((((_1t*_1v)+(_1w*_1y))+(_1z*_21))+(_22*_24))+(_25*_27))+(_28*_2a))+(_2b*_2d))+(_2e*_2g))+(_2i*_2k))+(_2l*_2n))+(_2o*_2q))+(_2r*_2t))+(_2u*_2w))+(_2x*_2z))+(_30*_32))+(_33*_38));let _3b=((_35*_36)-(_37*_37));if((abs(_3b)<0.00009999999747378752f)){_m=_1n;_n=_1m;_o=false;break;}let _3c=(1.0f/_3b);_j=trunc(((f16(clamp((((_39*_36)-(_3a*_37))*_3c),0.0f,1.0f))*255.0h)+0.5h));_k=trunc(((f16(clamp((((_3a*_35)-(_39*_37))*_3c),0.0f,1.0f))*255.0h)+0.5h));_l=(!((_j==_1m))|!((_k==_1n)));_m=_k;_n=_j;_o=_l;}}var _3d:vec2u;_q=_i;if(_o){switch(0u){default:{if((_n==_m)){_p=vec2u();break;}let _3e=(1.0h/(_m-_n));let _3f=(_n*-(_3e));let _3g=(_3e*255.0h);let _3h=(0u|(u32(((clamp(((_1a*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)));_3d=vec2u(((((((((0u|(u32(((clamp(((_12*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(0i)))|(u32(((clamp(((_13*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_14*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_15*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_16*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_17*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_18*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_19*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i))),_3h);_3d.y=(((((((_3h|(u32(((clamp(((_1b*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(3i)))|(u32(((clamp(((_1c*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(6i)))|(u32(((clamp(((_1d*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(9i)))|(u32(((clamp(((_1e*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(12i)))|(u32(((clamp(((_1f*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(15i)))|(u32(((clamp(((_1g*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(18i)))|(u32(((clamp(((_1h*_3g)+_3f),0.0h,1.0h)*7.0h)+0.5h))<<bitcast<u32>(21i)));_p=_3d;}}_q=_p;}let _3i=_q.x;let _3j=(((_3i&7190235u)+2396745u)^(_3i&9586980u));let _3k=(_3j^(((19173960u-(_3j&14380470u))&19173960u)>>bitcast<u32>(3i)));let _3l=_q.y;let _3m=(((_3l&7190235u)+2396745u)^(_3l&9586980u));let _3n=(_3k>>bitcast<u32>(16i));var _3o=vec2u(((u32(_n)|(u32(_m)<<bitcast<u32>(8i)))|(_3k<<bitcast<u32>(16i))),_3n);_3o.y=(_3n|((_3m^(((19173960u-(_3m&14380470u))&19173960u)>>bitcast<u32>(3i)))<<bitcast<u32>(8i)));x_844._0[((_t.y*((_s+31u)&4294967264u))+_v)]=_3o;}}return;}@compute @workgroup_size(16i, 16i, 1i) fn main(@builtin(global_invocation_id) _3p:vec3u,@builtin(local_invocation_id) _3q:vec3u,@builtin(workgroup_id) _3r:vec3u){x_746=_3p;x_752=_3q;_6();}";
|
|
2
|
-
export {
|
|
3
|
-
spark_bc4_r as default
|
|
4
|
-
};
|