-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converting dot Utils usage, see phetsims/dot#4
- Loading branch information
1 parent
277788e
commit 3d12a8d
Showing
11 changed files
with
60 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,11 @@ | |
* @author Jonathan Olson <[email protected]> | ||
*/ | ||
|
||
import Utils from '../../../dot/js/Utils.js'; | ||
import { clamp } from '../../../dot/js/util/clamp.js'; | ||
import Vector2 from '../../../dot/js/Vector2.js'; | ||
import { alpenglow } from '../alpenglow.js'; | ||
import { LineClipping } from './LineClipping.js'; | ||
import { roundSymmetric } from '../../../dot/js/util/roundSymmetric.js'; | ||
|
||
const scratchStartPoint = new Vector2( 0, 0 ); | ||
const scratchEndPoint = new Vector2( 0, 0 ); | ||
|
@@ -94,10 +94,10 @@ export class GridClipping { | |
const maxRawStartStepX = Math.max( rawStartStepX, rawEndStepX ); | ||
const maxRawStartStepY = Math.max( rawStartStepY, rawEndStepY ); | ||
|
||
const roundedMinStepX = Utils.roundSymmetric( minRawStartStepX ); | ||
const roundedMinStepY = Utils.roundSymmetric( minRawStartStepY ); | ||
const roundedMaxStepX = Utils.roundSymmetric( maxRawStartStepX ); | ||
const roundedMaxStepY = Utils.roundSymmetric( maxRawStartStepY ); | ||
const roundedMinStepX = roundSymmetric( minRawStartStepX ); | ||
const roundedMinStepY = roundSymmetric( minRawStartStepY ); | ||
const roundedMaxStepX = roundSymmetric( maxRawStartStepX ); | ||
const roundedMaxStepY = roundSymmetric( maxRawStartStepY ); | ||
|
||
// Integral "step" coordinates - with slight perturbation to expand our region to cover points/lines that lie | ||
// exactly on our grid lines (but not outside of our bounds) | ||
|
@@ -516,10 +516,10 @@ export class GridClipping { | |
const maxRawStartStepX = Math.max( rawStartStepX, rawEndStepX ); | ||
const maxRawStartStepY = Math.max( rawStartStepY, rawEndStepY ); | ||
|
||
const roundedMinStepX = Utils.roundSymmetric( minRawStartStepX ); | ||
const roundedMinStepY = Utils.roundSymmetric( minRawStartStepY ); | ||
const roundedMaxStepX = Utils.roundSymmetric( maxRawStartStepX ); | ||
const roundedMaxStepY = Utils.roundSymmetric( maxRawStartStepY ); | ||
const roundedMinStepX = roundSymmetric( minRawStartStepX ); | ||
const roundedMinStepY = roundSymmetric( minRawStartStepY ); | ||
const roundedMaxStepX = roundSymmetric( maxRawStartStepX ); | ||
const roundedMaxStepY = roundSymmetric( maxRawStartStepY ); | ||
|
||
// Integral "step" coordinates - with slight perturbation to expand our region to cover points/lines that lie | ||
// exactly on our grid lines (but not outside of our bounds) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
* @author Jonathan Olson <[email protected]> | ||
*/ | ||
|
||
import Utils from '../../../dot/js/Utils.js'; | ||
import { alpenglow } from '../alpenglow.js'; | ||
import { DeviceContext } from './compute/DeviceContext.js'; | ||
import { getArrayType, U32Order } from './compute/ConcreteType.js'; | ||
|
@@ -15,6 +14,7 @@ import { RadixSortModule } from './modules/gpu/RadixSortModule.js'; | |
import { u32S } from './wgsl/WGSLString.js'; | ||
import { Routine } from './compute/Routine.js'; | ||
import { Procedure } from './compute/Procedure.js'; | ||
import { toFixed } from '../../../dot/js/util/toFixed.js'; | ||
|
||
export class PerformanceTesting { | ||
public static async loopRadixSortTest( | ||
|
@@ -96,7 +96,7 @@ export class PerformanceTesting { | |
const elapsed = now - startTime; | ||
startTime = now; | ||
elapsedTimes.push( elapsed ); | ||
console.log( Utils.toFixed( elapsed, 0 ), elapsedTimes.length > 1 ? Utils.toFixed( _.sum( elapsedTimes.slice( 1 ) ) / elapsedTimes.slice( 1 ).length, 0 ) : 0 ); | ||
console.log( toFixed( elapsed, 0 ), elapsedTimes.length > 1 ? toFixed( _.sum( elapsedTimes.slice( 1 ) ) / elapsedTimes.slice( 1 ).length, 0 ) : 0 ); | ||
} | ||
|
||
// TODO: maybe avoid the await on the first frame? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
* @author Jonathan Olson <[email protected]> | ||
*/ | ||
|
||
import Utils from '../../../../dot/js/Utils.js'; | ||
import { optionize3 } from '../../../../phet-core/js/optionize.js'; | ||
import { alpenglow } from '../../alpenglow.js'; | ||
import type { DeviceContext } from './DeviceContext.js'; | ||
|
@@ -15,6 +14,7 @@ import { ComputePass } from './ComputePass.js'; | |
import type { TypedBuffer } from './TypedBuffer.js'; | ||
import { webgpu } from '../WebGPUAPI.js'; | ||
import { ConsoleLogger } from './ConsoleLogger.js'; | ||
import { roundSymmetric } from '../../../../dot/js/util/roundSymmetric.js'; | ||
|
||
export type ExecutorOptions = { | ||
getTimestampWrites?: ( name: string ) => GPUComputePassTimestampWrites | null; | ||
|
@@ -137,7 +137,7 @@ export class Executor { | |
if ( logResult ) { | ||
const data = new Uint32Array( logResult ); | ||
const length = data[ 0 ]; | ||
const usedMessage = `logging used ${length} of ${data.length - 1} u32s (${Utils.roundSymmetric( 100 * length / ( data.length - 1 ) )}%)`; | ||
const usedMessage = `logging used ${length} of ${data.length - 1} u32s (${roundSymmetric( 100 * length / ( data.length - 1 ) )}%)`; | ||
console.log( usedMessage ); | ||
|
||
const logData = ConsoleLogger.analyze( logResult ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,12 @@ | |
* @author Jonathan Olson <[email protected]> | ||
*/ | ||
|
||
import Utils from '../../../../dot/js/Utils.js'; | ||
import { alpenglow } from '../../alpenglow.js'; | ||
import type { DeviceContext } from './DeviceContext.js'; | ||
import { webgpu } from '../WebGPUAPI.js'; | ||
import type { BufferLogger } from './BufferLogger.js'; | ||
import { ByteEncoder } from './ByteEncoder.js'; | ||
import { roundSymmetric } from '../../../../dot/js/util/roundSymmetric.js'; | ||
|
||
export class TimestampLogger { | ||
|
||
|
@@ -107,7 +107,7 @@ export class TimestampLoggerResult { | |
public toString(): string { | ||
const numToTimestamp = ( n: number ): string => { | ||
let result = ''; | ||
let digits = '' + Utils.roundSymmetric( n ); | ||
let digits = '' + roundSymmetric( n ); | ||
|
||
while ( digits.length ) { | ||
if ( digits.length > 3 ) { | ||
|
Oops, something went wrong.