WebGPUProperties.js 405 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. class WebGPUProperties {
  2. constructor() {
  3. this.properties = new WeakMap();
  4. }
  5. get( object ) {
  6. let map = this.properties.get( object );
  7. if ( map === undefined ) {
  8. map = {};
  9. this.properties.set( object, map );
  10. }
  11. return map;
  12. }
  13. remove( object ) {
  14. this.properties.delete( object );
  15. }
  16. dispose() {
  17. this.properties = new WeakMap();
  18. }
  19. }
  20. export default WebGPUProperties;