@@ -4,37 +4,37 @@ import type { PackedData } from './vertexFormatData';
44import * as wgsl from './wgslTypes' ;
55
66/**
7- * Array schema constructed via `d.looseArrayOf ` function.
7+ * Array schema constructed via `d.disarrayOf ` function.
88 *
99 * Useful for defining vertex buffers.
1010 * Elements in the schema are not aligned in respect to their `byteAlignment`,
1111 * unless they are explicitly decorated with the custom align attribute
1212 * via `d.align` function.
1313 */
14- export interface LooseArray <
14+ export interface Disarray <
1515 TElement extends wgsl . BaseWgslData = wgsl . BaseWgslData ,
1616> {
17- readonly type : 'loose-array ' ;
17+ readonly type : 'disarray ' ;
1818 readonly elementCount : number ;
1919 readonly elementType : TElement ;
2020 readonly '~repr' : Infer < TElement > [ ] ;
2121}
2222
2323/**
24- * Struct schema constructed via `d.looseStruct ` function.
24+ * Struct schema constructed via `d.unstruct ` function.
2525 *
2626 * Useful for defining vertex buffers, as the standard layout restrictions do not apply.
2727 * Members are not aligned in respect to their `byteAlignment`,
2828 * unless they are explicitly decorated with the custom align attribute
2929 * via `d.align` function.
3030 */
31- export interface LooseStruct <
31+ export interface Unstruct <
3232 TProps extends Record < string , wgsl . BaseWgslData > = Record <
3333 string ,
3434 wgsl . BaseWgslData
3535 > ,
3636> {
37- readonly type : 'loose-struct ' ;
37+ readonly type : 'unstruct ' ;
3838 readonly propTypes : TProps ;
3939 readonly '~repr' : InferRecord < TProps > ;
4040}
@@ -50,60 +50,56 @@ export interface LooseDecorated<
5050}
5151
5252const looseTypeLiterals = [
53- 'loose-struct ' ,
54- 'loose-array ' ,
53+ 'unstruct ' ,
54+ 'disarray ' ,
5555 'loose-decorated' ,
5656 ...vertexFormats ,
5757] as const ;
5858
5959export type LooseTypeLiteral = ( typeof looseTypeLiterals ) [ number ] ;
6060
61- export type AnyLooseData =
62- | LooseArray
63- | LooseStruct
64- | LooseDecorated
65- | PackedData ;
61+ export type AnyLooseData = Disarray | Unstruct | LooseDecorated | PackedData ;
6662
6763export function isLooseData ( data : unknown ) : data is AnyLooseData {
6864 return looseTypeLiterals . includes ( ( data as AnyLooseData ) ?. type ) ;
6965}
7066
7167/**
72- * Checks whether the passed in value is a loose-array schema,
68+ * Checks whether the passed in value is a disarray schema,
7369 * as opposed to, e.g., a regular array schema.
7470 *
7571 * Array schemas can be used to describe uniform and storage buffers,
76- * whereas looseArray schemas cannot. Loose arrays are useful for
72+ * whereas disarray schemas cannot. Disarrays are useful for
7773 * defining vertex buffers instead.
7874 *
7975 * @example
80- * isLooseArray (d.arrayOf(d.u32, 4)) // false
81- * isLooseArray (d.looseArrayOf (d.u32, 4)) // true
82- * isLooseArray (d.vec3f) // false
76+ * isDisarray (d.arrayOf(d.u32, 4)) // false
77+ * isDisarray (d.disarrayOf (d.u32, 4)) // true
78+ * isDisarray (d.vec3f) // false
8379 */
84- export function isLooseArray < T extends LooseArray > (
80+ export function isDisarray < T extends Disarray > (
8581 schema : T | unknown ,
8682) : schema is T {
87- return ( schema as LooseArray ) ?. type === 'loose-array ' ;
83+ return ( schema as Disarray ) ?. type === 'disarray ' ;
8884}
8985
9086/**
91- * Checks whether passed in value is a looseStruct schema,
87+ * Checks whether passed in value is a unstruct schema,
9288 * as opposed to, e.g., a struct schema.
9389 *
9490 * Struct schemas can be used to describe uniform and storage buffers,
95- * whereas looseStruct schemas cannot. Loose structs are useful for
91+ * whereas unstruct schemas cannot. Unstructs are useful for
9692 * defining vertex buffers instead.
9793 *
9894 * @example
99- * isLooseStruct (d.struct({ a: d.u32 })) // false
100- * isLooseStruct (d.looseStruct ({ a: d.u32 })) // true
101- * isLooseStruct (d.vec3f) // false
95+ * isUnstruct (d.struct({ a: d.u32 })) // false
96+ * isUnstruct (d.unstruct ({ a: d.u32 })) // true
97+ * isUnstruct (d.vec3f) // false
10298 */
103- export function isLooseStruct < T extends LooseStruct > (
99+ export function isUnstruct < T extends Unstruct > (
104100 schema : T | unknown ,
105101) : schema is T {
106- return ( schema as T ) ?. type === 'loose-struct ' ;
102+ return ( schema as T ) ?. type === 'unstruct ' ;
107103}
108104
109105export function isLooseDecorated < T extends LooseDecorated > (
0 commit comments