constants.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. // 'depth24unorm-stencil8' extension
  137. Depth24UnormStencil8: 'depth24unorm-stencil8',
  138. // 'depth32float-stencil8' extension
  139. Depth32FloatStencil8: 'depth32float-stencil8',
  140. };
  141. export const GPUAddressMode = {
  142. ClampToEdge: 'clamp-to-edge',
  143. Repeat: 'repeat',
  144. MirrorRepeat: 'mirror-repeat'
  145. };
  146. export const GPUFilterMode = {
  147. Linear: 'linear',
  148. Nearest: 'nearest'
  149. };
  150. export const GPUBlendFactor = {
  151. Zero: 'zero',
  152. One: 'one',
  153. SrcColor: 'src-color',
  154. OneMinusSrcColor: 'one-minus-src-color',
  155. SrcAlpha: 'src-alpha',
  156. OneMinusSrcAlpha: 'one-minus-src-alpha',
  157. DstColor: 'dst-color',
  158. OneMinusDstColor: 'one-minus-dst-color',
  159. DstAlpha: 'dst-alpha',
  160. OneMinusDstAlpha: 'one-minus-dst-alpha',
  161. SrcAlphaSaturated: 'src-alpha-saturated',
  162. BlendColor: 'blend-color',
  163. OneMinusBlendColor: 'one-minus-blend-color'
  164. };
  165. export const GPUBlendOperation = {
  166. Add: 'add',
  167. Subtract: 'subtract',
  168. ReverseSubtract: 'reverse-subtract',
  169. Min: 'min',
  170. Max: 'max'
  171. };
  172. export const GPUColorWriteFlags = {
  173. None: 0,
  174. Red: 0x1,
  175. Green: 0x2,
  176. Blue: 0x4,
  177. Alpha: 0x8,
  178. All: 0xF
  179. };
  180. export const GPUStencilOperation = {
  181. Keep: 'keep',
  182. Zero: 'zero',
  183. Replace: 'replace',
  184. Invert: 'invert',
  185. IncrementClamp: 'increment-clamp',
  186. DecrementClamp: 'decrement-clamp',
  187. IncrementWrap: 'increment-wrap',
  188. DecrementWrap: 'decrement-wrap'
  189. };
  190. export const GPUBindingType = {
  191. UniformBuffer: 'uniform-buffer',
  192. StorageBuffer: 'storage-buffer',
  193. ReadonlyStorageBuffer: 'readonly-storage-buffer',
  194. Sampler: 'sampler',
  195. ComparisonSampler: 'comparison-sampler',
  196. SampledTexture: 'sampled-texture',
  197. MultisampledTexture: 'multisampled-texture',
  198. ReadonlyStorageTexture: 'readonly-storage-texture',
  199. WriteonlyStorageTexture: 'writeonly-storage-texture'
  200. };
  201. export const GPUTextureDimension = {
  202. OneD: '1d',
  203. TwoD: '2d',
  204. ThreeD: '3d'
  205. };
  206. export const GPUTextureViewDimension = {
  207. OneD: '1d',
  208. TwoD: '2d',
  209. TwoDArray: '2d-array',
  210. Cube: 'cube',
  211. CubeArray: 'cube-array',
  212. ThreeD: '3d'
  213. };
  214. export const GPUInputStepMode = {
  215. Vertex: 'vertex',
  216. Instance: 'instance'
  217. };
  218. export const GPUChunkSize = 16; // size of a chunk in bytes (STD140 layout)
  219. // @TODO: Move to src/constants.js
  220. export const BlendColorFactor = 211;
  221. export const OneMinusBlendColorFactor = 212;