WebGPUConstants.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. export const GPUPrimitiveTopology = {
  2. PointList: 'point-list',
  3. LineList: 'line-list',
  4. LineStrip: 'line-strip',
  5. TriangleList: 'triangle-list',
  6. TriangleStrip: 'triangle-strip',
  7. };
  8. export const GPUCompareFunction = {
  9. Never: 'never',
  10. Less: 'less',
  11. Equal: 'equal',
  12. LessEqual: 'less-equal',
  13. Greater: 'greater',
  14. NotEqual: 'not-equal',
  15. GreaterEqual: 'greater-equal',
  16. Always: 'always'
  17. };
  18. export const GPUStoreOp = {
  19. Store: 'store',
  20. Discard: 'discard'
  21. };
  22. export const GPULoadOp = {
  23. Load: 'load',
  24. Clear: 'clear'
  25. };
  26. export const GPUFrontFace = {
  27. CCW: 'ccw',
  28. CW: 'cw'
  29. };
  30. export const GPUCullMode = {
  31. None: 'none',
  32. Front: 'front',
  33. Back: 'back'
  34. };
  35. export const GPUIndexFormat = {
  36. Uint16: 'uint16',
  37. Uint32: 'uint32'
  38. };
  39. export const GPUVertexFormat = {
  40. Uint8x2: 'uint8x2',
  41. Uint8x4: 'uint8x4',
  42. Sint8x2: 'sint8x2',
  43. Sint8x4: 'sint8x4',
  44. Unorm8x2: 'unorm8x2',
  45. Unorm8x4: 'unorm8x4',
  46. Snorm8x2: 'snorm8x2',
  47. Snorm8x4: 'snorm8x4',
  48. Uint16x2: 'uint16x2',
  49. Uint16x4: 'uint16x4',
  50. Sint16x2: 'sint16x2',
  51. Sint16x4: 'sint16x4',
  52. Unorm16x2: 'unorm16x2',
  53. Unorm16x4: 'unorm16x4',
  54. Snorm16x2: 'snorm16x2',
  55. Snorm16x4: 'snorm16x4',
  56. Float16x2: 'float16x2',
  57. Float16x4: 'float16x4',
  58. Float32: 'float32',
  59. Float32x2: 'float32x2',
  60. Float32x3: 'float32x3',
  61. Float32x4: 'float32x4',
  62. Uint32: 'uint32',
  63. Uint32x2: 'uint32x2',
  64. Uint32x3: 'uint32x3',
  65. Uint32x4: 'uint32x4',
  66. Sint32: 'sint32',
  67. Sint32x2: 'sint32x2',
  68. Sint32x3: 'sint32x3',
  69. Sint32x4: 'sint32x4'
  70. };
  71. export const GPUTextureFormat = {
  72. // 8-bit formats
  73. R8Unorm: 'r8unorm',
  74. R8Snorm: 'r8snorm',
  75. R8Uint: 'r8uint',
  76. R8Sint: 'r8sint',
  77. // 16-bit formats
  78. R16Uint: 'r16uint',
  79. R16Sint: 'r16sint',
  80. R16Float: 'r16float',
  81. RG8Unorm: 'rg8unorm',
  82. RG8Snorm: 'rg8snorm',
  83. RG8Uint: 'rg8uint',
  84. RG8Sint: 'rg8sint',
  85. // 32-bit formats
  86. R32Uint: 'r32uint',
  87. R32Sint: 'r32sint',
  88. R32Float: 'r32float',
  89. RG16Uint: 'rg16uint',
  90. RG16Sint: 'rg16sint',
  91. RG16Float: 'rg16float',
  92. RGBA8Unorm: 'rgba8unorm',
  93. RGBA8UnormSRGB: 'rgba8unorm-srgb',
  94. RGBA8Snorm: 'rgba8snorm',
  95. RGBA8Uint: 'rgba8uint',
  96. RGBA8Sint: 'rgba8sint',
  97. BGRA8Unorm: 'bgra8unorm',
  98. BGRA8UnormSRGB: 'bgra8unorm-srgb',
  99. // Packed 32-bit formats
  100. RGB9E5UFloat: 'rgb9e5ufloat',
  101. RGB10A2Unorm: 'rgb10a2unorm',
  102. RG11B10uFloat: 'rgb10a2unorm',
  103. // 64-bit formats
  104. RG32Uint: 'rg32uint',
  105. RG32Sint: 'rg32sint',
  106. RG32Float: 'rg32float',
  107. RGBA16Uint: 'rgba16uint',
  108. RGBA16Sint: 'rgba16sint',
  109. RGBA16Float: 'rgba16float',
  110. // 128-bit formats
  111. RGBA32Uint: 'rgba32uint',
  112. RGBA32Sint: 'rgba32sint',
  113. RGBA32Float: 'rgba32float',
  114. // Depth and stencil formats
  115. Stencil8: 'stencil8',
  116. Depth16Unorm: 'depth16unorm',
  117. Depth24Plus: 'depth24plus',
  118. Depth24PlusStencil8: 'depth24plus-stencil8',
  119. Depth32Float: 'depth32float',
  120. // 'depth32float-stencil8' extension
  121. Depth32FloatStencil8: 'depth32float-stencil8',
  122. // BC compressed formats usable if 'texture-compression-bc' is both
  123. // supported by the device/user agent and enabled in requestDevice.
  124. BC1RGBAUnorm: 'bc1-rgba-unorm',
  125. BC1RGBAUnormSRGB: 'bc1-rgba-unorm-srgb',
  126. BC2RGBAUnorm: 'bc2-rgba-unorm',
  127. BC2RGBAUnormSRGB: 'bc2-rgba-unorm-srgb',
  128. BC3RGBAUnorm: 'bc3-rgba-unorm',
  129. BC3RGBAUnormSRGB: 'bc3-rgba-unorm-srgb',
  130. BC4RUnorm: 'bc4-r-unorm',
  131. BC4RSnorm: 'bc4-r-snorm',
  132. BC5RGUnorm: 'bc5-rg-unorm',
  133. BC5RGSnorm: 'bc5-rg-snorm',
  134. BC6HRGBUFloat: 'bc6h-rgb-ufloat',
  135. BC6HRGBFloat: 'bc6h-rgb-float',
  136. BC7RGBAUnorm: 'bc7-rgba-unorm',
  137. BC7RGBAUnormSRGB: 'bc7-rgba-srgb',
  138. // ETC2 compressed formats usable if 'texture-compression-etc2' is both
  139. // supported by the device/user agent and enabled in requestDevice.
  140. ETC2RGB8Unorm: 'etc2-rgb8unorm',
  141. ETC2RGB8UnormSRGB: 'etc2-rgb8unorm-srgb',
  142. ETC2RGB8A1Unorm: 'etc2-rgb8a1unorm',
  143. ETC2RGB8A1UnormSRGB: 'etc2-rgb8a1unorm-srgb',
  144. ETC2RGBA8Unorm: 'etc2-rgba8unorm',
  145. ETC2RGBA8UnormSRGB: 'etc2-rgba8unorm-srgb',
  146. EACR11Unorm: 'eac-r11unorm',
  147. EACR11Snorm: 'eac-r11snorm',
  148. EACRG11Unorm: 'eac-rg11unorm',
  149. EACRG11Snorm: 'eac-rg11snorm',
  150. // ASTC compressed formats usable if 'texture-compression-astc' is both
  151. // supported by the device/user agent and enabled in requestDevice.
  152. ASTC4x4Unorm: 'astc-4x4-unorm',
  153. ASTC4x4UnormSRGB: 'astc-4x4-unorm-srgb',
  154. ASTC5x4Unorm: 'astc-5x4-unorm',
  155. ASTC5x4UnormSRGB: 'astc-5x4-unorm-srgb',
  156. ASTC5x5Unorm: 'astc-5x5-unorm',
  157. ASTC5x5UnormSRGB: 'astc-5x5-unorm-srgb',
  158. ASTC6x5Unorm: 'astc-6x5-unorm',
  159. ASTC6x5UnormSRGB: 'astc-6x5-unorm-srgb',
  160. ASTC6x6Unorm: 'astc-6x6-unorm',
  161. ASTC6x6UnormSRGB: 'astc-6x6-unorm-srgb',
  162. ASTC8x5Unorm: 'astc-8x5-unorm',
  163. ASTC8x5UnormSRGB: 'astc-8x5-unorm-srgb',
  164. ASTC8x6Unorm: 'astc-8x6-unorm',
  165. ASTC8x6UnormSRGB: 'astc-8x6-unorm-srgb',
  166. ASTC8x8Unorm: 'astc-8x8-unorm',
  167. ASTC8x8UnormSRGB: 'astc-8x8-unorm-srgb',
  168. ASTC10x5Unorm: 'astc-10x5-unorm',
  169. ASTC10x5UnormSRGB: 'astc-10x5-unorm-srgb',
  170. ASTC10x6Unorm: 'astc-10x6-unorm',
  171. ASTC10x6UnormSRGB: 'astc-10x6-unorm-srgb',
  172. ASTC10x8Unorm: 'astc-10x8-unorm',
  173. ASTC10x8UnormSRGB: 'astc-10x8-unorm-srgb',
  174. ASTC10x10Unorm: 'astc-10x10-unorm',
  175. ASTC10x10UnormSRGB: 'astc-10x10-unorm-srgb',
  176. ASTC12x10Unorm: 'astc-12x10-unorm',
  177. ASTC12x10UnormSRGB: 'astc-12x10-unorm-srgb',
  178. ASTC12x12Unorm: 'astc-12x12-unorm',
  179. ASTC12x12UnormSRGB: 'astc-12x12-unorm-srgb',
  180. };
  181. export const GPUAddressMode = {
  182. ClampToEdge: 'clamp-to-edge',
  183. Repeat: 'repeat',
  184. MirrorRepeat: 'mirror-repeat'
  185. };
  186. export const GPUFilterMode = {
  187. Linear: 'linear',
  188. Nearest: 'nearest'
  189. };
  190. export const GPUBlendFactor = {
  191. Zero: 'zero',
  192. One: 'one',
  193. Src: 'src',
  194. OneMinusSrc: 'one-minus-src',
  195. SrcAlpha: 'src-alpha',
  196. OneMinusSrcAlpha: 'one-minus-src-alpha',
  197. Dst: 'dst',
  198. OneMinusDstColor: 'one-minus-dst',
  199. DstAlpha: 'dst-alpha',
  200. OneMinusDstAlpha: 'one-minus-dst-alpha',
  201. SrcAlphaSaturated: 'src-alpha-saturated',
  202. Constant: 'constant',
  203. OneMinusConstant: 'one-minus-constant'
  204. };
  205. export const GPUBlendOperation = {
  206. Add: 'add',
  207. Subtract: 'subtract',
  208. ReverseSubtract: 'reverse-subtract',
  209. Min: 'min',
  210. Max: 'max'
  211. };
  212. export const GPUColorWriteFlags = {
  213. None: 0,
  214. Red: 0x1,
  215. Green: 0x2,
  216. Blue: 0x4,
  217. Alpha: 0x8,
  218. All: 0xF
  219. };
  220. export const GPUStencilOperation = {
  221. Keep: 'keep',
  222. Zero: 'zero',
  223. Replace: 'replace',
  224. Invert: 'invert',
  225. IncrementClamp: 'increment-clamp',
  226. DecrementClamp: 'decrement-clamp',
  227. IncrementWrap: 'increment-wrap',
  228. DecrementWrap: 'decrement-wrap'
  229. };
  230. export const GPUBufferBindingType = {
  231. Uniform: 'uniform',
  232. Storage: 'storage',
  233. ReadOnlyStorage: 'read-only-storage'
  234. };
  235. export const GPUSamplerBindingType = {
  236. Filtering: 'filtering',
  237. NonFiltering: 'non-filtering',
  238. Comparison: 'comparison'
  239. };
  240. export const GPUTextureSampleType = {
  241. Float: 'float',
  242. UnfilterableFloat: 'unfilterable-float',
  243. Depth: 'depth',
  244. SInt: 'sint',
  245. UInt: 'uint'
  246. };
  247. export const GPUTextureDimension = {
  248. OneD: '1d',
  249. TwoD: '2d',
  250. ThreeD: '3d'
  251. };
  252. export const GPUTextureViewDimension = {
  253. OneD: '1d',
  254. TwoD: '2d',
  255. TwoDArray: '2d-array',
  256. Cube: 'cube',
  257. CubeArray: 'cube-array',
  258. ThreeD: '3d'
  259. };
  260. export const GPUTextureAspect = {
  261. All: 'all',
  262. StencilOnly: 'stencil-only',
  263. DepthOnly: 'depth-only'
  264. };
  265. export const GPUInputStepMode = {
  266. Vertex: 'vertex',
  267. Instance: 'instance'
  268. };
  269. export const GPUFeatureName = {
  270. DepthClipControl: 'depth-clip-control',
  271. Depth32FloatStencil8: 'depth32float-stencil8',
  272. TextureCompressionBC: 'texture-compression-bc',
  273. TextureCompressionETC2: 'texture-compression-etc2',
  274. TextureCompressionASTC: 'texture-compression-astc',
  275. TimestampQuery: 'timestamp-query',
  276. IndirectFirstInstance: 'indirect-first-instance',
  277. ShaderF16: 'shader-f16',
  278. RG11B10UFloat: 'rg11b10ufloat-renderable',
  279. BGRA8UNormStorage: 'bgra8unorm-storage',
  280. Float32Filterable: 'float32-filterable'
  281. };