| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967 |
- //--------------------------------------------------------------------------------------
- // File: EffectVariable.inl
- //
- // Direct3D 11 Effects Variable reflection template
- // These templates define the many Effect variable types.
- //
- // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
- // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
- // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
- // PARTICULAR PURPOSE.
- //
- // Copyright (c) Microsoft Corporation. All rights reserved.
- //
- // http://go.microsoft.com/fwlink/p/?LinkId=271568
- //--------------------------------------------------------------------------------------
- #pragma warning(push)
- #pragma warning(disable : 4127)
- //////////////////////////////////////////////////////////////////////////
- // Invalid variable forward defines
- //////////////////////////////////////////////////////////////////////////
- struct SEffectInvalidScalarVariable;
- struct SEffectInvalidVectorVariable;
- struct SEffectInvalidMatrixVariable;
- struct SEffectInvalidStringVariable;
- struct SEffectInvalidClassInstanceVariable;
- struct SEffectInvalidInterfaceVariable;
- struct SEffectInvalidShaderResourceVariable;
- struct SEffectInvalidUnorderedAccessViewVariable;
- struct SEffectInvalidRenderTargetViewVariable;
- struct SEffectInvalidDepthStencilViewVariable;
- struct SEffectInvalidConstantBuffer;
- struct SEffectInvalidShaderVariable;
- struct SEffectInvalidBlendVariable;
- struct SEffectInvalidDepthStencilVariable;
- struct SEffectInvalidRasterizerVariable;
- struct SEffectInvalidSamplerVariable;
- struct SEffectInvalidTechnique;
- struct SEffectInvalidPass;
- struct SEffectInvalidType;
- extern SEffectInvalidScalarVariable g_InvalidScalarVariable;
- extern SEffectInvalidVectorVariable g_InvalidVectorVariable;
- extern SEffectInvalidMatrixVariable g_InvalidMatrixVariable;
- extern SEffectInvalidStringVariable g_InvalidStringVariable;
- extern SEffectInvalidClassInstanceVariable g_InvalidClassInstanceVariable;
- extern SEffectInvalidInterfaceVariable g_InvalidInterfaceVariable;
- extern SEffectInvalidShaderResourceVariable g_InvalidShaderResourceVariable;
- extern SEffectInvalidUnorderedAccessViewVariable g_InvalidUnorderedAccessViewVariable;
- extern SEffectInvalidRenderTargetViewVariable g_InvalidRenderTargetViewVariable;
- extern SEffectInvalidDepthStencilViewVariable g_InvalidDepthStencilViewVariable;
- extern SEffectInvalidConstantBuffer g_InvalidConstantBuffer;
- extern SEffectInvalidShaderVariable g_InvalidShaderVariable;
- extern SEffectInvalidBlendVariable g_InvalidBlendVariable;
- extern SEffectInvalidDepthStencilVariable g_InvalidDepthStencilVariable;
- extern SEffectInvalidRasterizerVariable g_InvalidRasterizerVariable;
- extern SEffectInvalidSamplerVariable g_InvalidSamplerVariable;
- extern SEffectInvalidTechnique g_InvalidTechnique;
- extern SEffectInvalidPass g_InvalidPass;
- extern SEffectInvalidType g_InvalidType;
- enum ETemplateVarType
- {
- ETVT_Bool,
- ETVT_Int,
- ETVT_Float,
- ETVT_bool
- };
- //////////////////////////////////////////////////////////////////////////
- // Invalid effect variable struct definitions
- //////////////////////////////////////////////////////////////////////////
- struct SEffectInvalidType : public ID3DX11EffectType
- {
- STDMETHOD_(bool, IsValid)() override { return false; }
- STDMETHOD(GetDesc)(_Out_ D3DX11_EFFECT_TYPE_DESC *pDesc) override { UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD_(ID3DX11EffectType*, GetMemberTypeByIndex)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return &g_InvalidType; }
- STDMETHOD_(ID3DX11EffectType*, GetMemberTypeByName)(_In_z_ LPCSTR Name) override { UNREFERENCED_PARAMETER(Name); return &g_InvalidType; }
- STDMETHOD_(ID3DX11EffectType*, GetMemberTypeBySemantic)(_In_z_ LPCSTR Semantic) override { UNREFERENCED_PARAMETER(Semantic); return &g_InvalidType; }
- STDMETHOD_(LPCSTR, GetMemberName)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return nullptr; }
- STDMETHOD_(LPCSTR, GetMemberSemantic)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return nullptr; }
- IUNKNOWN_IMP(SEffectInvalidType, ID3DX11EffectType, IUnknown);
- };
- template<typename IBaseInterface>
- struct TEffectInvalidVariable : public IBaseInterface
- {
- public:
- STDMETHOD_(bool, IsValid)() override { return false; }
- STDMETHOD_(ID3DX11EffectType*, GetType)() override { return &g_InvalidType; }
- STDMETHOD(GetDesc)(_Out_ D3DX11_EFFECT_VARIABLE_DESC *pDesc) override { UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByIndex)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByName)(_In_z_ LPCSTR Name) override { UNREFERENCED_PARAMETER(Name); return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectVariable*, GetMemberByIndex)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectVariable*, GetMemberByName)(_In_z_ LPCSTR Name) override { UNREFERENCED_PARAMETER(Name); return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectVariable*, GetMemberBySemantic)(_In_z_ LPCSTR Semantic) override { UNREFERENCED_PARAMETER(Semantic); return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectVariable*, GetElement)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectConstantBuffer*, GetParentConstantBuffer)() override { return &g_InvalidConstantBuffer; }
- STDMETHOD_(ID3DX11EffectScalarVariable*, AsScalar)() override { return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectVectorVariable*, AsVector)() override { return &g_InvalidVectorVariable; }
- STDMETHOD_(ID3DX11EffectMatrixVariable*, AsMatrix)() override { return &g_InvalidMatrixVariable; }
- STDMETHOD_(ID3DX11EffectStringVariable*, AsString)() override { return &g_InvalidStringVariable; }
- STDMETHOD_(ID3DX11EffectClassInstanceVariable*, AsClassInstance)() override { return &g_InvalidClassInstanceVariable; }
- STDMETHOD_(ID3DX11EffectInterfaceVariable*, AsInterface)() override { return &g_InvalidInterfaceVariable; }
- STDMETHOD_(ID3DX11EffectShaderResourceVariable*, AsShaderResource)() override { return &g_InvalidShaderResourceVariable; }
- STDMETHOD_(ID3DX11EffectUnorderedAccessViewVariable*, AsUnorderedAccessView)() override { return &g_InvalidUnorderedAccessViewVariable; }
- STDMETHOD_(ID3DX11EffectRenderTargetViewVariable*, AsRenderTargetView)() override { return &g_InvalidRenderTargetViewVariable; }
- STDMETHOD_(ID3DX11EffectDepthStencilViewVariable*, AsDepthStencilView)() override { return &g_InvalidDepthStencilViewVariable; }
- STDMETHOD_(ID3DX11EffectConstantBuffer*, AsConstantBuffer)() override { return &g_InvalidConstantBuffer; }
- STDMETHOD_(ID3DX11EffectShaderVariable*, AsShader)() override { return &g_InvalidShaderVariable; }
- STDMETHOD_(ID3DX11EffectBlendVariable*, AsBlend)() override { return &g_InvalidBlendVariable; }
- STDMETHOD_(ID3DX11EffectDepthStencilVariable*, AsDepthStencil)() override { return &g_InvalidDepthStencilVariable; }
- STDMETHOD_(ID3DX11EffectRasterizerVariable*, AsRasterizer)() override { return &g_InvalidRasterizerVariable; }
- STDMETHOD_(ID3DX11EffectSamplerVariable*, AsSampler)() override { return &g_InvalidSamplerVariable; }
- STDMETHOD(SetRawValue)(_In_reads_bytes_(Count) const void *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetRawValue)(_Out_writes_bytes_(Count) void *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- };
- struct SEffectInvalidScalarVariable : public TEffectInvalidVariable<ID3DX11EffectScalarVariable>
- {
- public:
- STDMETHOD(SetFloat)(_In_ const float Value) override { UNREFERENCED_PARAMETER(Value); return E_FAIL; }
- STDMETHOD(GetFloat)(_Out_ float *pValue) override { UNREFERENCED_PARAMETER(pValue); return E_FAIL; }
- STDMETHOD(SetFloatArray)(_In_reads_(Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetFloatArray)(_Out_writes_(Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(SetInt)(_In_ const int Value) override { UNREFERENCED_PARAMETER(Value); return E_FAIL; }
- STDMETHOD(GetInt)(_Out_ int *pValue) override { UNREFERENCED_PARAMETER(pValue); return E_FAIL; }
- STDMETHOD(SetIntArray)(_In_reads_(Count) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetIntArray)(_Out_writes_(Count) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(SetBool)(_In_ const bool Value) override { UNREFERENCED_PARAMETER(Value); return E_FAIL; }
- STDMETHOD(GetBool)(_Out_ bool *pValue) override { UNREFERENCED_PARAMETER(pValue); return E_FAIL; }
- STDMETHOD(SetBoolArray)(_In_reads_(Count) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetBoolArray)(_Out_writes_(Count) bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidScalarVariable, ID3DX11EffectScalarVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidVectorVariable : public TEffectInvalidVariable<ID3DX11EffectVectorVariable>
- {
- public:
- STDMETHOD(SetFloatVector)(_In_reads_(4) const float *pData) override { UNREFERENCED_PARAMETER(pData); return E_FAIL; };
- STDMETHOD(SetIntVector)(_In_reads_(4) const int *pData) override { UNREFERENCED_PARAMETER(pData); return E_FAIL; };
- STDMETHOD(SetBoolVector)(_In_reads_(4) const bool *pData) override { UNREFERENCED_PARAMETER(pData); return E_FAIL; };
- STDMETHOD(GetFloatVector)(_Out_writes_(4) float *pData) override { UNREFERENCED_PARAMETER(pData); return E_FAIL; };
- STDMETHOD(GetIntVector)(_Out_writes_(4) int *pData) override { UNREFERENCED_PARAMETER(pData); return E_FAIL; };
- STDMETHOD(GetBoolVector)(_Out_writes_(4) bool *pData) override { UNREFERENCED_PARAMETER(pData); return E_FAIL; };
- STDMETHOD(SetBoolVectorArray) (_In_reads_(4*Count) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; };
- STDMETHOD(SetIntVectorArray) (_In_reads_(4*Count) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; };
- STDMETHOD(SetFloatVectorArray)(_In_reads_(4*Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; };
- STDMETHOD(GetBoolVectorArray) (_Out_writes_(4*Count) bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; };
- STDMETHOD(GetIntVectorArray) (_Out_writes_(4*Count) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; };
- STDMETHOD(GetFloatVectorArray)(_Out_writes_(4*Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; };
- IUNKNOWN_IMP(SEffectInvalidVectorVariable, ID3DX11EffectVectorVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidMatrixVariable : public TEffectInvalidVariable<ID3DX11EffectMatrixVariable>
- {
- public:
- STDMETHOD(SetMatrix)(_In_reads_(16) const float *pData) override { UNREFERENCED_PARAMETER(pData); return E_FAIL; }
- STDMETHOD(GetMatrix)(_Out_writes_(16) float *pData) override { UNREFERENCED_PARAMETER(pData); return E_FAIL; }
- STDMETHOD(SetMatrixArray)(_In_reads_(16*Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetMatrixArray)(_Out_writes_(16*Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(SetMatrixPointerArray)(_In_reads_(16*Count) const float **ppData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetMatrixPointerArray)(_Out_writes_(16*Count) float **ppData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(SetMatrixTranspose)(_In_reads_(16) const float *pData) override { UNREFERENCED_PARAMETER(pData); return E_FAIL; }
- STDMETHOD(GetMatrixTranspose)(_Out_writes_(16) float *pData) override { UNREFERENCED_PARAMETER(pData); return E_FAIL; }
- STDMETHOD(SetMatrixTransposeArray)(_In_reads_(16*Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetMatrixTransposeArray)(_Out_writes_(16*Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(SetMatrixTransposePointerArray)(_In_reads_(16*Count) const float **ppData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetMatrixTransposePointerArray)(_Out_writes_(16*Count) float **ppData, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidMatrixVariable, ID3DX11EffectMatrixVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidStringVariable : public TEffectInvalidVariable<ID3DX11EffectStringVariable>
- {
- public:
- STDMETHOD(GetString)(_Outptr_result_z_ LPCSTR *ppString) override { UNREFERENCED_PARAMETER(ppString); return E_FAIL; }
- STDMETHOD(GetStringArray)(_Out_writes_(Count) LPCSTR *ppStrings, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppStrings); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidStringVariable, ID3DX11EffectStringVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidClassInstanceVariable : public TEffectInvalidVariable<ID3DX11EffectClassInstanceVariable>
- {
- public:
- STDMETHOD(GetClassInstance)(_Outptr_ ID3D11ClassInstance **ppClassInstance) override { UNREFERENCED_PARAMETER(ppClassInstance); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidClassInstanceVariable, ID3DX11EffectClassInstanceVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidInterfaceVariable : public TEffectInvalidVariable<ID3DX11EffectInterfaceVariable>
- {
- public:
- STDMETHOD(SetClassInstance)(_In_ ID3DX11EffectClassInstanceVariable *pEffectClassInstance) override
- { UNREFERENCED_PARAMETER(pEffectClassInstance); return E_FAIL; }
- STDMETHOD(GetClassInstance)(_Outptr_ ID3DX11EffectClassInstanceVariable **ppEffectClassInstance) override
- { UNREFERENCED_PARAMETER(ppEffectClassInstance); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidInterfaceVariable, ID3DX11EffectInterfaceVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidShaderResourceVariable : public TEffectInvalidVariable<ID3DX11EffectShaderResourceVariable>
- {
- public:
- STDMETHOD(SetResource)(_In_ ID3D11ShaderResourceView *pResource) override { UNREFERENCED_PARAMETER(pResource); return E_FAIL; }
- STDMETHOD(GetResource)(_Outptr_ ID3D11ShaderResourceView **ppResource) override { UNREFERENCED_PARAMETER(ppResource); return E_FAIL; }
- STDMETHOD(SetResourceArray)(_In_reads_(Count) ID3D11ShaderResourceView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppResources); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetResourceArray)(_Out_writes_(Count) ID3D11ShaderResourceView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppResources); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidShaderResourceVariable, ID3DX11EffectShaderResourceVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidUnorderedAccessViewVariable : public TEffectInvalidVariable<ID3DX11EffectUnorderedAccessViewVariable>
- {
- public:
- STDMETHOD(SetUnorderedAccessView)(_In_ ID3D11UnorderedAccessView *pResource) override { UNREFERENCED_PARAMETER(pResource); return E_FAIL; }
- STDMETHOD(GetUnorderedAccessView)(_Outptr_ ID3D11UnorderedAccessView **ppResource) override { UNREFERENCED_PARAMETER(ppResource); return E_FAIL; }
- STDMETHOD(SetUnorderedAccessViewArray)(_In_reads_(Count) ID3D11UnorderedAccessView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppResources); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetUnorderedAccessViewArray)(_Out_writes_(Count) ID3D11UnorderedAccessView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppResources); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidUnorderedAccessViewVariable, ID3DX11EffectUnorderedAccessViewVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidRenderTargetViewVariable : public TEffectInvalidVariable<ID3DX11EffectRenderTargetViewVariable>
- {
- public:
- STDMETHOD(SetRenderTarget)(_In_ ID3D11RenderTargetView *pResource) override { UNREFERENCED_PARAMETER(pResource); return E_FAIL; }
- STDMETHOD(GetRenderTarget)(_Outptr_ ID3D11RenderTargetView **ppResource) override { UNREFERENCED_PARAMETER(ppResource); return E_FAIL; }
- STDMETHOD(SetRenderTargetArray)(_In_reads_(Count) ID3D11RenderTargetView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppResources); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetRenderTargetArray)(_Out_writes_(Count) ID3D11RenderTargetView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppResources); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidRenderTargetViewVariable, ID3DX11EffectRenderTargetViewVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidDepthStencilViewVariable : public TEffectInvalidVariable<ID3DX11EffectDepthStencilViewVariable>
- {
- public:
- STDMETHOD(SetDepthStencil)(_In_ ID3D11DepthStencilView *pResource) override { UNREFERENCED_PARAMETER(pResource); return E_FAIL; }
- STDMETHOD(GetDepthStencil)(_Outptr_ ID3D11DepthStencilView **ppResource) override { UNREFERENCED_PARAMETER(ppResource); return E_FAIL; }
- STDMETHOD(SetDepthStencilArray)(_In_reads_(Count) ID3D11DepthStencilView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppResources); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- STDMETHOD(GetDepthStencilArray)(_Out_writes_(Count) ID3D11DepthStencilView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override
- { UNREFERENCED_PARAMETER(ppResources); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidDepthStencilViewVariable, ID3DX11EffectDepthStencilViewVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidConstantBuffer : public TEffectInvalidVariable<ID3DX11EffectConstantBuffer>
- {
- public:
- STDMETHOD(SetConstantBuffer)(_In_ ID3D11Buffer *pConstantBuffer) override { UNREFERENCED_PARAMETER(pConstantBuffer); return E_FAIL; }
- STDMETHOD(GetConstantBuffer)(_Outptr_ ID3D11Buffer **ppConstantBuffer) override { UNREFERENCED_PARAMETER(ppConstantBuffer); return E_FAIL; }
- STDMETHOD(UndoSetConstantBuffer)() override { return E_FAIL; }
- STDMETHOD(SetTextureBuffer)(_In_ ID3D11ShaderResourceView *pTextureBuffer) override { UNREFERENCED_PARAMETER(pTextureBuffer); return E_FAIL; }
- STDMETHOD(GetTextureBuffer)(_Outptr_ ID3D11ShaderResourceView **ppTextureBuffer) override { UNREFERENCED_PARAMETER(ppTextureBuffer); return E_FAIL; }
- STDMETHOD(UndoSetTextureBuffer)() override { return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidConstantBuffer, ID3DX11EffectConstantBuffer, ID3DX11EffectVariable);
- };
- struct SEffectInvalidShaderVariable : public TEffectInvalidVariable<ID3DX11EffectShaderVariable>
- {
- public:
- STDMETHOD(GetShaderDesc)(_In_ uint32_t ShaderIndex, _Out_ D3DX11_EFFECT_SHADER_DESC *pDesc) override
- { UNREFERENCED_PARAMETER(ShaderIndex); UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD(GetVertexShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11VertexShader **ppVS) override
- { UNREFERENCED_PARAMETER(ShaderIndex); UNREFERENCED_PARAMETER(ppVS); return E_FAIL; }
- STDMETHOD(GetGeometryShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11GeometryShader **ppGS) override
- { UNREFERENCED_PARAMETER(ShaderIndex); UNREFERENCED_PARAMETER(ppGS); return E_FAIL; }
- STDMETHOD(GetPixelShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11PixelShader **ppPS) override
- { UNREFERENCED_PARAMETER(ShaderIndex); UNREFERENCED_PARAMETER(ppPS); return E_FAIL; }
- STDMETHOD(GetHullShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11HullShader **ppHS) override
- { UNREFERENCED_PARAMETER(ShaderIndex); UNREFERENCED_PARAMETER(ppHS); return E_FAIL; }
- STDMETHOD(GetDomainShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11DomainShader **ppDS) override
- { UNREFERENCED_PARAMETER(ShaderIndex); UNREFERENCED_PARAMETER(ppDS); return E_FAIL; }
- STDMETHOD(GetComputeShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11ComputeShader **ppCS) override
- { UNREFERENCED_PARAMETER(ShaderIndex); UNREFERENCED_PARAMETER(ppCS); return E_FAIL; }
- STDMETHOD(GetInputSignatureElementDesc)(_In_ uint32_t ShaderIndex, _In_ uint32_t Element, _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) override
- { UNREFERENCED_PARAMETER(ShaderIndex); UNREFERENCED_PARAMETER(Element); UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD(GetOutputSignatureElementDesc)(_In_ uint32_t ShaderIndex, _In_ uint32_t Element, _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) override
- { UNREFERENCED_PARAMETER(ShaderIndex); UNREFERENCED_PARAMETER(Element); UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD(GetPatchConstantSignatureElementDesc)(_In_ uint32_t ShaderIndex, _In_ uint32_t Element, _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) override
- { UNREFERENCED_PARAMETER(ShaderIndex); UNREFERENCED_PARAMETER(Element); UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidShaderVariable, ID3DX11EffectShaderVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidBlendVariable : public TEffectInvalidVariable<ID3DX11EffectBlendVariable>
- {
- public:
- STDMETHOD(GetBlendState)(_In_ uint32_t Index, _Outptr_ ID3D11BlendState **ppState) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(ppState); return E_FAIL; }
- STDMETHOD(SetBlendState)(_In_ uint32_t Index, _In_ ID3D11BlendState *pState) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(pState); return E_FAIL; }
- STDMETHOD(UndoSetBlendState)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return E_FAIL; }
- STDMETHOD(GetBackingStore)(_In_ uint32_t Index, _Out_ D3D11_BLEND_DESC *pDesc) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidBlendVariable, ID3DX11EffectBlendVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidDepthStencilVariable : public TEffectInvalidVariable<ID3DX11EffectDepthStencilVariable>
- {
- public:
- STDMETHOD(GetDepthStencilState)(_In_ uint32_t Index, _Outptr_ ID3D11DepthStencilState **ppState) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(ppState); return E_FAIL; }
- STDMETHOD(SetDepthStencilState)(_In_ uint32_t Index, _In_ ID3D11DepthStencilState *pState) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(pState); return E_FAIL; }
- STDMETHOD(UndoSetDepthStencilState)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return E_FAIL; }
- STDMETHOD(GetBackingStore)(_In_ uint32_t Index, _Out_ D3D11_DEPTH_STENCIL_DESC *pDesc) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidDepthStencilVariable, ID3DX11EffectDepthStencilVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidRasterizerVariable : public TEffectInvalidVariable<ID3DX11EffectRasterizerVariable>
- {
- public:
- STDMETHOD(GetRasterizerState)(_In_ uint32_t Index, _Outptr_ ID3D11RasterizerState **ppState) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(ppState); return E_FAIL; }
- STDMETHOD(SetRasterizerState)(_In_ uint32_t Index, _In_ ID3D11RasterizerState *pState) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(pState); return E_FAIL; }
- STDMETHOD(UndoSetRasterizerState)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return E_FAIL; }
- STDMETHOD(GetBackingStore)(_In_ uint32_t Index, _Out_ D3D11_RASTERIZER_DESC *pDesc) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidRasterizerVariable, ID3DX11EffectRasterizerVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidSamplerVariable : public TEffectInvalidVariable<ID3DX11EffectSamplerVariable>
- {
- public:
- STDMETHOD(GetSampler)(_In_ uint32_t Index, _Outptr_ ID3D11SamplerState **ppSampler) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(ppSampler); return E_FAIL; }
- STDMETHOD(SetSampler)(_In_ uint32_t Index, _In_ ID3D11SamplerState *pSampler) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(pSampler); return E_FAIL; }
- STDMETHOD(UndoSetSampler)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return E_FAIL; }
- STDMETHOD(GetBackingStore)(_In_ uint32_t Index, _Out_ D3D11_SAMPLER_DESC *pDesc) override
- { UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidSamplerVariable, ID3DX11EffectSamplerVariable, ID3DX11EffectVariable);
- };
- struct SEffectInvalidPass : public ID3DX11EffectPass
- {
- public:
- STDMETHOD_(bool, IsValid)() override { return false; }
- STDMETHOD(GetDesc)(_Out_ D3DX11_PASS_DESC *pDesc) override { UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD(GetVertexShaderDesc)(_Out_ D3DX11_PASS_SHADER_DESC *pDesc) override { UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD(GetGeometryShaderDesc)(_Out_ D3DX11_PASS_SHADER_DESC *pDesc) override { UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD(GetPixelShaderDesc)(_Out_ D3DX11_PASS_SHADER_DESC *pDesc) override { UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD(GetHullShaderDesc)(_Out_ D3DX11_PASS_SHADER_DESC *pDesc) override { UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD(GetDomainShaderDesc)(_Out_ D3DX11_PASS_SHADER_DESC *pDesc) override { UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD(GetComputeShaderDesc)(_Out_ D3DX11_PASS_SHADER_DESC *pDesc) override { UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByIndex)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByName)(_In_z_ LPCSTR Name) override { UNREFERENCED_PARAMETER(Name); return &g_InvalidScalarVariable; }
- STDMETHOD(Apply)(_In_ uint32_t Flags, _In_ ID3D11DeviceContext* pContext) override
- { UNREFERENCED_PARAMETER(Flags); UNREFERENCED_PARAMETER(pContext); return E_FAIL; }
- STDMETHOD(ComputeStateBlockMask)(_Inout_ D3DX11_STATE_BLOCK_MASK *pStateBlockMask) override { UNREFERENCED_PARAMETER(pStateBlockMask); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidPass, ID3DX11EffectPass, IUnknown);
- };
- struct SEffectInvalidTechnique : public ID3DX11EffectTechnique
- {
- public:
- STDMETHOD_(bool, IsValid)() override { return false; }
- STDMETHOD(GetDesc)(_Out_ D3DX11_TECHNIQUE_DESC *pDesc) override { UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByIndex)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByName)(_In_z_ LPCSTR Name) override { UNREFERENCED_PARAMETER(Name); return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectPass*, GetPassByIndex)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return &g_InvalidPass; }
- STDMETHOD_(ID3DX11EffectPass*, GetPassByName)(_In_z_ LPCSTR Name) override { UNREFERENCED_PARAMETER(Name); return &g_InvalidPass; }
- STDMETHOD(ComputeStateBlockMask)(_Inout_ D3DX11_STATE_BLOCK_MASK *pStateBlockMask) override { UNREFERENCED_PARAMETER(pStateBlockMask); return E_FAIL; }
- IUNKNOWN_IMP(SEffectInvalidTechnique, ID3DX11EffectTechnique, IUnknown);
- };
- struct SEffectInvalidGroup : public ID3DX11EffectGroup
- {
- public:
- STDMETHOD_(bool, IsValid)() override { return false; }
- STDMETHOD(GetDesc)(_Out_ D3DX11_GROUP_DESC *pDesc) override { UNREFERENCED_PARAMETER(pDesc); return E_FAIL; }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByIndex)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByName)(_In_z_ LPCSTR Name) override { UNREFERENCED_PARAMETER(Name); return &g_InvalidScalarVariable; }
- STDMETHOD_(ID3DX11EffectTechnique*, GetTechniqueByIndex)(_In_ uint32_t Index) override { UNREFERENCED_PARAMETER(Index); return &g_InvalidTechnique; }
- STDMETHOD_(ID3DX11EffectTechnique*, GetTechniqueByName)(_In_z_ LPCSTR Name) override { UNREFERENCED_PARAMETER(Name); return &g_InvalidTechnique; }
- IUNKNOWN_IMP(SEffectInvalidGroup, ID3DX11EffectGroup, IUnknown);
- };
- //////////////////////////////////////////////////////////////////////////
- // Helper routines
- //////////////////////////////////////////////////////////////////////////
- // This is an annoying warning that pops up in retail builds because
- // the code that jumps to "lExit" is conditionally not compiled.
- // The only alternative is more #ifdefs in every function
- #pragma warning( disable : 4102 ) // 'label' : unreferenced label
- #define VERIFYPARAMETER(x) \
- { if (!(x)) { DPF(0, "%s: Parameter " #x " was nullptr.", pFuncName); \
- __BREAK_ON_FAIL; hr = E_INVALIDARG; goto lExit; } }
- static HRESULT AnnotationInvalidSetCall(LPCSTR pFuncName)
- {
- DPF(0, "%s: Annotations are readonly", pFuncName);
- return D3DERR_INVALIDCALL;
- }
- static HRESULT ObjectSetRawValue()
- {
- DPF(0, "ID3DX11EffectVariable::SetRawValue: Objects do not support ths call; please use the specific object accessors instead.");
- return D3DERR_INVALIDCALL;
- }
- static HRESULT ObjectGetRawValue()
- {
- DPF(0, "ID3DX11EffectVariable::GetRawValue: Objects do not support ths call; please use the specific object accessors instead.");
- return D3DERR_INVALIDCALL;
- }
- ID3DX11EffectConstantBuffer * NoParentCB();
- ID3DX11EffectVariable * GetAnnotationByIndexHelper(_In_z_ const char *pClassName, _In_ uint32_t Index,
- _In_ uint32_t AnnotationCount, _In_reads_(AnnotationCount) SAnnotation *pAnnotations);
- ID3DX11EffectVariable * GetAnnotationByNameHelper(_In_z_ const char *pClassName, _In_z_ LPCSTR Name,
- _In_ uint32_t AnnotationCount, _In_reads_(AnnotationCount) SAnnotation *pAnnotations);
- template<typename SVarType>
- _Success_(return)
- bool GetVariableByIndexHelper(_In_ uint32_t Index, _In_ uint32_t VariableCount, _In_reads_(VariableCount) SVarType *pVariables,
- _In_opt_ uint8_t *pBaseAddress, _Outptr_ SVarType **ppMember, _Outptr_ void **ppDataPtr)
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::GetMemberByIndex";
- if (Index >= VariableCount)
- {
- DPF(0, "%s: Invalid index (%u, total: %u)", pFuncName, Index, VariableCount);
- return false;
- }
- *ppMember = pVariables + Index;
- *ppDataPtr = pBaseAddress + (*ppMember)->Data.Offset;
- return true;
- }
- template<typename SVarType>
- _Success_(return)
- bool GetVariableByNameHelper(_In_z_ LPCSTR Name, _In_ uint32_t VariableCount, _In_reads_(VariableCount) SVarType *pVariables,
- _In_opt_ uint8_t *pBaseAddress, _Outptr_ SVarType **ppMember, _Outptr_ void **ppDataPtr, _Out_ uint32_t* pIndex)
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::GetMemberByName";
- if (nullptr == Name)
- {
- DPF(0, "%s: Parameter Name was nullptr.", pFuncName);
- return false;
- }
- bool bHasSuper = false;
- for (uint32_t i = 0; i < VariableCount; ++ i)
- {
- *ppMember = pVariables + i;
- assert((*ppMember)->pName != 0);
- _Analysis_assume_((*ppMember)->pName != 0);
- if (strcmp((*ppMember)->pName, Name) == 0)
- {
- *ppDataPtr = pBaseAddress + (*ppMember)->Data.Offset;
- *pIndex = i;
- return true;
- }
- else if (i == 0 &&
- (*ppMember)->pName[0] == '$' &&
- strcmp((*ppMember)->pName, "$super") == 0)
- {
- bHasSuper = true;
- }
- }
- if (bHasSuper)
- {
- SVarType* pSuper = pVariables;
- return GetVariableByNameHelper<SVarType>(Name,
- pSuper->pType->StructType.Members,
- (SVarType*)pSuper->pType->StructType.pMembers,
- pBaseAddress + pSuper->Data.Offset,
- ppMember,
- ppDataPtr,
- pIndex);
- }
- DPF(0, "%s: Variable [%s] not found", pFuncName, Name);
- return false;
- }
- template<typename SVarType>
- _Success_(return)
- bool GetVariableBySemanticHelper(_In_z_ LPCSTR Semantic, _In_ uint32_t VariableCount, _In_reads_(VariableCount) SVarType *pVariables,
- _In_opt_ uint8_t *pBaseAddress, _Outptr_ SVarType **ppMember, _Outptr_ void **ppDataPtr, _Out_ uint32_t* pIndex)
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::GetMemberBySemantic";
- if (nullptr == Semantic)
- {
- DPF(0, "%s: Parameter Semantic was nullptr.", pFuncName);
- return false;
- }
- for (uint32_t i = 0; i < VariableCount; ++ i)
- {
- *ppMember = pVariables + i;
- if (nullptr != (*ppMember)->pSemantic &&
- _stricmp((*ppMember)->pSemantic, Semantic) == 0)
- {
- *ppDataPtr = pBaseAddress + (*ppMember)->Data.Offset;
- *pIndex = i;
- return true;
- }
- }
- DPF(0, "%s: Variable with semantic [%s] not found", pFuncName, Semantic);
- return false;
- }
- inline bool AreBoundsValid(_In_ uint32_t Offset, _In_ uint32_t Count, _In_ const void *pData, _In_ const SType *pType, _In_ uint32_t TotalUnpackedSize)
- {
- if (Count == 0) return true;
- uint32_t singleElementSize = pType->GetTotalUnpackedSize(true);
- assert(singleElementSize <= pType->Stride);
- return ((Offset + Count >= Offset) &&
- ((Offset + Count) < ((uint32_t)-1) / pType->Stride) &&
- (Count * pType->Stride + (uint8_t*)pData >= (uint8_t*)pData) &&
- ((Offset + Count - 1) * pType->Stride + singleElementSize <= TotalUnpackedSize));
- }
- // Note that the branches in this code is based on template parameters and will be compiled out
- template<ETemplateVarType SourceType, ETemplateVarType DestType, typename SRC_TYPE, bool ValidatePtr>
- __forceinline HRESULT CopyScalarValue(_In_ SRC_TYPE SrcValue, _Out_ void *pDest, _In_z_ const char *pFuncName)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- if (ValidatePtr)
- VERIFYPARAMETER(pDest);
- #else
- UNREFERENCED_PARAMETER(pFuncName);
- #endif
- switch (SourceType)
- {
- case ETVT_Bool:
- switch (DestType)
- {
- case ETVT_Bool:
- *(int*)pDest = (SrcValue != 0) ? -1 : 0;
- break;
- case ETVT_Int:
- *(int*)pDest = SrcValue ? 1 : 0;
- break;
- case ETVT_Float:
- *(float*)pDest = SrcValue ? 1.0f : 0.0f;
- break;
- case ETVT_bool:
- *(bool*)pDest = (SrcValue != 0) ? true : false;
- break;
- default:
- assert(0);
- }
- break;
- case ETVT_Int:
- switch (DestType)
- {
- case ETVT_Bool:
- *(int*)pDest = (SrcValue != 0) ? -1 : 0;
- break;
- case ETVT_Int:
- *(int*)pDest = (int) SrcValue;
- break;
- case ETVT_Float:
- *(float*)pDest = (float)(SrcValue);
- break;
- case ETVT_bool:
- *(bool*)pDest = (SrcValue != 0) ? true : false;
- break;
- default:
- assert(0);
- }
- break;
- case ETVT_Float:
- switch (DestType)
- {
- case ETVT_Bool:
- *(int*)pDest = (SrcValue != 0.0f) ? -1 : 0;
- break;
- case ETVT_Int:
- *(int*)pDest = (int) (SrcValue);
- break;
- case ETVT_Float:
- *(float*)pDest = (float) SrcValue;
- break;
- case ETVT_bool:
- *(bool*)pDest = (SrcValue != 0.0f) ? true : false;
- break;
- default:
- assert(0);
- }
- break;
- case ETVT_bool:
- switch (DestType)
- {
- case ETVT_Bool:
- *(int*)pDest = SrcValue ? -1 : 0;
- break;
- case ETVT_Int:
- *(int*)pDest = SrcValue ? 1 : 0;
- break;
- case ETVT_Float:
- *(float*)pDest = SrcValue ? 1.0f : 0.0f;
- break;
- case ETVT_bool:
- *(bool*)pDest = (SrcValue != 0) ? true : false;
- break;
- default:
- assert(0);
- }
- break;
- default:
- assert(0);
- }
- lExit:
- return hr;
- }
- #pragma warning(push)
- #pragma warning( disable : 6103 )
- template<ETemplateVarType SourceType, ETemplateVarType DestType, typename SRC_TYPE, typename DEST_TYPE>
- inline HRESULT SetScalarArray(_In_reads_(Count) const SRC_TYPE *pSrcValues, _Out_writes_(Count) DEST_TYPE *pDestValues,
- _In_ uint32_t Offset, _In_ uint32_t Count,
- _In_ const SType *pType, _In_ uint32_t TotalUnpackedSize, _In_z_ const char *pFuncName)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- VERIFYPARAMETER(pSrcValues);
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pSrcValues, pType, TotalUnpackedSize))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #else
- UNREFERENCED_PARAMETER(TotalUnpackedSize);
- UNREFERENCED_PARAMETER(pFuncName);
- #endif
- uint32_t i, j, delta = pType->NumericType.IsPackedArray ? 1 : SType::c_ScalarsPerRegister;
- pDestValues += Offset * delta;
- for (i = 0, j = 0; j < Count; i += delta, ++ j)
- {
- // pDestValues[i] = (DEST_TYPE)pSrcValues[j];
- CopyScalarValue<SourceType, DestType, SRC_TYPE, false>(pSrcValues[j], &pDestValues[i], "SetScalarArray");
- }
- lExit:
- return hr;
- }
- #pragma warning(pop)
- #pragma warning( disable : 6103 )
- template<ETemplateVarType SourceType, ETemplateVarType DestType, typename SRC_TYPE, typename DEST_TYPE>
- inline HRESULT GetScalarArray(_In_reads_(Count) SRC_TYPE *pSrcValues, _Out_writes_(Count) DEST_TYPE *pDestValues,
- _In_ uint32_t Offset, _In_ uint32_t Count,
- _In_ const SType *pType, _In_ uint32_t TotalUnpackedSize, _In_z_ const char *pFuncName)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- VERIFYPARAMETER(pDestValues);
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pDestValues, pType, TotalUnpackedSize))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #else
- UNREFERENCED_PARAMETER(TotalUnpackedSize);
- UNREFERENCED_PARAMETER(pFuncName);
- #endif
- uint32_t i, j, delta = pType->NumericType.IsPackedArray ? 1 : SType::c_ScalarsPerRegister;
- pSrcValues += Offset * delta;
- for (i = 0, j = 0; j < Count; i += delta, ++ j)
- {
- // pDestValues[j] = (DEST_TYPE)pSrcValues[i];
- CopyScalarValue<SourceType, DestType, SRC_TYPE, false>(pSrcValues[i], &pDestValues[j], "GetScalarArray");
- }
- lExit:
- return hr;
- }
- //////////////////////////////////////////////////////////////////////////
- // TVariable - implements type casting and member/element retrieval
- //////////////////////////////////////////////////////////////////////////
- // requires that IBaseInterface contain SVariable's fields and support ID3DX11EffectVariable
- template<typename IBaseInterface>
- struct TVariable : public IBaseInterface
- {
- STDMETHOD_(bool, IsValid)() override { return true; }
- STDMETHOD_(ID3DX11EffectVariable*, GetMemberByIndex)(_In_ uint32_t Index)
- {
- SVariable *pMember;
- UDataPointer dataPtr;
- TTopLevelVariable<ID3DX11EffectVariable> *pTopLevelEntity2 = GetTopLevelEntity();
- if (((ID3DX11Effect*)pTopLevelEntity2->pEffect)->IsOptimized())
- {
- DPF(0, "ID3DX11EffectVariable::GetMemberByIndex: Cannot get members; effect has been Optimize()'ed");
- return &g_InvalidScalarVariable;
- }
- if (pType->VarType != EVT_Struct)
- {
- DPF(0, "ID3DX11EffectVariable::GetMemberByIndex: Variable is not a structure");
- return &g_InvalidScalarVariable;
- }
- if (!GetVariableByIndexHelper<SVariable>(Index, pType->StructType.Members, pType->StructType.pMembers,
- Data.pNumeric, &pMember, &dataPtr.pGeneric))
- {
- return &g_InvalidScalarVariable;
- }
- return pTopLevelEntity2->pEffect->CreatePooledVariableMemberInterface(pTopLevelEntity2, pMember, dataPtr, false, Index);
- }
- STDMETHOD_(ID3DX11EffectVariable*, GetMemberByName)(_In_z_ LPCSTR Name)
- {
- SVariable *pMember;
- UDataPointer dataPtr;
- uint32_t index;
- TTopLevelVariable<ID3DX11EffectVariable> *pTopLevelEntity2 = GetTopLevelEntity();
- if (pTopLevelEntity2->pEffect->IsOptimized())
- {
- DPF(0, "ID3DX11EffectVariable::GetMemberByName: Cannot get members; effect has been Optimize()'ed");
- return &g_InvalidScalarVariable;
- }
- if (pType->VarType != EVT_Struct)
- {
- DPF(0, "ID3DX11EffectVariable::GetMemberByName: Variable is not a structure");
- return &g_InvalidScalarVariable;
- }
- if (!GetVariableByNameHelper<SVariable>(Name, pType->StructType.Members, pType->StructType.pMembers,
- Data.pNumeric, &pMember, &dataPtr.pGeneric, &index))
- {
- return &g_InvalidScalarVariable;
- }
- return pTopLevelEntity2->pEffect->CreatePooledVariableMemberInterface(pTopLevelEntity2, pMember, dataPtr, false, index);
- }
- STDMETHOD_(ID3DX11EffectVariable*, GetMemberBySemantic)(_In_z_ LPCSTR Semantic)
- {
- SVariable *pMember;
- UDataPointer dataPtr;
- uint32_t index;
- TTopLevelVariable<ID3DX11EffectVariable> *pTopLevelEntity2 = GetTopLevelEntity();
- if (pTopLevelEntity2->pEffect->IsOptimized())
- {
- DPF(0, "ID3DX11EffectVariable::GetMemberBySemantic: Cannot get members; effect has been Optimize()'ed");
- return &g_InvalidScalarVariable;
- }
- if (pType->VarType != EVT_Struct)
- {
- DPF(0, "ID3DX11EffectVariable::GetMemberBySemantic: Variable is not a structure");
- return &g_InvalidScalarVariable;
- }
- if (!GetVariableBySemanticHelper<SVariable>(Semantic, pType->StructType.Members, pType->StructType.pMembers,
- Data.pNumeric, &pMember, &dataPtr.pGeneric, &index))
- {
- return &g_InvalidScalarVariable;
- }
- return pTopLevelEntity2->pEffect->CreatePooledVariableMemberInterface(pTopLevelEntity2, pMember, dataPtr, false, index);
- }
- STDMETHOD_(ID3DX11EffectVariable*, GetElement)(_In_ uint32_t Index)
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::GetElement";
- TTopLevelVariable<ID3DX11EffectVariable> *pTopLevelEntity2 = GetTopLevelEntity();
- UDataPointer dataPtr;
- if (pTopLevelEntity2->pEffect->IsOptimized())
- {
- DPF(0, "ID3DX11EffectVariable::GetElement: Cannot get element; effect has been Optimize()'ed");
- return &g_InvalidScalarVariable;
- }
- if (!IsArray())
- {
- DPF(0, "%s: This interface does not refer to an array", pFuncName);
- return &g_InvalidScalarVariable;
- }
- if (Index >= pType->Elements)
- {
- DPF(0, "%s: Invalid element index (%u, total: %u)", pFuncName, Index, pType->Elements);
- return &g_InvalidScalarVariable;
- }
- if (pType->BelongsInConstantBuffer())
- {
- dataPtr.pGeneric = Data.pNumeric + pType->Stride * Index;
- }
- else
- {
- dataPtr.pGeneric = GetBlockByIndex(pType->VarType, pType->ObjectType, Data.pGeneric, Index);
- if (nullptr == dataPtr.pGeneric)
- {
- DPF(0, "%s: Internal error", pFuncName);
- return &g_InvalidScalarVariable;
- }
- }
- return pTopLevelEntity2->pEffect->CreatePooledVariableMemberInterface(pTopLevelEntity2, (SVariable *) this, dataPtr, true, Index);
- }
- STDMETHOD_(ID3DX11EffectScalarVariable*, AsScalar)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsScalar";
- if (pType->VarType != EVT_Numeric ||
- pType->NumericType.NumericLayout != ENL_Scalar)
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidScalarVariable;
- }
- return (ID3DX11EffectScalarVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectVectorVariable*, AsVector)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsVector";
- if (pType->VarType != EVT_Numeric ||
- pType->NumericType.NumericLayout != ENL_Vector)
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidVectorVariable;
- }
- return (ID3DX11EffectVectorVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectMatrixVariable*, AsMatrix)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsMatrix";
- if (pType->VarType != EVT_Numeric ||
- pType->NumericType.NumericLayout != ENL_Matrix)
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidMatrixVariable;
- }
- return (ID3DX11EffectMatrixVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectStringVariable*, AsString)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsString";
- if (!pType->IsObjectType(EOT_String))
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidStringVariable;
- }
- return (ID3DX11EffectStringVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectClassInstanceVariable*, AsClassInstance)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsClassInstance";
- if (!pType->IsClassInstance() )
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidClassInstanceVariable;
- }
- else if( pMemberData == nullptr )
- {
- DPF(0, "%s: Non-global class instance variables (members of structs or classes) and class instances "
- "inside tbuffers are not supported.", pFuncName );
- return &g_InvalidClassInstanceVariable;
- }
- return (ID3DX11EffectClassInstanceVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectInterfaceVariable*, AsInterface)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsInterface";
- if (!pType->IsInterface())
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidInterfaceVariable;
- }
- return (ID3DX11EffectInterfaceVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectShaderResourceVariable*, AsShaderResource)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsShaderResource";
- if (!pType->IsShaderResource())
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidShaderResourceVariable;
- }
- return (ID3DX11EffectShaderResourceVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectUnorderedAccessViewVariable*, AsUnorderedAccessView)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsUnorderedAccessView";
- if (!pType->IsUnorderedAccessView())
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidUnorderedAccessViewVariable;
- }
- return (ID3DX11EffectUnorderedAccessViewVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectRenderTargetViewVariable*, AsRenderTargetView)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsRenderTargetView";
- if (!pType->IsRenderTargetView())
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidRenderTargetViewVariable;
- }
- return (ID3DX11EffectRenderTargetViewVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectDepthStencilViewVariable*, AsDepthStencilView)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsDepthStencilView";
- if (!pType->IsDepthStencilView())
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidDepthStencilViewVariable;
- }
- return (ID3DX11EffectDepthStencilViewVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectConstantBuffer*, AsConstantBuffer)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsConstantBuffer";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidConstantBuffer;
- }
- STDMETHOD_(ID3DX11EffectShaderVariable*, AsShader)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsShader";
- if (!pType->IsShader())
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidShaderVariable;
- }
- return (ID3DX11EffectShaderVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectBlendVariable*, AsBlend)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsBlend";
- if (!pType->IsObjectType(EOT_Blend))
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidBlendVariable;
- }
- return (ID3DX11EffectBlendVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectDepthStencilVariable*, AsDepthStencil)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsDepthStencil";
- if (!pType->IsObjectType(EOT_DepthStencil))
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidDepthStencilVariable;
- }
- return (ID3DX11EffectDepthStencilVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectRasterizerVariable*, AsRasterizer)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsRasterizer";
- if (!pType->IsObjectType(EOT_Rasterizer))
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidRasterizerVariable;
- }
- return (ID3DX11EffectRasterizerVariable *) this;
- }
- STDMETHOD_(ID3DX11EffectSamplerVariable*, AsSampler)()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsSampler";
- if (!pType->IsSampler())
- {
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidSamplerVariable;
- }
- return (ID3DX11EffectSamplerVariable *) this;
- }
- // Numeric variables should override this
- STDMETHOD(SetRawValue)(_In_reads_bytes_(Count) const void *pData, _In_ uint32_t Offset, _In_ uint32_t Count)
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return ObjectSetRawValue(); }
- STDMETHOD(GetRawValue)(_Out_writes_(Count) void *pData, _In_ uint32_t Offset, _In_ uint32_t Count)
- { UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return ObjectGetRawValue(); }
- };
- //////////////////////////////////////////////////////////////////////////
- // TTopLevelVariable - functionality for annotations and global variables
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TTopLevelVariable : public SVariable, public IBaseInterface
- {
- // Required to create member/element variable interfaces
- CEffect *pEffect;
- CEffect* GetEffect()
- {
- return pEffect;
- }
- TTopLevelVariable() : pEffect (nullptr)
- {
- }
- uint32_t GetTotalUnpackedSize()
- {
- return ((SType*)pType)->GetTotalUnpackedSize(false);
- }
- STDMETHOD_(ID3DX11EffectType*, GetType)()
- {
- return (ID3DX11EffectType*)(SType*)pType;
- }
- TTopLevelVariable<ID3DX11EffectVariable> * GetTopLevelEntity()
- {
- return (TTopLevelVariable<ID3DX11EffectVariable> *)this;
- }
- bool IsArray()
- {
- return (pType->Elements > 0);
- }
- };
- //////////////////////////////////////////////////////////////////////////
- // TMember - functionality for structure/array members of other variables
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TMember : public SVariable, public IBaseInterface
- {
- // Indicates that this is a single element of a containing array
- uint32_t IsSingleElement : 1;
- // Required to create member/element variable interfaces
- TTopLevelVariable<ID3DX11EffectVariable> *pTopLevelEntity;
- TMember()
- {
- IsSingleElement = false;
- pTopLevelEntity = nullptr;
- }
- CEffect* GetEffect()
- {
- return pTopLevelEntity->pEffect;
- }
- uint32_t GetTotalUnpackedSize()
- {
- return pType->GetTotalUnpackedSize(IsSingleElement);
- }
- STDMETHOD_(ID3DX11EffectType*, GetType)() override
- {
- if (IsSingleElement)
- {
- return pTopLevelEntity->pEffect->CreatePooledSingleElementTypeInterface( pType );
- }
- else
- {
- return (ID3DX11EffectType*) pType;
- }
- }
- STDMETHOD(GetDesc)(_Out_ D3DX11_EFFECT_VARIABLE_DESC *pDesc) override
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVariable::GetDesc";
- VERIFYPARAMETER(pDesc != nullptr);
- pDesc->Name = pName;
- pDesc->Semantic = pSemantic;
- pDesc->Flags = 0;
- if (pTopLevelEntity->pEffect->IsReflectionData(pTopLevelEntity))
- {
- // Is part of an annotation
- assert(pTopLevelEntity->pEffect->IsReflectionData(Data.pGeneric));
- pDesc->Annotations = 0;
- pDesc->BufferOffset = 0;
- pDesc->Flags |= D3DX11_EFFECT_VARIABLE_ANNOTATION;
- }
- else
- {
- // Is part of a global variable
- assert(pTopLevelEntity->pEffect->IsRuntimeData(pTopLevelEntity));
- if (!pTopLevelEntity->pType->IsObjectType(EOT_String))
- {
- // strings are funny; their data is reflection data, so ignore those
- assert(pTopLevelEntity->pEffect->IsRuntimeData(Data.pGeneric));
- }
-
- pDesc->Annotations = ((TGlobalVariable<ID3DX11Effect>*)pTopLevelEntity)->AnnotationCount;
- SConstantBuffer *pCB = ((TGlobalVariable<ID3DX11Effect>*)pTopLevelEntity)->pCB;
- if (pType->BelongsInConstantBuffer())
- {
- assert(pCB != 0);
- _Analysis_assume_(pCB != 0);
- UINT_PTR offset = Data.pNumeric - pCB->pBackingStore;
- assert(offset == (uint32_t)offset);
- pDesc->BufferOffset = (uint32_t)offset;
- assert(pDesc->BufferOffset >= 0 && pDesc->BufferOffset + GetTotalUnpackedSize() <= pCB->Size);
- }
- else
- {
- assert(pCB == nullptr);
- pDesc->BufferOffset = 0;
- }
- }
- lExit:
- return hr;
- }
- TTopLevelVariable<ID3DX11EffectVariable> * GetTopLevelEntity()
- {
- return pTopLevelEntity;
- }
- bool IsArray()
- {
- return (pType->Elements > 0 && !IsSingleElement);
- }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByIndex)(_In_ uint32_t Index) override
- { return pTopLevelEntity->GetAnnotationByIndex(Index); }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByName)(_In_z_ LPCSTR Name) override
- { return pTopLevelEntity->GetAnnotationByName(Name); }
- STDMETHOD_(ID3DX11EffectConstantBuffer*, GetParentConstantBuffer)() override
- { return pTopLevelEntity->GetParentConstantBuffer(); }
- // Annotations should never be able to go down this codepath
- void DirtyVariable()
- {
- // make sure to call the global variable's version of dirty variable
- ((TGlobalVariable<ID3DX11EffectVariable>*)pTopLevelEntity)->DirtyVariable();
- }
- };
- //////////////////////////////////////////////////////////////////////////
- // TAnnotation - functionality for top level annotations
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TAnnotation : public TVariable<TTopLevelVariable<IBaseInterface> >
- {
- STDMETHOD(GetDesc)(_Out_ D3DX11_EFFECT_VARIABLE_DESC *pDesc) override
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVariable::GetDesc";
- VERIFYPARAMETER(pDesc != nullptr);
- pDesc->Name = pName;
- pDesc->Semantic = pSemantic;
- pDesc->Flags = D3DX11_EFFECT_VARIABLE_ANNOTATION;
- pDesc->Annotations = 0;
- pDesc->BufferOffset = 0;
- pDesc->ExplicitBindPoint = 0;
- lExit:
- return hr;
- }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByIndex)(_In_ uint32_t Index) override
- {
- UNREFERENCED_PARAMETER(Index);
- static LPCSTR pFuncName = "ID3DX11EffectVariable::GetAnnotationByIndex";
- DPF(0, "%s: Only variables may have annotations", pFuncName);
- return &g_InvalidScalarVariable;
- }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByName)(_In_z_ LPCSTR Name) override
- {
- UNREFERENCED_PARAMETER(Name);
- static LPCSTR pFuncName = "ID3DX11EffectVariable::GetAnnotationByName";
- DPF(0, "%s: Only variables may have annotations", pFuncName);
- return &g_InvalidScalarVariable;
- }
- STDMETHOD_(ID3DX11EffectConstantBuffer*, GetParentConstantBuffer)() override
- { return NoParentCB(); }
- void DirtyVariable()
- {
- assert(0);
- }
- };
- //////////////////////////////////////////////////////////////////////////
- // TGlobalVariable - functionality for top level global variables
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TGlobalVariable : public TVariable<TTopLevelVariable<IBaseInterface> >
- {
- Timer LastModifiedTime;
- // if numeric, pointer to the constant buffer where this variable lives
- SConstantBuffer *pCB;
- uint32_t AnnotationCount;
- SAnnotation *pAnnotations;
- TGlobalVariable() :
- LastModifiedTime(0),
- pCB(nullptr),
- AnnotationCount(0),
- pAnnotations(nullptr)
- {
- }
- STDMETHOD(GetDesc)(_Out_ D3DX11_EFFECT_VARIABLE_DESC *pDesc)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVariable::GetDesc";
- VERIFYPARAMETER(pDesc != nullptr);
- pDesc->Name = pName;
- pDesc->Semantic = pSemantic;
- pDesc->Flags = 0;
- pDesc->Annotations = AnnotationCount;
- if (pType->BelongsInConstantBuffer())
- {
- assert(pCB != 0);
- _Analysis_assume_(pCB != 0);
- UINT_PTR offset = Data.pNumeric - pCB->pBackingStore;
- assert(offset == (uint32_t)offset);
- pDesc->BufferOffset = (uint32_t)offset;
- assert(pDesc->BufferOffset >= 0 && pDesc->BufferOffset + GetTotalUnpackedSize() <= pCB->Size );
- }
- else
- {
- assert(pCB == nullptr);
- pDesc->BufferOffset = 0;
- }
- if (ExplicitBindPoint != -1)
- {
- pDesc->ExplicitBindPoint = ExplicitBindPoint;
- pDesc->Flags |= D3DX11_EFFECT_VARIABLE_EXPLICIT_BIND_POINT;
- }
- else
- {
- pDesc->ExplicitBindPoint = 0;
- }
- lExit:
- return hr;
- }
- // these are all well defined for global vars
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByIndex)(_In_ uint32_t Index)
- {
- return GetAnnotationByIndexHelper("ID3DX11EffectVariable", Index, AnnotationCount, pAnnotations);
- }
- STDMETHOD_(ID3DX11EffectVariable*, GetAnnotationByName)(_In_z_ LPCSTR Name)
- {
- return GetAnnotationByNameHelper("ID3DX11EffectVariable", Name, AnnotationCount, pAnnotations);
- }
- STDMETHOD_(ID3DX11EffectConstantBuffer*, GetParentConstantBuffer)()
- {
- if (nullptr != pCB)
- {
- assert(pType->BelongsInConstantBuffer());
- return (ID3DX11EffectConstantBuffer*)pCB;
- }
- else
- {
- assert(!pType->BelongsInConstantBuffer());
- return &g_InvalidConstantBuffer;
- }
- }
- inline void DirtyVariable()
- {
- assert(pCB != 0);
- _Analysis_assume_(pCB != 0);
- pCB->IsDirty = true;
- LastModifiedTime = pEffect->GetCurrentTime();
- }
- };
- //////////////////////////////////////////////////////////////////////////
- // TNumericVariable - implements raw set/get functionality
- //////////////////////////////////////////////////////////////////////////
- // IMPORTANT NOTE: All of these numeric & object aspect classes MUST NOT
- // add data members to the base variable classes. Otherwise type sizes
- // will disagree between object & numeric variables and we cannot eaily
- // create arrays of global variables using SGlobalVariable
- // Requires that IBaseInterface have SVariable's members, GetTotalUnpackedSize() and DirtyVariable()
- template<typename IBaseInterface, bool IsAnnotation>
- struct TNumericVariable : public IBaseInterface
- {
- STDMETHOD(SetRawValue)(_In_reads_bytes_(ByteCount) const void *pData, _In_ uint32_t ByteOffset, _In_ uint32_t ByteCount) override
- {
- if (IsAnnotation)
- {
- return AnnotationInvalidSetCall("ID3DX11EffectVariable::SetRawValue");
- }
- else
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3DX11EffectVariable::SetRawValue";
- VERIFYPARAMETER(pData);
- if ((ByteOffset + ByteCount < ByteOffset) ||
- (ByteCount + (uint8_t*)pData < (uint8_t*)pData) ||
- ((ByteOffset + ByteCount) > GetTotalUnpackedSize()))
- {
- // overflow of some kind
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #endif
- DirtyVariable();
- memcpy(Data.pNumeric + ByteOffset, pData, ByteCount);
- lExit:
- return hr;
- }
- }
- STDMETHOD(GetRawValue)(_Out_writes_bytes_(ByteCount) void *pData, _In_ uint32_t ByteOffset, _In_ uint32_t ByteCount) override
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3DX11EffectVariable::GetRawValue";
- VERIFYPARAMETER(pData);
- if ((ByteOffset + ByteCount < ByteOffset) ||
- (ByteCount + (uint8_t*)pData < (uint8_t*)pData) ||
- ((ByteOffset + ByteCount) > GetTotalUnpackedSize()))
- {
- // overflow of some kind
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #endif
- memcpy(pData, Data.pNumeric + ByteOffset, ByteCount);
- lExit:
- return hr;
- }
- };
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectScalarVariable (TFloatScalarVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface, bool IsAnnotation>
- struct TFloatScalarVariable : public TNumericVariable<IBaseInterface, IsAnnotation>
- {
- STDMETHOD(SetFloat)(_In_ const float Value) override;
- STDMETHOD(GetFloat)(_Out_ float *pValue) override;
- STDMETHOD(SetFloatArray)(_In_reads_(Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetFloatArray)(_Out_writes_(Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(SetInt)(_In_ const int Value) override;
- STDMETHOD(GetInt)(_Out_ int *pValue) override;
- STDMETHOD(SetIntArray)(_In_reads_(Count) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetIntArray)(_Out_writes_(Count) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(SetBool)(_In_ const bool Value) override;
- STDMETHOD(GetBool)(_Out_ bool *pValue) override;
- STDMETHOD(SetBoolArray)(_In_reads_(Count) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetBoolArray)(_Out_writes_(Count) bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- };
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::SetFloat(float Value)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetFloat";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return CopyScalarValue<ETVT_Float, ETVT_Float, float, false>(Value, Data.pNumericFloat, pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::GetFloat(float *pValue)
- {
- return CopyScalarValue<ETVT_Float, ETVT_Float, float, true>(*Data.pNumericFloat, pValue, "ID3DX11EffectScalarVariable::GetFloat");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::SetFloatArray(const float *pData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetFloatArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return SetScalarArray<ETVT_Float, ETVT_Float, float, float>(pData, Data.pNumericFloat, Offset, Count,
- pType, GetTotalUnpackedSize(), pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::GetFloatArray(float *pData, uint32_t Offset, uint32_t Count)
- {
- return GetScalarArray<ETVT_Float, ETVT_Float, float, float>(Data.pNumericFloat, pData, Offset, Count,
- pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetFloatArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::SetInt(const int Value)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetInt";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return CopyScalarValue<ETVT_Int, ETVT_Float, int, false>(Value, Data.pNumericFloat, pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::GetInt(int *pValue)
- {
- return CopyScalarValue<ETVT_Float, ETVT_Int, float, true>(*Data.pNumericFloat, pValue, "ID3DX11EffectScalarVariable::GetInt");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::SetIntArray(const int *pData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetIntArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return SetScalarArray<ETVT_Int, ETVT_Float, int, float>(pData, Data.pNumericFloat, Offset, Count,
- pType, GetTotalUnpackedSize(), pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::GetIntArray(int *pData, uint32_t Offset, uint32_t Count)
- {
- return GetScalarArray<ETVT_Float, ETVT_Int, float, int>(Data.pNumericFloat, pData, Offset, Count,
- pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetIntArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::SetBool(const bool Value)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBool";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return CopyScalarValue<ETVT_bool, ETVT_Float, bool, false>(Value, Data.pNumericFloat, pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::GetBool(bool *pValue)
- {
- return CopyScalarValue<ETVT_Float, ETVT_bool, float, true>(*Data.pNumericFloat, pValue, "ID3DX11EffectScalarVariable::GetBool");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::SetBoolArray(const bool *pData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBoolArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return SetScalarArray<ETVT_bool, ETVT_Float, bool, float>(pData, Data.pNumericFloat, Offset, Count,
- pType, GetTotalUnpackedSize(), pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::GetBoolArray(bool *pData, uint32_t Offset, uint32_t Count)
- {
- return GetScalarArray<ETVT_Float, ETVT_bool, float, bool>(Data.pNumericFloat, pData, Offset, Count,
- pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetBoolArray");
- }
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectScalarVariable (TIntScalarVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface, bool IsAnnotation>
- struct TIntScalarVariable : public TNumericVariable<IBaseInterface, IsAnnotation>
- {
- STDMETHOD(SetFloat)(_In_ const float Value) override;
- STDMETHOD(GetFloat)(_Out_ float *pValue) override;
- STDMETHOD(SetFloatArray)(_In_reads_(Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetFloatArray)(_Out_writes_(Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(SetInt)(_In_ const int Value) override;
- STDMETHOD(GetInt)(_Out_ int *pValue) override;
- STDMETHOD(SetIntArray)(_In_reads_(Count) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetIntArray)(_Out_writes_(Count) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(SetBool)(_In_ const bool Value) override;
- STDMETHOD(GetBool)(_Out_ bool *pValue) override;
- STDMETHOD(SetBoolArray)(_In_reads_(Count) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetBoolArray)(_Out_writes_(Count) bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- };
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::SetFloat(float Value)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetFloat";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return CopyScalarValue<ETVT_Float, ETVT_Int, float, false>(Value, Data.pNumericInt, pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::GetFloat(float *pValue)
- {
- return CopyScalarValue<ETVT_Int, ETVT_Float, int, true>(*Data.pNumericInt, pValue, "ID3DX11EffectScalarVariable::GetFloat");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::SetFloatArray(const float *pData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetFloatArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return SetScalarArray<ETVT_Float, ETVT_Int, float, int>(pData, Data.pNumericInt, Offset, Count,
- pType, GetTotalUnpackedSize(), pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::GetFloatArray(float *pData, uint32_t Offset, uint32_t Count)
- {
- return GetScalarArray<ETVT_Int, ETVT_Float, int, float>(Data.pNumericInt, pData, Offset, Count,
- pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetFloatArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::SetInt(const int Value)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetInt";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return CopyScalarValue<ETVT_Int, ETVT_Int, int, false>(Value, Data.pNumericInt, pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::GetInt(int *pValue)
- {
- return CopyScalarValue<ETVT_Int, ETVT_Int, int, true>(*Data.pNumericInt, pValue, "ID3DX11EffectScalarVariable::GetInt");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::SetIntArray(const int *pData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetIntArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return SetScalarArray<ETVT_Int, ETVT_Int, int, int>(pData, Data.pNumericInt, Offset, Count,
- pType, GetTotalUnpackedSize(), pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::GetIntArray(int *pData, uint32_t Offset, uint32_t Count)
- {
- return GetScalarArray<ETVT_Int, ETVT_Int, int, int>(Data.pNumericInt, pData, Offset, Count,
- pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetIntArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::SetBool(const bool Value)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBool";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return CopyScalarValue<ETVT_bool, ETVT_Int, bool, false>(Value, Data.pNumericInt, pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::GetBool(bool *pValue)
- {
- return CopyScalarValue<ETVT_Int, ETVT_bool, int, true>(*Data.pNumericInt, pValue, "ID3DX11EffectScalarVariable::GetBool");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::SetBoolArray(const bool *pData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBoolArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return SetScalarArray<ETVT_bool, ETVT_Int, bool, int>(pData, Data.pNumericInt, Offset, Count,
- pType, GetTotalUnpackedSize(), pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::GetBoolArray(bool *pData, uint32_t Offset, uint32_t Count)
- {
- return GetScalarArray<ETVT_Int, ETVT_bool, int, bool>(Data.pNumericInt, pData, Offset, Count,
- pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetBoolArray");
- }
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectScalarVariable (TBoolScalarVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface, bool IsAnnotation>
- struct TBoolScalarVariable : public TNumericVariable<IBaseInterface, IsAnnotation>
- {
- STDMETHOD(SetFloat)(_In_ const float Value) override;
- STDMETHOD(GetFloat)(_Out_ float *pValue) override;
- STDMETHOD(SetFloatArray)(_In_reads_(Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetFloatArray)(_Out_writes_(Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(SetInt)(_In_ const int Value) override;
- STDMETHOD(GetInt)(_Out_ int *pValue) override;
- STDMETHOD(SetIntArray)(_In_reads_(Count) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetIntArray)(_Out_writes_(Count) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(SetBool)(_In_ const bool Value) override;
- STDMETHOD(GetBool)(_Out_ bool *pValue) override;
- STDMETHOD(SetBoolArray)(_In_reads_(Count) const bool *pData, uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetBoolArray)(_Out_writes_(Count) bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- };
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::SetFloat(float Value)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetFloat";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return CopyScalarValue<ETVT_Float, ETVT_Bool, float, false>(Value, Data.pNumericBool, pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::GetFloat(float *pValue)
- {
- return CopyScalarValue<ETVT_Bool, ETVT_Float, BOOL, true>(*Data.pNumericBool, pValue, "ID3DX11EffectScalarVariable::GetFloat");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::SetFloatArray(const float *pData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetFloatArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return SetScalarArray<ETVT_Float, ETVT_Bool, float, BOOL>(pData, Data.pNumericBool, Offset, Count,
- pType, GetTotalUnpackedSize(), pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::GetFloatArray(float *pData, uint32_t Offset, uint32_t Count)
- {
- return GetScalarArray<ETVT_Bool, ETVT_Float, BOOL, float>(Data.pNumericBool, pData, Offset, Count,
- pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetFloatArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::SetInt(const int Value)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetInt";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return CopyScalarValue<ETVT_Int, ETVT_Bool, int, false>(Value, Data.pNumericBool, pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::GetInt(int *pValue)
- {
- return CopyScalarValue<ETVT_Bool, ETVT_Int, BOOL, true>(*Data.pNumericBool, pValue, "ID3DX11EffectScalarVariable::GetInt");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::SetIntArray(const int *pData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetIntArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return SetScalarArray<ETVT_Int, ETVT_Bool, int, BOOL>(pData, Data.pNumericBool, Offset, Count,
- pType, GetTotalUnpackedSize(), pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::GetIntArray(int *pData, uint32_t Offset, uint32_t Count)
- {
- return GetScalarArray<ETVT_Bool, ETVT_Int, BOOL, int>(Data.pNumericBool, pData, Offset, Count,
- pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetIntArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::SetBool(const bool Value)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBool";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return CopyScalarValue<ETVT_bool, ETVT_Bool, bool, false>(Value, Data.pNumericBool, pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::GetBool(bool *pValue)
- {
- return CopyScalarValue<ETVT_Bool, ETVT_bool, BOOL, true>(*Data.pNumericBool, pValue, "ID3DX11EffectScalarVariable::GetBool");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::SetBoolArray(const bool *pData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBoolArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return SetScalarArray<ETVT_bool, ETVT_Bool, bool, BOOL>(pData, Data.pNumericBool, Offset, Count,
- pType, GetTotalUnpackedSize(), pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::GetBoolArray(bool *pData, uint32_t Offset, uint32_t Count)
- {
- return GetScalarArray<ETVT_Bool, ETVT_bool, BOOL, bool>(Data.pNumericBool, pData, Offset, Count,
- pType, GetTotalUnpackedSize(), "ID3DX11EffectScalarVariable::GetBoolArray");
- }
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectVectorVariable (TVectorVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType >
- struct TVectorVariable : public TNumericVariable<IBaseInterface, IsAnnotation>
- {
- STDMETHOD(SetBoolVector) (_In_reads_(4) const bool *pData) override;
- STDMETHOD(SetIntVector) (_In_reads_(4) const int *pData) override;
- STDMETHOD(SetFloatVector)(_In_reads_(4) const float *pData) override;
- STDMETHOD(GetBoolVector) (_Out_writes_(4) bool *pData) override;
- STDMETHOD(GetIntVector) (_Out_writes_(4) int *pData) override;
- STDMETHOD(GetFloatVector)(_Out_writes_(4) float *pData) override;
- STDMETHOD(SetBoolVectorArray) (_In_reads_(Count*4) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(SetIntVectorArray) (_In_reads_(Count*4) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(SetFloatVectorArray)(_In_reads_(Count*4) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetBoolVectorArray) (_Out_writes_(Count*4) bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetIntVectorArray) (_Out_writes_(Count*4) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetFloatVectorArray)(_Out_writes_(Count*4) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- };
- // Note that branches in this code is based on template parameters and will be compiled out
- #pragma warning (push)
- #pragma warning (disable : 6101)
- template <ETemplateVarType DestType, ETemplateVarType SourceType>
- void __forceinline CopyDataWithTypeConversion(_Out_ void *pDest,
- _In_ const void *pSource,
- _In_ size_t dstVecSize, _In_ size_t srcVecSize,
- _In_ size_t elementCount, _In_ size_t vecCount)
- {
- switch (SourceType)
- {
- case ETVT_Bool:
- switch (DestType)
- {
- case ETVT_Bool:
- for (size_t j=0; j<vecCount; j++)
- {
- memcpy(pDest, pSource, elementCount * SType::c_ScalarSize);
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- case ETVT_Int:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- ((int*)pDest)[i] = ((bool*)pSource)[i] ? -1 : 0;
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- case ETVT_Float:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- ((float*)pDest)[i] = ((bool*)pSource)[i] ? -1.0f : 0.0f;
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- case ETVT_bool:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- ((bool*)pDest)[i] = (((int*)pSource)[i] != 0) ? true : false;
- pDest = ((bool*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- default:
- assert(0);
- }
- break;
- case ETVT_Int:
- switch (DestType)
- {
- case ETVT_Bool:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- ((int*)pDest)[i] = (((int*)pSource)[i] != 0) ? -1 : 0;
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- case ETVT_Int:
- for (size_t j=0; j<vecCount; j++)
- {
- memcpy(pDest, pSource, elementCount * SType::c_ScalarSize);
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- case ETVT_Float:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- ((float*)pDest)[i] = (float)(((int*)pSource)[i]);
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- case ETVT_bool:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- ((bool*)pDest)[i] = (((int*)pSource)[i] != 0) ? true : false;
- pDest = ((bool*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- default:
- assert(0);
- }
- break;
- case ETVT_Float:
- switch (DestType)
- {
- case ETVT_Bool:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- ((int*)pDest)[i] = (((float*)pSource)[i] != 0.0f) ? -1 : 0;
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- case ETVT_Int:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- ((int*)pDest)[i] = (int)((float*)pSource)[i];
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- case ETVT_Float:
- for (size_t i=0; i<vecCount; i++)
- {
- memcpy( pDest, pSource, elementCount * SType::c_ScalarSize);
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- case ETVT_bool:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- ((bool*)pDest)[i] = (((float*)pSource)[i] != 0.0f) ? true : false;
- pDest = ((bool*) pDest) + dstVecSize;
- pSource = ((float*) pSource) + srcVecSize;
- }
- break;
- default:
- assert(0);
- }
- break;
- case ETVT_bool:
- switch (DestType)
- {
- case ETVT_Bool:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- reinterpret_cast<int*>(pDest)[i] = reinterpret_cast<const bool*>(pSource)[i] ? -1 : 0;
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((bool*) pSource) + srcVecSize;
- }
- break;
- case ETVT_Int:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- reinterpret_cast<int*>(pDest)[i] = reinterpret_cast<const bool*>(pSource)[i] ? -1 : 0;
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((bool*) pSource) + srcVecSize;
- }
- break;
- case ETVT_Float:
- for (size_t j=0; j<vecCount; j++)
- {
- for (size_t i=0; i<elementCount; i++)
- reinterpret_cast<float*>(pDest)[i] = reinterpret_cast<const bool*>(pSource)[i] ? -1.0f : 0.0f;
- pDest = ((float*) pDest) + dstVecSize;
- pSource = ((bool*) pSource) + srcVecSize;
- }
- break;
- case ETVT_bool:
- for (size_t j=0; j<vecCount; j++)
- {
- memcpy(pDest, pSource, elementCount);
- pDest = ((bool*) pDest) + dstVecSize;
- pSource = ((bool*) pSource) + srcVecSize;
- }
- break;
- default:
- assert(0);
- }
- break;
- default:
- assert(0);
- }
- }
- #pragma warning (pop)
- // Float Vector
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType >::SetFloatVector(const float *pData)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::SetFloatVector";
- #ifdef _DEBUG
- VERIFYPARAMETER(pData);
- #endif
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- CopyDataWithTypeConversion<BaseType, ETVT_Float>(Data.pVector, pData, 4, pType->NumericType.Columns, pType->NumericType.Columns, 1);
- lExit:
- return hr;
- }
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType>::GetFloatVector(float *pData)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::GetFloatVector";
- #ifdef _DEBUG
- VERIFYPARAMETER(pData);
- #endif
- CopyDataWithTypeConversion<ETVT_Float, BaseType>(pData, Data.pVector, pType->NumericType.Columns, 4, pType->NumericType.Columns, 1);
- lExit:
- return hr;
- }
- // Int Vector
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType >::SetIntVector(const int *pData)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::SetIntVector";
- #ifdef _DEBUG
- VERIFYPARAMETER(pData);
- #endif
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- CopyDataWithTypeConversion<BaseType, ETVT_Int>(Data.pVector, pData, 4, pType->NumericType.Columns, pType->NumericType.Columns, 1);
- lExit:
- return hr;
- }
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType>::GetIntVector(int *pData)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::GetIntVector";
- VERIFYPARAMETER(pData);
- #endif
- CopyDataWithTypeConversion<ETVT_Int, BaseType>(pData, Data.pVector, pType->NumericType.Columns, 4, pType->NumericType.Columns, 1);
- lExit:
- return hr;
- }
- // Bool Vector
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType >::SetBoolVector(const bool *pData)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::SetBoolVector";
- #ifdef _DEBUG
- VERIFYPARAMETER(pData);
- #endif
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- CopyDataWithTypeConversion<BaseType, ETVT_bool>(Data.pVector, pData, 4, pType->NumericType.Columns, pType->NumericType.Columns, 1);
- lExit:
- return hr;
- }
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType>::GetBoolVector(bool *pData)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::GetBoolVector";
- VERIFYPARAMETER(pData);
- #endif
- CopyDataWithTypeConversion<ETVT_bool, BaseType>(pData, Data.pVector, pType->NumericType.Columns, 4, pType->NumericType.Columns, 1);
- lExit:
- return hr;
- }
- // Vector Arrays /////////////////////////////////////////////////////////
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType>::SetFloatVectorArray(const float *pData, uint32_t Offset, uint32_t Count)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::SetFloatVectorArray";
- #ifdef _DEBUG
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pData, pType, GetTotalUnpackedSize()))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #endif
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- // ensure we don't write over the padding at the end of the vector array
- CopyDataWithTypeConversion<BaseType, ETVT_Float>(Data.pVector + Offset, pData, 4, pType->NumericType.Columns, pType->NumericType.Columns, std::max(std::min((int)Count, (int)pType->Elements - (int)Offset), 0));
- lExit:
- return hr;
- }
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType>::GetFloatVectorArray(float *pData, uint32_t Offset, uint32_t Count)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::GetFloatVectorArray";
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pData, pType, GetTotalUnpackedSize()))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #endif
- // ensure we don't read past the end of the vector array
- CopyDataWithTypeConversion<ETVT_Float, BaseType>(pData, Data.pVector + Offset, pType->NumericType.Columns, 4, pType->NumericType.Columns, std::max(std::min((int)Count, (int)pType->Elements - (int)Offset), 0));
- lExit:
- return hr;
- }
- // int
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType>::SetIntVectorArray(const int *pData, uint32_t Offset, uint32_t Count)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::SetIntVectorArray";
- #ifdef _DEBUG
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pData, pType, GetTotalUnpackedSize()))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #endif
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- // ensure we don't write over the padding at the end of the vector array
- CopyDataWithTypeConversion<BaseType, ETVT_Int>(Data.pVector + Offset, pData, 4, pType->NumericType.Columns, pType->NumericType.Columns, std::max(std::min((int)Count, (int)pType->Elements - (int)Offset), 0));
- lExit:
- return hr;
- }
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType>::GetIntVectorArray(int *pData, uint32_t Offset, uint32_t Count)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::GetIntVectorArray";
- #ifdef _DEBUG
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pData, pType, GetTotalUnpackedSize()))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #endif
- // ensure we don't read past the end of the vector array
- CopyDataWithTypeConversion<ETVT_Int, BaseType>(pData, Data.pVector + Offset, pType->NumericType.Columns, 4, pType->NumericType.Columns, std::max(std::min((int)Count, (int)pType->Elements - (int)Offset), 0));
- lExit:
- return hr;
- }
- // bool
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType>::SetBoolVectorArray(const bool *pData, uint32_t Offset, uint32_t Count)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::SetBoolVectorArray";
- #ifdef _DEBUG
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pData, pType, GetTotalUnpackedSize()))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #endif
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- // ensure we don't write over the padding at the end of the vector array
- CopyDataWithTypeConversion<BaseType, ETVT_bool>(Data.pVector + Offset, pData, 4, pType->NumericType.Columns, pType->NumericType.Columns, std::max(std::min((int)Count, (int)pType->Elements - (int)Offset), 0));
- lExit:
- return hr;
- }
- template<typename IBaseInterface, bool IsAnnotation, ETemplateVarType BaseType>
- _Use_decl_annotations_
- HRESULT TVectorVariable<IBaseInterface, IsAnnotation, BaseType>::GetBoolVectorArray(bool *pData, uint32_t Offset, uint32_t Count)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::GetBoolVectorArray";
- #ifdef _DEBUG
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pData, pType, GetTotalUnpackedSize()))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #endif
- // ensure we don't read past the end of the vector array
- CopyDataWithTypeConversion<ETVT_bool, BaseType>(pData, Data.pVector + Offset, pType->NumericType.Columns, 4, pType->NumericType.Columns, std::max(std::min((int)Count, (int)pType->Elements - (int)Offset), 0));
- lExit:
- return hr;
- }
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectVector4Variable (TVectorVariable implementation) [OPTIMIZED]
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TVector4Variable : public TVectorVariable<IBaseInterface, false, ETVT_Float>
- {
- STDMETHOD(SetFloatVector)(_In_reads_(4) const float *pData) override;
- STDMETHOD(GetFloatVector)(_Out_writes_(4) float *pData) override;
- STDMETHOD(SetFloatVectorArray)(_In_reads_(Count*4) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetFloatVectorArray)(_Out_writes_(Count*4) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- };
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TVector4Variable<IBaseInterface>::SetFloatVector(const float *pData)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::SetFloatVector";
- #ifdef _DEBUG
- VERIFYPARAMETER(pData);
- #endif
- DirtyVariable();
- Data.pVector[0] = ((CEffectVector4*) pData)[0];
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TVector4Variable<IBaseInterface>::GetFloatVector(float *pData)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::GetFloatVector";
- #ifdef _DEBUG
- VERIFYPARAMETER(pData);
- #endif
- memcpy(pData, Data.pVector, pType->NumericType.Columns * SType::c_ScalarSize);
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TVector4Variable<IBaseInterface>::SetFloatVectorArray(const float *pData, uint32_t Offset, uint32_t Count)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::SetFloatVectorArray";
- #ifdef _DEBUG
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pData, pType, GetTotalUnpackedSize()))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #endif
- DirtyVariable();
- // ensure we don't write over the padding at the end of the vector array
- memcpy(Data.pVector + Offset, pData,
- std::min<size_t>(Count * sizeof(CEffectVector4), pType->TotalSize - (Offset * sizeof(CEffectVector4))));
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TVector4Variable<IBaseInterface>::GetFloatVectorArray(float *pData, uint32_t Offset, uint32_t Count)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectVectorVariable::GetFloatVectorArray";
- #ifdef _DEBUG
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pData, pType, GetTotalUnpackedSize()))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #endif
- // ensure we don't read past the end of the vector array
- memcpy(pData, Data.pVector + Offset,
- std::min<size_t>(Count * sizeof(CEffectVector4), pType->TotalSize - (Offset * sizeof(CEffectVector4))));
- lExit:
- return hr;
- }
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectMatrixVariable (TMatrixVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface, bool IsAnnotation>
- struct TMatrixVariable : public TNumericVariable<IBaseInterface, IsAnnotation>
- {
- STDMETHOD(SetMatrix)(_In_reads_(16) const float *pData) override;
- STDMETHOD(GetMatrix)(_Out_writes_(16) float *pData) override;
- STDMETHOD(SetMatrixArray)(_In_reads_(Count*16) const float *pData, uint32_t Offset, uint32_t Count) override;
- STDMETHOD(GetMatrixArray)(_Out_writes_(Count*16) float *pData, uint32_t Offset, uint32_t Count) override;
- STDMETHOD(SetMatrixPointerArray)(_In_reads_(Count*16) const float **ppData, uint32_t Offset, uint32_t Count) override;
- STDMETHOD(GetMatrixPointerArray)(_Out_writes_(Count*16) float **ppData, uint32_t Offset, uint32_t Count) override;
- STDMETHOD(SetMatrixTranspose)(_In_reads_(16) const float *pData) override;
- STDMETHOD(GetMatrixTranspose)(_Out_writes_(16) float *pData) override;
- STDMETHOD(SetMatrixTransposeArray)(_In_reads_(Count*16) const float *pData, uint32_t Offset, uint32_t Count) override;
- STDMETHOD(GetMatrixTransposeArray)(_Out_writes_(Count*16) float *pData, uint32_t Offset, uint32_t Count) override;
- STDMETHOD(SetMatrixTransposePointerArray)(_In_reads_(Count*16) const float **ppData, uint32_t Offset, uint32_t Count) override;
- STDMETHOD(GetMatrixTransposePointerArray)(_Out_writes_(Count*16) float **ppData, uint32_t Offset, uint32_t Count) override;
- };
- #pragma warning (push)
- #pragma warning (disable : 6101)
- template<bool Transpose>
- static void SetMatrixTransposeHelper(_In_ const SType *pType, _Out_writes_bytes_(64) uint8_t *pDestData, _In_reads_(16) const float* pMatrix)
- {
- uint32_t registers, entries;
-
- if (Transpose)
- {
- // row major
- registers = pType->NumericType.Rows;
- entries = pType->NumericType.Columns;
- }
- else
- {
- // column major
- registers = pType->NumericType.Columns;
- entries = pType->NumericType.Rows;
- }
- _Analysis_assume_( registers <= 4 );
- _Analysis_assume_( entries <= 4 );
- for (size_t i = 0; i < registers; ++ i)
- {
- for (size_t j = 0; j < entries; ++ j)
- {
- #pragma prefast(suppress:__WARNING_UNRELATED_LOOP_TERMINATION, "regs / entries <= 4")
- ((float*)pDestData)[j] = ((float*)pMatrix)[j * 4 + i];
- }
- pDestData += SType::c_RegisterSize;
- }
- }
- template<bool Transpose>
- static void GetMatrixTransposeHelper(_In_ const SType *pType, _In_reads_bytes_(64) uint8_t *pSrcData, _Out_writes_(16) float* pMatrix)
- {
- uint32_t registers, entries;
- if (Transpose)
- {
- // row major
- registers = pType->NumericType.Rows;
- entries = pType->NumericType.Columns;
- }
- else
- {
- // column major
- registers = pType->NumericType.Columns;
- entries = pType->NumericType.Rows;
- }
- _Analysis_assume_( registers <= 4 );
- _Analysis_assume_( entries <= 4 );
- for (size_t i = 0; i < registers; ++ i)
- {
- for (size_t j = 0; j < entries; ++ j)
- {
- ((float*)pMatrix)[j * 4 + i] = ((float*)pSrcData)[j];
- }
- pSrcData += SType::c_RegisterSize;
- }
- }
- template<bool Transpose, bool IsSetting, bool ExtraIndirection>
- HRESULT DoMatrixArrayInternal(_In_ const SType *pType, _In_ uint32_t TotalUnpackedSize,
- _Out_ uint8_t *pEffectData,
- void *pMatrixData,
- _In_ uint32_t Offset, _In_ uint32_t Count, _In_z_ LPCSTR pFuncName)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pMatrixData, pType, TotalUnpackedSize))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- #else
- UNREFERENCED_PARAMETER(TotalUnpackedSize);
- UNREFERENCED_PARAMETER(pFuncName);
- #endif
- if ((pType->NumericType.IsColumnMajor && Transpose) || (!pType->NumericType.IsColumnMajor && !Transpose))
- {
- // fast path
- uint32_t dataSize;
- if (Transpose)
- {
- dataSize = ((pType->NumericType.Columns - 1) * 4 + pType->NumericType.Rows) * SType::c_ScalarSize;
- }
- else
- {
- dataSize = ((pType->NumericType.Rows - 1) * 4 + pType->NumericType.Columns) * SType::c_ScalarSize;
- }
- for (size_t i = 0; i < Count; ++ i)
- {
- CEffectMatrix *pMatrix;
- if (ExtraIndirection)
- {
- pMatrix = ((CEffectMatrix **)pMatrixData)[i];
- if (!pMatrix)
- {
- continue;
- }
- }
- else
- {
- pMatrix = ((CEffectMatrix *)pMatrixData) + i;
- }
- if (IsSetting)
- {
- memcpy(pEffectData + pType->Stride * (i + Offset), pMatrix, dataSize);
- }
- else
- {
- memcpy(pMatrix, pEffectData + pType->Stride * (i + Offset), dataSize);
- }
- }
- }
- else
- {
- // slow path
- for (size_t i = 0; i < Count; ++ i)
- {
- CEffectMatrix *pMatrix;
- if (ExtraIndirection)
- {
- pMatrix = ((CEffectMatrix **)pMatrixData)[i];
- if (!pMatrix)
- {
- continue;
- }
- }
- else
- {
- pMatrix = ((CEffectMatrix *)pMatrixData) + i;
- }
- if (IsSetting)
- {
- SetMatrixTransposeHelper<Transpose>(pType, pEffectData + pType->Stride * (i + Offset), (float*) pMatrix);
- }
- else
- {
- GetMatrixTransposeHelper<Transpose>(pType, pEffectData + pType->Stride * (i + Offset), (float*) pMatrix);
- }
- }
- }
- lExit:
- return hr;
- }
- #pragma warning (pop)
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::SetMatrix(const float *pData)
- {
- static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrix";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return DoMatrixArrayInternal<false, true, false>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, const_cast<float*>(pData), 0, 1, pFuncName);
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::GetMatrix(float *pData)
- {
- return DoMatrixArrayInternal<false, false, false>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, pData, 0, 1, "ID3DX11EffectMatrixVariable::GetMatrix");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::SetMatrixArray(const float *pData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrixArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return DoMatrixArrayInternal<false, true, false>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, const_cast<float*>(pData), Offset, Count, "ID3DX11EffectMatrixVariable::SetMatrixArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::GetMatrixArray(float *pData, uint32_t Offset, uint32_t Count)
- {
- return DoMatrixArrayInternal<false, false, false>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, pData, Offset, Count, "ID3DX11EffectMatrixVariable::GetMatrixArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::SetMatrixPointerArray(const float **ppData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrixPointerArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return DoMatrixArrayInternal<false, true, true>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, const_cast<float**>(ppData), Offset, Count, "ID3DX11EffectMatrixVariable::SetMatrixPointerArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::GetMatrixPointerArray(float **ppData, uint32_t Offset, uint32_t Count)
- {
- return DoMatrixArrayInternal<false, false, true>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, ppData, Offset, Count, "ID3DX11EffectMatrixVariable::GetMatrixPointerArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::SetMatrixTranspose(const float *pData)
- {
- static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrixTranspose";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return DoMatrixArrayInternal<true, true, false>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, const_cast<float*>(pData), 0, 1, "ID3DX11EffectMatrixVariable::SetMatrixTranspose");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::GetMatrixTranspose(float *pData)
- {
- return DoMatrixArrayInternal<true, false, false>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, pData, 0, 1, "ID3DX11EffectMatrixVariable::GetMatrixTranspose");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::SetMatrixTransposeArray(const float *pData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrixTransposeArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return DoMatrixArrayInternal<true, true, false>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, const_cast<float*>(pData), Offset, Count, "ID3DX11EffectMatrixVariable::SetMatrixTransposeArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::GetMatrixTransposeArray(float *pData, uint32_t Offset, uint32_t Count)
- {
- return DoMatrixArrayInternal<true, false, false>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, pData, Offset, Count, "ID3DX11EffectMatrixVariable::GetMatrixTransposeArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::SetMatrixTransposePointerArray(const float **ppData, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectMatrixVariable::SetMatrixTransposePointerArray";
- if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
- DirtyVariable();
- return DoMatrixArrayInternal<true, true, true>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, const_cast<float**>(ppData), Offset, Count, "ID3DX11EffectMatrixVariable::SetMatrixTransposePointerArray");
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TMatrixVariable<IBaseInterface, IsAnnotation>::GetMatrixTransposePointerArray(float **ppData, uint32_t Offset, uint32_t Count)
- {
- return DoMatrixArrayInternal<true, false, true>(pType, GetTotalUnpackedSize(),
- Data.pNumeric, ppData, Offset, Count, "ID3DX11EffectMatrixVariable::GetMatrixTransposePointerArray");
- }
- // Optimize commonly used fast paths
- // (non-annotations only!)
- template<typename IBaseInterface, bool IsColumnMajor>
- struct TMatrix4x4Variable : public TMatrixVariable<IBaseInterface, false>
- {
- STDMETHOD(SetMatrix)(_In_reads_(16) const float *pData) override;
- STDMETHOD(GetMatrix)(_Out_writes_(16) float *pData) override;
- STDMETHOD(SetMatrixArray)(_In_reads_(16*Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetMatrixArray)(_Out_writes_(16*Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(SetMatrixTranspose)(_In_reads_(16) const float *pData) override;
- STDMETHOD(GetMatrixTranspose)(_Out_writes_(16) float *pData) override;
- STDMETHOD(SetMatrixTransposeArray)(_In_reads_(16*Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetMatrixTransposeArray)(_Out_writes_(16*Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- };
- inline static void Matrix4x4TransposeHelper(_In_reads_bytes_(64) const void *pSrc, _Out_writes_bytes_(64) void *pDst)
- {
- uint8_t *pDestData = (uint8_t*)pDst;
- uint32_t *pMatrix = (uint32_t*)pSrc;
- ((uint32_t*)pDestData)[0 * 4 + 0] = pMatrix[0 * 4 + 0];
- ((uint32_t*)pDestData)[0 * 4 + 1] = pMatrix[1 * 4 + 0];
- ((uint32_t*)pDestData)[0 * 4 + 2] = pMatrix[2 * 4 + 0];
- ((uint32_t*)pDestData)[0 * 4 + 3] = pMatrix[3 * 4 + 0];
- ((uint32_t*)pDestData)[1 * 4 + 0] = pMatrix[0 * 4 + 1];
- ((uint32_t*)pDestData)[1 * 4 + 1] = pMatrix[1 * 4 + 1];
- ((uint32_t*)pDestData)[1 * 4 + 2] = pMatrix[2 * 4 + 1];
- ((uint32_t*)pDestData)[1 * 4 + 3] = pMatrix[3 * 4 + 1];
- ((uint32_t*)pDestData)[2 * 4 + 0] = pMatrix[0 * 4 + 2];
- ((uint32_t*)pDestData)[2 * 4 + 1] = pMatrix[1 * 4 + 2];
- ((uint32_t*)pDestData)[2 * 4 + 2] = pMatrix[2 * 4 + 2];
- ((uint32_t*)pDestData)[2 * 4 + 3] = pMatrix[3 * 4 + 2];
- ((uint32_t*)pDestData)[3 * 4 + 0] = pMatrix[0 * 4 + 3];
- ((uint32_t*)pDestData)[3 * 4 + 1] = pMatrix[1 * 4 + 3];
- ((uint32_t*)pDestData)[3 * 4 + 2] = pMatrix[2 * 4 + 3];
- ((uint32_t*)pDestData)[3 * 4 + 3] = pMatrix[3 * 4 + 3];
- }
- inline static void Matrix4x4Copy(_In_reads_bytes_(64) const void *pSrc, _Out_writes_bytes_(64) void *pDst)
- {
- #if 1
- // In tests, this path ended up generating faster code both on x86 and x64
- // T1 - Matrix4x4Copy - this path
- // T2 - Matrix4x4Transpose
- // T1: 1.88 T2: 1.92 - with 32 bit copies
- // T1: 1.85 T2: 1.80 - with 64 bit copies
- uint64_t *pDestData = (uint64_t*)pDst;
- uint64_t *pMatrix = (uint64_t*)pSrc;
- pDestData[0 * 4 + 0] = pMatrix[0 * 4 + 0];
- pDestData[0 * 4 + 1] = pMatrix[0 * 4 + 1];
- pDestData[0 * 4 + 2] = pMatrix[0 * 4 + 2];
- pDestData[0 * 4 + 3] = pMatrix[0 * 4 + 3];
- pDestData[1 * 4 + 0] = pMatrix[1 * 4 + 0];
- pDestData[1 * 4 + 1] = pMatrix[1 * 4 + 1];
- pDestData[1 * 4 + 2] = pMatrix[1 * 4 + 2];
- pDestData[1 * 4 + 3] = pMatrix[1 * 4 + 3];
- #else
- uint32_t *pDestData = (uint32_t*)pDst;
- uint32_t *pMatrix = (uint32_t*)pSrc;
- pDestData[0 * 4 + 0] = pMatrix[0 * 4 + 0];
- pDestData[0 * 4 + 1] = pMatrix[0 * 4 + 1];
- pDestData[0 * 4 + 2] = pMatrix[0 * 4 + 2];
- pDestData[0 * 4 + 3] = pMatrix[0 * 4 + 3];
- pDestData[1 * 4 + 0] = pMatrix[1 * 4 + 0];
- pDestData[1 * 4 + 1] = pMatrix[1 * 4 + 1];
- pDestData[1 * 4 + 2] = pMatrix[1 * 4 + 2];
- pDestData[1 * 4 + 3] = pMatrix[1 * 4 + 3];
- pDestData[2 * 4 + 0] = pMatrix[2 * 4 + 0];
- pDestData[2 * 4 + 1] = pMatrix[2 * 4 + 1];
- pDestData[2 * 4 + 2] = pMatrix[2 * 4 + 2];
- pDestData[2 * 4 + 3] = pMatrix[2 * 4 + 3];
- pDestData[3 * 4 + 0] = pMatrix[3 * 4 + 0];
- pDestData[3 * 4 + 1] = pMatrix[3 * 4 + 1];
- pDestData[3 * 4 + 2] = pMatrix[3 * 4 + 2];
- pDestData[3 * 4 + 3] = pMatrix[3 * 4 + 3];
- #endif
- }
- // Note that branches in this code is based on template parameters and will be compiled out
- #pragma warning (push)
- #pragma warning (disable : 6101)
- template<bool IsColumnMajor, bool Transpose, bool IsSetting>
- inline HRESULT DoMatrix4x4ArrayInternal(_In_ uint8_t *pEffectData,
- _When_(IsSetting, _In_reads_bytes_(64 * Count))
- _When_(!IsSetting, _Out_writes_bytes_(64 * Count))
- void *pMatrixData,
- _In_ uint32_t Offset, _In_ uint32_t Count
- #ifdef _DEBUG
- , _In_ const SType *pType, _In_ uint32_t TotalUnpackedSize, _In_z_ LPCSTR pFuncName
- #endif
- )
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- #pragma warning( suppress : 6001 )
- if (!AreBoundsValid(Offset, Count, pMatrixData, pType, TotalUnpackedSize))
- {
- DPF(0, "%s: Invalid range specified", pFuncName);
- VH(E_INVALIDARG);
- }
- assert(pType->NumericType.IsColumnMajor == IsColumnMajor && pType->Stride == (4 * SType::c_RegisterSize));
- #endif
- if ((IsColumnMajor && Transpose) || (!IsColumnMajor && !Transpose))
- {
- // fast path
- for (size_t i = 0; i < Count; ++ i)
- {
- CEffectMatrix *pMatrix = ((CEffectMatrix *)pMatrixData) + i;
- if (IsSetting)
- {
- Matrix4x4Copy(pMatrix, pEffectData + 4 * SType::c_RegisterSize * (i + Offset));
- }
- else
- {
- Matrix4x4Copy(pEffectData + 4 * SType::c_RegisterSize * (i + Offset), pMatrix);
- }
- }
- }
- else
- {
- // slow path
- for (size_t i = 0; i < Count; ++ i)
- {
- CEffectMatrix *pMatrix = ((CEffectMatrix *)pMatrixData) + i;
- if (IsSetting)
- {
- Matrix4x4TransposeHelper((float*) pMatrix, pEffectData + 4 * SType::c_RegisterSize * (i + Offset));
- }
- else
- {
- Matrix4x4TransposeHelper(pEffectData + 4 * SType::c_RegisterSize * (i + Offset), (float*) pMatrix);
- }
- }
- }
- lExit:
- return hr;
- }
- #pragma warning (pop)
- template<typename IBaseInterface, bool IsColumnMajor>
- _Use_decl_annotations_
- HRESULT TMatrix4x4Variable<IBaseInterface, IsColumnMajor>::SetMatrix(const float *pData)
- {
- DirtyVariable();
- return DoMatrix4x4ArrayInternal<IsColumnMajor, false, true>(Data.pNumeric, const_cast<float*>(pData), 0, 1
- #ifdef _DEBUG
- , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::SetMatrix");
- #else
- );
- #endif
- }
- template<typename IBaseInterface, bool IsColumnMajor>
- _Use_decl_annotations_
- HRESULT TMatrix4x4Variable<IBaseInterface, IsColumnMajor>::GetMatrix(float *pData)
- {
- return DoMatrix4x4ArrayInternal<IsColumnMajor, false, false>(Data.pNumeric, pData, 0, 1
- #ifdef _DEBUG
- , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::GetMatrix");
- #else
- );
- #endif
- }
- template<typename IBaseInterface, bool IsColumnMajor>
- _Use_decl_annotations_
- HRESULT TMatrix4x4Variable<IBaseInterface, IsColumnMajor>::SetMatrixArray(const float *pData, uint32_t Offset, uint32_t Count)
- {
- DirtyVariable();
- return DoMatrix4x4ArrayInternal<IsColumnMajor, false, true>(Data.pNumeric, const_cast<float*>(pData), Offset, Count
- #ifdef _DEBUG
- , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::SetMatrixArray");
- #else
- );
- #endif
- }
- template<typename IBaseInterface, bool IsColumnMajor>
- _Use_decl_annotations_
- HRESULT TMatrix4x4Variable<IBaseInterface, IsColumnMajor>::GetMatrixArray(float *pData, uint32_t Offset, uint32_t Count)
- {
- return DoMatrix4x4ArrayInternal<IsColumnMajor, false, false>(Data.pNumeric, pData, Offset, Count
- #ifdef _DEBUG
- , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::GetMatrixArray");
- #else
- );
- #endif
- }
- template<typename IBaseInterface, bool IsColumnMajor>
- _Use_decl_annotations_
- HRESULT TMatrix4x4Variable<IBaseInterface, IsColumnMajor>::SetMatrixTranspose(const float *pData)
- {
- DirtyVariable();
- return DoMatrix4x4ArrayInternal<IsColumnMajor, true, true>(Data.pNumeric, const_cast<float*>(pData), 0, 1
- #ifdef _DEBUG
- , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::SetMatrixTranspose");
- #else
- );
- #endif
- }
- template<typename IBaseInterface, bool IsColumnMajor>
- _Use_decl_annotations_
- HRESULT TMatrix4x4Variable<IBaseInterface, IsColumnMajor>::GetMatrixTranspose(float *pData)
- {
- return DoMatrix4x4ArrayInternal<IsColumnMajor, true, false>(Data.pNumeric, pData, 0, 1
- #ifdef _DEBUG
- , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::GetMatrixTranspose");
- #else
- );
- #endif
- }
- template<typename IBaseInterface, bool IsColumnMajor>
- _Use_decl_annotations_
- HRESULT TMatrix4x4Variable<IBaseInterface, IsColumnMajor>::SetMatrixTransposeArray(const float *pData, uint32_t Offset, uint32_t Count)
- {
- DirtyVariable();
- return DoMatrix4x4ArrayInternal<IsColumnMajor, true, true>(Data.pNumeric, const_cast<float*>(pData), Offset, Count
- #ifdef _DEBUG
- , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::SetMatrixTransposeArray");
- #else
- );
- #endif
- }
- template<typename IBaseInterface, bool IsColumnMajor>
- _Use_decl_annotations_
- HRESULT TMatrix4x4Variable<IBaseInterface, IsColumnMajor>::GetMatrixTransposeArray(float *pData, uint32_t Offset, uint32_t Count)
- {
- return DoMatrix4x4ArrayInternal<IsColumnMajor, true, false>(Data.pNumeric, pData, Offset, Count
- #ifdef _DEBUG
- , pType, GetTotalUnpackedSize(), "ID3DX11EffectMatrixVariable::GetMatrixTransposeArray");
- #else
- );
- #endif
- }
- #ifdef _DEBUG
- // Useful object macro to check bounds and parameters
- #define CHECK_OBJECT_ARRAY_BOUNDS(Offset, Count, Pointer) \
- HRESULT hr = S_OK; \
- VERIFYPARAMETER(Pointer) \
- uint32_t elements = IsArray() ? pType->Elements : 1; \
- \
- if ((Offset + Count < Offset) || (elements < Offset + Count)) \
- { \
- DPF(0, "%s: Invalid range specified", pFuncName); \
- VH(E_INVALIDARG); \
- } \
- #define CHECK_OBJECT_SCALAR_BOUNDS(Index, Pointer) \
- HRESULT hr = S_OK; \
- VERIFYPARAMETER(Pointer) \
- uint32_t elements = IsArray() ? pType->Elements : 1; \
- \
- if (Index >= elements) \
- { \
- DPF(0, "%s: Invalid index specified", pFuncName); \
- VH(E_INVALIDARG); \
- } \
- #define CHECK_SCALAR_BOUNDS(Index) \
- HRESULT hr = S_OK; \
- uint32_t elements = IsArray() ? pType->Elements : 1; \
- \
- if (Index >= elements) \
- { \
- DPF(0, "%s: Invalid index specified", pFuncName); \
- VH(E_INVALIDARG); \
- } \
- #else // _DEBUG
- #define CHECK_OBJECT_ARRAY_BOUNDS(Offset, Count, Pointer) \
- HRESULT hr = S_OK; \
- #define CHECK_OBJECT_SCALAR_BOUNDS(Index, Pointer) \
- HRESULT hr = S_OK; \
- #define CHECK_SCALAR_BOUNDS(Index) \
- HRESULT hr = S_OK; \
- #endif // _DEBUG
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectStringVariable (TStringVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface, bool IsAnnotation>
- struct TStringVariable : public IBaseInterface
- {
- STDMETHOD(GetString)(_Outptr_result_z_ LPCSTR *ppString) override;
- STDMETHOD(GetStringArray)( _Out_writes_(Count) LPCSTR *ppStrings, _In_ uint32_t Offset, _In_ uint32_t Count ) override;
- };
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- HRESULT TStringVariable<IBaseInterface, IsAnnotation>::GetString(LPCSTR *ppString)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectStringVariable::GetString";
- VERIFYPARAMETER(ppString);
- if (GetTopLevelEntity()->pEffect->IsOptimized())
- {
- DPF(0, "%s: Effect has been Optimize()'ed; all string/reflection data has been deleted", pFuncName);
- return D3DERR_INVALIDCALL;
- }
- assert(Data.pString != 0);
- _Analysis_assume_(Data.pString != 0);
- *ppString = Data.pString->pString;
- lExit:
- return hr;
- }
- template<typename IBaseInterface, bool IsAnnotation>
- _Use_decl_annotations_
- #pragma warning(suppress : 6054)
- HRESULT TStringVariable<IBaseInterface, IsAnnotation>::GetStringArray( LPCSTR *ppStrings, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectStringVariable::GetStringArray";
- CHECK_OBJECT_ARRAY_BOUNDS(Offset, Count, ppStrings);
- if (GetTopLevelEntity()->pEffect->IsOptimized())
- {
- DPF(0, "%s: Effect has been Optimize()'ed; all string/reflection data has been deleted", pFuncName);
- return D3DERR_INVALIDCALL;
- }
- assert(Data.pString != 0);
- _Analysis_assume_(Data.pString != 0);
- for (size_t i = 0; i < Count; ++ i)
- {
- ppStrings[i] = (Data.pString + Offset + i)->pString;
- }
- lExit:
- return hr;
- }
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectClassInstanceVariable (TClassInstanceVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TClassInstanceVariable : public IBaseInterface
- {
- STDMETHOD(GetClassInstance)(_Outptr_ ID3D11ClassInstance **ppClassInstance) override;
- };
- template<typename IBaseClassInstance>
- HRESULT TClassInstanceVariable<IBaseClassInstance>::GetClassInstance(_Outptr_ ID3D11ClassInstance** ppClassInstance)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectClassInstanceVariable::GetClassInstance";
- assert( pMemberData != 0 && pMemberData->Data.pD3DClassInstance != 0);
- _Analysis_assume_( pMemberData != 0 && pMemberData->Data.pD3DClassInstance != 0);
- *ppClassInstance = pMemberData->Data.pD3DClassInstance;
- SAFE_ADDREF(*ppClassInstance);
- lExit:
- return hr;
- }
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectInterfaceeVariable (TInterfaceVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TInterfaceVariable : public IBaseInterface
- {
- STDMETHOD(SetClassInstance)(_In_ ID3DX11EffectClassInstanceVariable *pEffectClassInstance) override;
- STDMETHOD(GetClassInstance)(_Outptr_ ID3DX11EffectClassInstanceVariable **ppEffectClassInstance) override;
- };
- template<typename IBaseInterface>
- HRESULT TInterfaceVariable<IBaseInterface>::SetClassInstance(_In_ ID3DX11EffectClassInstanceVariable *pEffectClassInstance)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectInterfaceVariable::SetClassInstance";
- // Note that we don't check if the types are compatible. The debug layer will complain if it is.
- // IsValid() will not catch type mismatches.
- SClassInstanceGlobalVariable* pCI = (SClassInstanceGlobalVariable*)pEffectClassInstance;
- Data.pInterface->pClassInstance = pCI;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- HRESULT TInterfaceVariable<IBaseInterface>::GetClassInstance(_Outptr_ ID3DX11EffectClassInstanceVariable **ppEffectClassInstance)
- {
- HRESULT hr = S_OK;
- static LPCSTR pFuncName = "ID3DX11EffectInterfaceVariable::GetClassInstance";
- #ifdef _DEBUG
- VERIFYPARAMETER(ppEffectClassInstance);
- #endif
- *ppEffectClassInstance = Data.pInterface->pClassInstance;
- lExit:
- return hr;
- }
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectShaderResourceVariable (TShaderResourceVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TShaderResourceVariable : public IBaseInterface
- {
- STDMETHOD(SetResource)(_In_ ID3D11ShaderResourceView *pResource) override;
- STDMETHOD(GetResource)(_Outptr_ ID3D11ShaderResourceView **ppResource) override;
- STDMETHOD(SetResourceArray)(_In_reads_(Count) ID3D11ShaderResourceView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetResourceArray)(_Out_writes_(Count) ID3D11ShaderResourceView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- };
- static LPCSTR GetTextureTypeNameFromEnum(_In_ EObjectType ObjectType)
- {
- switch (ObjectType)
- {
- case EOT_Buffer:
- return "Buffer";
- case EOT_Texture:
- return "texture";
- case EOT_Texture1D:
- case EOT_Texture1DArray:
- return "Texture1D";
- case EOT_Texture2DMS:
- case EOT_Texture2DMSArray:
- return "Texture2DMS";
- case EOT_Texture2D:
- case EOT_Texture2DArray:
- return "Texture2D";
- case EOT_Texture3D:
- return "Texture3D";
- case EOT_TextureCube:
- return "TextureCube";
- case EOT_TextureCubeArray:
- return "TextureCubeArray";
- case EOT_RWTexture1D:
- case EOT_RWTexture1DArray:
- return "RWTexture1D";
- case EOT_RWTexture2D:
- case EOT_RWTexture2DArray:
- return "RWTexture2D";
- case EOT_RWTexture3D:
- return "RWTexture3D";
- case EOT_RWBuffer:
- return "RWBuffer";
- case EOT_ByteAddressBuffer:
- return "ByteAddressBuffer";
- case EOT_RWByteAddressBuffer:
- return "RWByteAddressBuffer";
- case EOT_StructuredBuffer:
- return "StructuredBuffe";
- case EOT_RWStructuredBuffer:
- return "RWStructuredBuffer";
- case EOT_RWStructuredBufferAlloc:
- return "RWStructuredBufferAlloc";
- case EOT_RWStructuredBufferConsume:
- return "RWStructuredBufferConsume";
- case EOT_AppendStructuredBuffer:
- return "AppendStructuredBuffer";
- case EOT_ConsumeStructuredBuffer:
- return "ConsumeStructuredBuffer";
- }
- return "<unknown texture format>";
- }
- static LPCSTR GetResourceDimensionNameFromEnum(_In_ D3D11_RESOURCE_DIMENSION ResourceDimension)
- {
- switch (ResourceDimension)
- {
- case D3D11_RESOURCE_DIMENSION_BUFFER:
- return "Buffer";
- case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
- return "Texture1D";
- case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
- return "Texture2D";
- case D3D11_RESOURCE_DIMENSION_TEXTURE3D:
- return "Texture3D";
- }
- return "<unknown texture format>";
- }
- static LPCSTR GetSRVDimensionNameFromEnum(_In_ D3D11_SRV_DIMENSION ViewDimension)
- {
- switch (ViewDimension)
- {
- case D3D11_SRV_DIMENSION_BUFFER:
- case D3D11_SRV_DIMENSION_BUFFEREX:
- return "Buffer";
- case D3D11_SRV_DIMENSION_TEXTURE1D:
- return "Texture1D";
- case D3D11_SRV_DIMENSION_TEXTURE1DARRAY:
- return "Texture1DArray";
- case D3D11_SRV_DIMENSION_TEXTURE2D:
- return "Texture2D";
- case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
- return "Texture2DArray";
- case D3D11_SRV_DIMENSION_TEXTURE2DMS:
- return "Texture2DMS";
- case D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY:
- return "Texture2DMSArray";
- case D3D11_SRV_DIMENSION_TEXTURE3D:
- return "Texture3D";
- case D3D11_SRV_DIMENSION_TEXTURECUBE:
- return "TextureCube";
- }
- return "<unknown texture format>";
- }
- static LPCSTR GetUAVDimensionNameFromEnum(_In_ D3D11_UAV_DIMENSION ViewDimension)
- {
- switch (ViewDimension)
- {
- case D3D11_UAV_DIMENSION_BUFFER:
- return "Buffer";
- case D3D11_UAV_DIMENSION_TEXTURE1D:
- return "RWTexture1D";
- case D3D11_UAV_DIMENSION_TEXTURE1DARRAY:
- return "RWTexture1DArray";
- case D3D11_UAV_DIMENSION_TEXTURE2D:
- return "RWTexture2D";
- case D3D11_UAV_DIMENSION_TEXTURE2DARRAY:
- return "RWTexture2DArray";
- case D3D11_UAV_DIMENSION_TEXTURE3D:
- return "RWTexture3D";
- }
- return "<unknown texture format>";
- }
- static LPCSTR GetRTVDimensionNameFromEnum(_In_ D3D11_RTV_DIMENSION ViewDimension)
- {
- switch (ViewDimension)
- {
- case D3D11_RTV_DIMENSION_BUFFER:
- return "Buffer";
- case D3D11_RTV_DIMENSION_TEXTURE1D:
- return "Texture1D";
- case D3D11_RTV_DIMENSION_TEXTURE1DARRAY:
- return "Texture1DArray";
- case D3D11_RTV_DIMENSION_TEXTURE2D:
- return "Texture2D";
- case D3D11_RTV_DIMENSION_TEXTURE2DARRAY:
- return "Texture2DArray";
- case D3D11_RTV_DIMENSION_TEXTURE2DMS:
- return "Texture2DMS";
- case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY:
- return "Texture2DMSArray";
- case D3D11_RTV_DIMENSION_TEXTURE3D:
- return "Texture3D";
- }
- return "<unknown texture format>";
- }
- static LPCSTR GetDSVDimensionNameFromEnum(_In_ D3D11_DSV_DIMENSION ViewDimension)
- {
- switch (ViewDimension)
- {
- case D3D11_DSV_DIMENSION_TEXTURE1D:
- return "Texture1D";
- case D3D11_DSV_DIMENSION_TEXTURE1DARRAY:
- return "Texture1DArray";
- case D3D11_DSV_DIMENSION_TEXTURE2D:
- return "Texture2D";
- case D3D11_DSV_DIMENSION_TEXTURE2DARRAY:
- return "Texture2DArray";
- case D3D11_DSV_DIMENSION_TEXTURE2DMS:
- return "Texture2DMS";
- case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY:
- return "Texture2DMSArray";
- }
- return "<unknown texture format>";
- }
- static HRESULT ValidateTextureType(_In_ ID3D11ShaderResourceView *pView, _In_ EObjectType ObjectType, _In_z_ LPCSTR pFuncName)
- {
- if (nullptr != pView)
- {
- D3D11_SHADER_RESOURCE_VIEW_DESC desc;
- pView->GetDesc(&desc);
- switch (ObjectType)
- {
- case EOT_Texture:
- if (desc.ViewDimension != D3D11_SRV_DIMENSION_BUFFER && desc.ViewDimension != D3D11_SRV_DIMENSION_BUFFEREX)
- return S_OK;
- break;
- case EOT_Buffer:
- if (desc.ViewDimension != D3D11_SRV_DIMENSION_BUFFER && desc.ViewDimension != D3D11_SRV_DIMENSION_BUFFEREX)
- break;
- if (desc.ViewDimension == D3D11_SRV_DIMENSION_BUFFEREX && (desc.BufferEx.Flags & D3D11_BUFFEREX_SRV_FLAG_RAW))
- {
- DPF(0, "%s: Resource type mismatch; %s expected, ByteAddressBuffer provided.", pFuncName, GetTextureTypeNameFromEnum(ObjectType));
- return E_INVALIDARG;
- }
- else
- {
- ID3D11Buffer* pBuffer = nullptr;
- pView->GetResource( (ID3D11Resource**)&pBuffer );
- assert( pBuffer != nullptr );
- D3D11_BUFFER_DESC BufDesc;
- pBuffer->GetDesc( &BufDesc );
- SAFE_RELEASE( pBuffer );
- if( BufDesc.MiscFlags & D3D11_RESOURCE_MISC_BUFFER_STRUCTURED )
- {
- DPF(0, "%s: Resource type mismatch; %s expected, StructuredBuffer provided.", pFuncName, GetTextureTypeNameFromEnum(ObjectType));
- return E_INVALIDARG;
- }
- else
- {
- return S_OK;
- }
- }
- break;
- case EOT_Texture1D:
- case EOT_Texture1DArray:
- if (desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE1D ||
- desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE1DARRAY)
- return S_OK;
- break;
- case EOT_Texture2D:
- case EOT_Texture2DArray:
- if (desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE2D ||
- desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE2DARRAY)
- return S_OK;
- break;
- case EOT_Texture2DMS:
- case EOT_Texture2DMSArray:
- if (desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE2DMS ||
- desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY)
- return S_OK;
- break;
- case EOT_Texture3D:
- if (desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE3D)
- return S_OK;
- break;
- case EOT_TextureCube:
- case EOT_TextureCubeArray:
- if (desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURECUBE ||
- desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURECUBEARRAY)
- return S_OK;
- break;
- case EOT_ByteAddressBuffer:
- if (desc.ViewDimension == D3D11_SRV_DIMENSION_BUFFEREX && (desc.BufferEx.Flags & D3D11_BUFFEREX_SRV_FLAG_RAW))
- return S_OK;
- break;
- case EOT_StructuredBuffer:
- if (desc.ViewDimension == D3D11_SRV_DIMENSION_BUFFEREX || desc.ViewDimension == D3D11_SRV_DIMENSION_BUFFER)
- {
- ID3D11Buffer* pBuffer = nullptr;
- pView->GetResource( (ID3D11Resource**)&pBuffer );
- assert( pBuffer != nullptr );
- D3D11_BUFFER_DESC BufDesc;
- pBuffer->GetDesc( &BufDesc );
- SAFE_RELEASE( pBuffer );
- if( BufDesc.MiscFlags & D3D11_RESOURCE_MISC_BUFFER_STRUCTURED )
- {
- return S_OK;
- }
- else
- {
- DPF(0, "%s: Resource type mismatch; %s expected, non-structured Buffer provided.", pFuncName, GetTextureTypeNameFromEnum(ObjectType));
- return E_INVALIDARG;
- }
- }
- break;
- default:
- assert(0); // internal error, should never get here
- return E_FAIL;
- }
-
- DPF(0, "%s: Resource type mismatch; %s expected, %s provided.", pFuncName, GetTextureTypeNameFromEnum(ObjectType), GetSRVDimensionNameFromEnum(desc.ViewDimension));
- return E_INVALIDARG;
- }
- return S_OK;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderResourceVariable<IBaseInterface>::SetResource(ID3D11ShaderResourceView *pResource)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3DX11EffectShaderResourceVariable::SetResource";
- VH(ValidateTextureType(pResource, pType->ObjectType, pFuncName));
- #endif
- // Texture variables don't need to be dirtied.
- SAFE_ADDREF(pResource);
- SAFE_RELEASE(Data.pShaderResource->pShaderResource);
- Data.pShaderResource->pShaderResource = pResource;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderResourceVariable<IBaseInterface>::GetResource(ID3D11ShaderResourceView **ppResource)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3DX11EffectShaderResourceVariable::GetResource";
- VERIFYPARAMETER(ppResource);
- #endif
- assert(Data.pShaderResource != 0 && Data.pShaderResource->pShaderResource != 0);
- _Analysis_assume_(Data.pShaderResource != 0 && Data.pShaderResource->pShaderResource != 0);
- *ppResource = Data.pShaderResource->pShaderResource;
- SAFE_ADDREF(*ppResource);
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderResourceVariable<IBaseInterface>::SetResourceArray(ID3D11ShaderResourceView **ppResources, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderResourceVariable::SetResourceArray";
- CHECK_OBJECT_ARRAY_BOUNDS(Offset, Count, ppResources);
- #ifdef _DEBUG
- for (size_t i = 0; i < Count; ++ i)
- {
- VH(ValidateTextureType(ppResources[i], pType->ObjectType, pFuncName));
- }
- #endif
- // Texture variables don't need to be dirtied.
- for (size_t i = 0; i < Count; ++ i)
- {
- SShaderResource *pResourceBlock = Data.pShaderResource + Offset + i;
- SAFE_ADDREF(ppResources[i]);
- SAFE_RELEASE(pResourceBlock->pShaderResource);
- pResourceBlock->pShaderResource = ppResources[i];
- }
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderResourceVariable<IBaseInterface>::GetResourceArray(ID3D11ShaderResourceView **ppResources, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderResourceVariable::GetResourceArray";
- CHECK_OBJECT_ARRAY_BOUNDS(Offset, Count, ppResources);
- for (size_t i = 0; i < Count; ++ i)
- {
- ppResources[i] = (Data.pShaderResource + Offset + i)->pShaderResource;
- SAFE_ADDREF(ppResources[i]);
- }
- lExit:
- return hr;
- }
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectUnorderedAccessViewVariable (TUnorderedAccessViewVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TUnorderedAccessViewVariable : public IBaseInterface
- {
- STDMETHOD(SetUnorderedAccessView)(_In_ ID3D11UnorderedAccessView *pResource) override;
- STDMETHOD(GetUnorderedAccessView)(_Outptr_ ID3D11UnorderedAccessView **ppResource) override;
- STDMETHOD(SetUnorderedAccessViewArray)(_In_reads_(Count) ID3D11UnorderedAccessView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetUnorderedAccessViewArray)(_Out_writes_(Count) ID3D11UnorderedAccessView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- };
- static HRESULT ValidateTextureType(_In_ ID3D11UnorderedAccessView *pView, _In_ EObjectType ObjectType, _In_z_ LPCSTR pFuncName)
- {
- if (nullptr != pView)
- {
- D3D11_UNORDERED_ACCESS_VIEW_DESC desc;
- pView->GetDesc(&desc);
- switch (ObjectType)
- {
- case EOT_RWBuffer:
- if (desc.ViewDimension != D3D11_UAV_DIMENSION_BUFFER)
- break;
- if (desc.Buffer.Flags & D3D11_BUFFER_UAV_FLAG_RAW)
- {
- DPF(0, "%s: Resource type mismatch; %s expected, RWByteAddressBuffer provided.", pFuncName, GetTextureTypeNameFromEnum(ObjectType));
- return E_INVALIDARG;
- }
- else
- {
- ID3D11Buffer* pBuffer = nullptr;
- pView->GetResource( (ID3D11Resource**)&pBuffer );
- assert( pBuffer != nullptr );
- D3D11_BUFFER_DESC BufDesc;
- pBuffer->GetDesc( &BufDesc );
- SAFE_RELEASE( pBuffer );
- if( BufDesc.MiscFlags & D3D11_RESOURCE_MISC_BUFFER_STRUCTURED )
- {
- DPF(0, "%s: Resource type mismatch; %s expected, an RWStructuredBuffer provided.", pFuncName, GetTextureTypeNameFromEnum(ObjectType));
- return E_INVALIDARG;
- }
- else
- {
- return S_OK;
- }
- }
- break;
- case EOT_RWTexture1D:
- case EOT_RWTexture1DArray:
- if (desc.ViewDimension == D3D11_UAV_DIMENSION_TEXTURE1D ||
- desc.ViewDimension == D3D11_UAV_DIMENSION_TEXTURE1DARRAY)
- return S_OK;
- break;
- case EOT_RWTexture2D:
- case EOT_RWTexture2DArray:
- if (desc.ViewDimension == D3D11_UAV_DIMENSION_TEXTURE2D ||
- desc.ViewDimension == D3D11_UAV_DIMENSION_TEXTURE2DARRAY)
- return S_OK;
- break;
- case EOT_RWTexture3D:
- if (desc.ViewDimension == D3D11_UAV_DIMENSION_TEXTURE3D)
- return S_OK;
- break;
- case EOT_RWByteAddressBuffer:
- if (desc.ViewDimension == D3D11_UAV_DIMENSION_BUFFER && (desc.Buffer.Flags & D3D11_BUFFER_UAV_FLAG_RAW))
- return S_OK;
- break;
- case EOT_RWStructuredBuffer:
- if (desc.ViewDimension == D3D11_UAV_DIMENSION_BUFFER)
- {
- ID3D11Buffer* pBuffer = nullptr;
- pView->GetResource( (ID3D11Resource**)&pBuffer );
- assert( pBuffer != nullptr );
- D3D11_BUFFER_DESC BufDesc;
- pBuffer->GetDesc( &BufDesc );
- SAFE_RELEASE( pBuffer );
- if( BufDesc.MiscFlags & D3D11_RESOURCE_MISC_BUFFER_STRUCTURED )
- {
- return S_OK;
- }
- else
- {
- DPF(0, "%s: Resource type mismatch; %s expected, non-structured Buffer provided.", pFuncName, GetTextureTypeNameFromEnum(ObjectType));
- return E_INVALIDARG;
- }
- }
- break;
- case EOT_RWStructuredBufferAlloc:
- case EOT_RWStructuredBufferConsume:
- if (desc.ViewDimension != D3D11_UAV_DIMENSION_BUFFER)
- break;
- if (desc.Buffer.Flags & D3D11_BUFFER_UAV_FLAG_COUNTER)
- {
- return S_OK;
- }
- else
- {
- DPF(0, "%s: Resource type mismatch; %s expected, non-Counter buffer provided.", pFuncName, GetTextureTypeNameFromEnum(ObjectType));
- return E_INVALIDARG;
- }
- break;
- case EOT_AppendStructuredBuffer:
- case EOT_ConsumeStructuredBuffer:
- if (desc.ViewDimension != D3D11_UAV_DIMENSION_BUFFER)
- break;
- if (desc.Buffer.Flags & D3D11_BUFFER_UAV_FLAG_APPEND)
- {
- return S_OK;
- }
- else
- {
- DPF(0, "%s: Resource type mismatch; %s expected, non-Append buffer provided.", pFuncName, GetTextureTypeNameFromEnum(ObjectType));
- return E_INVALIDARG;
- }
- break;
- default:
- assert(0); // internal error, should never get here
- return E_FAIL;
- }
- DPF(0, "%s: Resource type mismatch; %s expected, %s provided.", pFuncName, GetTextureTypeNameFromEnum(ObjectType), GetUAVDimensionNameFromEnum(desc.ViewDimension));
- return E_INVALIDARG;
- }
- return S_OK;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TUnorderedAccessViewVariable<IBaseInterface>::SetUnorderedAccessView(ID3D11UnorderedAccessView *pResource)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3DX11EffectUnorderedAccessViewVariable::SetUnorderedAccessView";
- VH(ValidateTextureType(pResource, pType->ObjectType, pFuncName));
- #endif
- // UAV variables don't need to be dirtied.
- SAFE_ADDREF(pResource);
- SAFE_RELEASE(Data.pUnorderedAccessView->pUnorderedAccessView);
- Data.pUnorderedAccessView->pUnorderedAccessView = pResource;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TUnorderedAccessViewVariable<IBaseInterface>::GetUnorderedAccessView(ID3D11UnorderedAccessView **ppResource)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3DX11EffectUnorderedAccessViewVariable::GetUnorderedAccessView";
- VERIFYPARAMETER(ppResource);
- #endif
- assert(Data.pUnorderedAccessView != 0 && Data.pUnorderedAccessView->pUnorderedAccessView != 0);
- _Analysis_assume_(Data.pUnorderedAccessView != 0 && Data.pUnorderedAccessView->pUnorderedAccessView != 0);
- *ppResource = Data.pUnorderedAccessView->pUnorderedAccessView;
- SAFE_ADDREF(*ppResource);
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TUnorderedAccessViewVariable<IBaseInterface>::SetUnorderedAccessViewArray(ID3D11UnorderedAccessView **ppResources, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectUnorderedAccessViewVariable::SetUnorderedAccessViewArray";
- CHECK_OBJECT_ARRAY_BOUNDS(Offset, Count, ppResources);
- #ifdef _DEBUG
- for (size_t i = 0; i < Count; ++ i)
- {
- VH(ValidateTextureType(ppResources[i], pType->ObjectType, pFuncName));
- }
- #endif
- // Texture variables don't need to be dirtied.
- for (size_t i = 0; i < Count; ++ i)
- {
- SUnorderedAccessView *pResourceBlock = Data.pUnorderedAccessView + Offset + i;
- SAFE_ADDREF(ppResources[i]);
- SAFE_RELEASE(pResourceBlock->pUnorderedAccessView);
- pResourceBlock->pUnorderedAccessView = ppResources[i];
- }
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TUnorderedAccessViewVariable<IBaseInterface>::GetUnorderedAccessViewArray(ID3D11UnorderedAccessView **ppResources, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectUnorderedAccessViewVariable::GetUnorderedAccessViewArray";
- CHECK_OBJECT_ARRAY_BOUNDS(Offset, Count, ppResources);
- for (size_t i = 0; i < Count; ++ i)
- {
- ppResources[i] = (Data.pUnorderedAccessView + Offset + i)->pUnorderedAccessView;
- SAFE_ADDREF(ppResources[i]);
- }
- lExit:
- return hr;
- }
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectRenderTargetViewVariable (TRenderTargetViewVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TRenderTargetViewVariable : public IBaseInterface
- {
- STDMETHOD(SetRenderTarget)(_In_ ID3D11RenderTargetView *pResource) override;
- STDMETHOD(GetRenderTarget)(_Outptr_ ID3D11RenderTargetView **ppResource) override;
- STDMETHOD(SetRenderTargetArray)(_In_reads_(Count) ID3D11RenderTargetView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetRenderTargetArray)(_Out_writes_(Count) ID3D11RenderTargetView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- };
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TRenderTargetViewVariable<IBaseInterface>::SetRenderTarget(ID3D11RenderTargetView *pResource)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3DX11EffectRenderTargetVariable::SetRenderTarget";
- #endif
- // Texture variables don't need to be dirtied.
- SAFE_ADDREF(pResource);
- SAFE_RELEASE(Data.pRenderTargetView->pRenderTargetView);
- Data.pRenderTargetView->pRenderTargetView = pResource;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TRenderTargetViewVariable<IBaseInterface>::GetRenderTarget(ID3D11RenderTargetView **ppResource)
- {
- HRESULT hr = S_OK;
- assert(Data.pRenderTargetView->pRenderTargetView != 0);
- _Analysis_assume_(Data.pRenderTargetView->pRenderTargetView != 0);
- *ppResource = Data.pRenderTargetView->pRenderTargetView;
- SAFE_ADDREF(*ppResource);
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TRenderTargetViewVariable<IBaseInterface>::SetRenderTargetArray(ID3D11RenderTargetView **ppResources, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectRenderTargetVariable::SetRenderTargetArray";
- CHECK_OBJECT_ARRAY_BOUNDS(Offset, Count, ppResources);
- // Texture variables don't need to be dirtied.
- for (size_t i = 0; i < Count; ++ i)
- {
- SRenderTargetView *pResourceBlock = Data.pRenderTargetView + Offset + i;
- SAFE_ADDREF(ppResources[i]);
- SAFE_RELEASE(pResourceBlock->pRenderTargetView);
- pResourceBlock->pRenderTargetView = ppResources[i];
- }
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TRenderTargetViewVariable<IBaseInterface>::GetRenderTargetArray(ID3D11RenderTargetView **ppResources, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3DX11EffectRenderTargetVariable::GetRenderTargetArray";
- CHECK_OBJECT_ARRAY_BOUNDS(Offset, Count, ppResources);
- for (size_t i = 0; i < Count; ++ i)
- {
- ppResources[i] = (Data.pRenderTargetView + Offset + i)->pRenderTargetView;
- SAFE_ADDREF(ppResources[i]);
- }
- lExit:
- return hr;
- }
- //////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectDepthStencilViewVariable (TDepthStencilViewVariable implementation)
- //////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TDepthStencilViewVariable : public IBaseInterface
- {
- STDMETHOD(SetDepthStencil)(_In_ ID3D11DepthStencilView *pResource) override;
- STDMETHOD(GetDepthStencil)(_Outptr_ ID3D11DepthStencilView **ppResource) override;
- STDMETHOD(SetDepthStencilArray)(_In_reads_(Count) ID3D11DepthStencilView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- STDMETHOD(GetDepthStencilArray)(_Out_writes_(Count) ID3D11DepthStencilView **ppResources, _In_ uint32_t Offset, _In_ uint32_t Count) override;
- };
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TDepthStencilViewVariable<IBaseInterface>::SetDepthStencil(ID3D11DepthStencilView *pResource)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3D11DepthStencilViewVariable::SetDepthStencil";
- #endif
- // Texture variables don't need to be dirtied.
- SAFE_ADDREF(pResource);
- SAFE_RELEASE(Data.pDepthStencilView->pDepthStencilView);
- Data.pDepthStencilView->pDepthStencilView = pResource;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TDepthStencilViewVariable<IBaseInterface>::GetDepthStencil(ID3D11DepthStencilView **ppResource)
- {
- HRESULT hr = S_OK;
- #ifdef _DEBUG
- static LPCSTR pFuncName = "ID3D11DepthStencilViewVariable::GetDepthStencil";
- VERIFYPARAMETER(ppResource);
- #endif
- assert(Data.pDepthStencilView->pDepthStencilView != 0);
- _Analysis_assume_(Data.pDepthStencilView->pDepthStencilView != 0);
- *ppResource = Data.pDepthStencilView->pDepthStencilView;
- SAFE_ADDREF(*ppResource);
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TDepthStencilViewVariable<IBaseInterface>::SetDepthStencilArray(ID3D11DepthStencilView **ppResources, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3D11DepthStencilViewVariable::SetDepthStencilArray";
- CHECK_OBJECT_ARRAY_BOUNDS(Offset, Count, ppResources);
- // Texture variables don't need to be dirtied.
- for (size_t i = 0; i < Count; ++ i)
- {
- SDepthStencilView *pResourceBlock = Data.pDepthStencilView + Offset + i;
- SAFE_ADDREF(ppResources[i]);
- SAFE_RELEASE(pResourceBlock->pDepthStencilView);
- pResourceBlock->pDepthStencilView = ppResources[i];
- }
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TDepthStencilViewVariable<IBaseInterface>::GetDepthStencilArray(ID3D11DepthStencilView **ppResources, uint32_t Offset, uint32_t Count)
- {
- static LPCSTR pFuncName = "ID3D11DepthStencilViewVariable::GetDepthStencilArray";
- CHECK_OBJECT_ARRAY_BOUNDS(Offset, Count, ppResources);
- for (size_t i = 0; i < Count; ++ i)
- {
- ppResources[i] = (Data.pDepthStencilView + Offset + i)->pDepthStencilView;
- SAFE_ADDREF(ppResources[i]);
- }
- lExit:
- return hr;
- }
- ////////////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectShaderVariable (TShaderVariable implementation)
- ////////////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TShaderVariable : public IBaseInterface
- {
- STDMETHOD(GetShaderDesc)(_In_ uint32_t ShaderIndex, _Out_ D3DX11_EFFECT_SHADER_DESC *pDesc) override;
- STDMETHOD(GetVertexShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11VertexShader **ppVS) override;
- STDMETHOD(GetGeometryShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11GeometryShader **ppGS) override;
- STDMETHOD(GetPixelShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11PixelShader **ppPS) override;
- STDMETHOD(GetHullShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11HullShader **ppHS) override;
- STDMETHOD(GetDomainShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11DomainShader **ppDS) override;
- STDMETHOD(GetComputeShader)(_In_ uint32_t ShaderIndex, _Outptr_ ID3D11ComputeShader **ppCS) override;
- STDMETHOD(GetInputSignatureElementDesc)(_In_ uint32_t ShaderIndex, _In_ uint32_t Element, _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) override;
- STDMETHOD(GetOutputSignatureElementDesc)(_In_ uint32_t ShaderIndex, _In_ uint32_t Element, _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) override;
- STDMETHOD(GetPatchConstantSignatureElementDesc)(_In_ uint32_t ShaderIndex, _In_ uint32_t Element, _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) override;
- STDMETHOD_(bool, IsValid)();
- };
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderVariable<IBaseInterface>::GetShaderDesc(uint32_t ShaderIndex, D3DX11_EFFECT_SHADER_DESC *pDesc)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderVariable::GetShaderDesc";
- CHECK_OBJECT_SCALAR_BOUNDS(ShaderIndex, pDesc);
- hr = Data.pShader[ShaderIndex].GetShaderDesc(pDesc, false);
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderVariable<IBaseInterface>::GetVertexShader(uint32_t ShaderIndex, ID3D11VertexShader **ppVS)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderVariable::GetVertexShader";
- CHECK_OBJECT_SCALAR_BOUNDS(ShaderIndex, ppVS);
- VH( Data.pShader[ShaderIndex].GetVertexShader(ppVS) );
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderVariable<IBaseInterface>::GetGeometryShader(uint32_t ShaderIndex, ID3D11GeometryShader **ppGS)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderVariable::GetGeometryShader";
- CHECK_OBJECT_SCALAR_BOUNDS(ShaderIndex, ppGS);
- VH( Data.pShader[ShaderIndex].GetGeometryShader(ppGS) );
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderVariable<IBaseInterface>::GetPixelShader(uint32_t ShaderIndex, ID3D11PixelShader **ppPS)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderVariable::GetPixelShader";
- CHECK_OBJECT_SCALAR_BOUNDS(ShaderIndex, ppPS);
- VH( Data.pShader[ShaderIndex].GetPixelShader(ppPS) );
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderVariable<IBaseInterface>::GetHullShader(uint32_t ShaderIndex, ID3D11HullShader **ppHS)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderVariable::GetHullShader";
- CHECK_OBJECT_SCALAR_BOUNDS(ShaderIndex, ppHS);
- VH( Data.pShader[ShaderIndex].GetHullShader(ppHS) );
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderVariable<IBaseInterface>::GetDomainShader(uint32_t ShaderIndex, ID3D11DomainShader **ppDS)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderVariable::GetDomainShader";
- CHECK_OBJECT_SCALAR_BOUNDS(ShaderIndex, ppDS);
- VH( Data.pShader[ShaderIndex].GetDomainShader(ppDS) );
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderVariable<IBaseInterface>::GetComputeShader(uint32_t ShaderIndex, ID3D11ComputeShader **ppCS)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderVariable::GetComputeShader";
- CHECK_OBJECT_SCALAR_BOUNDS(ShaderIndex, ppCS);
- VH( Data.pShader[ShaderIndex].GetComputeShader(ppCS) );
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderVariable<IBaseInterface>::GetInputSignatureElementDesc(uint32_t ShaderIndex, uint32_t Element, D3D11_SIGNATURE_PARAMETER_DESC *pDesc)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderVariable::GetInputSignatureElementDesc";
- CHECK_OBJECT_SCALAR_BOUNDS(ShaderIndex, pDesc);
- VH( Data.pShader[ShaderIndex].GetSignatureElementDesc(SShaderBlock::ST_Input, Element, pDesc) );
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderVariable<IBaseInterface>::GetOutputSignatureElementDesc(uint32_t ShaderIndex, uint32_t Element, D3D11_SIGNATURE_PARAMETER_DESC *pDesc)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderVariable::GetOutputSignatureElementDesc";
- CHECK_OBJECT_SCALAR_BOUNDS(ShaderIndex, pDesc);
- VH( Data.pShader[ShaderIndex].GetSignatureElementDesc(SShaderBlock::ST_Output, Element, pDesc) );
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TShaderVariable<IBaseInterface>::GetPatchConstantSignatureElementDesc(uint32_t ShaderIndex, uint32_t Element, D3D11_SIGNATURE_PARAMETER_DESC *pDesc)
- {
- static LPCSTR pFuncName = "ID3DX11EffectShaderVariable::GetPatchConstantSignatureElementDesc";
- CHECK_OBJECT_SCALAR_BOUNDS(ShaderIndex, pDesc);
- VH( Data.pShader[ShaderIndex].GetSignatureElementDesc(SShaderBlock::ST_PatchConstant, Element, pDesc) );
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- bool TShaderVariable<IBaseInterface>::IsValid()
- {
- uint32_t numElements = IsArray()? pType->Elements : 1;
- bool valid = true;
- while( numElements > 0 && ( valid = Data.pShader[ numElements-1 ].IsValid ) )
- numElements--;
- return valid;
- }
- ////////////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectBlendVariable (TBlendVariable implementation)
- ////////////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TBlendVariable : public IBaseInterface
- {
- public:
- STDMETHOD(GetBlendState)(_In_ uint32_t Index, _Outptr_ ID3D11BlendState **ppState) override;
- STDMETHOD(SetBlendState)(_In_ uint32_t Index, _In_ ID3D11BlendState *pState) override;
- STDMETHOD(UndoSetBlendState)(_In_ uint32_t Index) override;
- STDMETHOD(GetBackingStore)(_In_ uint32_t Index, _Out_ D3D11_BLEND_DESC *pDesc) override;
- STDMETHOD_(bool, IsValid)() override;
- };
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TBlendVariable<IBaseInterface>::GetBlendState(uint32_t Index, ID3D11BlendState **ppState)
- {
- static LPCSTR pFuncName = "ID3DX11EffectBlendVariable::GetBlendState";
- CHECK_OBJECT_SCALAR_BOUNDS(Index, ppState);
- assert(Data.pBlend[Index].pBlendObject != 0);
- _Analysis_assume_(Data.pBlend[Index].pBlendObject != 0);
- *ppState = Data.pBlend[Index].pBlendObject;
- SAFE_ADDREF(*ppState);
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TBlendVariable<IBaseInterface>::SetBlendState(uint32_t Index, ID3D11BlendState *pState)
- {
- static LPCSTR pFuncName = "ID3DX11EffectBlendState::SetBlendState";
- CHECK_SCALAR_BOUNDS(Index);
- if( !Data.pBlend[Index].IsUserManaged )
- {
- // Save original state object in case we UndoSet
- assert( pMemberData[Index].Type == MDT_BlendState );
- VB( pMemberData[Index].Data.pD3DEffectsManagedBlendState == nullptr );
- pMemberData[Index].Data.pD3DEffectsManagedBlendState = Data.pBlend[Index].pBlendObject;
- Data.pBlend[Index].pBlendObject = nullptr;
- Data.pBlend[Index].IsUserManaged = true;
- }
- SAFE_ADDREF( pState );
- SAFE_RELEASE( Data.pBlend[Index].pBlendObject );
- Data.pBlend[Index].pBlendObject = pState;
- Data.pBlend[Index].IsValid = true;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TBlendVariable<IBaseInterface>::UndoSetBlendState(uint32_t Index)
- {
- static LPCSTR pFuncName = "ID3DX11EffectBlendState::UndoSetBlendState";
- CHECK_SCALAR_BOUNDS(Index);
- if( !Data.pBlend[Index].IsUserManaged )
- {
- return S_FALSE;
- }
- // Revert to original state object
- SAFE_RELEASE( Data.pBlend[Index].pBlendObject );
- Data.pBlend[Index].pBlendObject = pMemberData[Index].Data.pD3DEffectsManagedBlendState;
- pMemberData[Index].Data.pD3DEffectsManagedBlendState = nullptr;
- Data.pBlend[Index].IsUserManaged = false;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TBlendVariable<IBaseInterface>::GetBackingStore(uint32_t Index, D3D11_BLEND_DESC *pBlendDesc)
- {
- static LPCSTR pFuncName = "ID3DX11EffectBlendVariable::GetBackingStore";
- CHECK_OBJECT_SCALAR_BOUNDS(Index, pBlendDesc);
- if( Data.pBlend[Index].IsUserManaged )
- {
- if( Data.pBlend[Index].pBlendObject )
- {
- Data.pBlend[Index].pBlendObject->GetDesc( pBlendDesc );
- }
- else
- {
- *pBlendDesc = CD3D11_BLEND_DESC( D3D11_DEFAULT );
- }
- }
- else
- {
- SBlendBlock *pBlock = Data.pBlend + Index;
- if (pBlock->ApplyAssignments(GetTopLevelEntity()->pEffect))
- {
- pBlock->pAssignments[0].LastRecomputedTime = 0; // Force a recreate of this block the next time ApplyRenderStateBlock is called
- }
- memcpy( pBlendDesc, &pBlock->BackingStore, sizeof(D3D11_BLEND_DESC) );
- }
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- bool TBlendVariable<IBaseInterface>::IsValid()
- {
- uint32_t numElements = IsArray()? pType->Elements : 1;
- bool valid = true;
- while( numElements > 0 && ( valid = Data.pBlend[ numElements-1 ].IsValid ) )
- numElements--;
- return valid;
- }
- ////////////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectDepthStencilVariable (TDepthStencilVariable implementation)
- ////////////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TDepthStencilVariable : public IBaseInterface
- {
- public:
- STDMETHOD(GetDepthStencilState)(_In_ uint32_t Index, _Outptr_ ID3D11DepthStencilState **ppState) override;
- STDMETHOD(SetDepthStencilState)(_In_ uint32_t Index, _In_ ID3D11DepthStencilState *pState) override;
- STDMETHOD(UndoSetDepthStencilState)(_In_ uint32_t Index) override;
- STDMETHOD(GetBackingStore)(_In_ uint32_t Index, _Out_ D3D11_DEPTH_STENCIL_DESC *pDesc) override;
- STDMETHOD_(bool, IsValid)() override;
- };
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TDepthStencilVariable<IBaseInterface>::GetDepthStencilState(uint32_t Index, ID3D11DepthStencilState **ppState)
- {
- static LPCSTR pFuncName = "ID3DX11EffectDepthStencilVariable::GetDepthStencilState";
- CHECK_OBJECT_SCALAR_BOUNDS(Index, ppState);
- assert(Data.pDepthStencil[Index].pDSObject != 0);
- _Analysis_assume_(Data.pDepthStencil[Index].pDSObject != 0);
- *ppState = Data.pDepthStencil[Index].pDSObject;
- SAFE_ADDREF(*ppState);
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TDepthStencilVariable<IBaseInterface>::SetDepthStencilState(uint32_t Index, ID3D11DepthStencilState *pState)
- {
- static LPCSTR pFuncName = "ID3DX11EffectDepthStencilState::SetDepthStencilState";
- CHECK_SCALAR_BOUNDS(Index);
- if( !Data.pDepthStencil[Index].IsUserManaged )
- {
- // Save original state object in case we UndoSet
- assert( pMemberData[Index].Type == MDT_DepthStencilState );
- VB( pMemberData[Index].Data.pD3DEffectsManagedDepthStencilState == nullptr );
- pMemberData[Index].Data.pD3DEffectsManagedDepthStencilState = Data.pDepthStencil[Index].pDSObject;
- Data.pDepthStencil[Index].pDSObject = nullptr;
- Data.pDepthStencil[Index].IsUserManaged = true;
- }
- SAFE_ADDREF( pState );
- SAFE_RELEASE( Data.pDepthStencil[Index].pDSObject );
- Data.pDepthStencil[Index].pDSObject = pState;
- Data.pDepthStencil[Index].IsValid = true;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- HRESULT TDepthStencilVariable<IBaseInterface>::UndoSetDepthStencilState(_In_ uint32_t Index)
- {
- static LPCSTR pFuncName = "ID3DX11EffectDepthStencilState::UndoSetDepthStencilState";
- CHECK_SCALAR_BOUNDS(Index);
- if( !Data.pDepthStencil[Index].IsUserManaged )
- {
- return S_FALSE;
- }
- // Revert to original state object
- SAFE_RELEASE( Data.pDepthStencil[Index].pDSObject );
- Data.pDepthStencil[Index].pDSObject = pMemberData[Index].Data.pD3DEffectsManagedDepthStencilState;
- pMemberData[Index].Data.pD3DEffectsManagedDepthStencilState = nullptr;
- Data.pDepthStencil[Index].IsUserManaged = false;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TDepthStencilVariable<IBaseInterface>::GetBackingStore(uint32_t Index, D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc)
- {
- static LPCSTR pFuncName = "ID3DX11EffectDepthStencilVariable::GetBackingStore";
- CHECK_OBJECT_SCALAR_BOUNDS(Index, pDepthStencilDesc);
- if( Data.pDepthStencil[Index].IsUserManaged )
- {
- if( Data.pDepthStencil[Index].pDSObject )
- {
- Data.pDepthStencil[Index].pDSObject->GetDesc( pDepthStencilDesc );
- }
- else
- {
- *pDepthStencilDesc = CD3D11_DEPTH_STENCIL_DESC( D3D11_DEFAULT );
- }
- }
- else
- {
- SDepthStencilBlock *pBlock = Data.pDepthStencil + Index;
- if (pBlock->ApplyAssignments(GetTopLevelEntity()->pEffect))
- {
- pBlock->pAssignments[0].LastRecomputedTime = 0; // Force a recreate of this block the next time ApplyRenderStateBlock is called
- }
- memcpy(pDepthStencilDesc, &pBlock->BackingStore, sizeof(D3D11_DEPTH_STENCIL_DESC));
- }
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- bool TDepthStencilVariable<IBaseInterface>::IsValid()
- {
- uint32_t numElements = IsArray()? pType->Elements : 1;
- bool valid = true;
- while( numElements > 0 && ( valid = Data.pDepthStencil[ numElements-1 ].IsValid ) )
- numElements--;
- return valid;
- }
- ////////////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectRasterizerVariable (TRasterizerVariable implementation)
- ////////////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TRasterizerVariable : public IBaseInterface
- {
- public:
- STDMETHOD(GetRasterizerState)(_In_ uint32_t Index, _Outptr_ ID3D11RasterizerState **ppState) override;
- STDMETHOD(SetRasterizerState)(_In_ uint32_t Index, _In_ ID3D11RasterizerState *pState) override;
- STDMETHOD(UndoSetRasterizerState)(_In_ uint32_t Index) override;
- STDMETHOD(GetBackingStore)(_In_ uint32_t Index, _Out_ D3D11_RASTERIZER_DESC *pDesc) override;
- STDMETHOD_(bool, IsValid)() override;
- };
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TRasterizerVariable<IBaseInterface>::GetRasterizerState(uint32_t Index, ID3D11RasterizerState **ppState)
- {
- static LPCSTR pFuncName = "ID3DX11EffectRasterizerVariable::GetRasterizerState";
- CHECK_OBJECT_SCALAR_BOUNDS(Index, ppState);
- assert(Data.pRasterizer[Index].pRasterizerObject != 0);
- _Analysis_assume_(Data.pRasterizer[Index].pRasterizerObject != 0);
- *ppState = Data.pRasterizer[Index].pRasterizerObject;
- SAFE_ADDREF(*ppState);
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TRasterizerVariable<IBaseInterface>::SetRasterizerState(uint32_t Index, ID3D11RasterizerState *pState)
- {
- static LPCSTR pFuncName = "ID3DX11EffectRasterizerState::SetRasterizerState";
- CHECK_SCALAR_BOUNDS(Index);
- if( !Data.pRasterizer[Index].IsUserManaged )
- {
- // Save original state object in case we UndoSet
- assert( pMemberData[Index].Type == MDT_RasterizerState );
- VB( pMemberData[Index].Data.pD3DEffectsManagedRasterizerState == nullptr );
- pMemberData[Index].Data.pD3DEffectsManagedRasterizerState = Data.pRasterizer[Index].pRasterizerObject;
- Data.pRasterizer[Index].pRasterizerObject = nullptr;
- Data.pRasterizer[Index].IsUserManaged = true;
- }
- SAFE_ADDREF( pState );
- SAFE_RELEASE( Data.pRasterizer[Index].pRasterizerObject );
- Data.pRasterizer[Index].pRasterizerObject = pState;
- Data.pRasterizer[Index].IsValid = true;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TRasterizerVariable<IBaseInterface>::UndoSetRasterizerState(uint32_t Index)
- {
- static LPCSTR pFuncName = "ID3DX11EffectRasterizerState::UndoSetRasterizerState";
- CHECK_SCALAR_BOUNDS(Index);
- if( !Data.pRasterizer[Index].IsUserManaged )
- {
- return S_FALSE;
- }
- // Revert to original state object
- SAFE_RELEASE( Data.pRasterizer[Index].pRasterizerObject );
- Data.pRasterizer[Index].pRasterizerObject = pMemberData[Index].Data.pD3DEffectsManagedRasterizerState;
- pMemberData[Index].Data.pD3DEffectsManagedRasterizerState = nullptr;
- Data.pRasterizer[Index].IsUserManaged = false;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TRasterizerVariable<IBaseInterface>::GetBackingStore(uint32_t Index, D3D11_RASTERIZER_DESC *pRasterizerDesc)
- {
- static LPCSTR pFuncName = "ID3DX11EffectRasterizerVariable::GetBackingStore";
- CHECK_OBJECT_SCALAR_BOUNDS(Index, pRasterizerDesc);
- if( Data.pRasterizer[Index].IsUserManaged )
- {
- if( Data.pRasterizer[Index].pRasterizerObject )
- {
- Data.pRasterizer[Index].pRasterizerObject->GetDesc( pRasterizerDesc );
- }
- else
- {
- *pRasterizerDesc = CD3D11_RASTERIZER_DESC( D3D11_DEFAULT );
- }
- }
- else
- {
- SRasterizerBlock *pBlock = Data.pRasterizer + Index;
- if (pBlock->ApplyAssignments(GetTopLevelEntity()->pEffect))
- {
- pBlock->pAssignments[0].LastRecomputedTime = 0; // Force a recreate of this block the next time ApplyRenderStateBlock is called
- }
- memcpy(pRasterizerDesc, &pBlock->BackingStore, sizeof(D3D11_RASTERIZER_DESC));
- }
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- bool TRasterizerVariable<IBaseInterface>::IsValid()
- {
- uint32_t numElements = IsArray()? pType->Elements : 1;
- bool valid = true;
- while( numElements > 0 && ( valid = Data.pRasterizer[ numElements-1 ].IsValid ) )
- numElements--;
- return valid;
- }
- ////////////////////////////////////////////////////////////////////////////////
- // ID3DX11EffectSamplerVariable (TSamplerVariable implementation)
- ////////////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TSamplerVariable : public IBaseInterface
- {
- public:
- STDMETHOD(GetSampler)(_In_ uint32_t Index, _Outptr_ ID3D11SamplerState **ppSampler) override;
- STDMETHOD(SetSampler)(_In_ uint32_t Index, _In_ ID3D11SamplerState *pSampler) override;
- STDMETHOD(UndoSetSampler)(_In_ uint32_t Index) override;
- STDMETHOD(GetBackingStore)(_In_ uint32_t Index, _Out_ D3D11_SAMPLER_DESC *pDesc) override;
- };
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TSamplerVariable<IBaseInterface>::GetSampler(uint32_t Index, ID3D11SamplerState **ppSampler)
- {
- static LPCSTR pFuncName = "ID3DX11EffectSamplerVariable::GetSampler";
- CHECK_OBJECT_SCALAR_BOUNDS(Index, ppSampler);
- _Analysis_assume_( Data.pSampler[Index].pD3DObject != 0 );
- *ppSampler = Data.pSampler[Index].pD3DObject;
- SAFE_ADDREF(*ppSampler);
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TSamplerVariable<IBaseInterface>::SetSampler(uint32_t Index, ID3D11SamplerState *pSampler)
- {
- static LPCSTR pFuncName = "ID3DX11EffectSamplerState::SetSampler";
- CHECK_SCALAR_BOUNDS(Index);
- // Replace all references to the old shader block with this one
- GetEffect()->ReplaceSamplerReference(&Data.pSampler[Index], pSampler);
- if( !Data.pSampler[Index].IsUserManaged )
- {
- // Save original state object in case we UndoSet
- assert( pMemberData[Index].Type == MDT_SamplerState );
- VB( pMemberData[Index].Data.pD3DEffectsManagedSamplerState == nullptr );
- pMemberData[Index].Data.pD3DEffectsManagedSamplerState = Data.pSampler[Index].pD3DObject;
- Data.pSampler[Index].pD3DObject = nullptr;
- Data.pSampler[Index].IsUserManaged = true;
- }
- SAFE_ADDREF( pSampler );
- SAFE_RELEASE( Data.pSampler[Index].pD3DObject );
- Data.pSampler[Index].pD3DObject = pSampler;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- HRESULT TSamplerVariable<IBaseInterface>::UndoSetSampler(_In_ uint32_t Index)
- {
- static LPCSTR pFuncName = "ID3DX11EffectSamplerState::UndoSetSampler";
- CHECK_SCALAR_BOUNDS(Index);
- if( !Data.pSampler[Index].IsUserManaged )
- {
- return S_FALSE;
- }
- // Replace all references to the old shader block with this one
- GetEffect()->ReplaceSamplerReference(&Data.pSampler[Index], pMemberData[Index].Data.pD3DEffectsManagedSamplerState);
- // Revert to original state object
- SAFE_RELEASE( Data.pSampler[Index].pD3DObject );
- Data.pSampler[Index].pD3DObject = pMemberData[Index].Data.pD3DEffectsManagedSamplerState;
- pMemberData[Index].Data.pD3DEffectsManagedSamplerState = nullptr;
- Data.pSampler[Index].IsUserManaged = false;
- lExit:
- return hr;
- }
- template<typename IBaseInterface>
- _Use_decl_annotations_
- HRESULT TSamplerVariable<IBaseInterface>::GetBackingStore(uint32_t Index, D3D11_SAMPLER_DESC *pDesc)
- {
- static LPCSTR pFuncName = "ID3DX11EffectSamplerVariable::GetBackingStore";
- CHECK_OBJECT_SCALAR_BOUNDS(Index, pDesc);
- if( Data.pSampler[Index].IsUserManaged )
- {
- if( Data.pSampler[Index].pD3DObject )
- {
- Data.pSampler[Index].pD3DObject->GetDesc( pDesc );
- }
- else
- {
- *pDesc = CD3D11_SAMPLER_DESC( D3D11_DEFAULT );
- }
- }
- else
- {
- SSamplerBlock *pBlock = Data.pSampler + Index;
- if (pBlock->ApplyAssignments(GetTopLevelEntity()->pEffect))
- {
- pBlock->pAssignments[0].LastRecomputedTime = 0; // Force a recreate of this block the next time ApplyRenderStateBlock is called
- }
- memcpy(pDesc, &pBlock->BackingStore.SamplerDesc, sizeof(D3D11_SAMPLER_DESC));
- }
- lExit:
- return hr;
- }
- ////////////////////////////////////////////////////////////////////////////////
- // TUncastableVariable
- ////////////////////////////////////////////////////////////////////////////////
- template<typename IBaseInterface>
- struct TUncastableVariable : public IBaseInterface
- {
- STDMETHOD_(ID3DX11EffectScalarVariable*, AsScalar)() override;
- STDMETHOD_(ID3DX11EffectVectorVariable*, AsVector)() override;
- STDMETHOD_(ID3DX11EffectMatrixVariable*, AsMatrix)() override;
- STDMETHOD_(ID3DX11EffectStringVariable*, AsString)() override;
- STDMETHOD_(ID3DX11EffectClassInstanceVariable*, AsClassInstance)() override;
- STDMETHOD_(ID3DX11EffectInterfaceVariable*, AsInterface)() override;
- STDMETHOD_(ID3DX11EffectShaderResourceVariable*, AsShaderResource)() override;
- STDMETHOD_(ID3DX11EffectUnorderedAccessViewVariable*, AsUnorderedAccessView)() override;
- STDMETHOD_(ID3DX11EffectRenderTargetViewVariable*, AsRenderTargetView)() override;
- STDMETHOD_(ID3DX11EffectDepthStencilViewVariable*, AsDepthStencilView)() override;
- STDMETHOD_(ID3DX11EffectConstantBuffer*, AsConstantBuffer)() override;
- STDMETHOD_(ID3DX11EffectShaderVariable*, AsShader)() override;
- STDMETHOD_(ID3DX11EffectBlendVariable*, AsBlend)() override;
- STDMETHOD_(ID3DX11EffectDepthStencilVariable*, AsDepthStencil)() override;
- STDMETHOD_(ID3DX11EffectRasterizerVariable*, AsRasterizer)() override;
- STDMETHOD_(ID3DX11EffectSamplerVariable*, AsSampler)() override;
- };
- template<typename IBaseInterface>
- ID3DX11EffectScalarVariable * TUncastableVariable<IBaseInterface>::AsScalar()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsScalar";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidScalarVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectVectorVariable * TUncastableVariable<IBaseInterface>::AsVector()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsVector";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidVectorVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectMatrixVariable * TUncastableVariable<IBaseInterface>::AsMatrix()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsMatrix";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidMatrixVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectStringVariable * TUncastableVariable<IBaseInterface>::AsString()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsString";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidStringVariable;
- }
- template<typename IBaseClassInstance>
- ID3DX11EffectClassInstanceVariable * TUncastableVariable<IBaseClassInstance>::AsClassInstance()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsClassInstance";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidClassInstanceVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectInterfaceVariable * TUncastableVariable<IBaseInterface>::AsInterface()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsInterface";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidInterfaceVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectShaderResourceVariable * TUncastableVariable<IBaseInterface>::AsShaderResource()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsShaderResource";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidShaderResourceVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectUnorderedAccessViewVariable * TUncastableVariable<IBaseInterface>::AsUnorderedAccessView()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsUnorderedAccessView";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidUnorderedAccessViewVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectRenderTargetViewVariable * TUncastableVariable<IBaseInterface>::AsRenderTargetView()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsRenderTargetView";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidRenderTargetViewVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectDepthStencilViewVariable * TUncastableVariable<IBaseInterface>::AsDepthStencilView()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsDepthStencilView";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidDepthStencilViewVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectConstantBuffer * TUncastableVariable<IBaseInterface>::AsConstantBuffer()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsConstantBuffer";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidConstantBuffer;
- }
- template<typename IBaseInterface>
- ID3DX11EffectShaderVariable * TUncastableVariable<IBaseInterface>::AsShader()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsShader";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidShaderVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectBlendVariable * TUncastableVariable<IBaseInterface>::AsBlend()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsBlend";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidBlendVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectDepthStencilVariable * TUncastableVariable<IBaseInterface>::AsDepthStencil()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsDepthStencil";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidDepthStencilVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectRasterizerVariable * TUncastableVariable<IBaseInterface>::AsRasterizer()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsRasterizer";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidRasterizerVariable;
- }
- template<typename IBaseInterface>
- ID3DX11EffectSamplerVariable * TUncastableVariable<IBaseInterface>::AsSampler()
- {
- static LPCSTR pFuncName = "ID3DX11EffectVariable::AsSampler";
- DPF(0, "%s: Invalid typecast", pFuncName);
- return &g_InvalidSamplerVariable;
- }
- ////////////////////////////////////////////////////////////////////////////////
- // Macros to instantiate the myriad templates
- ////////////////////////////////////////////////////////////////////////////////
- // generates a global variable, annotation, global variable member, and annotation member of each struct type
- #define GenerateReflectionClasses(Type, BaseInterface) \
- struct S##Type##GlobalVariable : public T##Type##Variable<TGlobalVariable<BaseInterface>, false> { IUNKNOWN_IMP(S##Type##GlobalVariable, BaseInterface, ID3DX11EffectVariable); }; \
- struct S##Type##Annotation : public T##Type##Variable<TAnnotation<BaseInterface>, true> { IUNKNOWN_IMP(S##Type##Annotation, BaseInterface, ID3DX11EffectVariable);}; \
- struct S##Type##GlobalVariableMember : public T##Type##Variable<TVariable<TMember<BaseInterface> >, false> { IUNKNOWN_IMP(S##Type##GlobalVariableMember, BaseInterface, ID3DX11EffectVariable); }; \
- struct S##Type##AnnotationMember : public T##Type##Variable<TVariable<TMember<BaseInterface> >, true> { IUNKNOWN_IMP(S##Type##AnnotationMember, BaseInterface, ID3DX11EffectVariable); };
- #define GenerateVectorReflectionClasses(Type, BaseType, BaseInterface) \
- struct S##Type##GlobalVariable : public TVectorVariable<TGlobalVariable<BaseInterface>, false, BaseType> { IUNKNOWN_IMP(S##Type##GlobalVariable, BaseInterface, ID3DX11EffectVariable); }; \
- struct S##Type##Annotation : public TVectorVariable<TAnnotation<BaseInterface>, true, BaseType> { IUNKNOWN_IMP(S##Type##Annotation, BaseInterface, ID3DX11EffectVariable);}; \
- struct S##Type##GlobalVariableMember : public TVectorVariable<TVariable<TMember<BaseInterface> >, false, BaseType> { IUNKNOWN_IMP(S##Type##GlobalVariableMember, BaseInterface, ID3DX11EffectVariable);}; \
- struct S##Type##AnnotationMember : public TVectorVariable<TVariable<TMember<BaseInterface> >, true, BaseType> { IUNKNOWN_IMP(S##Type##AnnotationMember, BaseInterface, ID3DX11EffectVariable);};
- #define GenerateReflectionGlobalOnlyClasses(Type) \
- struct S##Type##GlobalVariable : public T##Type##Variable<TGlobalVariable<ID3DX11Effect##Type##Variable> > { IUNKNOWN_IMP(S##Type##GlobalVariable, ID3DX11Effect##Type##Variable, ID3DX11EffectVariable); }; \
- struct S##Type##GlobalVariableMember : public T##Type##Variable<TVariable<TMember<ID3DX11Effect##Type##Variable> > > { IUNKNOWN_IMP(S##Type##GlobalVariableMember, ID3DX11Effect##Type##Variable, ID3DX11EffectVariable); }; \
- GenerateReflectionClasses(Numeric, ID3DX11EffectVariable);
- GenerateReflectionClasses(FloatScalar, ID3DX11EffectScalarVariable);
- GenerateReflectionClasses(IntScalar, ID3DX11EffectScalarVariable);
- GenerateReflectionClasses(BoolScalar, ID3DX11EffectScalarVariable);
- GenerateVectorReflectionClasses(FloatVector, ETVT_Float, ID3DX11EffectVectorVariable);
- GenerateVectorReflectionClasses(BoolVector, ETVT_Bool, ID3DX11EffectVectorVariable);
- GenerateVectorReflectionClasses(IntVector, ETVT_Int, ID3DX11EffectVectorVariable);
- GenerateReflectionClasses(Matrix, ID3DX11EffectMatrixVariable);
- GenerateReflectionClasses(String, ID3DX11EffectStringVariable);
- GenerateReflectionGlobalOnlyClasses(ClassInstance);
- GenerateReflectionGlobalOnlyClasses(Interface);
- GenerateReflectionGlobalOnlyClasses(ShaderResource);
- GenerateReflectionGlobalOnlyClasses(UnorderedAccessView);
- GenerateReflectionGlobalOnlyClasses(RenderTargetView);
- GenerateReflectionGlobalOnlyClasses(DepthStencilView);
- GenerateReflectionGlobalOnlyClasses(Shader);
- GenerateReflectionGlobalOnlyClasses(Blend);
- GenerateReflectionGlobalOnlyClasses(DepthStencil);
- GenerateReflectionGlobalOnlyClasses(Rasterizer);
- GenerateReflectionGlobalOnlyClasses(Sampler);
- // Optimized matrix classes
- struct SMatrix4x4ColumnMajorGlobalVariable : public TMatrix4x4Variable<TGlobalVariable<ID3DX11EffectMatrixVariable>, true> { IUNKNOWN_IMP(SMatrix4x4ColumnMajorGlobalVariable, ID3DX11EffectMatrixVariable, ID3DX11EffectVariable); };
- struct SMatrix4x4RowMajorGlobalVariable : public TMatrix4x4Variable<TGlobalVariable<ID3DX11EffectMatrixVariable>, false> { IUNKNOWN_IMP(SMatrix4x4RowMajorGlobalVariable, ID3DX11EffectMatrixVariable, ID3DX11EffectVariable); };
- struct SMatrix4x4ColumnMajorGlobalVariableMember : public TMatrix4x4Variable<TVariable<TMember<ID3DX11EffectMatrixVariable> >, true> { IUNKNOWN_IMP(SMatrix4x4ColumnMajorGlobalVariableMember, ID3DX11EffectMatrixVariable, ID3DX11EffectVariable); };
- struct SMatrix4x4RowMajorGlobalVariableMember : public TMatrix4x4Variable<TVariable<TMember<ID3DX11EffectMatrixVariable> >, false> { IUNKNOWN_IMP(SMatrix4x4RowMajorGlobalVariableMember, ID3DX11EffectMatrixVariable, ID3DX11EffectVariable); };
- // Optimized vector classes
- struct SFloatVector4GlobalVariable : public TVector4Variable<TGlobalVariable<ID3DX11EffectVectorVariable> > { IUNKNOWN_IMP(SFloatVector4GlobalVariable, ID3DX11EffectVectorVariable, ID3DX11EffectVariable); };
- struct SFloatVector4GlobalVariableMember : public TVector4Variable<TVariable<TMember<ID3DX11EffectVectorVariable> > > { IUNKNOWN_IMP(SFloatVector4GlobalVariableMember, ID3DX11EffectVectorVariable, ID3DX11EffectVariable); };
- // These 3 classes should never be used directly
- // The "base" global variable struct (all global variables should be the same size in bytes,
- // but we pick this as the default).
- struct SGlobalVariable : public TGlobalVariable<ID3DX11EffectVariable>
- {
- };
- // The "base" annotation struct (all annotations should be the same size in bytes,
- // but we pick this as the default).
- struct SAnnotation : public TAnnotation<ID3DX11EffectVariable>
- {
- };
- // The "base" variable member struct (all annotation/global variable members should be the
- // same size in bytes, but we pick this as the default).
- struct SMember : public TVariable<TMember<ID3DX11EffectVariable> >
- {
- };
- // creates a new variable of the appropriate polymorphic type where pVar was
- HRESULT PlacementNewVariable(_In_ void *pVar, _In_ SType *pType, _In_ bool IsAnnotation);
- SMember * CreateNewMember(_In_ SType *pType, _In_ bool IsAnnotation);
- #pragma warning(pop)
|