| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>WGSLNodeBuilder - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <p class="inheritance" translate="no"><a href="NodeBuilder.html">NodeBuilder</a> → </p>
- <h1 translate="no">WGSLNodeBuilder</h1>
- <section>
- <header>
- <div class="class-description"><p>A node builder targeting WGSL.</p>
- <p>This module generates WGSL shader code from node materials and also
- generates the respective bindings and vertex buffer definitions. These
- data are later used by the renderer to create render and compute pipelines
- for render objects.</p></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <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>
- <div class="method">
- <div class="description">
- <p>Constructs a new WGSL node builder renderer.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>object</strong>
- </td>
- <td class="description last">
- <p>The 3D object.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>renderer</strong>
- </td>
- <td class="description last">
- <p>The renderer.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="builtins" translate="no">.<a href="#builtins">builtins</a><span class="type-signature"> : Object.<string, Map.<string, Object>></span> </h3>
- <div class="description">
- <p>A dictionary that holds for each shader stage a Map of builtins.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="directives" translate="no">.<a href="#directives">directives</a><span class="type-signature"> : Object.<string, Set.<string>></span> </h3>
- <div class="description">
- <p>A dictionary that holds for each shader stage a Set of directives.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="scopedArrays" translate="no">.<a href="#scopedArrays">scopedArrays</a><span class="type-signature"> : Map.<string, Object></span> </h3>
- <div class="description">
- <p>A map for managing scope arrays. Only relevant for when using
- <a href="WorkgroupInfoNode.html">WorkgroupInfoNode</a> in context of compute shaders.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="uniformGroups" translate="no">.<a href="#uniformGroups">uniformGroups</a><span class="type-signature"> : Object.<string, Object.<string, <a href="NodeUniformsGroup.html">NodeUniformsGroup</a>>></span> </h3>
- <div class="description">
- <p>A dictionary that holds for each shader stage ('vertex', 'fragment', 'compute')
- another dictionary which manages UBOs per group ('render','frame','object').</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="buildCode" translate="no">.<a href="#buildCode">buildCode</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Controls the code build of the shader stages.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#buildCode">NodeBuilder#buildCode</a></dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Builds the given shader node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderNode</strong>
- </td>
- <td class="description last">
- <p>The shader node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#buildFunctionCode">NodeBuilder#buildFunctionCode</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL function code.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="enableClipDistances" translate="no">.<a href="#enableClipDistances">enableClipDistances</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Enables the 'clip_distances' directive.</p>
- </div>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Enables the given directive for the given shader stage.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The directive name.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage to enable the directive for.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="enableDualSourceBlending" translate="no">.<a href="#enableDualSourceBlending">enableDualSourceBlending</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Enables the 'dual_source_blending' directive.</p>
- </div>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Enables hardware clipping.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>planeCount</strong>
- </td>
- <td class="description last">
- <p>The clipping plane count.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="enableShaderF16" translate="no">.<a href="#enableShaderF16">enableShaderF16</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Enables the 'f16' directive.</p>
- </div>
- </div>
- <h3 class="name name-method" id="enableSubGroups" translate="no">.<a href="#enableSubGroups">enableSubGroups</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Enables the 'subgroups' directive.</p>
- </div>
- </div>
- <h3 class="name name-method" id="enableSubgroupsF16" translate="no">.<a href="#enableSubgroupsF16">enableSubgroupsF16</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Enables the 'subgroups-f16' directive.</p>
- </div>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Generates the array declaration string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>type</strong>
- </td>
- <td class="description last">
- <p>The type.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>count</strong>
- </td>
- <td class="description last">
- <p>The count.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#generateArrayDeclaration">NodeBuilder#generateArrayDeclaration</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The generated value as a shader string.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Generates the WGSL snippet for a manual filtered texture.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>levelSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
- <p>Default is <code>'0u'</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Generates the WGSL snippet for sampling/loading the given texture.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage this code snippet is generated for.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#generateTexture">NodeBuilder#generateTexture</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Generates the WGSL snippet when sampling textures with a bias to the mip level.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>biasSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the bias to apply to the mip level before sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage this code snippet is generated for.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Generates the WGSL snippet for sampling a depth texture and comparing the sampled depth values
- against a reference value.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>compareSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the reference value.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage this code snippet is generated for.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Generates a WGSL variable that holds the texture dimension of the given texture.
- It also returns information about the number of layers (elements) of an arrayed
- texture as well as the cube face count of cube textures.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture to generate the function for.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the video texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>levelSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The name of the dimension variable.</dt>
- </dl>
- </div>
- <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.<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>
- <div class="method">
- <div class="description">
- <p>Generates the WGSL snippet for sampling/loading the given texture using explicit gradients.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>gradSnippet</strong>
- </td>
- <td class="description last">
- <p>An array holding both gradient WGSL snippets.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage this code snippet is generated for.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Generates the WGSL snippet when sampling textures with explicit mip level.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>levelSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage this code snippet is generated for.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Generates the WGSL snippet that reads a single texel from a texture without sampling or filtering.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvIndexSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>levelSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Generates the WGSL snippet for a texture lookup with explicit level-of-detail.
- Since it's a lookup, no sampling or filtering is applied.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offsetSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>levelSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture.</p>
- <p>Default is <code>'0u'</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#generateTextureLod">NodeBuilder#generateTextureLod</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Generates the WGSL snippet that writes a single texel to a texture.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>textureProperty</strong>
- </td>
- <td class="description last">
- <p>The name of the texture uniform in the shader.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uvIndexSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents texture coordinates used for sampling.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>depthSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represents 0-based texture array index to sample.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>valueSnippet</strong>
- </td>
- <td class="description last">
- <p>A WGSL snippet that represent the new texel value.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Generates a wrap function used in context of textures.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture to generate the function for.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The name of the generated function.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the shader attributes of the given shader stage as a WGSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getAttributes">NodeBuilder#getAttributes</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the shader attributes.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the bitcast method name for a given input and outputType.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>type</strong>
- </td>
- <td class="description last">
- <p>The output type to bitcast to.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The resolved WGSL bitcast invocation.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>This method should be used whenever builtins are required in nodes.
- The internal builtins data structure will make sure builtins are
- defined in the WGSL source.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The builtin name.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>property</strong>
- </td>
- <td class="description last">
- <p>The property name.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>type</strong>
- </td>
- <td class="description last">
- <p>The node data type.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage this code snippet is generated for.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The property name.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the builtins of the given shader stage as a WGSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A WGSL snippet that represents the builtins of the given stage.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the clip distances builtin.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The clip distances builtin.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the directives of the given shader stage as a WGSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A WGSL snippet that enables the directives of the given stage.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Overwritten as a NOP since this method is intended for the WebGL 2 backend.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getDrawIndex">NodeBuilder#getDrawIndex</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Null.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the frag coord builtin.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getFragCoord">NodeBuilder#getFragCoord</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The frag coord builtin.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the frag depth builtin.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The frag depth builtin.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the front facing builtin.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getFrontFacing">NodeBuilder#getFrontFacing</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The front facing builtin.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the native shader operator name for a given generic name.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>op</strong>
- </td>
- <td class="description last">
- <p>The operator name to resolve.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getFunctionOperator">NodeBuilder#getFunctionOperator</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The resolved operator name.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Contextually returns either the vertex stage instance index builtin
- or the linearized index of an compute invocation within a grid of workgroups.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getInstanceIndex">NodeBuilder#getInstanceIndex</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The instance index.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns a builtin representing the index of a compute invocation within the scope of a workgroup load.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The invocation local index.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns a builtin representing the index of a compute invocation within the scope of a subgroup.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The invocation subgroup index.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the native shader method name for a given generic name.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>method</strong>
- </td>
- <td class="description last">
- <p>The method name to resolve.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>output</strong>
- </td>
- <td class="description last">
- <p>An optional output.</p>
- <p>Default is <code>null</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getMethod">NodeBuilder#getMethod</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The resolved WGSL method name.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the node access for the given node and shader stage.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>node</strong>
- </td>
- <td class="description last">
- <p>The storage node.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The node access.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the output struct name.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getOutputStructName">NodeBuilder#getOutputStructName</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The name of the output struct.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns a WGSL snippet that represents the property name of the given node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>node</strong>
- </td>
- <td class="description last">
- <p>The node.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage this code snippet is generated for.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getPropertyName">NodeBuilder#getPropertyName</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The property name.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>This method should be used when a new scoped buffer is used in context of
- compute shaders. It adds the array to the internal data structure which is
- later used to generate the respective WGSL.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The array name.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>scope</strong>
- </td>
- <td class="description last">
- <p>The scope.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>bufferType</strong>
- </td>
- <td class="description last">
- <p>The buffer type.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>bufferCount</strong>
- </td>
- <td class="description last">
- <p>The buffer count.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The array name.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the scoped arrays of the given shader stage as a WGSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the scoped arrays.
- Returns <code>undefined</code> when used in the vertex or fragment stage.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns A WGSL snippet representing the storage access.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>node</strong>
- </td>
- <td class="description last">
- <p>The storage node.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet representing the storage access.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the members of the given struct type node as a WGSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>struct</strong>
- </td>
- <td class="description last">
- <p>The struct type node.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the struct members.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the structs of the given shader stage as a WGSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the structs.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns a builtin representing the index of a compute invocation's subgroup within its workgroup.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The subgroup index.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns a builtin representing the size of a subgroup within the current shader.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The subgroup size.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the native snippet for a ternary operation.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>condSnippet</strong>
- </td>
- <td class="description last">
- <p>The condition determining which expression gets resolved.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>ifSnippet</strong>
- </td>
- <td class="description last">
- <p>The expression to resolve to if the condition is true.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>elseSnippet</strong>
- </td>
- <td class="description last">
- <p>The expression to resolve to if the condition is false.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getTernary">NodeBuilder#getTernary</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The resolved method name.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the WGSL type of the given node data type.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>type</strong>
- </td>
- <td class="description last">
- <p>The node data type.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getType">NodeBuilder#getType</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL type.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>This method is one of the more important ones since it's responsible
- for generating a matching binding instance for the given uniform node.</p>
- <p>These bindings are later used in the renderer to create bind groups
- and layouts.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>node</strong>
- </td>
- <td class="description last">
- <p>The uniform node.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>type</strong>
- </td>
- <td class="description last">
- <p>The node data type.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>An optional uniform name.</p>
- <p>Default is <code>null</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getUniformFromNode">NodeBuilder#getUniformFromNode</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The node uniform object.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the uniforms of the given shader stage as a WGSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getUniforms">NodeBuilder#getUniforms</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the uniforms.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns a WGSL string representing a variable.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>type</strong>
- </td>
- <td class="description last">
- <p>The variable's type.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The variable's name.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>count</strong>
- </td>
- <td class="description last">
- <p>The array length.</p>
- <p>Default is <code>null</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVar">NodeBuilder#getVar</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines a variable.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the variables of the given shader stage as a WGSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVars">NodeBuilder#getVars</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the variables.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the varyings of the given shader stage as a WGSL string.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVaryings">NodeBuilder#getVaryings</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The WGSL snippet that defines the varyings.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns the vertex index builtin.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#getVertexIndex">NodeBuilder#getVertexIndex</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The vertex index.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns <code>true</code> if the given builtin is defined in the given shader stage.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The builtin name.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>shaderStage</strong>
- </td>
- <td class="description last">
- <p>The shader stage this code snippet is generated for.</p>
- <p>Default is <code>this.shaderStage</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the given builtin is defined in the given shader stage or not.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Whether the requested feature is available or not.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The requested feature.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#isAvailable">NodeBuilder#isAvailable</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the requested feature is supported or not.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Whether to flip texture data along its vertical axis or not.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeBuilder.html#isFlipY">NodeBuilder#isFlipY</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Returns always <code>false</code> in context of WGSL.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns <code>true</code> if the sampled values of the given texture should be compared against a reference value.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <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>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Returns <code>true</code> if the given texture is unfilterable.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>texture</strong>
- </td>
- <td class="description last">
- <p>The texture.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the given texture is unfilterable or not.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <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>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|