constants.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. // BC compressed formats usable if 'texture-compression-bc' is both
  121. // supported by the device/user agent and enabled in requestDevice.
  122. BC1RGBAUnorm: 'bc1-rgba-unorm',
  123. BC1RGBAUnormSRGB: 'bc1-rgba-unorm-srgb',
  124. BC2RGBAUnorm: 'bc2-rgba-unorm',
  125. BC2RGBAUnormSRGB: 'bc2-rgba-unorm-srgb',
  126. BC3RGBAUnorm: 'bc3-rgba-unorm',
  127. BC3RGBAUnormSRGB: 'bc3-rgba-unorm-srgb',
  128. BC4RUnorm: 'bc4-r-unorm',
  129. BC4RSnorm: 'bc4-r-snorm',
  130. BC5RGUnorm: 'bc5-rg-unorm',
  131. BC5RGSnorm: 'bc5-rg-snorm',
  132. BC6HRGBUFloat: 'bc6h-rgb-ufloat',
  133. BC6HRGBFloat: 'bc6h-rgb-float',
  134. BC7RGBAUnorm: 'bc7-rgba-unorm',
  135. BC7RGBAUnormSRGB: 'bc7-rgba-srgb',
  136. // ETC2 compressed formats usable if 'texture-compression-etc2' is both
  137. // supported by the device/user agent and enabled in requestDevice.
  138. ETC2RGB8Unorm: 'etc2-rgb8unorm',
  139. ETC2RGB8UnormSRGB: 'etc2-rgb8unorm-srgb',
  140. ETC2RGB8A1Unorm: 'etc2-rgb8a1unorm',
  141. ETC2RGB8A1UnormSRGB: 'etc2-rgb8a1unorm-srgb',
  142. ETC2RGBA8Unorm: 'etc2-rgba8unorm',
  143. ETC2RGBA8UnormSRGB: 'etc2-rgba8unorm-srgb',
  144. EACR11Unorm: 'eac-r11unorm',
  145. EACR11Snorm: 'eac-r11snorm',
  146. EACRG11Unorm: 'eac-rg11unorm',
  147. EACRG11Snorm: 'eac-rg11snorm',
  148. // 'depth24unorm-stencil8' extension
  149. Depth24UnormStencil8: 'depth24unorm-stencil8',
  150. // 'depth32float-stencil8' extension
  151. Depth32FloatStencil8: 'depth32float-stencil8',
  152. };
  153. export const GPUAddressMode = {
  154. ClampToEdge: 'clamp-to-edge',
  155. Repeat: 'repeat',
  156. MirrorRepeat: 'mirror-repeat'
  157. };
  158. export const GPUFilterMode = {
  159. Linear: 'linear',
  160. Nearest: 'nearest'
  161. };
  162. export const GPUBlendFactor = {
  163. Zero: 'zero',
  164. One: 'one',
  165. SrcColor: 'src-color',
  166. OneMinusSrcColor: 'one-minus-src-color',
  167. SrcAlpha: 'src-alpha',
  168. OneMinusSrcAlpha: 'one-minus-src-alpha',
  169. DstColor: 'dst-color',
  170. OneMinusDstColor: 'one-minus-dst-color',
  171. DstAlpha: 'dst-alpha',
  172. OneMinusDstAlpha: 'one-minus-dst-alpha',
  173. SrcAlphaSaturated: 'src-alpha-saturated',
  174. BlendColor: 'blend-color',
  175. OneMinusBlendColor: 'one-minus-blend-color'
  176. };
  177. export const GPUBlendOperation = {
  178. Add: 'add',
  179. Subtract: 'subtract',
  180. ReverseSubtract: 'reverse-subtract',
  181. Min: 'min',
  182. Max: 'max'
  183. };
  184. export const GPUColorWriteFlags = {
  185. None: 0,
  186. Red: 0x1,
  187. Green: 0x2,
  188. Blue: 0x4,
  189. Alpha: 0x8,
  190. All: 0xF
  191. };
  192. export const GPUStencilOperation = {
  193. Keep: 'keep',
  194. Zero: 'zero',
  195. Replace: 'replace',
  196. Invert: 'invert',
  197. IncrementClamp: 'increment-clamp',
  198. DecrementClamp: 'decrement-clamp',
  199. IncrementWrap: 'increment-wrap',
  200. DecrementWrap: 'decrement-wrap'
  201. };
  202. export const GPUBindingType = {
  203. UniformBuffer: 'uniform-buffer',
  204. StorageBuffer: 'storage-buffer',
  205. ReadonlyStorageBuffer: 'readonly-storage-buffer',
  206. Sampler: 'sampler',
  207. ComparisonSampler: 'comparison-sampler',
  208. SampledTexture: 'sampled-texture',
  209. MultisampledTexture: 'multisampled-texture',
  210. ReadonlyStorageTexture: 'readonly-storage-texture',
  211. WriteonlyStorageTexture: 'writeonly-storage-texture'
  212. };
  213. export const GPUTextureDimension = {
  214. OneD: '1d',
  215. TwoD: '2d',
  216. ThreeD: '3d'
  217. };
  218. export const GPUTextureViewDimension = {
  219. OneD: '1d',
  220. TwoD: '2d',
  221. TwoDArray: '2d-array',
  222. Cube: 'cube',
  223. CubeArray: 'cube-array',
  224. ThreeD: '3d'
  225. };
  226. export const GPUInputStepMode = {
  227. Vertex: 'vertex',
  228. Instance: 'instance'
  229. };
  230. export const GPUChunkSize = 16; // size of a chunk in bytes (STD140 layout)
  231. // @TODO: Move to src/constants.js
  232. export const BlendColorFactor = 211;
  233. export const OneMinusBlendColorFactor = 212;