最新代码

This commit is contained in:
Teo
2025-07-29 11:22:30 +08:00
parent d503e64098
commit b01d143ea6
1490 changed files with 680232 additions and 28 deletions

View File

@ -0,0 +1,33 @@
import { GPU_CHUNK_BYTES } from './Constants.js';
function getFloatLength( floatLength ) {
// ensure chunk size alignment (STD140 layout)
return floatLength + ( ( GPU_CHUNK_BYTES - ( floatLength % GPU_CHUNK_BYTES ) ) % GPU_CHUNK_BYTES );
}
function getVectorLength( count, vectorLength = 4 ) {
const strideLength = getStrideLength( vectorLength );
const floatLength = strideLength * count;
return getFloatLength( floatLength );
}
function getStrideLength( vectorLength ) {
const strideLength = 4;
return vectorLength + ( ( strideLength - ( vectorLength % strideLength ) ) % strideLength );
}
export {
getFloatLength,
getVectorLength,
getStrideLength
};