dcl_interface (sm5 - asm) - Win32 apps | Microsoft Docs
文章推薦指數: 80 %
Declare function table pointers (interfaces). ... In the HLSL virtual inlining model it's always known what global variable/input is used ... Skiptomaincontent Thisbrowserisnolongersupported. UpgradetoMicrosoftEdgetotakeadvantageofthelatestfeatures,securityupdates,andtechnicalsupport. DownloadMicrosoftEdge Moreinfo Tableofcontents Exitfocusmode ReadinEnglish Save Tableofcontents ReadinEnglish Save Edit Twitter LinkedIn Facebook Email Tableofcontents dcl_interface(sm5-asm) Article 03/09/2021 2minutestoread 3contributors Inthisarticle Declarefunctiontablepointers(interfaces). dcl_interfacefp#[arraySize][numCallSites]={ft#,ft#,...} Item Description fp# [in]Thefunctiontablepointers. Remarks EachinterfaceneedstobeboundfromtheAPIbeforetheshaderisusable.Bindinggivesareferencetooneofthefunctiontablessothatthemethodslotscanbefilledin.Thecompilerwillnotgeneratepointersforunreferencedobjects. AfunctiontablepointerhasafullsetofmethodslotstoavoidtheextralevelofindirectionthataC++pointer-to-pointer-to-vtablerepresentationwouldrequire.Thatwouldalsorequirethatthispointersbe5-tuples.IntheHLSLvirtualinliningmodelit'salwaysknownwhatglobalvariable/inputisusedforacallsowecansetuptablesperrootobject. Functionpointerdeclarationsindicatewhichfunctiontablesarelegaltousewiththem.Thisalsoallowsderivationofmethodcorrelationinformation. Thefirst[]ofaninterfacedeclarationisthearraysize.Ifdynamicindexingisusedthedeclarationwillindicatethatasshown.Anarrayofinterfacepointerscanbeindexedstaticallyalso,itisnotrequiredthatarraysofinterfacepointersmeandynamicindexing. Numberingofinterfacepointersstartsat0forthefirstdeclarationandsubsequentlytakesarraysizeintoaccount,sothefirstpointerafterafourentryarrayfp0[4][1]wouldbefp4[][]. Thesecond[]ofaninterfacedeclarationisthenumberofcallsites,whichmustmatchthenumberofbodiesineachtablereferencedinthedeclaration. Therearenoboundstohowmanyfunctiontable(ft#)choicescanbelistedinaninterfacedeclaration. Agivenfunctiontable(ft#)canappearmorethanonceinoneormoreinterfacedeclarations. Restrictions Thenumberofobjectsitesinashader,whichisthesumacrossallfp#declarationsoftheir[arraySize]declarations,mustbenomorethan253.Thisnumbercorrespondstohowmanythispointerscanbepresent.Theruntimeenforcesthis253limittokeepaboundonthesizeoftheDDIforcommunicatingthispointerdata. Thenumberofcallsitesinashader,whichisthesumacrossallfcallstatementsofthenumberofpotentialbranchtargets,mustbenomorethan4096. Forexample,anfcallthatusesastaticindexforthefirstfp[][]dimensioncountsasone: fcallfp0[0][0]//+1 Anfcallthatusesadynamicindexcountsasthenumberofelementsinthearray(first[]ofdcl_interface): dcl_interface_dynamicindexedfp1[2][1]={ft2,ft3,ft4}... fcallfp1[r0.z+0][1]//+2 Thislimithelpssomeimplementationseasilyfittablesoffunctionbodyselectionsinconstantbuffer-likestorage. Thisinstructionappliestothefollowingshaderstages: Vertex Hull Domain Geometry Pixel Compute X X X X X X MinimumShaderModel Thisinstructionissupportedinthefollowingshadermodels: ShaderModel Supported ShaderModel5 yes ShaderModel4.1 no ShaderModel4 no ShaderModel3(DirectXHLSL) no ShaderModel2(DirectXHLSL) no ShaderModel1(DirectXHLSL) no cs_4_0andcs_4_1supportthisinstructionforUAVandSRV. Relatedtopics ShaderModel5Assembly(DirectXHLSL) Inthisarticle
延伸文章資訊
- 1Tutorial 4: Buffers, Shaders, and HLSL - RasterTek
fx HLSL shader program through the technique pointer. The first step in this function is to set o...
- 2Example of VK_KHR_buffer_device_address? : r/vulkan - Reddit
I know this was probably added mainly to support raytracing shaders, but is there a good example ...
- 3hlsl interface/function pointer implementation of pingpong-buffer
Hi, my goal is a fairly simple mechanism to implement a ping-ponging buffer within hlsl. The basi...
- 4dcl_interface (sm5 - asm) - Win32 apps | Microsoft Docs
Declare function table pointers (interfaces). ... In the HLSL virtual inlining model it's always ...
- 5Advanced HLSL using closures and function pointers - code4k
Hacking function pointers in HLSL. The principle is very simple: Instead of using interface and c...