WGSLNodeBuilder.html 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>WGSLNodeBuilder - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="NodeBuilder.html">NodeBuilder</a> → </p>
  13. <h1 translate="no">WGSLNodeBuilder</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A node builder targeting WGSL.</p>
  17. <p>This module generates WGSL shader code from node materials and also
  18. generates the respective bindings and vertex buffer definitions. These
  19. data are later used by the renderer to create render and compute pipelines
  20. for render objects.</p></div>
  21. </header>
  22. <article>
  23. <div class="container-overview">
  24. <h2>Constructor</h2>
  25. <h3 class="name name-method" id="WGSLNodeBuilder" translate="no">new <a href="#WGSLNodeBuilder">WGSLNodeBuilder</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, renderer : <span class="param-type"><a href="Renderer.html">Renderer</a></span> )</span> </h3>
  26. <div class="method">
  27. <div class="description">
  28. <p>Constructs a new WGSL node builder renderer.</p>
  29. </div>
  30. <table class="params">
  31. <tbody>
  32. <tr>
  33. <td class="name">
  34. <strong translate="no">object</strong>
  35. </td>
  36. <td class="description last">
  37. <p>The 3D object.</p>
  38. </td>
  39. </tr>
  40. <tr>
  41. <td class="name">
  42. <strong translate="no">renderer</strong>
  43. </td>
  44. <td class="description last">
  45. <p>The renderer.</p>
  46. </td>
  47. </tr>
  48. </tbody>
  49. </table>
  50. </div>
  51. </div>
  52. <h2 class="subsection-title">Properties</h2>
  53. <div class="member">
  54. <h3 class="name" id="builtins" translate="no">.<a href="#builtins">builtins</a><span class="type-signature"> : Object.&lt;string, Map.&lt;string, Object>></span> </h3>
  55. <div class="description">
  56. <p>A dictionary that holds for each shader stage a Map of builtins.</p>
  57. </div>
  58. </div>
  59. <div class="member">
  60. <h3 class="name" id="directives" translate="no">.<a href="#directives">directives</a><span class="type-signature"> : Object.&lt;string, Set.&lt;string>></span> </h3>
  61. <div class="description">
  62. <p>A dictionary that holds for each shader stage a Set of directives.</p>
  63. </div>
  64. </div>
  65. <div class="member">
  66. <h3 class="name" id="scopedArrays" translate="no">.<a href="#scopedArrays">scopedArrays</a><span class="type-signature"> : Map.&lt;string, Object></span> </h3>
  67. <div class="description">
  68. <p>A map for managing scope arrays. Only relevant for when using
  69. <a href="WorkgroupInfoNode.html">WorkgroupInfoNode</a> in context of compute shaders.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="uniformGroups" translate="no">.<a href="#uniformGroups">uniformGroups</a><span class="type-signature"> : Object.&lt;string, Object.&lt;string, <a href="NodeUniformsGroup.html">NodeUniformsGroup</a>>></span> </h3>
  74. <div class="description">
  75. <p>A dictionary that holds for each shader stage ('vertex', 'fragment', 'compute')
  76. another dictionary which manages UBOs per group ('render','frame','object').</p>
  77. </div>
  78. </div>
  79. <div class="member">
  80. <h3 class="name" id="uniformGroupsBindings" translate="no">.<a href="#uniformGroupsBindings">uniformGroupsBindings</a><span class="type-signature"> : Object.&lt;string, {index: number, id: number}></span> </h3>
  81. <div class="description">
  82. <p>A dictionary that holds the assigned binding indices for each uniform group.
  83. This ensures the same binding index is used across all shader stages.</p>
  84. </div>
  85. </div>
  86. <h2 class="subsection-title">Methods</h2>
  87. <h3 class="name name-method" id="buildCode" translate="no">.<a href="#buildCode">buildCode</a><span class="signature">()</span> </h3>
  88. <div class="method">
  89. <div class="description">
  90. <p>Controls the code build of the shader stages.</p>
  91. </div>
  92. <dl class="details">
  93. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#buildCode">NodeBuilder#buildCode</a></dt>
  94. </dl>
  95. </div>
  96. <h3 class="name name-method" id="buildFunctionCode" translate="no">.<a href="#buildFunctionCode">buildFunctionCode</a><span class="signature">( shaderNode : <span class="param-type">ShaderNodeInternal</span> )</span><span class="type-signature"> : string</span> </h3>
  97. <div class="method">
  98. <div class="description">
  99. <p>Builds the given shader node.</p>
  100. </div>
  101. <table class="params">
  102. <tbody>
  103. <tr>
  104. <td class="name">
  105. <strong translate="no">shaderNode</strong>
  106. </td>
  107. <td class="description last">
  108. <p>The shader node.</p>
  109. </td>
  110. </tr>
  111. </tbody>
  112. </table>
  113. <dl class="details">
  114. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#buildFunctionCode">NodeBuilder#buildFunctionCode</a></dt>
  115. </dl>
  116. <dl class="details">
  117. <dt class="tag-returns"><strong>Returns:</strong> The WGSL function code.</dt>
  118. </dl>
  119. </div>
  120. <h3 class="name name-method" id="enableClipDistances" translate="no">.<a href="#enableClipDistances">enableClipDistances</a><span class="signature">()</span> </h3>
  121. <div class="method">
  122. <div class="description">
  123. <p>Enables the 'clip_distances' directive.</p>
  124. </div>
  125. </div>
  126. <h3 class="name name-method" id="enableDirective" translate="no">.<a href="#enableDirective">enableDirective</a><span class="signature">( name : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span> )</span> </h3>
  127. <div class="method">
  128. <div class="description">
  129. <p>Enables the given directive for the given shader stage.</p>
  130. </div>
  131. <table class="params">
  132. <tbody>
  133. <tr>
  134. <td class="name">
  135. <strong translate="no">name</strong>
  136. </td>
  137. <td class="description last">
  138. <p>The directive name.</p>
  139. </td>
  140. </tr>
  141. <tr>
  142. <td class="name">
  143. <strong translate="no">shaderStage</strong>
  144. </td>
  145. <td class="description last">
  146. <p>The shader stage to enable the directive for.</p>
  147. <p>Default is <code>this.shaderStage</code>.</p>
  148. </td>
  149. </tr>
  150. </tbody>
  151. </table>
  152. </div>
  153. <h3 class="name name-method" id="enableDualSourceBlending" translate="no">.<a href="#enableDualSourceBlending">enableDualSourceBlending</a><span class="signature">()</span> </h3>
  154. <div class="method">
  155. <div class="description">
  156. <p>Enables the 'dual_source_blending' directive.</p>
  157. </div>
  158. </div>
  159. <h3 class="name name-method" id="enableHardwareClipping" translate="no">.<a href="#enableHardwareClipping">enableHardwareClipping</a><span class="signature">( planeCount : <span class="param-type">string</span> )</span> </h3>
  160. <div class="method">
  161. <div class="description">
  162. <p>Enables hardware clipping.</p>
  163. </div>
  164. <table class="params">
  165. <tbody>
  166. <tr>
  167. <td class="name">
  168. <strong translate="no">planeCount</strong>
  169. </td>
  170. <td class="description last">
  171. <p>The clipping plane count.</p>
  172. </td>
  173. </tr>
  174. </tbody>
  175. </table>
  176. </div>
  177. <h3 class="name name-method" id="enableShaderF16" translate="no">.<a href="#enableShaderF16">enableShaderF16</a><span class="signature">()</span> </h3>
  178. <div class="method">
  179. <div class="description">
  180. <p>Enables the 'f16' directive.</p>
  181. </div>
  182. </div>
  183. <h3 class="name name-method" id="enableSubGroups" translate="no">.<a href="#enableSubGroups">enableSubGroups</a><span class="signature">()</span> </h3>
  184. <div class="method">
  185. <div class="description">
  186. <p>Enables the 'subgroups' directive.</p>
  187. </div>
  188. </div>
  189. <h3 class="name name-method" id="enableSubgroupsF16" translate="no">.<a href="#enableSubgroupsF16">enableSubgroupsF16</a><span class="signature">()</span> </h3>
  190. <div class="method">
  191. <div class="description">
  192. <p>Enables the 'subgroups-f16' directive.</p>
  193. </div>
  194. </div>
  195. <h3 class="name name-method" id="generateArrayDeclaration" translate="no">.<a href="#generateArrayDeclaration">generateArrayDeclaration</a><span class="signature">( type : <span class="param-type">string</span>, count : <span class="param-type">number</span> )</span><span class="type-signature"> : string</span> </h3>
  196. <div class="method">
  197. <div class="description">
  198. <p>Generates the array declaration string.</p>
  199. </div>
  200. <table class="params">
  201. <tbody>
  202. <tr>
  203. <td class="name">
  204. <strong translate="no">type</strong>
  205. </td>
  206. <td class="description last">
  207. <p>The type.</p>
  208. </td>
  209. </tr>
  210. <tr>
  211. <td class="name">
  212. <strong translate="no">count</strong>
  213. </td>
  214. <td class="description last">
  215. <p>The count.</p>
  216. </td>
  217. </tr>
  218. </tbody>
  219. </table>
  220. <dl class="details">
  221. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#generateArrayDeclaration">NodeBuilder#generateArrayDeclaration</a></dt>
  222. </dl>
  223. <dl class="details">
  224. <dt class="tag-returns"><strong>Returns:</strong> The generated value as a shader string.</dt>
  225. </dl>
  226. </div>
  227. <h3 class="name name-method" id="generateFilteredTexture" translate="no">.<a href="#generateFilteredTexture">generateFilteredTexture</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, offsetSnippet : <span class="param-type">string</span>, levelSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  228. <div class="method">
  229. <div class="description">
  230. <p>Generates the WGSL snippet for a manual filtered texture.</p>
  231. </div>
  232. <table class="params">
  233. <tbody>
  234. <tr>
  235. <td class="name">
  236. <strong translate="no">texture</strong>
  237. </td>
  238. <td class="description last">
  239. <p>The texture.</p>
  240. </td>
  241. </tr>
  242. <tr>
  243. <td class="name">
  244. <strong translate="no">textureProperty</strong>
  245. </td>
  246. <td class="description last">
  247. <p>The name of the texture uniform in the shader.</p>
  248. </td>
  249. </tr>
  250. <tr>
  251. <td class="name">
  252. <strong translate="no">uvSnippet</strong>
  253. </td>
  254. <td class="description last">
  255. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  256. </td>
  257. </tr>
  258. <tr>
  259. <td class="name">
  260. <strong translate="no">offsetSnippet</strong>
  261. </td>
  262. <td class="description last">
  263. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  264. </td>
  265. </tr>
  266. <tr>
  267. <td class="name">
  268. <strong translate="no">levelSnippet</strong>
  269. </td>
  270. <td class="description last">
  271. <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
  272. <p>Default is <code>'0u'</code>.</p>
  273. </td>
  274. </tr>
  275. <tr>
  276. <td class="name">
  277. <strong translate="no">depthSnippet</strong>
  278. </td>
  279. <td class="description last">
  280. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  281. </td>
  282. </tr>
  283. </tbody>
  284. </table>
  285. <dl class="details">
  286. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  287. </dl>
  288. </div>
  289. <h3 class="name name-method" id="generateStorageTextureLoad" translate="no">.<a href="#generateStorageTextureLoad">generateStorageTextureLoad</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvIndexSnippet : <span class="param-type">string</span>, levelSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">string</span>, offsetSnippet : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  290. <div class="method">
  291. <div class="description">
  292. <p>Generates the WGSL snippet that reads a single texel from a storage texture.</p>
  293. </div>
  294. <table class="params">
  295. <tbody>
  296. <tr>
  297. <td class="name">
  298. <strong translate="no">texture</strong>
  299. </td>
  300. <td class="description last">
  301. <p>The texture.</p>
  302. </td>
  303. </tr>
  304. <tr>
  305. <td class="name">
  306. <strong translate="no">textureProperty</strong>
  307. </td>
  308. <td class="description last">
  309. <p>The name of the texture uniform in the shader.</p>
  310. </td>
  311. </tr>
  312. <tr>
  313. <td class="name">
  314. <strong translate="no">uvIndexSnippet</strong>
  315. </td>
  316. <td class="description last">
  317. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  318. </td>
  319. </tr>
  320. <tr>
  321. <td class="name">
  322. <strong translate="no">levelSnippet</strong>
  323. </td>
  324. <td class="description last">
  325. <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
  326. </td>
  327. </tr>
  328. <tr>
  329. <td class="name">
  330. <strong translate="no">depthSnippet</strong>
  331. </td>
  332. <td class="description last">
  333. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  334. </td>
  335. </tr>
  336. <tr>
  337. <td class="name">
  338. <strong translate="no">offsetSnippet</strong>
  339. </td>
  340. <td class="description last">
  341. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  342. </td>
  343. </tr>
  344. </tbody>
  345. </table>
  346. <dl class="details">
  347. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  348. </dl>
  349. </div>
  350. <h3 class="name name-method" id="generateTexture" translate="no">.<a href="#generateTexture">generateTexture</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">string</span>, offsetSnippet : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  351. <div class="method">
  352. <div class="description">
  353. <p>Generates the WGSL snippet for sampling/loading the given texture.</p>
  354. </div>
  355. <table class="params">
  356. <tbody>
  357. <tr>
  358. <td class="name">
  359. <strong translate="no">texture</strong>
  360. </td>
  361. <td class="description last">
  362. <p>The texture.</p>
  363. </td>
  364. </tr>
  365. <tr>
  366. <td class="name">
  367. <strong translate="no">textureProperty</strong>
  368. </td>
  369. <td class="description last">
  370. <p>The name of the texture uniform in the shader.</p>
  371. </td>
  372. </tr>
  373. <tr>
  374. <td class="name">
  375. <strong translate="no">uvSnippet</strong>
  376. </td>
  377. <td class="description last">
  378. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  379. </td>
  380. </tr>
  381. <tr>
  382. <td class="name">
  383. <strong translate="no">depthSnippet</strong>
  384. </td>
  385. <td class="description last">
  386. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  387. </td>
  388. </tr>
  389. <tr>
  390. <td class="name">
  391. <strong translate="no">offsetSnippet</strong>
  392. </td>
  393. <td class="description last">
  394. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  395. </td>
  396. </tr>
  397. <tr>
  398. <td class="name">
  399. <strong translate="no">shaderStage</strong>
  400. </td>
  401. <td class="description last">
  402. <p>The shader stage this code snippet is generated for.</p>
  403. <p>Default is <code>this.shaderStage</code>.</p>
  404. </td>
  405. </tr>
  406. </tbody>
  407. </table>
  408. <dl class="details">
  409. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#generateTexture">NodeBuilder#generateTexture</a></dt>
  410. </dl>
  411. <dl class="details">
  412. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  413. </dl>
  414. </div>
  415. <h3 class="name name-method" id="generateTextureBias" translate="no">.<a href="#generateTextureBias">generateTextureBias</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, biasSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">string</span>, offsetSnippet : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  416. <div class="method">
  417. <div class="description">
  418. <p>Generates the WGSL snippet when sampling textures with a bias to the mip level.</p>
  419. </div>
  420. <table class="params">
  421. <tbody>
  422. <tr>
  423. <td class="name">
  424. <strong translate="no">texture</strong>
  425. </td>
  426. <td class="description last">
  427. <p>The texture.</p>
  428. </td>
  429. </tr>
  430. <tr>
  431. <td class="name">
  432. <strong translate="no">textureProperty</strong>
  433. </td>
  434. <td class="description last">
  435. <p>The name of the texture uniform in the shader.</p>
  436. </td>
  437. </tr>
  438. <tr>
  439. <td class="name">
  440. <strong translate="no">uvSnippet</strong>
  441. </td>
  442. <td class="description last">
  443. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  444. </td>
  445. </tr>
  446. <tr>
  447. <td class="name">
  448. <strong translate="no">biasSnippet</strong>
  449. </td>
  450. <td class="description last">
  451. <p>A WGSL snippet that represents the bias to apply to the mip level before sampling.</p>
  452. </td>
  453. </tr>
  454. <tr>
  455. <td class="name">
  456. <strong translate="no">depthSnippet</strong>
  457. </td>
  458. <td class="description last">
  459. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  460. </td>
  461. </tr>
  462. <tr>
  463. <td class="name">
  464. <strong translate="no">offsetSnippet</strong>
  465. </td>
  466. <td class="description last">
  467. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  468. </td>
  469. </tr>
  470. <tr>
  471. <td class="name">
  472. <strong translate="no">shaderStage</strong>
  473. </td>
  474. <td class="description last">
  475. <p>The shader stage this code snippet is generated for.</p>
  476. <p>Default is <code>this.shaderStage</code>.</p>
  477. </td>
  478. </tr>
  479. </tbody>
  480. </table>
  481. <dl class="details">
  482. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  483. </dl>
  484. </div>
  485. <h3 class="name name-method" id="generateTextureCompare" translate="no">.<a href="#generateTextureCompare">generateTextureCompare</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, compareSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">string</span>, offsetSnippet : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  486. <div class="method">
  487. <div class="description">
  488. <p>Generates the WGSL snippet for sampling a depth texture and comparing the sampled depth values
  489. against a reference value.</p>
  490. </div>
  491. <table class="params">
  492. <tbody>
  493. <tr>
  494. <td class="name">
  495. <strong translate="no">texture</strong>
  496. </td>
  497. <td class="description last">
  498. <p>The texture.</p>
  499. </td>
  500. </tr>
  501. <tr>
  502. <td class="name">
  503. <strong translate="no">textureProperty</strong>
  504. </td>
  505. <td class="description last">
  506. <p>The name of the texture uniform in the shader.</p>
  507. </td>
  508. </tr>
  509. <tr>
  510. <td class="name">
  511. <strong translate="no">uvSnippet</strong>
  512. </td>
  513. <td class="description last">
  514. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  515. </td>
  516. </tr>
  517. <tr>
  518. <td class="name">
  519. <strong translate="no">compareSnippet</strong>
  520. </td>
  521. <td class="description last">
  522. <p>A WGSL snippet that represents the reference value.</p>
  523. </td>
  524. </tr>
  525. <tr>
  526. <td class="name">
  527. <strong translate="no">depthSnippet</strong>
  528. </td>
  529. <td class="description last">
  530. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  531. </td>
  532. </tr>
  533. <tr>
  534. <td class="name">
  535. <strong translate="no">offsetSnippet</strong>
  536. </td>
  537. <td class="description last">
  538. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  539. </td>
  540. </tr>
  541. <tr>
  542. <td class="name">
  543. <strong translate="no">shaderStage</strong>
  544. </td>
  545. <td class="description last">
  546. <p>The shader stage this code snippet is generated for.</p>
  547. <p>Default is <code>this.shaderStage</code>.</p>
  548. </td>
  549. </tr>
  550. </tbody>
  551. </table>
  552. <dl class="details">
  553. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  554. </dl>
  555. </div>
  556. <h3 class="name name-method" id="generateTextureDimension" translate="no">.<a href="#generateTextureDimension">generateTextureDimension</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, levelSnippet : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  557. <div class="method">
  558. <div class="description">
  559. <p>Generates a WGSL variable that holds the texture dimension of the given texture.
  560. It also returns information about the number of layers (elements) of an arrayed
  561. texture as well as the cube face count of cube textures.</p>
  562. </div>
  563. <table class="params">
  564. <tbody>
  565. <tr>
  566. <td class="name">
  567. <strong translate="no">texture</strong>
  568. </td>
  569. <td class="description last">
  570. <p>The texture to generate the function for.</p>
  571. </td>
  572. </tr>
  573. <tr>
  574. <td class="name">
  575. <strong translate="no">textureProperty</strong>
  576. </td>
  577. <td class="description last">
  578. <p>The name of the video texture uniform in the shader.</p>
  579. </td>
  580. </tr>
  581. <tr>
  582. <td class="name">
  583. <strong translate="no">levelSnippet</strong>
  584. </td>
  585. <td class="description last">
  586. <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
  587. </td>
  588. </tr>
  589. </tbody>
  590. </table>
  591. <dl class="details">
  592. <dt class="tag-returns"><strong>Returns:</strong> The name of the dimension variable.</dt>
  593. </dl>
  594. </div>
  595. <h3 class="name name-method" id="generateTextureGrad" translate="no">.<a href="#generateTextureGrad">generateTextureGrad</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, gradSnippet : <span class="param-type">Array.&lt;string></span>, depthSnippet : <span class="param-type">string</span>, offsetSnippet : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  596. <div class="method">
  597. <div class="description">
  598. <p>Generates the WGSL snippet for sampling/loading the given texture using explicit gradients.</p>
  599. </div>
  600. <table class="params">
  601. <tbody>
  602. <tr>
  603. <td class="name">
  604. <strong translate="no">texture</strong>
  605. </td>
  606. <td class="description last">
  607. <p>The texture.</p>
  608. </td>
  609. </tr>
  610. <tr>
  611. <td class="name">
  612. <strong translate="no">textureProperty</strong>
  613. </td>
  614. <td class="description last">
  615. <p>The name of the texture uniform in the shader.</p>
  616. </td>
  617. </tr>
  618. <tr>
  619. <td class="name">
  620. <strong translate="no">uvSnippet</strong>
  621. </td>
  622. <td class="description last">
  623. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  624. </td>
  625. </tr>
  626. <tr>
  627. <td class="name">
  628. <strong translate="no">gradSnippet</strong>
  629. </td>
  630. <td class="description last">
  631. <p>An array holding both gradient WGSL snippets.</p>
  632. </td>
  633. </tr>
  634. <tr>
  635. <td class="name">
  636. <strong translate="no">depthSnippet</strong>
  637. </td>
  638. <td class="description last">
  639. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  640. </td>
  641. </tr>
  642. <tr>
  643. <td class="name">
  644. <strong translate="no">offsetSnippet</strong>
  645. </td>
  646. <td class="description last">
  647. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  648. </td>
  649. </tr>
  650. <tr>
  651. <td class="name">
  652. <strong translate="no">shaderStage</strong>
  653. </td>
  654. <td class="description last">
  655. <p>The shader stage this code snippet is generated for.</p>
  656. <p>Default is <code>this.shaderStage</code>.</p>
  657. </td>
  658. </tr>
  659. </tbody>
  660. </table>
  661. <dl class="details">
  662. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  663. </dl>
  664. </div>
  665. <h3 class="name name-method" id="generateTextureLevel" translate="no">.<a href="#generateTextureLevel">generateTextureLevel</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, levelSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">string</span>, offsetSnippet : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  666. <div class="method">
  667. <div class="description">
  668. <p>Generates the WGSL snippet when sampling textures with explicit mip level.</p>
  669. </div>
  670. <table class="params">
  671. <tbody>
  672. <tr>
  673. <td class="name">
  674. <strong translate="no">texture</strong>
  675. </td>
  676. <td class="description last">
  677. <p>The texture.</p>
  678. </td>
  679. </tr>
  680. <tr>
  681. <td class="name">
  682. <strong translate="no">textureProperty</strong>
  683. </td>
  684. <td class="description last">
  685. <p>The name of the texture uniform in the shader.</p>
  686. </td>
  687. </tr>
  688. <tr>
  689. <td class="name">
  690. <strong translate="no">uvSnippet</strong>
  691. </td>
  692. <td class="description last">
  693. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  694. </td>
  695. </tr>
  696. <tr>
  697. <td class="name">
  698. <strong translate="no">levelSnippet</strong>
  699. </td>
  700. <td class="description last">
  701. <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
  702. </td>
  703. </tr>
  704. <tr>
  705. <td class="name">
  706. <strong translate="no">depthSnippet</strong>
  707. </td>
  708. <td class="description last">
  709. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  710. </td>
  711. </tr>
  712. <tr>
  713. <td class="name">
  714. <strong translate="no">offsetSnippet</strong>
  715. </td>
  716. <td class="description last">
  717. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  718. </td>
  719. </tr>
  720. <tr>
  721. <td class="name">
  722. <strong translate="no">shaderStage</strong>
  723. </td>
  724. <td class="description last">
  725. <p>The shader stage this code snippet is generated for.</p>
  726. <p>Default is <code>this.shaderStage</code>.</p>
  727. </td>
  728. </tr>
  729. </tbody>
  730. </table>
  731. <dl class="details">
  732. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  733. </dl>
  734. </div>
  735. <h3 class="name name-method" id="generateTextureLoad" translate="no">.<a href="#generateTextureLoad">generateTextureLoad</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvIndexSnippet : <span class="param-type">string</span>, levelSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">string</span>, offsetSnippet : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  736. <div class="method">
  737. <div class="description">
  738. <p>Generates the WGSL snippet that reads a single texel from a texture without sampling or filtering.</p>
  739. </div>
  740. <table class="params">
  741. <tbody>
  742. <tr>
  743. <td class="name">
  744. <strong translate="no">texture</strong>
  745. </td>
  746. <td class="description last">
  747. <p>The texture.</p>
  748. </td>
  749. </tr>
  750. <tr>
  751. <td class="name">
  752. <strong translate="no">textureProperty</strong>
  753. </td>
  754. <td class="description last">
  755. <p>The name of the texture uniform in the shader.</p>
  756. </td>
  757. </tr>
  758. <tr>
  759. <td class="name">
  760. <strong translate="no">uvIndexSnippet</strong>
  761. </td>
  762. <td class="description last">
  763. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  764. </td>
  765. </tr>
  766. <tr>
  767. <td class="name">
  768. <strong translate="no">levelSnippet</strong>
  769. </td>
  770. <td class="description last">
  771. <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
  772. </td>
  773. </tr>
  774. <tr>
  775. <td class="name">
  776. <strong translate="no">depthSnippet</strong>
  777. </td>
  778. <td class="description last">
  779. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  780. </td>
  781. </tr>
  782. <tr>
  783. <td class="name">
  784. <strong translate="no">offsetSnippet</strong>
  785. </td>
  786. <td class="description last">
  787. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  788. </td>
  789. </tr>
  790. </tbody>
  791. </table>
  792. <dl class="details">
  793. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  794. </dl>
  795. </div>
  796. <h3 class="name name-method" id="generateTextureLod" translate="no">.<a href="#generateTextureLod">generateTextureLod</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">string</span>, offsetSnippet : <span class="param-type">string</span>, levelSnippet : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  797. <div class="method">
  798. <div class="description">
  799. <p>Generates the WGSL snippet for a texture lookup with explicit level-of-detail.
  800. Since it's a lookup, no sampling or filtering is applied.</p>
  801. </div>
  802. <table class="params">
  803. <tbody>
  804. <tr>
  805. <td class="name">
  806. <strong translate="no">texture</strong>
  807. </td>
  808. <td class="description last">
  809. <p>The texture.</p>
  810. </td>
  811. </tr>
  812. <tr>
  813. <td class="name">
  814. <strong translate="no">textureProperty</strong>
  815. </td>
  816. <td class="description last">
  817. <p>The name of the texture uniform in the shader.</p>
  818. </td>
  819. </tr>
  820. <tr>
  821. <td class="name">
  822. <strong translate="no">uvSnippet</strong>
  823. </td>
  824. <td class="description last">
  825. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  826. </td>
  827. </tr>
  828. <tr>
  829. <td class="name">
  830. <strong translate="no">depthSnippet</strong>
  831. </td>
  832. <td class="description last">
  833. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  834. </td>
  835. </tr>
  836. <tr>
  837. <td class="name">
  838. <strong translate="no">offsetSnippet</strong>
  839. </td>
  840. <td class="description last">
  841. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  842. </td>
  843. </tr>
  844. <tr>
  845. <td class="name">
  846. <strong translate="no">levelSnippet</strong>
  847. </td>
  848. <td class="description last">
  849. <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
  850. <p>Default is <code>'0u'</code>.</p>
  851. </td>
  852. </tr>
  853. </tbody>
  854. </table>
  855. <dl class="details">
  856. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#generateTextureLod">NodeBuilder#generateTextureLod</a></dt>
  857. </dl>
  858. <dl class="details">
  859. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  860. </dl>
  861. </div>
  862. <h3 class="name name-method" id="generateTextureStore" translate="no">.<a href="#generateTextureStore">generateTextureStore</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, textureProperty : <span class="param-type">string</span>, uvIndexSnippet : <span class="param-type">string</span>, depthSnippet : <span class="param-type">string</span>, valueSnippet : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  863. <div class="method">
  864. <div class="description">
  865. <p>Generates the WGSL snippet that writes a single texel to a texture.</p>
  866. </div>
  867. <table class="params">
  868. <tbody>
  869. <tr>
  870. <td class="name">
  871. <strong translate="no">texture</strong>
  872. </td>
  873. <td class="description last">
  874. <p>The texture.</p>
  875. </td>
  876. </tr>
  877. <tr>
  878. <td class="name">
  879. <strong translate="no">textureProperty</strong>
  880. </td>
  881. <td class="description last">
  882. <p>The name of the texture uniform in the shader.</p>
  883. </td>
  884. </tr>
  885. <tr>
  886. <td class="name">
  887. <strong translate="no">uvIndexSnippet</strong>
  888. </td>
  889. <td class="description last">
  890. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  891. </td>
  892. </tr>
  893. <tr>
  894. <td class="name">
  895. <strong translate="no">depthSnippet</strong>
  896. </td>
  897. <td class="description last">
  898. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  899. </td>
  900. </tr>
  901. <tr>
  902. <td class="name">
  903. <strong translate="no">valueSnippet</strong>
  904. </td>
  905. <td class="description last">
  906. <p>A WGSL snippet that represent the new texel value.</p>
  907. </td>
  908. </tr>
  909. </tbody>
  910. </table>
  911. <dl class="details">
  912. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  913. </dl>
  914. </div>
  915. <h3 class="name name-method" id="generateWrapFunction" translate="no">.<a href="#generateWrapFunction">generateWrapFunction</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span><span class="type-signature"> : string</span> </h3>
  916. <div class="method">
  917. <div class="description">
  918. <p>Generates a wrap function used in context of textures.</p>
  919. </div>
  920. <table class="params">
  921. <tbody>
  922. <tr>
  923. <td class="name">
  924. <strong translate="no">texture</strong>
  925. </td>
  926. <td class="description last">
  927. <p>The texture to generate the function for.</p>
  928. </td>
  929. </tr>
  930. </tbody>
  931. </table>
  932. <dl class="details">
  933. <dt class="tag-returns"><strong>Returns:</strong> The name of the generated function.</dt>
  934. </dl>
  935. </div>
  936. <h3 class="name name-method" id="getAttributes" translate="no">.<a href="#getAttributes">getAttributes</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  937. <div class="method">
  938. <div class="description">
  939. <p>Returns the shader attributes of the given shader stage as a WGSL string.</p>
  940. </div>
  941. <table class="params">
  942. <tbody>
  943. <tr>
  944. <td class="name">
  945. <strong translate="no">shaderStage</strong>
  946. </td>
  947. <td class="description last">
  948. <p>The shader stage.</p>
  949. </td>
  950. </tr>
  951. </tbody>
  952. </table>
  953. <dl class="details">
  954. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getAttributes">NodeBuilder#getAttributes</a></dt>
  955. </dl>
  956. <dl class="details">
  957. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the shader attributes.</dt>
  958. </dl>
  959. </div>
  960. <h3 class="name name-method" id="getBitcastMethod" translate="no">.<a href="#getBitcastMethod">getBitcastMethod</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  961. <div class="method">
  962. <div class="description">
  963. <p>Returns the bitcast method name for a given input and outputType.</p>
  964. </div>
  965. <table class="params">
  966. <tbody>
  967. <tr>
  968. <td class="name">
  969. <strong translate="no">type</strong>
  970. </td>
  971. <td class="description last">
  972. <p>The output type to bitcast to.</p>
  973. </td>
  974. </tr>
  975. </tbody>
  976. </table>
  977. <dl class="details">
  978. <dt class="tag-returns"><strong>Returns:</strong> The resolved WGSL bitcast invocation.</dt>
  979. </dl>
  980. </div>
  981. <h3 class="name name-method" id="getBuiltin" translate="no">.<a href="#getBuiltin">getBuiltin</a><span class="signature">( name : <span class="param-type">string</span>, property : <span class="param-type">string</span>, type : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  982. <div class="method">
  983. <div class="description">
  984. <p>This method should be used whenever builtins are required in nodes.
  985. The internal builtins data structure will make sure builtins are
  986. defined in the WGSL source.</p>
  987. </div>
  988. <table class="params">
  989. <tbody>
  990. <tr>
  991. <td class="name">
  992. <strong translate="no">name</strong>
  993. </td>
  994. <td class="description last">
  995. <p>The builtin name.</p>
  996. </td>
  997. </tr>
  998. <tr>
  999. <td class="name">
  1000. <strong translate="no">property</strong>
  1001. </td>
  1002. <td class="description last">
  1003. <p>The property name.</p>
  1004. </td>
  1005. </tr>
  1006. <tr>
  1007. <td class="name">
  1008. <strong translate="no">type</strong>
  1009. </td>
  1010. <td class="description last">
  1011. <p>The node data type.</p>
  1012. </td>
  1013. </tr>
  1014. <tr>
  1015. <td class="name">
  1016. <strong translate="no">shaderStage</strong>
  1017. </td>
  1018. <td class="description last">
  1019. <p>The shader stage this code snippet is generated for.</p>
  1020. <p>Default is <code>this.shaderStage</code>.</p>
  1021. </td>
  1022. </tr>
  1023. </tbody>
  1024. </table>
  1025. <dl class="details">
  1026. <dt class="tag-returns"><strong>Returns:</strong> The property name.</dt>
  1027. </dl>
  1028. </div>
  1029. <h3 class="name name-method" id="getBuiltins" translate="no">.<a href="#getBuiltins">getBuiltins</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1030. <div class="method">
  1031. <div class="description">
  1032. <p>Returns the builtins of the given shader stage as a WGSL string.</p>
  1033. </div>
  1034. <table class="params">
  1035. <tbody>
  1036. <tr>
  1037. <td class="name">
  1038. <strong translate="no">shaderStage</strong>
  1039. </td>
  1040. <td class="description last">
  1041. <p>The shader stage.</p>
  1042. </td>
  1043. </tr>
  1044. </tbody>
  1045. </table>
  1046. <dl class="details">
  1047. <dt class="tag-returns"><strong>Returns:</strong> A WGSL snippet that represents the builtins of the given stage.</dt>
  1048. </dl>
  1049. </div>
  1050. <h3 class="name name-method" id="getClipDistance" translate="no">.<a href="#getClipDistance">getClipDistance</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1051. <div class="method">
  1052. <div class="description">
  1053. <p>Returns the clip distances builtin.</p>
  1054. </div>
  1055. <dl class="details">
  1056. <dt class="tag-returns"><strong>Returns:</strong> The clip distances builtin.</dt>
  1057. </dl>
  1058. </div>
  1059. <h3 class="name name-method" id="getDirectives" translate="no">.<a href="#getDirectives">getDirectives</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1060. <div class="method">
  1061. <div class="description">
  1062. <p>Returns the directives of the given shader stage as a WGSL string.</p>
  1063. </div>
  1064. <table class="params">
  1065. <tbody>
  1066. <tr>
  1067. <td class="name">
  1068. <strong translate="no">shaderStage</strong>
  1069. </td>
  1070. <td class="description last">
  1071. <p>The shader stage.</p>
  1072. </td>
  1073. </tr>
  1074. </tbody>
  1075. </table>
  1076. <dl class="details">
  1077. <dt class="tag-returns"><strong>Returns:</strong> A WGSL snippet that enables the directives of the given stage.</dt>
  1078. </dl>
  1079. </div>
  1080. <h3 class="name name-method" id="getDrawIndex" translate="no">.<a href="#getDrawIndex">getDrawIndex</a><span class="signature">()</span><span class="type-signature"> : null</span> </h3>
  1081. <div class="method">
  1082. <div class="description">
  1083. <p>Overwritten as a NOP since this method is intended for the WebGL 2 backend.</p>
  1084. </div>
  1085. <dl class="details">
  1086. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getDrawIndex">NodeBuilder#getDrawIndex</a></dt>
  1087. </dl>
  1088. <dl class="details">
  1089. <dt class="tag-returns"><strong>Returns:</strong> Null.</dt>
  1090. </dl>
  1091. </div>
  1092. <h3 class="name name-method" id="getFloatPackingMethod" translate="no">.<a href="#getFloatPackingMethod">getFloatPackingMethod</a><span class="signature">( encoding : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1093. <div class="method">
  1094. <div class="description">
  1095. <p>Returns the float packing method name for a given numeric encoding.</p>
  1096. </div>
  1097. <table class="params">
  1098. <tbody>
  1099. <tr>
  1100. <td class="name">
  1101. <strong translate="no">encoding</strong>
  1102. </td>
  1103. <td class="description last">
  1104. <p>The numeric encoding that describes how the float values are mapped to the integer range.</p>
  1105. </td>
  1106. </tr>
  1107. </tbody>
  1108. </table>
  1109. <dl class="details">
  1110. <dt class="tag-returns"><strong>Returns:</strong> The resolve WGSL float packing method name.</dt>
  1111. </dl>
  1112. </div>
  1113. <h3 class="name name-method" id="getFloatUnpackingMethod" translate="no">.<a href="#getFloatUnpackingMethod">getFloatUnpackingMethod</a><span class="signature">( encoding : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1114. <div class="method">
  1115. <div class="description">
  1116. <p>Returns the float unpacking method name for a given numeric encoding.</p>
  1117. </div>
  1118. <table class="params">
  1119. <tbody>
  1120. <tr>
  1121. <td class="name">
  1122. <strong translate="no">encoding</strong>
  1123. </td>
  1124. <td class="description last">
  1125. <p>The numeric encoding that describes how the integer values are mapped to the float range.</p>
  1126. </td>
  1127. </tr>
  1128. </tbody>
  1129. </table>
  1130. <dl class="details">
  1131. <dt class="tag-returns"><strong>Returns:</strong> The resolve WGSL float unpacking method name.</dt>
  1132. </dl>
  1133. </div>
  1134. <h3 class="name name-method" id="getFragCoord" translate="no">.<a href="#getFragCoord">getFragCoord</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1135. <div class="method">
  1136. <div class="description">
  1137. <p>Returns the frag coord builtin.</p>
  1138. </div>
  1139. <dl class="details">
  1140. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getFragCoord">NodeBuilder#getFragCoord</a></dt>
  1141. </dl>
  1142. <dl class="details">
  1143. <dt class="tag-returns"><strong>Returns:</strong> The frag coord builtin.</dt>
  1144. </dl>
  1145. </div>
  1146. <h3 class="name name-method" id="getFragDepth" translate="no">.<a href="#getFragDepth">getFragDepth</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1147. <div class="method">
  1148. <div class="description">
  1149. <p>Returns the frag depth builtin.</p>
  1150. </div>
  1151. <dl class="details">
  1152. <dt class="tag-returns"><strong>Returns:</strong> The frag depth builtin.</dt>
  1153. </dl>
  1154. </div>
  1155. <h3 class="name name-method" id="getFrontFacing" translate="no">.<a href="#getFrontFacing">getFrontFacing</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1156. <div class="method">
  1157. <div class="description">
  1158. <p>Returns the front facing builtin.</p>
  1159. </div>
  1160. <dl class="details">
  1161. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getFrontFacing">NodeBuilder#getFrontFacing</a></dt>
  1162. </dl>
  1163. <dl class="details">
  1164. <dt class="tag-returns"><strong>Returns:</strong> The front facing builtin.</dt>
  1165. </dl>
  1166. </div>
  1167. <h3 class="name name-method" id="getFunctionOperator" translate="no">.<a href="#getFunctionOperator">getFunctionOperator</a><span class="signature">( op : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1168. <div class="method">
  1169. <div class="description">
  1170. <p>Returns the native shader operator name for a given generic name.</p>
  1171. </div>
  1172. <table class="params">
  1173. <tbody>
  1174. <tr>
  1175. <td class="name">
  1176. <strong translate="no">op</strong>
  1177. </td>
  1178. <td class="description last">
  1179. <p>The operator name to resolve.</p>
  1180. </td>
  1181. </tr>
  1182. </tbody>
  1183. </table>
  1184. <dl class="details">
  1185. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getFunctionOperator">NodeBuilder#getFunctionOperator</a></dt>
  1186. </dl>
  1187. <dl class="details">
  1188. <dt class="tag-returns"><strong>Returns:</strong> The resolved operator name.</dt>
  1189. </dl>
  1190. </div>
  1191. <h3 class="name name-method" id="getInstanceIndex" translate="no">.<a href="#getInstanceIndex">getInstanceIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1192. <div class="method">
  1193. <div class="description">
  1194. <p>Contextually returns either the vertex stage instance index builtin
  1195. or the linearized index of an compute invocation within a grid of workgroups.</p>
  1196. </div>
  1197. <dl class="details">
  1198. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getInstanceIndex">NodeBuilder#getInstanceIndex</a></dt>
  1199. </dl>
  1200. <dl class="details">
  1201. <dt class="tag-returns"><strong>Returns:</strong> The instance index.</dt>
  1202. </dl>
  1203. </div>
  1204. <h3 class="name name-method" id="getInvocationLocalIndex" translate="no">.<a href="#getInvocationLocalIndex">getInvocationLocalIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1205. <div class="method">
  1206. <div class="description">
  1207. <p>Returns a builtin representing the index of a compute invocation within the scope of a workgroup load.</p>
  1208. </div>
  1209. <dl class="details">
  1210. <dt class="tag-returns"><strong>Returns:</strong> The invocation local index.</dt>
  1211. </dl>
  1212. </div>
  1213. <h3 class="name name-method" id="getInvocationSubgroupIndex" translate="no">.<a href="#getInvocationSubgroupIndex">getInvocationSubgroupIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1214. <div class="method">
  1215. <div class="description">
  1216. <p>Returns a builtin representing the index of a compute invocation within the scope of a subgroup.</p>
  1217. </div>
  1218. <dl class="details">
  1219. <dt class="tag-returns"><strong>Returns:</strong> The invocation subgroup index.</dt>
  1220. </dl>
  1221. </div>
  1222. <h3 class="name name-method" id="getMethod" translate="no">.<a href="#getMethod">getMethod</a><span class="signature">( method : <span class="param-type">string</span>, output : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1223. <div class="method">
  1224. <div class="description">
  1225. <p>Returns the native shader method name for a given generic name.</p>
  1226. </div>
  1227. <table class="params">
  1228. <tbody>
  1229. <tr>
  1230. <td class="name">
  1231. <strong translate="no">method</strong>
  1232. </td>
  1233. <td class="description last">
  1234. <p>The method name to resolve.</p>
  1235. </td>
  1236. </tr>
  1237. <tr>
  1238. <td class="name">
  1239. <strong translate="no">output</strong>
  1240. </td>
  1241. <td class="description last">
  1242. <p>An optional output.</p>
  1243. <p>Default is <code>null</code>.</p>
  1244. </td>
  1245. </tr>
  1246. </tbody>
  1247. </table>
  1248. <dl class="details">
  1249. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getMethod">NodeBuilder#getMethod</a></dt>
  1250. </dl>
  1251. <dl class="details">
  1252. <dt class="tag-returns"><strong>Returns:</strong> The resolved WGSL method name.</dt>
  1253. </dl>
  1254. </div>
  1255. <h3 class="name name-method" id="getNodeAccess" translate="no">.<a href="#getNodeAccess">getNodeAccess</a><span class="signature">( node : <span class="param-type"><a href="StorageTextureNode.html">StorageTextureNode</a> | <a href="StorageBufferNode.html">StorageBufferNode</a></span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1256. <div class="method">
  1257. <div class="description">
  1258. <p>Returns the node access for the given node and shader stage.</p>
  1259. </div>
  1260. <table class="params">
  1261. <tbody>
  1262. <tr>
  1263. <td class="name">
  1264. <strong translate="no">node</strong>
  1265. </td>
  1266. <td class="description last">
  1267. <p>The storage node.</p>
  1268. </td>
  1269. </tr>
  1270. <tr>
  1271. <td class="name">
  1272. <strong translate="no">shaderStage</strong>
  1273. </td>
  1274. <td class="description last">
  1275. <p>The shader stage.</p>
  1276. </td>
  1277. </tr>
  1278. </tbody>
  1279. </table>
  1280. <dl class="details">
  1281. <dt class="tag-returns"><strong>Returns:</strong> The node access.</dt>
  1282. </dl>
  1283. </div>
  1284. <h3 class="name name-method" id="getOutputStructName" translate="no">.<a href="#getOutputStructName">getOutputStructName</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1285. <div class="method">
  1286. <div class="description">
  1287. <p>Returns the output struct name.</p>
  1288. </div>
  1289. <dl class="details">
  1290. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getOutputStructName">NodeBuilder#getOutputStructName</a></dt>
  1291. </dl>
  1292. <dl class="details">
  1293. <dt class="tag-returns"><strong>Returns:</strong> The name of the output struct.</dt>
  1294. </dl>
  1295. </div>
  1296. <h3 class="name name-method" id="getPropertyName" translate="no">.<a href="#getPropertyName">getPropertyName</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1297. <div class="method">
  1298. <div class="description">
  1299. <p>Returns a WGSL snippet that represents the property name of the given node.</p>
  1300. </div>
  1301. <table class="params">
  1302. <tbody>
  1303. <tr>
  1304. <td class="name">
  1305. <strong translate="no">node</strong>
  1306. </td>
  1307. <td class="description last">
  1308. <p>The node.</p>
  1309. </td>
  1310. </tr>
  1311. <tr>
  1312. <td class="name">
  1313. <strong translate="no">shaderStage</strong>
  1314. </td>
  1315. <td class="description last">
  1316. <p>The shader stage this code snippet is generated for.</p>
  1317. <p>Default is <code>this.shaderStage</code>.</p>
  1318. </td>
  1319. </tr>
  1320. </tbody>
  1321. </table>
  1322. <dl class="details">
  1323. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getPropertyName">NodeBuilder#getPropertyName</a></dt>
  1324. </dl>
  1325. <dl class="details">
  1326. <dt class="tag-returns"><strong>Returns:</strong> The property name.</dt>
  1327. </dl>
  1328. </div>
  1329. <h3 class="name name-method" id="getScopedArray" translate="no">.<a href="#getScopedArray">getScopedArray</a><span class="signature">( name : <span class="param-type">string</span>, scope : <span class="param-type">string</span>, bufferType : <span class="param-type">string</span>, bufferCount : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1330. <div class="method">
  1331. <div class="description">
  1332. <p>This method should be used when a new scoped buffer is used in context of
  1333. compute shaders. It adds the array to the internal data structure which is
  1334. later used to generate the respective WGSL.</p>
  1335. </div>
  1336. <table class="params">
  1337. <tbody>
  1338. <tr>
  1339. <td class="name">
  1340. <strong translate="no">name</strong>
  1341. </td>
  1342. <td class="description last">
  1343. <p>The array name.</p>
  1344. </td>
  1345. </tr>
  1346. <tr>
  1347. <td class="name">
  1348. <strong translate="no">scope</strong>
  1349. </td>
  1350. <td class="description last">
  1351. <p>The scope.</p>
  1352. </td>
  1353. </tr>
  1354. <tr>
  1355. <td class="name">
  1356. <strong translate="no">bufferType</strong>
  1357. </td>
  1358. <td class="description last">
  1359. <p>The buffer type.</p>
  1360. </td>
  1361. </tr>
  1362. <tr>
  1363. <td class="name">
  1364. <strong translate="no">bufferCount</strong>
  1365. </td>
  1366. <td class="description last">
  1367. <p>The buffer count.</p>
  1368. </td>
  1369. </tr>
  1370. </tbody>
  1371. </table>
  1372. <dl class="details">
  1373. <dt class="tag-returns"><strong>Returns:</strong> The array name.</dt>
  1374. </dl>
  1375. </div>
  1376. <h3 class="name name-method" id="getScopedArrays" translate="no">.<a href="#getScopedArrays">getScopedArrays</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string | undefined</span> </h3>
  1377. <div class="method">
  1378. <div class="description">
  1379. <p>Returns the scoped arrays of the given shader stage as a WGSL string.</p>
  1380. </div>
  1381. <table class="params">
  1382. <tbody>
  1383. <tr>
  1384. <td class="name">
  1385. <strong translate="no">shaderStage</strong>
  1386. </td>
  1387. <td class="description last">
  1388. <p>The shader stage.</p>
  1389. </td>
  1390. </tr>
  1391. </tbody>
  1392. </table>
  1393. <dl class="details">
  1394. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the scoped arrays.
  1395. Returns <code>undefined</code> when used in the vertex or fragment stage.</dt>
  1396. </dl>
  1397. </div>
  1398. <h3 class="name name-method" id="getStorageAccess" translate="no">.<a href="#getStorageAccess">getStorageAccess</a><span class="signature">( node : <span class="param-type"><a href="StorageTextureNode.html">StorageTextureNode</a> | <a href="StorageBufferNode.html">StorageBufferNode</a></span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1399. <div class="method">
  1400. <div class="description">
  1401. <p>Returns A WGSL snippet representing the storage access.</p>
  1402. </div>
  1403. <table class="params">
  1404. <tbody>
  1405. <tr>
  1406. <td class="name">
  1407. <strong translate="no">node</strong>
  1408. </td>
  1409. <td class="description last">
  1410. <p>The storage node.</p>
  1411. </td>
  1412. </tr>
  1413. <tr>
  1414. <td class="name">
  1415. <strong translate="no">shaderStage</strong>
  1416. </td>
  1417. <td class="description last">
  1418. <p>The shader stage.</p>
  1419. </td>
  1420. </tr>
  1421. </tbody>
  1422. </table>
  1423. <dl class="details">
  1424. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet representing the storage access.</dt>
  1425. </dl>
  1426. </div>
  1427. <h3 class="name name-method" id="getStructMembers" translate="no">.<a href="#getStructMembers">getStructMembers</a><span class="signature">( struct : <span class="param-type"><a href="StructTypeNode.html">StructTypeNode</a></span> )</span><span class="type-signature"> : string</span> </h3>
  1428. <div class="method">
  1429. <div class="description">
  1430. <p>Returns the members of the given struct type node as a WGSL string.</p>
  1431. </div>
  1432. <table class="params">
  1433. <tbody>
  1434. <tr>
  1435. <td class="name">
  1436. <strong translate="no">struct</strong>
  1437. </td>
  1438. <td class="description last">
  1439. <p>The struct type node.</p>
  1440. </td>
  1441. </tr>
  1442. </tbody>
  1443. </table>
  1444. <dl class="details">
  1445. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the struct members.</dt>
  1446. </dl>
  1447. </div>
  1448. <h3 class="name name-method" id="getStructs" translate="no">.<a href="#getStructs">getStructs</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1449. <div class="method">
  1450. <div class="description">
  1451. <p>Returns the structs of the given shader stage as a WGSL string.</p>
  1452. </div>
  1453. <table class="params">
  1454. <tbody>
  1455. <tr>
  1456. <td class="name">
  1457. <strong translate="no">shaderStage</strong>
  1458. </td>
  1459. <td class="description last">
  1460. <p>The shader stage.</p>
  1461. </td>
  1462. </tr>
  1463. </tbody>
  1464. </table>
  1465. <dl class="details">
  1466. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the structs.</dt>
  1467. </dl>
  1468. </div>
  1469. <h3 class="name name-method" id="getSubgroupIndex" translate="no">.<a href="#getSubgroupIndex">getSubgroupIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1470. <div class="method">
  1471. <div class="description">
  1472. <p>Returns a builtin representing the index of a compute invocation's subgroup within its workgroup.</p>
  1473. </div>
  1474. <dl class="details">
  1475. <dt class="tag-returns"><strong>Returns:</strong> The subgroup index.</dt>
  1476. </dl>
  1477. </div>
  1478. <h3 class="name name-method" id="getSubgroupSize" translate="no">.<a href="#getSubgroupSize">getSubgroupSize</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1479. <div class="method">
  1480. <div class="description">
  1481. <p>Returns a builtin representing the size of a subgroup within the current shader.</p>
  1482. </div>
  1483. <dl class="details">
  1484. <dt class="tag-returns"><strong>Returns:</strong> The subgroup size.</dt>
  1485. </dl>
  1486. </div>
  1487. <h3 class="name name-method" id="getTernary" translate="no">.<a href="#getTernary">getTernary</a><span class="signature">( condSnippet : <span class="param-type">string</span>, ifSnippet : <span class="param-type">string</span>, elseSnippet : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1488. <div class="method">
  1489. <div class="description">
  1490. <p>Returns the native snippet for a ternary operation.</p>
  1491. </div>
  1492. <table class="params">
  1493. <tbody>
  1494. <tr>
  1495. <td class="name">
  1496. <strong translate="no">condSnippet</strong>
  1497. </td>
  1498. <td class="description last">
  1499. <p>The condition determining which expression gets resolved.</p>
  1500. </td>
  1501. </tr>
  1502. <tr>
  1503. <td class="name">
  1504. <strong translate="no">ifSnippet</strong>
  1505. </td>
  1506. <td class="description last">
  1507. <p>The expression to resolve to if the condition is true.</p>
  1508. </td>
  1509. </tr>
  1510. <tr>
  1511. <td class="name">
  1512. <strong translate="no">elseSnippet</strong>
  1513. </td>
  1514. <td class="description last">
  1515. <p>The expression to resolve to if the condition is false.</p>
  1516. </td>
  1517. </tr>
  1518. </tbody>
  1519. </table>
  1520. <dl class="details">
  1521. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getTernary">NodeBuilder#getTernary</a></dt>
  1522. </dl>
  1523. <dl class="details">
  1524. <dt class="tag-returns"><strong>Returns:</strong> The resolved method name.</dt>
  1525. </dl>
  1526. </div>
  1527. <h3 class="name name-method" id="getType" translate="no">.<a href="#getType">getType</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1528. <div class="method">
  1529. <div class="description">
  1530. <p>Returns the WGSL type of the given node data type.</p>
  1531. </div>
  1532. <table class="params">
  1533. <tbody>
  1534. <tr>
  1535. <td class="name">
  1536. <strong translate="no">type</strong>
  1537. </td>
  1538. <td class="description last">
  1539. <p>The node data type.</p>
  1540. </td>
  1541. </tr>
  1542. </tbody>
  1543. </table>
  1544. <dl class="details">
  1545. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getType">NodeBuilder#getType</a></dt>
  1546. </dl>
  1547. <dl class="details">
  1548. <dt class="tag-returns"><strong>Returns:</strong> The WGSL type.</dt>
  1549. </dl>
  1550. </div>
  1551. <h3 class="name name-method" id="getUniformBufferLimit" translate="no">.<a href="#getUniformBufferLimit">getUniformBufferLimit</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  1552. <div class="method">
  1553. <div class="description">
  1554. <p>Returns the maximum uniform buffer size limit.</p>
  1555. </div>
  1556. <dl class="details">
  1557. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getUniformBufferLimit">NodeBuilder#getUniformBufferLimit</a></dt>
  1558. </dl>
  1559. <dl class="details">
  1560. <dt class="tag-returns"><strong>Returns:</strong> The maximum uniform buffer size in bytes.</dt>
  1561. </dl>
  1562. </div>
  1563. <h3 class="name name-method" id="getUniformFromNode" translate="no">.<a href="#getUniformFromNode">getUniformFromNode</a><span class="signature">( node : <span class="param-type"><a href="UniformNode.html">UniformNode</a></span>, type : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span>, name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="NodeUniform.html">NodeUniform</a></span> </h3>
  1564. <div class="method">
  1565. <div class="description">
  1566. <p>This method is one of the more important ones since it's responsible
  1567. for generating a matching binding instance for the given uniform node.</p>
  1568. <p>These bindings are later used in the renderer to create bind groups
  1569. and layouts.</p>
  1570. </div>
  1571. <table class="params">
  1572. <tbody>
  1573. <tr>
  1574. <td class="name">
  1575. <strong translate="no">node</strong>
  1576. </td>
  1577. <td class="description last">
  1578. <p>The uniform node.</p>
  1579. </td>
  1580. </tr>
  1581. <tr>
  1582. <td class="name">
  1583. <strong translate="no">type</strong>
  1584. </td>
  1585. <td class="description last">
  1586. <p>The node data type.</p>
  1587. </td>
  1588. </tr>
  1589. <tr>
  1590. <td class="name">
  1591. <strong translate="no">shaderStage</strong>
  1592. </td>
  1593. <td class="description last">
  1594. <p>The shader stage.</p>
  1595. </td>
  1596. </tr>
  1597. <tr>
  1598. <td class="name">
  1599. <strong translate="no">name</strong>
  1600. </td>
  1601. <td class="description last">
  1602. <p>An optional uniform name.</p>
  1603. <p>Default is <code>null</code>.</p>
  1604. </td>
  1605. </tr>
  1606. </tbody>
  1607. </table>
  1608. <dl class="details">
  1609. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getUniformFromNode">NodeBuilder#getUniformFromNode</a></dt>
  1610. </dl>
  1611. <dl class="details">
  1612. <dt class="tag-returns"><strong>Returns:</strong> The node uniform object.</dt>
  1613. </dl>
  1614. </div>
  1615. <h3 class="name name-method" id="getUniforms" translate="no">.<a href="#getUniforms">getUniforms</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1616. <div class="method">
  1617. <div class="description">
  1618. <p>Returns the uniforms of the given shader stage as a WGSL string.</p>
  1619. </div>
  1620. <table class="params">
  1621. <tbody>
  1622. <tr>
  1623. <td class="name">
  1624. <strong translate="no">shaderStage</strong>
  1625. </td>
  1626. <td class="description last">
  1627. <p>The shader stage.</p>
  1628. </td>
  1629. </tr>
  1630. </tbody>
  1631. </table>
  1632. <dl class="details">
  1633. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getUniforms">NodeBuilder#getUniforms</a></dt>
  1634. </dl>
  1635. <dl class="details">
  1636. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the uniforms.</dt>
  1637. </dl>
  1638. </div>
  1639. <h3 class="name name-method" id="getVar" translate="no">.<a href="#getVar">getVar</a><span class="signature">( type : <span class="param-type">string</span>, name : <span class="param-type">string</span>, count : <span class="param-type">number</span> )</span><span class="type-signature"> : string</span> </h3>
  1640. <div class="method">
  1641. <div class="description">
  1642. <p>Returns a WGSL string representing a variable.</p>
  1643. </div>
  1644. <table class="params">
  1645. <tbody>
  1646. <tr>
  1647. <td class="name">
  1648. <strong translate="no">type</strong>
  1649. </td>
  1650. <td class="description last">
  1651. <p>The variable's type.</p>
  1652. </td>
  1653. </tr>
  1654. <tr>
  1655. <td class="name">
  1656. <strong translate="no">name</strong>
  1657. </td>
  1658. <td class="description last">
  1659. <p>The variable's name.</p>
  1660. </td>
  1661. </tr>
  1662. <tr>
  1663. <td class="name">
  1664. <strong translate="no">count</strong>
  1665. </td>
  1666. <td class="description last">
  1667. <p>The array length.</p>
  1668. <p>Default is <code>null</code>.</p>
  1669. </td>
  1670. </tr>
  1671. </tbody>
  1672. </table>
  1673. <dl class="details">
  1674. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVar">NodeBuilder#getVar</a></dt>
  1675. </dl>
  1676. <dl class="details">
  1677. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines a variable.</dt>
  1678. </dl>
  1679. </div>
  1680. <h3 class="name name-method" id="getVars" translate="no">.<a href="#getVars">getVars</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1681. <div class="method">
  1682. <div class="description">
  1683. <p>Returns the variables of the given shader stage as a WGSL string.</p>
  1684. </div>
  1685. <table class="params">
  1686. <tbody>
  1687. <tr>
  1688. <td class="name">
  1689. <strong translate="no">shaderStage</strong>
  1690. </td>
  1691. <td class="description last">
  1692. <p>The shader stage.</p>
  1693. </td>
  1694. </tr>
  1695. </tbody>
  1696. </table>
  1697. <dl class="details">
  1698. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVars">NodeBuilder#getVars</a></dt>
  1699. </dl>
  1700. <dl class="details">
  1701. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the variables.</dt>
  1702. </dl>
  1703. </div>
  1704. <h3 class="name name-method" id="getVaryings" translate="no">.<a href="#getVaryings">getVaryings</a><span class="signature">( shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  1705. <div class="method">
  1706. <div class="description">
  1707. <p>Returns the varyings of the given shader stage as a WGSL string.</p>
  1708. </div>
  1709. <table class="params">
  1710. <tbody>
  1711. <tr>
  1712. <td class="name">
  1713. <strong translate="no">shaderStage</strong>
  1714. </td>
  1715. <td class="description last">
  1716. <p>The shader stage.</p>
  1717. </td>
  1718. </tr>
  1719. </tbody>
  1720. </table>
  1721. <dl class="details">
  1722. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVaryings">NodeBuilder#getVaryings</a></dt>
  1723. </dl>
  1724. <dl class="details">
  1725. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the varyings.</dt>
  1726. </dl>
  1727. </div>
  1728. <h3 class="name name-method" id="getVertexIndex" translate="no">.<a href="#getVertexIndex">getVertexIndex</a><span class="signature">()</span><span class="type-signature"> : string</span> </h3>
  1729. <div class="method">
  1730. <div class="description">
  1731. <p>Returns the vertex index builtin.</p>
  1732. </div>
  1733. <dl class="details">
  1734. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVertexIndex">NodeBuilder#getVertexIndex</a></dt>
  1735. </dl>
  1736. <dl class="details">
  1737. <dt class="tag-returns"><strong>Returns:</strong> The vertex index.</dt>
  1738. </dl>
  1739. </div>
  1740. <h3 class="name name-method" id="hasBuiltin" translate="no">.<a href="#hasBuiltin">hasBuiltin</a><span class="signature">( name : <span class="param-type">string</span>, shaderStage : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> </h3>
  1741. <div class="method">
  1742. <div class="description">
  1743. <p>Returns <code>true</code> if the given builtin is defined in the given shader stage.</p>
  1744. </div>
  1745. <table class="params">
  1746. <tbody>
  1747. <tr>
  1748. <td class="name">
  1749. <strong translate="no">name</strong>
  1750. </td>
  1751. <td class="description last">
  1752. <p>The builtin name.</p>
  1753. </td>
  1754. </tr>
  1755. <tr>
  1756. <td class="name">
  1757. <strong translate="no">shaderStage</strong>
  1758. </td>
  1759. <td class="description last">
  1760. <p>The shader stage this code snippet is generated for.</p>
  1761. <p>Default is <code>this.shaderStage</code>.</p>
  1762. </td>
  1763. </tr>
  1764. </tbody>
  1765. </table>
  1766. <dl class="details">
  1767. <dt class="tag-returns"><strong>Returns:</strong> Whether the given builtin is defined in the given shader stage or not.</dt>
  1768. </dl>
  1769. </div>
  1770. <h3 class="name name-method" id="isAvailable" translate="no">.<a href="#isAvailable">isAvailable</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> </h3>
  1771. <div class="method">
  1772. <div class="description">
  1773. <p>Whether the requested feature is available or not.</p>
  1774. </div>
  1775. <table class="params">
  1776. <tbody>
  1777. <tr>
  1778. <td class="name">
  1779. <strong translate="no">name</strong>
  1780. </td>
  1781. <td class="description last">
  1782. <p>The requested feature.</p>
  1783. </td>
  1784. </tr>
  1785. </tbody>
  1786. </table>
  1787. <dl class="details">
  1788. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#isAvailable">NodeBuilder#isAvailable</a></dt>
  1789. </dl>
  1790. <dl class="details">
  1791. <dt class="tag-returns"><strong>Returns:</strong> Whether the requested feature is supported or not.</dt>
  1792. </dl>
  1793. </div>
  1794. <h3 class="name name-method" id="isFlipY" translate="no">.<a href="#isFlipY">isFlipY</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
  1795. <div class="method">
  1796. <div class="description">
  1797. <p>Whether to flip texture data along its vertical axis or not.</p>
  1798. </div>
  1799. <dl class="details">
  1800. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#isFlipY">NodeBuilder#isFlipY</a></dt>
  1801. </dl>
  1802. <dl class="details">
  1803. <dt class="tag-returns"><strong>Returns:</strong> Returns always <code>false</code> in context of WGSL.</dt>
  1804. </dl>
  1805. </div>
  1806. <h3 class="name name-method" id="isSampleCompare" translate="no">.<a href="#isSampleCompare">isSampleCompare</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  1807. <div class="method">
  1808. <div class="description">
  1809. <p>Returns <code>true</code> if the sampled values of the given texture should be compared against a reference value.</p>
  1810. </div>
  1811. <table class="params">
  1812. <tbody>
  1813. <tr>
  1814. <td class="name">
  1815. <strong translate="no">texture</strong>
  1816. </td>
  1817. <td class="description last">
  1818. <p>The texture.</p>
  1819. </td>
  1820. </tr>
  1821. </tbody>
  1822. </table>
  1823. <dl class="details">
  1824. <dt class="tag-returns"><strong>Returns:</strong> Whether the sampled values of the given texture should be compared against a reference value or not.</dt>
  1825. </dl>
  1826. </div>
  1827. <h3 class="name name-method" id="isUnfilterable" translate="no">.<a href="#isUnfilterable">isUnfilterable</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  1828. <div class="method">
  1829. <div class="description">
  1830. <p>Returns <code>true</code> if the given texture is unfilterable.</p>
  1831. </div>
  1832. <table class="params">
  1833. <tbody>
  1834. <tr>
  1835. <td class="name">
  1836. <strong translate="no">texture</strong>
  1837. </td>
  1838. <td class="description last">
  1839. <p>The texture.</p>
  1840. </td>
  1841. </tr>
  1842. </tbody>
  1843. </table>
  1844. <dl class="details">
  1845. <dt class="tag-returns"><strong>Returns:</strong> Whether the given texture is unfilterable or not.</dt>
  1846. </dl>
  1847. </div>
  1848. <h2 class="subsection-title">Source</h2>
  1849. <p>
  1850. <a href="https://github.com/mrdoob/three.js/blob/master/src/renderers/webgpu/nodes/WGSLNodeBuilder.js" translate="no" target="_blank" rel="noopener">src/renderers/webgpu/nodes/WGSLNodeBuilder.js</a>
  1851. </p>
  1852. </article>
  1853. </section>
  1854. <script src="../scripts/linenumber.js"></script>
  1855. <script src="../scripts/page.js"></script>
  1856. </body>
  1857. </html>
粤ICP备19079148号