Skip to content

Commit

Permalink
Update WGSLNodeBuilder.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Spiri0 authored Dec 4, 2024
1 parent 8f2e365 commit 2bafcdf
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/renderers/webgpu/nodes/WGSLNodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,8 @@ const wgslTypeLib = {

mat2: 'mat2x2<f32>',
mat3: 'mat3x3<f32>',
mat4: 'mat4x4<f32>',
mat4: 'mat4x4<f32>'

//because arrays with their two degrees of freedom are special
array( elementType, count ) {

const isValidType = ( type ) => !! this[ type ];

if ( ! isValidType( elementType ) ) {

throw new Error( `Unknown type: ${elementType}` );

}

if ( typeof count !== 'number' || ! Number.isInteger( count ) || count < 1 ) {

throw new Error( `Invalid size: ${count}. Size must be a positive integer` );

}

return `array<${this[ elementType ]}, ${count}>`;

}
};

const wgslCodeCache = {};
Expand Down

0 comments on commit 2bafcdf

Please sign in to comment.