GPUShaderModuleDescriptor.js 687 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Reusable descriptor for `GPUDevice.createShaderModule()`.
  3. *
  4. * @private
  5. */
  6. class GPUShaderModuleDescriptor {
  7. constructor() {
  8. /**
  9. * The label of the shader module.
  10. *
  11. * @type {string}
  12. */
  13. this.label = '';
  14. /**
  15. * The WGSL source code of the shader module.
  16. *
  17. * @type {string}
  18. */
  19. this.code = '';
  20. /**
  21. * Compilation hints that may help the implementation produce optimized code.
  22. *
  23. * @type {Array<Object>}
  24. */
  25. this.compilationHints = [];
  26. }
  27. /**
  28. * Resets the descriptor to its default state.
  29. */
  30. reset() {
  31. this.label = '';
  32. this.code = '';
  33. this.compilationHints.length = 0;
  34. }
  35. }
  36. export default GPUShaderModuleDescriptor;
粤ICP备19079148号