constants.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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. Uchar2: 'uchar2',
  40. Uchar4: 'uchar4',
  41. Char2: 'char2',
  42. Char4: 'char4',
  43. Uchar2Norm: 'uchar2norm',
  44. Uchar4Norm: 'uchar4norm',
  45. Char2Norm: 'char2norm',
  46. Char4Norm: 'char4norm',
  47. Ushort2: 'ushort2',
  48. Ushort4: 'ushort4',
  49. Short2: 'short2',
  50. Short4: 'short4',
  51. Ushort2Norm: 'ushort2norm',
  52. Ushort4Norm: 'ushort4norm',
  53. Short2Norm: 'short2norm',
  54. Short4Norm: 'short4norm',
  55. Half2: 'half2',
  56. Half4: 'half4',
  57. Float: 'float',
  58. Float2: 'float2',
  59. Float3: 'float3',
  60. Float4: 'float4',
  61. Uint: 'uint',
  62. Uint2: 'uint2',
  63. Uint3: 'uint3',
  64. Uint4: 'uint4',
  65. Int: 'int',
  66. Int2: 'int2',
  67. Int3: 'int3',
  68. Int4: 'int4',
  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. BRGA8Unorm: 'bgra8unorm',
  97. BRGA8UnormSRGB: '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. // @TODO Move to src/constants.js
  180. export const BlendColorFactor = 211;
  181. export const OneMinusBlendColorFactor = 212;