constants.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. Clear: 'clear'
  21. };
  22. export const GPULoadOp = {
  23. Load: 'load'
  24. };
  25. export const GPUFrontFace = {
  26. CCW: 'ccw',
  27. CW: 'cw'
  28. };
  29. export const GPUCullMode = {
  30. None: 'none',
  31. Front: 'front',
  32. Back: 'back'
  33. };
  34. export const GPUIndexFormat = {
  35. Uint16: 'uint16',
  36. Uint32: 'uint32'
  37. };
  38. export const GPUVertexFormat = {
  39. Uint8x2: 'uint8x2',
  40. Uint8x4: 'uint8x4',
  41. Sint8x2: 'sint8x2',
  42. Sint8x4: 'sint8x4',
  43. Unorm8x2: 'unorm8x2',
  44. Unorm8x4: 'unorm8x4',
  45. Snorm8x2: 'snorm8x2',
  46. Snorm8x4: 'snorm8x4',
  47. Uint16x2: 'uint16x2',
  48. Uint16x4: 'uint16x4',
  49. Sint16x2: 'sint16x2',
  50. Sint16x4: 'sint16x4',
  51. Unorm16x2: 'unorm16x2',
  52. Unorm16x4: 'unorm16x4',
  53. Snorm16x2: 'snorm16x2',
  54. Snorm16x4: 'snorm16x4',
  55. Float16x2: 'float16x2',
  56. Float16x4: 'float16x4',
  57. Float32: 'float32',
  58. Float32x2: 'float32x2',
  59. Float32x3: 'float32x3',
  60. Float32x4: 'float32x4',
  61. Uint32: 'uint32',
  62. Uint32x2: 'uint32x2',
  63. Uint32x3: 'uint32x3',
  64. Uint32x4: 'uint32x4',
  65. Sint32: 'sint32',
  66. Sint32x2: 'sint32x2',
  67. Sint32x3: 'sint32x3',
  68. Sint32x4: 'sint32x4'
  69. };
  70. export const GPUTextureFormat = {
  71. // 8-bit formats
  72. R8Unorm: 'r8unorm',
  73. R8Snorm: 'r8snorm',
  74. R8Uint: 'r8uint',
  75. R8Sint: 'r8sint',
  76. // 16-bit formats
  77. R16Uint: 'r16uint',
  78. R16Sint: 'r16sint',
  79. R16Float: 'r16float',
  80. RG8Unorm: 'rg8unorm',
  81. RG8Snorm: 'rg8snorm',
  82. RG8Uint: 'rg8uint',
  83. RG8Sint: 'rg8sint',
  84. // 32-bit formats
  85. R32Uint: 'r32uint',
  86. R32Sint: 'r32sint',
  87. R32Float: 'r32float',
  88. RG16Uint: 'rg16uint',
  89. RG16Sint: 'rg16sint',
  90. RG16Float: 'rg16float',
  91. RGBA8Unorm: 'rgba8unorm',
  92. RGBA8UnormSRGB: 'rgba8unorm-srgb',
  93. RGBA8Snorm: 'rgba8snorm',
  94. RGBA8Uint: 'rgba8uint',
  95. RGBA8Sint: 'rgba8sint',
  96. BGRA8Unorm: 'bgra8unorm',
  97. BGRA8UnormSRGB: 'bgra8unorm-srgb',
  98. // Packed 32-bit formats
  99. RGB9E5UFloat: 'rgb9e5ufloat',
  100. RGB10A2Unorm: 'rgb10a2unorm',
  101. RG11B10uFloat: 'rgb10a2unorm',
  102. // 64-bit formats
  103. RG32Uint: 'rg32uint',
  104. RG32Sint: 'rg32sint',
  105. RG32Float: 'rg32float',
  106. RGBA16Uint: 'rgba16uint',
  107. RGBA16Sint: 'rgba16sint',
  108. RGBA16Float: 'rgba16float',
  109. // 128-bit formats
  110. RGBA32Uint: 'rgba32uint',
  111. RGBA32Sint: 'rgba32sint',
  112. RGBA32Float: 'rgba32float',
  113. // Depth and stencil formats
  114. Stencil8: 'stencil8',
  115. Depth16Unorm: 'depth16unorm',
  116. Depth24Plus: 'depth24plus',
  117. Depth24PlusStencil8: 'depth24plus-stencil8',
  118. Depth32Float: 'depth32float',
  119. // BC compressed formats usable if 'texture-compression-bc' is both
  120. // supported by the device/user agent and enabled in requestDevice.
  121. BC1RGBAUnorm: 'bc1-rgba-unorm',
  122. BC1RGBAUnormSRGB: 'bc1-rgba-unorm-srgb',
  123. BC2RGBAUnorm: 'bc2-rgba-unorm',
  124. BC2RGBAUnormSRGB: 'bc2-rgba-unorm-srgb',
  125. BC3RGBAUnorm: 'bc3-rgba-unorm',
  126. BC3RGBAUnormSRGB: 'bc3-rgba-unorm-srgb',
  127. BC4RUnorm: 'bc4-r-unorm',
  128. BC4RSNorm: 'bc4-r-snorm',
  129. BC5RGUnorm: 'bc5-rg-unorm',
  130. BC5RGSnorm: 'bc5-rg-snorm',
  131. BC6HRGBUFloat: 'bc6h-rgb-ufloat',
  132. BC6HRGBFloat: 'bc6h-rgb-float',
  133. BC7RGBAUnorm: 'bc7-rgba-unorm',
  134. BC7RGBAUnormSRGB: 'bc7-rgba-srgb',
  135. // 'depth24unorm-stencil8' extension
  136. Depth24UnormStencil8: 'depth24unorm-stencil8',
  137. // 'depth32float-stencil8' extension
  138. Depth32FloatStencil8: 'depth32float-stencil8',
  139. };
  140. export const GPUAddressMode = {
  141. ClampToEdge: 'clamp-to-edge',
  142. Repeat: 'repeat',
  143. MirrorRepeat: 'mirror-repeat'
  144. };
  145. export const GPUFilterMode = {
  146. Linear: 'linear',
  147. Nearest: 'nearest'
  148. };
  149. export const GPUBlendFactor = {
  150. Zero: 'zero',
  151. One: 'one',
  152. SrcColor: 'src-color',
  153. OneMinusSrcColor: 'one-minus-src-color',
  154. SrcAlpha: 'src-alpha',
  155. OneMinusSrcAlpha: 'one-minus-src-alpha',
  156. DstColor: 'dst-color',
  157. OneMinusDstColor: 'one-minus-dst-color',
  158. DstAlpha: 'dst-alpha',
  159. OneMinusDstAlpha: 'one-minus-dst-alpha',
  160. SrcAlphaSaturated: 'src-alpha-saturated',
  161. BlendColor: 'blend-color',
  162. OneMinusBlendColor: 'one-minus-blend-color'
  163. };
  164. export const GPUBlendOperation = {
  165. Add: 'add',
  166. Subtract: 'subtract',
  167. ReverseSubtract: 'reverse-subtract',
  168. Min: 'min',
  169. Max: 'max'
  170. };
  171. export const GPUColorWriteFlags = {
  172. None: 0,
  173. Red: 0x1,
  174. Green: 0x2,
  175. Blue: 0x4,
  176. Alpha: 0x8,
  177. All: 0xF
  178. };
  179. export const GPUStencilOperation = {
  180. Keep: 'keep',
  181. Zero: 'zero',
  182. Replace: 'replace',
  183. Invert: 'invert',
  184. IncrementClamp: 'increment-clamp',
  185. DecrementClamp: 'decrement-clamp',
  186. IncrementWrap: 'increment-wrap',
  187. DecrementWrap: 'decrement-wrap'
  188. };
  189. export const GPUBindingType = {
  190. UniformBuffer: 'uniform-buffer',
  191. StorageBuffer: 'storage-buffer',
  192. ReadonlyStorageBuffer: 'readonly-storage-buffer',
  193. Sampler: 'sampler',
  194. ComparisonSampler: 'comparison-sampler',
  195. SampledTexture: 'sampled-texture',
  196. MultisampledTexture: 'multisampled-texture',
  197. ReadonlyStorageTexture: 'readonly-storage-texture',
  198. WriteonlyStorageTexture: 'writeonly-storage-texture'
  199. };
  200. export const GPUTextureDimension = {
  201. OneD: '1d',
  202. TwoD: '2d',
  203. ThreeD: '3d'
  204. };
  205. export const GPUTextureViewDimension = {
  206. OneD: '1d',
  207. TwoD: '2d',
  208. TwoDArray: '2d-array',
  209. Cube: 'cube',
  210. CubeArray: 'cube-array',
  211. ThreeD: '3d'
  212. };
  213. export const GPUInputStepMode = {
  214. Vertex: 'vertex',
  215. Instance: 'instance'
  216. };
  217. export const GPUChunkSize = 16; // size of a chunk in bytes (STD140 layout)
  218. // @TODO: Move to src/constants.js
  219. export const BlendColorFactor = 211;
  220. export const OneMinusBlendColorFactor = 212;