@luma.gl/shadertools 9.0.15 → 9.0.16
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/dist/dist.dev.js +784 -173
- package/dist/dist.min.js +75 -75
- package/dist/index.cjs +15 -2832
- package/dist/index.cjs.map +4 -4
- package/dist/lib/wgsl/get-shader-layout-wgsl.js +5 -5
- package/package.json +4 -3
- package/src/lib/wgsl/get-shader-layout-wgsl.ts +5 -5
- package/dist/libs/wgsl-reflect/wgsl_reflect.module.d.ts +0 -1112
- package/dist/libs/wgsl-reflect/wgsl_reflect.module.d.ts.map +0 -1
- package/dist/libs/wgsl-reflect/wgsl_reflect.module.js +0 -3389
- package/src/libs/wgsl-reflect/wgsl_reflect.module.js +0 -3394
- package/src/libs/wgsl-reflect/wgsl_reflect.module.js.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { log } from '@luma.gl/core';
|
|
5
|
-
import { WgslReflect } from '
|
|
5
|
+
import { WgslReflect } from 'wgsl_reflect';
|
|
6
6
|
/**
|
|
7
7
|
* Parse a ShaderLayout from WGSL shader source code.
|
|
8
8
|
* @param source WGSL source code (can contain both @vertex and @fragment entry points)
|
|
@@ -20,10 +20,10 @@ export function getShaderLayoutFromWGSL(source) {
|
|
|
20
20
|
}
|
|
21
21
|
for (const uniform of parsedWGSL.uniforms) {
|
|
22
22
|
const members = [];
|
|
23
|
-
for (const
|
|
23
|
+
for (const attribute of uniform.type?.members || []) {
|
|
24
24
|
members.push({
|
|
25
|
-
name:
|
|
26
|
-
type: getType(
|
|
25
|
+
name: attribute.name,
|
|
26
|
+
type: getType(attribute.type)
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
shaderLayout.bindings.push({
|
|
@@ -45,7 +45,7 @@ export function getShaderLayoutFromWGSL(source) {
|
|
|
45
45
|
const type = getType(wgslAttribute.type);
|
|
46
46
|
shaderLayout.attributes.push({
|
|
47
47
|
name: wgslAttribute.name,
|
|
48
|
-
location: wgslAttribute.location,
|
|
48
|
+
location: Number(wgslAttribute.location),
|
|
49
49
|
type
|
|
50
50
|
});
|
|
51
51
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/shadertools",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.16",
|
|
4
4
|
"description": "Shader module system for luma.gl",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@math.gl/core": "^4.0.0",
|
|
53
|
-
"@math.gl/types": "^4.0.0"
|
|
53
|
+
"@math.gl/types": "^4.0.0",
|
|
54
|
+
"wgsl_reflect": "^1.0.1"
|
|
54
55
|
},
|
|
55
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "b1f2597d6efc8aa223ddb3bf6b1530510f17ea40"
|
|
56
57
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ShaderAttributeType, ShaderLayout, log} from '@luma.gl/core';
|
|
6
|
-
import {WgslReflect} from '
|
|
6
|
+
import {WgslReflect} from 'wgsl_reflect';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Parse a ShaderLayout from WGSL shader source code.
|
|
@@ -23,10 +23,10 @@ export function getShaderLayoutFromWGSL(source: string): ShaderLayout {
|
|
|
23
23
|
|
|
24
24
|
for (const uniform of parsedWGSL.uniforms) {
|
|
25
25
|
const members = [];
|
|
26
|
-
for (const
|
|
26
|
+
for (const attribute of (uniform.type as any)?.members || []) {
|
|
27
27
|
members.push({
|
|
28
|
-
name:
|
|
29
|
-
type: getType(
|
|
28
|
+
name: attribute.name,
|
|
29
|
+
type: getType(attribute.type)
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -53,7 +53,7 @@ export function getShaderLayoutFromWGSL(source: string): ShaderLayout {
|
|
|
53
53
|
|
|
54
54
|
shaderLayout.attributes.push({
|
|
55
55
|
name: wgslAttribute.name,
|
|
56
|
-
location: wgslAttribute.location,
|
|
56
|
+
location: Number(wgslAttribute.location),
|
|
57
57
|
type
|
|
58
58
|
});
|
|
59
59
|
}
|