1
0

WGSLNodeBuilder.html 72 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776
  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>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>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>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>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>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>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>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>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> )</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>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>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>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>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>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. </tbody>
  276. </table>
  277. <dl class="details">
  278. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  279. </dl>
  280. </div>
  281. <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>
  282. <div class="method">
  283. <div class="description">
  284. <p>Generates the WGSL snippet for sampling/loading the given texture.</p>
  285. </div>
  286. <table class="params">
  287. <tbody>
  288. <tr>
  289. <td class="name">
  290. <strong>texture</strong>
  291. </td>
  292. <td class="description last">
  293. <p>The texture.</p>
  294. </td>
  295. </tr>
  296. <tr>
  297. <td class="name">
  298. <strong>textureProperty</strong>
  299. </td>
  300. <td class="description last">
  301. <p>The name of the texture uniform in the shader.</p>
  302. </td>
  303. </tr>
  304. <tr>
  305. <td class="name">
  306. <strong>uvSnippet</strong>
  307. </td>
  308. <td class="description last">
  309. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  310. </td>
  311. </tr>
  312. <tr>
  313. <td class="name">
  314. <strong>depthSnippet</strong>
  315. </td>
  316. <td class="description last">
  317. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  318. </td>
  319. </tr>
  320. <tr>
  321. <td class="name">
  322. <strong>offsetSnippet</strong>
  323. </td>
  324. <td class="description last">
  325. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  326. </td>
  327. </tr>
  328. <tr>
  329. <td class="name">
  330. <strong>shaderStage</strong>
  331. </td>
  332. <td class="description last">
  333. <p>The shader stage this code snippet is generated for.</p>
  334. <p>Default is <code>this.shaderStage</code>.</p>
  335. </td>
  336. </tr>
  337. </tbody>
  338. </table>
  339. <dl class="details">
  340. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#generateTexture">NodeBuilder#generateTexture</a></dt>
  341. </dl>
  342. <dl class="details">
  343. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  344. </dl>
  345. </div>
  346. <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>
  347. <div class="method">
  348. <div class="description">
  349. <p>Generates the WGSL snippet when sampling textures with a bias to the mip level.</p>
  350. </div>
  351. <table class="params">
  352. <tbody>
  353. <tr>
  354. <td class="name">
  355. <strong>texture</strong>
  356. </td>
  357. <td class="description last">
  358. <p>The texture.</p>
  359. </td>
  360. </tr>
  361. <tr>
  362. <td class="name">
  363. <strong>textureProperty</strong>
  364. </td>
  365. <td class="description last">
  366. <p>The name of the texture uniform in the shader.</p>
  367. </td>
  368. </tr>
  369. <tr>
  370. <td class="name">
  371. <strong>uvSnippet</strong>
  372. </td>
  373. <td class="description last">
  374. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  375. </td>
  376. </tr>
  377. <tr>
  378. <td class="name">
  379. <strong>biasSnippet</strong>
  380. </td>
  381. <td class="description last">
  382. <p>A WGSL snippet that represents the bias to apply to the mip level before sampling.</p>
  383. </td>
  384. </tr>
  385. <tr>
  386. <td class="name">
  387. <strong>depthSnippet</strong>
  388. </td>
  389. <td class="description last">
  390. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  391. </td>
  392. </tr>
  393. <tr>
  394. <td class="name">
  395. <strong>offsetSnippet</strong>
  396. </td>
  397. <td class="description last">
  398. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  399. </td>
  400. </tr>
  401. <tr>
  402. <td class="name">
  403. <strong>shaderStage</strong>
  404. </td>
  405. <td class="description last">
  406. <p>The shader stage this code snippet is generated for.</p>
  407. <p>Default is <code>this.shaderStage</code>.</p>
  408. </td>
  409. </tr>
  410. </tbody>
  411. </table>
  412. <dl class="details">
  413. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  414. </dl>
  415. </div>
  416. <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>
  417. <div class="method">
  418. <div class="description">
  419. <p>Generates the WGSL snippet for sampling a depth texture and comparing the sampled depth values
  420. against a reference value.</p>
  421. </div>
  422. <table class="params">
  423. <tbody>
  424. <tr>
  425. <td class="name">
  426. <strong>texture</strong>
  427. </td>
  428. <td class="description last">
  429. <p>The texture.</p>
  430. </td>
  431. </tr>
  432. <tr>
  433. <td class="name">
  434. <strong>textureProperty</strong>
  435. </td>
  436. <td class="description last">
  437. <p>The name of the texture uniform in the shader.</p>
  438. </td>
  439. </tr>
  440. <tr>
  441. <td class="name">
  442. <strong>uvSnippet</strong>
  443. </td>
  444. <td class="description last">
  445. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  446. </td>
  447. </tr>
  448. <tr>
  449. <td class="name">
  450. <strong>compareSnippet</strong>
  451. </td>
  452. <td class="description last">
  453. <p>A WGSL snippet that represents the reference value.</p>
  454. </td>
  455. </tr>
  456. <tr>
  457. <td class="name">
  458. <strong>depthSnippet</strong>
  459. </td>
  460. <td class="description last">
  461. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  462. </td>
  463. </tr>
  464. <tr>
  465. <td class="name">
  466. <strong>offsetSnippet</strong>
  467. </td>
  468. <td class="description last">
  469. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  470. </td>
  471. </tr>
  472. <tr>
  473. <td class="name">
  474. <strong>shaderStage</strong>
  475. </td>
  476. <td class="description last">
  477. <p>The shader stage this code snippet is generated for.</p>
  478. <p>Default is <code>this.shaderStage</code>.</p>
  479. </td>
  480. </tr>
  481. </tbody>
  482. </table>
  483. <dl class="details">
  484. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  485. </dl>
  486. </div>
  487. <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>
  488. <div class="method">
  489. <div class="description">
  490. <p>Generates a WGSL variable that holds the texture dimension of the given texture.
  491. It also returns information about the number of layers (elements) of an arrayed
  492. texture as well as the cube face count of cube textures.</p>
  493. </div>
  494. <table class="params">
  495. <tbody>
  496. <tr>
  497. <td class="name">
  498. <strong>texture</strong>
  499. </td>
  500. <td class="description last">
  501. <p>The texture to generate the function for.</p>
  502. </td>
  503. </tr>
  504. <tr>
  505. <td class="name">
  506. <strong>textureProperty</strong>
  507. </td>
  508. <td class="description last">
  509. <p>The name of the video texture uniform in the shader.</p>
  510. </td>
  511. </tr>
  512. <tr>
  513. <td class="name">
  514. <strong>levelSnippet</strong>
  515. </td>
  516. <td class="description last">
  517. <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
  518. </td>
  519. </tr>
  520. </tbody>
  521. </table>
  522. <dl class="details">
  523. <dt class="tag-returns"><strong>Returns:</strong> The name of the dimension variable.</dt>
  524. </dl>
  525. </div>
  526. <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>
  527. <div class="method">
  528. <div class="description">
  529. <p>Generates the WGSL snippet for sampling/loading the given texture using explicit gradients.</p>
  530. </div>
  531. <table class="params">
  532. <tbody>
  533. <tr>
  534. <td class="name">
  535. <strong>texture</strong>
  536. </td>
  537. <td class="description last">
  538. <p>The texture.</p>
  539. </td>
  540. </tr>
  541. <tr>
  542. <td class="name">
  543. <strong>textureProperty</strong>
  544. </td>
  545. <td class="description last">
  546. <p>The name of the texture uniform in the shader.</p>
  547. </td>
  548. </tr>
  549. <tr>
  550. <td class="name">
  551. <strong>uvSnippet</strong>
  552. </td>
  553. <td class="description last">
  554. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  555. </td>
  556. </tr>
  557. <tr>
  558. <td class="name">
  559. <strong>gradSnippet</strong>
  560. </td>
  561. <td class="description last">
  562. <p>An array holding both gradient WGSL snippets.</p>
  563. </td>
  564. </tr>
  565. <tr>
  566. <td class="name">
  567. <strong>depthSnippet</strong>
  568. </td>
  569. <td class="description last">
  570. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  571. </td>
  572. </tr>
  573. <tr>
  574. <td class="name">
  575. <strong>offsetSnippet</strong>
  576. </td>
  577. <td class="description last">
  578. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  579. </td>
  580. </tr>
  581. <tr>
  582. <td class="name">
  583. <strong>shaderStage</strong>
  584. </td>
  585. <td class="description last">
  586. <p>The shader stage this code snippet is generated for.</p>
  587. <p>Default is <code>this.shaderStage</code>.</p>
  588. </td>
  589. </tr>
  590. </tbody>
  591. </table>
  592. <dl class="details">
  593. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  594. </dl>
  595. </div>
  596. <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>
  597. <div class="method">
  598. <div class="description">
  599. <p>Generates the WGSL snippet when sampling textures with explicit mip level.</p>
  600. </div>
  601. <table class="params">
  602. <tbody>
  603. <tr>
  604. <td class="name">
  605. <strong>texture</strong>
  606. </td>
  607. <td class="description last">
  608. <p>The texture.</p>
  609. </td>
  610. </tr>
  611. <tr>
  612. <td class="name">
  613. <strong>textureProperty</strong>
  614. </td>
  615. <td class="description last">
  616. <p>The name of the texture uniform in the shader.</p>
  617. </td>
  618. </tr>
  619. <tr>
  620. <td class="name">
  621. <strong>uvSnippet</strong>
  622. </td>
  623. <td class="description last">
  624. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  625. </td>
  626. </tr>
  627. <tr>
  628. <td class="name">
  629. <strong>levelSnippet</strong>
  630. </td>
  631. <td class="description last">
  632. <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
  633. </td>
  634. </tr>
  635. <tr>
  636. <td class="name">
  637. <strong>depthSnippet</strong>
  638. </td>
  639. <td class="description last">
  640. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  641. </td>
  642. </tr>
  643. <tr>
  644. <td class="name">
  645. <strong>offsetSnippet</strong>
  646. </td>
  647. <td class="description last">
  648. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  649. </td>
  650. </tr>
  651. <tr>
  652. <td class="name">
  653. <strong>shaderStage</strong>
  654. </td>
  655. <td class="description last">
  656. <p>The shader stage this code snippet is generated for.</p>
  657. <p>Default is <code>this.shaderStage</code>.</p>
  658. </td>
  659. </tr>
  660. </tbody>
  661. </table>
  662. <dl class="details">
  663. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  664. </dl>
  665. </div>
  666. <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>
  667. <div class="method">
  668. <div class="description">
  669. <p>Generates the WGSL snippet that reads a single texel from a texture without sampling or filtering.</p>
  670. </div>
  671. <table class="params">
  672. <tbody>
  673. <tr>
  674. <td class="name">
  675. <strong>texture</strong>
  676. </td>
  677. <td class="description last">
  678. <p>The texture.</p>
  679. </td>
  680. </tr>
  681. <tr>
  682. <td class="name">
  683. <strong>textureProperty</strong>
  684. </td>
  685. <td class="description last">
  686. <p>The name of the texture uniform in the shader.</p>
  687. </td>
  688. </tr>
  689. <tr>
  690. <td class="name">
  691. <strong>uvIndexSnippet</strong>
  692. </td>
  693. <td class="description last">
  694. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  695. </td>
  696. </tr>
  697. <tr>
  698. <td class="name">
  699. <strong>levelSnippet</strong>
  700. </td>
  701. <td class="description last">
  702. <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
  703. </td>
  704. </tr>
  705. <tr>
  706. <td class="name">
  707. <strong>depthSnippet</strong>
  708. </td>
  709. <td class="description last">
  710. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  711. </td>
  712. </tr>
  713. <tr>
  714. <td class="name">
  715. <strong>offsetSnippet</strong>
  716. </td>
  717. <td class="description last">
  718. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  719. </td>
  720. </tr>
  721. </tbody>
  722. </table>
  723. <dl class="details">
  724. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  725. </dl>
  726. </div>
  727. <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>
  728. <div class="method">
  729. <div class="description">
  730. <p>Generates the WGSL snippet for a texture lookup with explicit level-of-detail.
  731. Since it's a lookup, no sampling or filtering is applied.</p>
  732. </div>
  733. <table class="params">
  734. <tbody>
  735. <tr>
  736. <td class="name">
  737. <strong>texture</strong>
  738. </td>
  739. <td class="description last">
  740. <p>The texture.</p>
  741. </td>
  742. </tr>
  743. <tr>
  744. <td class="name">
  745. <strong>textureProperty</strong>
  746. </td>
  747. <td class="description last">
  748. <p>The name of the texture uniform in the shader.</p>
  749. </td>
  750. </tr>
  751. <tr>
  752. <td class="name">
  753. <strong>uvSnippet</strong>
  754. </td>
  755. <td class="description last">
  756. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  757. </td>
  758. </tr>
  759. <tr>
  760. <td class="name">
  761. <strong>depthSnippet</strong>
  762. </td>
  763. <td class="description last">
  764. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  765. </td>
  766. </tr>
  767. <tr>
  768. <td class="name">
  769. <strong>offsetSnippet</strong>
  770. </td>
  771. <td class="description last">
  772. <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
  773. </td>
  774. </tr>
  775. <tr>
  776. <td class="name">
  777. <strong>levelSnippet</strong>
  778. </td>
  779. <td class="description last">
  780. <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
  781. <p>Default is <code>'0u'</code>.</p>
  782. </td>
  783. </tr>
  784. </tbody>
  785. </table>
  786. <dl class="details">
  787. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#generateTextureLod">NodeBuilder#generateTextureLod</a></dt>
  788. </dl>
  789. <dl class="details">
  790. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  791. </dl>
  792. </div>
  793. <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>
  794. <div class="method">
  795. <div class="description">
  796. <p>Generates the WGSL snippet that writes a single texel to a texture.</p>
  797. </div>
  798. <table class="params">
  799. <tbody>
  800. <tr>
  801. <td class="name">
  802. <strong>texture</strong>
  803. </td>
  804. <td class="description last">
  805. <p>The texture.</p>
  806. </td>
  807. </tr>
  808. <tr>
  809. <td class="name">
  810. <strong>textureProperty</strong>
  811. </td>
  812. <td class="description last">
  813. <p>The name of the texture uniform in the shader.</p>
  814. </td>
  815. </tr>
  816. <tr>
  817. <td class="name">
  818. <strong>uvIndexSnippet</strong>
  819. </td>
  820. <td class="description last">
  821. <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
  822. </td>
  823. </tr>
  824. <tr>
  825. <td class="name">
  826. <strong>depthSnippet</strong>
  827. </td>
  828. <td class="description last">
  829. <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
  830. </td>
  831. </tr>
  832. <tr>
  833. <td class="name">
  834. <strong>valueSnippet</strong>
  835. </td>
  836. <td class="description last">
  837. <p>A WGSL snippet that represent the new texel value.</p>
  838. </td>
  839. </tr>
  840. </tbody>
  841. </table>
  842. <dl class="details">
  843. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
  844. </dl>
  845. </div>
  846. <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>
  847. <div class="method">
  848. <div class="description">
  849. <p>Generates a wrap function used in context of textures.</p>
  850. </div>
  851. <table class="params">
  852. <tbody>
  853. <tr>
  854. <td class="name">
  855. <strong>texture</strong>
  856. </td>
  857. <td class="description last">
  858. <p>The texture to generate the function for.</p>
  859. </td>
  860. </tr>
  861. </tbody>
  862. </table>
  863. <dl class="details">
  864. <dt class="tag-returns"><strong>Returns:</strong> The name of the generated function.</dt>
  865. </dl>
  866. </div>
  867. <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>
  868. <div class="method">
  869. <div class="description">
  870. <p>Returns the shader attributes of the given shader stage as a WGSL string.</p>
  871. </div>
  872. <table class="params">
  873. <tbody>
  874. <tr>
  875. <td class="name">
  876. <strong>shaderStage</strong>
  877. </td>
  878. <td class="description last">
  879. <p>The shader stage.</p>
  880. </td>
  881. </tr>
  882. </tbody>
  883. </table>
  884. <dl class="details">
  885. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getAttributes">NodeBuilder#getAttributes</a></dt>
  886. </dl>
  887. <dl class="details">
  888. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the shader attributes.</dt>
  889. </dl>
  890. </div>
  891. <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>
  892. <div class="method">
  893. <div class="description">
  894. <p>Returns the bitcast method name for a given input and outputType.</p>
  895. </div>
  896. <table class="params">
  897. <tbody>
  898. <tr>
  899. <td class="name">
  900. <strong>type</strong>
  901. </td>
  902. <td class="description last">
  903. <p>The output type to bitcast to.</p>
  904. </td>
  905. </tr>
  906. </tbody>
  907. </table>
  908. <dl class="details">
  909. <dt class="tag-returns"><strong>Returns:</strong> The resolved WGSL bitcast invocation.</dt>
  910. </dl>
  911. </div>
  912. <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>
  913. <div class="method">
  914. <div class="description">
  915. <p>This method should be used whenever builtins are required in nodes.
  916. The internal builtins data structure will make sure builtins are
  917. defined in the WGSL source.</p>
  918. </div>
  919. <table class="params">
  920. <tbody>
  921. <tr>
  922. <td class="name">
  923. <strong>name</strong>
  924. </td>
  925. <td class="description last">
  926. <p>The builtin name.</p>
  927. </td>
  928. </tr>
  929. <tr>
  930. <td class="name">
  931. <strong>property</strong>
  932. </td>
  933. <td class="description last">
  934. <p>The property name.</p>
  935. </td>
  936. </tr>
  937. <tr>
  938. <td class="name">
  939. <strong>type</strong>
  940. </td>
  941. <td class="description last">
  942. <p>The node data type.</p>
  943. </td>
  944. </tr>
  945. <tr>
  946. <td class="name">
  947. <strong>shaderStage</strong>
  948. </td>
  949. <td class="description last">
  950. <p>The shader stage this code snippet is generated for.</p>
  951. <p>Default is <code>this.shaderStage</code>.</p>
  952. </td>
  953. </tr>
  954. </tbody>
  955. </table>
  956. <dl class="details">
  957. <dt class="tag-returns"><strong>Returns:</strong> The property name.</dt>
  958. </dl>
  959. </div>
  960. <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>
  961. <div class="method">
  962. <div class="description">
  963. <p>Returns the builtins of the given shader stage as a WGSL string.</p>
  964. </div>
  965. <table class="params">
  966. <tbody>
  967. <tr>
  968. <td class="name">
  969. <strong>shaderStage</strong>
  970. </td>
  971. <td class="description last">
  972. <p>The shader stage.</p>
  973. </td>
  974. </tr>
  975. </tbody>
  976. </table>
  977. <dl class="details">
  978. <dt class="tag-returns"><strong>Returns:</strong> A WGSL snippet that represents the builtins of the given stage.</dt>
  979. </dl>
  980. </div>
  981. <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>
  982. <div class="method">
  983. <div class="description">
  984. <p>Returns the clip distances builtin.</p>
  985. </div>
  986. <dl class="details">
  987. <dt class="tag-returns"><strong>Returns:</strong> The clip distances builtin.</dt>
  988. </dl>
  989. </div>
  990. <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>
  991. <div class="method">
  992. <div class="description">
  993. <p>Returns the directives of the given shader stage as a WGSL string.</p>
  994. </div>
  995. <table class="params">
  996. <tbody>
  997. <tr>
  998. <td class="name">
  999. <strong>shaderStage</strong>
  1000. </td>
  1001. <td class="description last">
  1002. <p>The shader stage.</p>
  1003. </td>
  1004. </tr>
  1005. </tbody>
  1006. </table>
  1007. <dl class="details">
  1008. <dt class="tag-returns"><strong>Returns:</strong> A WGSL snippet that enables the directives of the given stage.</dt>
  1009. </dl>
  1010. </div>
  1011. <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>
  1012. <div class="method">
  1013. <div class="description">
  1014. <p>Overwritten as a NOP since this method is intended for the WebGL 2 backend.</p>
  1015. </div>
  1016. <dl class="details">
  1017. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getDrawIndex">NodeBuilder#getDrawIndex</a></dt>
  1018. </dl>
  1019. <dl class="details">
  1020. <dt class="tag-returns"><strong>Returns:</strong> Null.</dt>
  1021. </dl>
  1022. </div>
  1023. <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>
  1024. <div class="method">
  1025. <div class="description">
  1026. <p>Returns the float packing method name for a given numeric encoding.</p>
  1027. </div>
  1028. <table class="params">
  1029. <tbody>
  1030. <tr>
  1031. <td class="name">
  1032. <strong>encoding</strong>
  1033. </td>
  1034. <td class="description last">
  1035. <p>The numeric encoding that describes how the float values are mapped to the integer range.</p>
  1036. </td>
  1037. </tr>
  1038. </tbody>
  1039. </table>
  1040. <dl class="details">
  1041. <dt class="tag-returns"><strong>Returns:</strong> The resolve WGSL float packing method name.</dt>
  1042. </dl>
  1043. </div>
  1044. <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>
  1045. <div class="method">
  1046. <div class="description">
  1047. <p>Returns the float unpacking method name for a given numeric encoding.</p>
  1048. </div>
  1049. <table class="params">
  1050. <tbody>
  1051. <tr>
  1052. <td class="name">
  1053. <strong>encoding</strong>
  1054. </td>
  1055. <td class="description last">
  1056. <p>The numeric encoding that describes how the integer values are mapped to the float range.</p>
  1057. </td>
  1058. </tr>
  1059. </tbody>
  1060. </table>
  1061. <dl class="details">
  1062. <dt class="tag-returns"><strong>Returns:</strong> The resolve WGSL float unpacking method name.</dt>
  1063. </dl>
  1064. </div>
  1065. <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>
  1066. <div class="method">
  1067. <div class="description">
  1068. <p>Returns the frag coord builtin.</p>
  1069. </div>
  1070. <dl class="details">
  1071. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getFragCoord">NodeBuilder#getFragCoord</a></dt>
  1072. </dl>
  1073. <dl class="details">
  1074. <dt class="tag-returns"><strong>Returns:</strong> The frag coord builtin.</dt>
  1075. </dl>
  1076. </div>
  1077. <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>
  1078. <div class="method">
  1079. <div class="description">
  1080. <p>Returns the frag depth builtin.</p>
  1081. </div>
  1082. <dl class="details">
  1083. <dt class="tag-returns"><strong>Returns:</strong> The frag depth builtin.</dt>
  1084. </dl>
  1085. </div>
  1086. <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>
  1087. <div class="method">
  1088. <div class="description">
  1089. <p>Returns the front facing builtin.</p>
  1090. </div>
  1091. <dl class="details">
  1092. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getFrontFacing">NodeBuilder#getFrontFacing</a></dt>
  1093. </dl>
  1094. <dl class="details">
  1095. <dt class="tag-returns"><strong>Returns:</strong> The front facing builtin.</dt>
  1096. </dl>
  1097. </div>
  1098. <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>
  1099. <div class="method">
  1100. <div class="description">
  1101. <p>Returns the native shader operator name for a given generic name.</p>
  1102. </div>
  1103. <table class="params">
  1104. <tbody>
  1105. <tr>
  1106. <td class="name">
  1107. <strong>op</strong>
  1108. </td>
  1109. <td class="description last">
  1110. <p>The operator name to resolve.</p>
  1111. </td>
  1112. </tr>
  1113. </tbody>
  1114. </table>
  1115. <dl class="details">
  1116. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getFunctionOperator">NodeBuilder#getFunctionOperator</a></dt>
  1117. </dl>
  1118. <dl class="details">
  1119. <dt class="tag-returns"><strong>Returns:</strong> The resolved operator name.</dt>
  1120. </dl>
  1121. </div>
  1122. <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>
  1123. <div class="method">
  1124. <div class="description">
  1125. <p>Contextually returns either the vertex stage instance index builtin
  1126. or the linearized index of an compute invocation within a grid of workgroups.</p>
  1127. </div>
  1128. <dl class="details">
  1129. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getInstanceIndex">NodeBuilder#getInstanceIndex</a></dt>
  1130. </dl>
  1131. <dl class="details">
  1132. <dt class="tag-returns"><strong>Returns:</strong> The instance index.</dt>
  1133. </dl>
  1134. </div>
  1135. <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>
  1136. <div class="method">
  1137. <div class="description">
  1138. <p>Returns a builtin representing the index of a compute invocation within the scope of a workgroup load.</p>
  1139. </div>
  1140. <dl class="details">
  1141. <dt class="tag-returns"><strong>Returns:</strong> The invocation local index.</dt>
  1142. </dl>
  1143. </div>
  1144. <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>
  1145. <div class="method">
  1146. <div class="description">
  1147. <p>Returns a builtin representing the index of a compute invocation within the scope of a subgroup.</p>
  1148. </div>
  1149. <dl class="details">
  1150. <dt class="tag-returns"><strong>Returns:</strong> The invocation subgroup index.</dt>
  1151. </dl>
  1152. </div>
  1153. <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>
  1154. <div class="method">
  1155. <div class="description">
  1156. <p>Returns the native shader method name for a given generic name.</p>
  1157. </div>
  1158. <table class="params">
  1159. <tbody>
  1160. <tr>
  1161. <td class="name">
  1162. <strong>method</strong>
  1163. </td>
  1164. <td class="description last">
  1165. <p>The method name to resolve.</p>
  1166. </td>
  1167. </tr>
  1168. <tr>
  1169. <td class="name">
  1170. <strong>output</strong>
  1171. </td>
  1172. <td class="description last">
  1173. <p>An optional output.</p>
  1174. <p>Default is <code>null</code>.</p>
  1175. </td>
  1176. </tr>
  1177. </tbody>
  1178. </table>
  1179. <dl class="details">
  1180. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getMethod">NodeBuilder#getMethod</a></dt>
  1181. </dl>
  1182. <dl class="details">
  1183. <dt class="tag-returns"><strong>Returns:</strong> The resolved WGSL method name.</dt>
  1184. </dl>
  1185. </div>
  1186. <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>
  1187. <div class="method">
  1188. <div class="description">
  1189. <p>Returns the node access for the given node and shader stage.</p>
  1190. </div>
  1191. <table class="params">
  1192. <tbody>
  1193. <tr>
  1194. <td class="name">
  1195. <strong>node</strong>
  1196. </td>
  1197. <td class="description last">
  1198. <p>The storage node.</p>
  1199. </td>
  1200. </tr>
  1201. <tr>
  1202. <td class="name">
  1203. <strong>shaderStage</strong>
  1204. </td>
  1205. <td class="description last">
  1206. <p>The shader stage.</p>
  1207. </td>
  1208. </tr>
  1209. </tbody>
  1210. </table>
  1211. <dl class="details">
  1212. <dt class="tag-returns"><strong>Returns:</strong> The node access.</dt>
  1213. </dl>
  1214. </div>
  1215. <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>
  1216. <div class="method">
  1217. <div class="description">
  1218. <p>Returns the output struct name.</p>
  1219. </div>
  1220. <dl class="details">
  1221. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getOutputStructName">NodeBuilder#getOutputStructName</a></dt>
  1222. </dl>
  1223. <dl class="details">
  1224. <dt class="tag-returns"><strong>Returns:</strong> The name of the output struct.</dt>
  1225. </dl>
  1226. </div>
  1227. <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>
  1228. <div class="method">
  1229. <div class="description">
  1230. <p>Returns a WGSL snippet that represents the property name of the given node.</p>
  1231. </div>
  1232. <table class="params">
  1233. <tbody>
  1234. <tr>
  1235. <td class="name">
  1236. <strong>node</strong>
  1237. </td>
  1238. <td class="description last">
  1239. <p>The node.</p>
  1240. </td>
  1241. </tr>
  1242. <tr>
  1243. <td class="name">
  1244. <strong>shaderStage</strong>
  1245. </td>
  1246. <td class="description last">
  1247. <p>The shader stage this code snippet is generated for.</p>
  1248. <p>Default is <code>this.shaderStage</code>.</p>
  1249. </td>
  1250. </tr>
  1251. </tbody>
  1252. </table>
  1253. <dl class="details">
  1254. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getPropertyName">NodeBuilder#getPropertyName</a></dt>
  1255. </dl>
  1256. <dl class="details">
  1257. <dt class="tag-returns"><strong>Returns:</strong> The property name.</dt>
  1258. </dl>
  1259. </div>
  1260. <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>
  1261. <div class="method">
  1262. <div class="description">
  1263. <p>This method should be used when a new scoped buffer is used in context of
  1264. compute shaders. It adds the array to the internal data structure which is
  1265. later used to generate the respective WGSL.</p>
  1266. </div>
  1267. <table class="params">
  1268. <tbody>
  1269. <tr>
  1270. <td class="name">
  1271. <strong>name</strong>
  1272. </td>
  1273. <td class="description last">
  1274. <p>The array name.</p>
  1275. </td>
  1276. </tr>
  1277. <tr>
  1278. <td class="name">
  1279. <strong>scope</strong>
  1280. </td>
  1281. <td class="description last">
  1282. <p>The scope.</p>
  1283. </td>
  1284. </tr>
  1285. <tr>
  1286. <td class="name">
  1287. <strong>bufferType</strong>
  1288. </td>
  1289. <td class="description last">
  1290. <p>The buffer type.</p>
  1291. </td>
  1292. </tr>
  1293. <tr>
  1294. <td class="name">
  1295. <strong>bufferCount</strong>
  1296. </td>
  1297. <td class="description last">
  1298. <p>The buffer count.</p>
  1299. </td>
  1300. </tr>
  1301. </tbody>
  1302. </table>
  1303. <dl class="details">
  1304. <dt class="tag-returns"><strong>Returns:</strong> The array name.</dt>
  1305. </dl>
  1306. </div>
  1307. <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>
  1308. <div class="method">
  1309. <div class="description">
  1310. <p>Returns the scoped arrays of the given shader stage as a WGSL string.</p>
  1311. </div>
  1312. <table class="params">
  1313. <tbody>
  1314. <tr>
  1315. <td class="name">
  1316. <strong>shaderStage</strong>
  1317. </td>
  1318. <td class="description last">
  1319. <p>The shader stage.</p>
  1320. </td>
  1321. </tr>
  1322. </tbody>
  1323. </table>
  1324. <dl class="details">
  1325. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the scoped arrays.
  1326. Returns <code>undefined</code> when used in the vertex or fragment stage.</dt>
  1327. </dl>
  1328. </div>
  1329. <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>
  1330. <div class="method">
  1331. <div class="description">
  1332. <p>Returns A WGSL snippet representing the storage access.</p>
  1333. </div>
  1334. <table class="params">
  1335. <tbody>
  1336. <tr>
  1337. <td class="name">
  1338. <strong>node</strong>
  1339. </td>
  1340. <td class="description last">
  1341. <p>The storage node.</p>
  1342. </td>
  1343. </tr>
  1344. <tr>
  1345. <td class="name">
  1346. <strong>shaderStage</strong>
  1347. </td>
  1348. <td class="description last">
  1349. <p>The shader stage.</p>
  1350. </td>
  1351. </tr>
  1352. </tbody>
  1353. </table>
  1354. <dl class="details">
  1355. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet representing the storage access.</dt>
  1356. </dl>
  1357. </div>
  1358. <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>
  1359. <div class="method">
  1360. <div class="description">
  1361. <p>Returns the members of the given struct type node as a WGSL string.</p>
  1362. </div>
  1363. <table class="params">
  1364. <tbody>
  1365. <tr>
  1366. <td class="name">
  1367. <strong>struct</strong>
  1368. </td>
  1369. <td class="description last">
  1370. <p>The struct type node.</p>
  1371. </td>
  1372. </tr>
  1373. </tbody>
  1374. </table>
  1375. <dl class="details">
  1376. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the struct members.</dt>
  1377. </dl>
  1378. </div>
  1379. <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>
  1380. <div class="method">
  1381. <div class="description">
  1382. <p>Returns the structs of the given shader stage as a WGSL string.</p>
  1383. </div>
  1384. <table class="params">
  1385. <tbody>
  1386. <tr>
  1387. <td class="name">
  1388. <strong>shaderStage</strong>
  1389. </td>
  1390. <td class="description last">
  1391. <p>The shader stage.</p>
  1392. </td>
  1393. </tr>
  1394. </tbody>
  1395. </table>
  1396. <dl class="details">
  1397. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the structs.</dt>
  1398. </dl>
  1399. </div>
  1400. <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>
  1401. <div class="method">
  1402. <div class="description">
  1403. <p>Returns a builtin representing the index of a compute invocation's subgroup within its workgroup.</p>
  1404. </div>
  1405. <dl class="details">
  1406. <dt class="tag-returns"><strong>Returns:</strong> The subgroup index.</dt>
  1407. </dl>
  1408. </div>
  1409. <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>
  1410. <div class="method">
  1411. <div class="description">
  1412. <p>Returns a builtin representing the size of a subgroup within the current shader.</p>
  1413. </div>
  1414. <dl class="details">
  1415. <dt class="tag-returns"><strong>Returns:</strong> The subgroup size.</dt>
  1416. </dl>
  1417. </div>
  1418. <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>
  1419. <div class="method">
  1420. <div class="description">
  1421. <p>Returns the native snippet for a ternary operation.</p>
  1422. </div>
  1423. <table class="params">
  1424. <tbody>
  1425. <tr>
  1426. <td class="name">
  1427. <strong>condSnippet</strong>
  1428. </td>
  1429. <td class="description last">
  1430. <p>The condition determining which expression gets resolved.</p>
  1431. </td>
  1432. </tr>
  1433. <tr>
  1434. <td class="name">
  1435. <strong>ifSnippet</strong>
  1436. </td>
  1437. <td class="description last">
  1438. <p>The expression to resolve to if the condition is true.</p>
  1439. </td>
  1440. </tr>
  1441. <tr>
  1442. <td class="name">
  1443. <strong>elseSnippet</strong>
  1444. </td>
  1445. <td class="description last">
  1446. <p>The expression to resolve to if the condition is false.</p>
  1447. </td>
  1448. </tr>
  1449. </tbody>
  1450. </table>
  1451. <dl class="details">
  1452. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getTernary">NodeBuilder#getTernary</a></dt>
  1453. </dl>
  1454. <dl class="details">
  1455. <dt class="tag-returns"><strong>Returns:</strong> The resolved method name.</dt>
  1456. </dl>
  1457. </div>
  1458. <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>
  1459. <div class="method">
  1460. <div class="description">
  1461. <p>Returns the WGSL type of the given node data type.</p>
  1462. </div>
  1463. <table class="params">
  1464. <tbody>
  1465. <tr>
  1466. <td class="name">
  1467. <strong>type</strong>
  1468. </td>
  1469. <td class="description last">
  1470. <p>The node data type.</p>
  1471. </td>
  1472. </tr>
  1473. </tbody>
  1474. </table>
  1475. <dl class="details">
  1476. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getType">NodeBuilder#getType</a></dt>
  1477. </dl>
  1478. <dl class="details">
  1479. <dt class="tag-returns"><strong>Returns:</strong> The WGSL type.</dt>
  1480. </dl>
  1481. </div>
  1482. <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>
  1483. <div class="method">
  1484. <div class="description">
  1485. <p>This method is one of the more important ones since it's responsible
  1486. for generating a matching binding instance for the given uniform node.</p>
  1487. <p>These bindings are later used in the renderer to create bind groups
  1488. and layouts.</p>
  1489. </div>
  1490. <table class="params">
  1491. <tbody>
  1492. <tr>
  1493. <td class="name">
  1494. <strong>node</strong>
  1495. </td>
  1496. <td class="description last">
  1497. <p>The uniform node.</p>
  1498. </td>
  1499. </tr>
  1500. <tr>
  1501. <td class="name">
  1502. <strong>type</strong>
  1503. </td>
  1504. <td class="description last">
  1505. <p>The node data type.</p>
  1506. </td>
  1507. </tr>
  1508. <tr>
  1509. <td class="name">
  1510. <strong>shaderStage</strong>
  1511. </td>
  1512. <td class="description last">
  1513. <p>The shader stage.</p>
  1514. </td>
  1515. </tr>
  1516. <tr>
  1517. <td class="name">
  1518. <strong>name</strong>
  1519. </td>
  1520. <td class="description last">
  1521. <p>An optional uniform name.</p>
  1522. <p>Default is <code>null</code>.</p>
  1523. </td>
  1524. </tr>
  1525. </tbody>
  1526. </table>
  1527. <dl class="details">
  1528. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getUniformFromNode">NodeBuilder#getUniformFromNode</a></dt>
  1529. </dl>
  1530. <dl class="details">
  1531. <dt class="tag-returns"><strong>Returns:</strong> The node uniform object.</dt>
  1532. </dl>
  1533. </div>
  1534. <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>
  1535. <div class="method">
  1536. <div class="description">
  1537. <p>Returns the uniforms of the given shader stage as a WGSL string.</p>
  1538. </div>
  1539. <table class="params">
  1540. <tbody>
  1541. <tr>
  1542. <td class="name">
  1543. <strong>shaderStage</strong>
  1544. </td>
  1545. <td class="description last">
  1546. <p>The shader stage.</p>
  1547. </td>
  1548. </tr>
  1549. </tbody>
  1550. </table>
  1551. <dl class="details">
  1552. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getUniforms">NodeBuilder#getUniforms</a></dt>
  1553. </dl>
  1554. <dl class="details">
  1555. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the uniforms.</dt>
  1556. </dl>
  1557. </div>
  1558. <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>
  1559. <div class="method">
  1560. <div class="description">
  1561. <p>Returns a WGSL string representing a variable.</p>
  1562. </div>
  1563. <table class="params">
  1564. <tbody>
  1565. <tr>
  1566. <td class="name">
  1567. <strong>type</strong>
  1568. </td>
  1569. <td class="description last">
  1570. <p>The variable's type.</p>
  1571. </td>
  1572. </tr>
  1573. <tr>
  1574. <td class="name">
  1575. <strong>name</strong>
  1576. </td>
  1577. <td class="description last">
  1578. <p>The variable's name.</p>
  1579. </td>
  1580. </tr>
  1581. <tr>
  1582. <td class="name">
  1583. <strong>count</strong>
  1584. </td>
  1585. <td class="description last">
  1586. <p>The array length.</p>
  1587. <p>Default is <code>null</code>.</p>
  1588. </td>
  1589. </tr>
  1590. </tbody>
  1591. </table>
  1592. <dl class="details">
  1593. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVar">NodeBuilder#getVar</a></dt>
  1594. </dl>
  1595. <dl class="details">
  1596. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines a variable.</dt>
  1597. </dl>
  1598. </div>
  1599. <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>
  1600. <div class="method">
  1601. <div class="description">
  1602. <p>Returns the variables of the given shader stage as a WGSL string.</p>
  1603. </div>
  1604. <table class="params">
  1605. <tbody>
  1606. <tr>
  1607. <td class="name">
  1608. <strong>shaderStage</strong>
  1609. </td>
  1610. <td class="description last">
  1611. <p>The shader stage.</p>
  1612. </td>
  1613. </tr>
  1614. </tbody>
  1615. </table>
  1616. <dl class="details">
  1617. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVars">NodeBuilder#getVars</a></dt>
  1618. </dl>
  1619. <dl class="details">
  1620. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the variables.</dt>
  1621. </dl>
  1622. </div>
  1623. <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>
  1624. <div class="method">
  1625. <div class="description">
  1626. <p>Returns the varyings of the given shader stage as a WGSL string.</p>
  1627. </div>
  1628. <table class="params">
  1629. <tbody>
  1630. <tr>
  1631. <td class="name">
  1632. <strong>shaderStage</strong>
  1633. </td>
  1634. <td class="description last">
  1635. <p>The shader stage.</p>
  1636. </td>
  1637. </tr>
  1638. </tbody>
  1639. </table>
  1640. <dl class="details">
  1641. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVaryings">NodeBuilder#getVaryings</a></dt>
  1642. </dl>
  1643. <dl class="details">
  1644. <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the varyings.</dt>
  1645. </dl>
  1646. </div>
  1647. <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>
  1648. <div class="method">
  1649. <div class="description">
  1650. <p>Returns the vertex index builtin.</p>
  1651. </div>
  1652. <dl class="details">
  1653. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVertexIndex">NodeBuilder#getVertexIndex</a></dt>
  1654. </dl>
  1655. <dl class="details">
  1656. <dt class="tag-returns"><strong>Returns:</strong> The vertex index.</dt>
  1657. </dl>
  1658. </div>
  1659. <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>
  1660. <div class="method">
  1661. <div class="description">
  1662. <p>Returns <code>true</code> if the given builtin is defined in the given shader stage.</p>
  1663. </div>
  1664. <table class="params">
  1665. <tbody>
  1666. <tr>
  1667. <td class="name">
  1668. <strong>name</strong>
  1669. </td>
  1670. <td class="description last">
  1671. <p>The builtin name.</p>
  1672. </td>
  1673. </tr>
  1674. <tr>
  1675. <td class="name">
  1676. <strong>shaderStage</strong>
  1677. </td>
  1678. <td class="description last">
  1679. <p>The shader stage this code snippet is generated for.</p>
  1680. <p>Default is <code>this.shaderStage</code>.</p>
  1681. </td>
  1682. </tr>
  1683. </tbody>
  1684. </table>
  1685. <dl class="details">
  1686. <dt class="tag-returns"><strong>Returns:</strong> Whether the given builtin is defined in the given shader stage or not.</dt>
  1687. </dl>
  1688. </div>
  1689. <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>
  1690. <div class="method">
  1691. <div class="description">
  1692. <p>Whether the requested feature is available or not.</p>
  1693. </div>
  1694. <table class="params">
  1695. <tbody>
  1696. <tr>
  1697. <td class="name">
  1698. <strong>name</strong>
  1699. </td>
  1700. <td class="description last">
  1701. <p>The requested feature.</p>
  1702. </td>
  1703. </tr>
  1704. </tbody>
  1705. </table>
  1706. <dl class="details">
  1707. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#isAvailable">NodeBuilder#isAvailable</a></dt>
  1708. </dl>
  1709. <dl class="details">
  1710. <dt class="tag-returns"><strong>Returns:</strong> Whether the requested feature is supported or not.</dt>
  1711. </dl>
  1712. </div>
  1713. <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>
  1714. <div class="method">
  1715. <div class="description">
  1716. <p>Whether to flip texture data along its vertical axis or not.</p>
  1717. </div>
  1718. <dl class="details">
  1719. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#isFlipY">NodeBuilder#isFlipY</a></dt>
  1720. </dl>
  1721. <dl class="details">
  1722. <dt class="tag-returns"><strong>Returns:</strong> Returns always <code>false</code> in context of WGSL.</dt>
  1723. </dl>
  1724. </div>
  1725. <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>
  1726. <div class="method">
  1727. <div class="description">
  1728. <p>Returns <code>true</code> if the sampled values of the given texture should be compared against a reference value.</p>
  1729. </div>
  1730. <table class="params">
  1731. <tbody>
  1732. <tr>
  1733. <td class="name">
  1734. <strong>texture</strong>
  1735. </td>
  1736. <td class="description last">
  1737. <p>The texture.</p>
  1738. </td>
  1739. </tr>
  1740. </tbody>
  1741. </table>
  1742. <dl class="details">
  1743. <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>
  1744. </dl>
  1745. </div>
  1746. <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>
  1747. <div class="method">
  1748. <div class="description">
  1749. <p>Returns <code>true</code> if the given texture is unfilterable.</p>
  1750. </div>
  1751. <table class="params">
  1752. <tbody>
  1753. <tr>
  1754. <td class="name">
  1755. <strong>texture</strong>
  1756. </td>
  1757. <td class="description last">
  1758. <p>The texture.</p>
  1759. </td>
  1760. </tr>
  1761. </tbody>
  1762. </table>
  1763. <dl class="details">
  1764. <dt class="tag-returns"><strong>Returns:</strong> Whether the given texture is unfilterable or not.</dt>
  1765. </dl>
  1766. </div>
  1767. <h2 class="subsection-title">Source</h2>
  1768. <p>
  1769. <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>
  1770. </p>
  1771. </article>
  1772. </section>
  1773. <script src="../scripts/linenumber.js"></script>
  1774. <script src="../scripts/page.js"></script>
  1775. </body>
  1776. </html>
粤ICP备19079148号