runtime.h 97 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974
  1. // This file generated by compiling the following source (runtime.c) as follows:
  2. // clang -S -emit-llvm -target nvptr runtime.c
  3. // opt -S -mem2reg runtime.ll -o runtime.opt.ll
  4. // The resulting LLVM-IR is stripped of its datalayout and replaced with one
  5. // compatible with DXIL.
  6. // runtime.c
  7. #if 0
  8. #include <stddef.h>
  9. static const int STACK_SIZE_IN_BYTES = 1024;
  10. typedef float float3 __attribute__((vector_size(3*sizeof(float))));
  11. typedef float float4 __attribute__((vector_size(4*sizeof(float))));
  12. typedef float float12 __attribute__((vector_size(12*sizeof(float))));
  13. typedef float (M3x4)[12];
  14. typedef int (StackType)[STACK_SIZE_IN_BYTES/sizeof(int)];
  15. typedef unsigned char byte;
  16. typedef struct RuntimeDataStruct
  17. {
  18. int DispatchRaysIndex[2];
  19. int DispatchRaysDimensions[2];
  20. float RayTMin;
  21. float RayTCurrent;
  22. unsigned RayFlags;
  23. float WorldRayOrigin[3];
  24. float WorldRayDirection[3];
  25. float ObjectRayOrigin[3];
  26. float ObjectRayDirection[3];
  27. M3x4 ObjectToWorld;
  28. M3x4 WorldToObject;
  29. unsigned PrimitiveIndex;
  30. unsigned InstanceIndex;
  31. unsigned InstanceID;
  32. unsigned HitKind;
  33. unsigned ShaderRecordOffset;
  34. // Pending hit values - accessed in anyHit and intersection shaders before a hit has been committed
  35. float PendingRayTCurrent;
  36. unsigned PendingPrimitiveIndex;
  37. unsigned PendingInstanceIndex;
  38. unsigned PendingInstanceID;
  39. unsigned PendingHitKind;
  40. unsigned PendingShaderRecordOffset;
  41. int GroupIndex;
  42. int AnyHitResult;
  43. int AnyHitStateId; // Originally temporary. We needed to avoid resource usage
  44. // in ReportHit() because of linking issues so weset the value here first.
  45. // May be worth retaining to cache the value when fetching the intersection
  46. // stateId (fetch them both at once).
  47. int PayloadOffset;
  48. int CommittedAttrOffset;
  49. int PendingAttrOffset;
  50. int StackOffset; // offset from the start of the stack
  51. StackType* Stack;
  52. } RuntimeData;
  53. typedef RuntimeData* RuntimeDataType;
  54. typedef struct TraceRaySpills_ClosestHit
  55. {
  56. float RayTMin;
  57. float RayTCurrent;
  58. unsigned RayFlags;
  59. float WorldRayOrigin[3];
  60. float WorldRayDirection[3];
  61. float ObjectRayOrigin[3];
  62. float ObjectRayDirection[3];
  63. unsigned PrimitiveIndex;
  64. unsigned InstanceIndex;
  65. unsigned InstanceID;
  66. unsigned HitKind;
  67. unsigned ShaderRecordOffset;
  68. } TraceRaySpills_ClosestHit;
  69. typedef struct TraceRaySpills_Miss
  70. {
  71. float RayTMin;
  72. float RayTCurrent;
  73. unsigned RayFlags;
  74. float WorldRayOrigin[3];
  75. float WorldRayDirection[3];
  76. unsigned ShaderRecordOffset;
  77. } TraceRaySpills_Miss;
  78. #define REF(x) (runtimeData->x)
  79. #define REF_FLT(x) (runtimeData->x)
  80. #define REF_STACK(offset) ((*runtimeData->Stack)[runtimeData->StackOffset + offset])
  81. #define REF_FLT_OFS(x, offset) (runtimeData->x[offset])
  82. // Return next stateID
  83. int rewrite_dispatch(RuntimeDataType runtimeData, int stateID);
  84. void* rewrite_setLaunchParams(RuntimeDataType runtimeData, unsigned dimx, unsigned dimy);
  85. unsigned rewrite_getStackSize(void);
  86. StackType* rewrite_createStack(void);
  87. void stackInit(RuntimeDataType runtimeData, StackType* theStack, unsigned stackSize)
  88. {
  89. REF(Stack) = theStack;
  90. REF(StackOffset) = stackSize/sizeof(int) - 1;
  91. REF(PayloadOffset) = 1111; // recognizable bogus values
  92. REF(CommittedAttrOffset) = 2222;
  93. REF(PendingAttrOffset) = 3333;
  94. }
  95. void stackFramePush(RuntimeDataType runtimeData, int size)
  96. {
  97. REF(StackOffset) -= size;
  98. }
  99. void stackFramePop(RuntimeDataType runtimeData, int size)
  100. {
  101. REF(StackOffset) += size;
  102. }
  103. int stackFrameOffset(RuntimeDataType runtimeData)
  104. {
  105. return REF(StackOffset);
  106. }
  107. int payloadOffset(RuntimeDataType runtimeData)
  108. {
  109. return REF(PayloadOffset);
  110. }
  111. int committedAttrOffset(RuntimeDataType runtimeData)
  112. {
  113. return REF(CommittedAttrOffset);
  114. }
  115. int pendingAttrOffset(RuntimeDataType runtimeData)
  116. {
  117. return REF(PendingAttrOffset);
  118. }
  119. int* stackIntPtr(RuntimeDataType runtimeData, int baseOffset, int offset)
  120. {
  121. return &(*runtimeData->Stack)[baseOffset + offset];
  122. }
  123. void traceFramePush(RuntimeDataType runtimeData, int attrSize)
  124. {
  125. // Save the old payload and attribute offsets
  126. REF_STACK(-1) = REF(CommittedAttrOffset);
  127. REF_STACK(-2) = REF(PendingAttrOffset);
  128. // Set new offsets
  129. REF(CommittedAttrOffset) = REF(StackOffset) - 2 - attrSize;
  130. REF(PendingAttrOffset) = REF(StackOffset) - 2 - 2 * attrSize;
  131. }
  132. void traceFramePop(RuntimeDataType runtimeData)
  133. {
  134. // Restore the old attribute offsets
  135. REF(CommittedAttrOffset) = REF_STACK(-1);
  136. REF(PendingAttrOffset) = REF_STACK(-2);
  137. }
  138. void traceRaySave_ClosestHit(RuntimeDataType runtimeData, TraceRaySpills_ClosestHit* spills)
  139. {
  140. spills->RayFlags = REF(RayFlags);
  141. spills->RayTCurrent = REF_FLT(RayTCurrent);
  142. spills->RayTMin = REF_FLT(RayTMin);
  143. spills->WorldRayOrigin[0] = REF_FLT(WorldRayOrigin[0]);
  144. spills->WorldRayOrigin[1] = REF_FLT(WorldRayOrigin[1]);
  145. spills->WorldRayOrigin[2] = REF_FLT(WorldRayOrigin[2]);
  146. spills->WorldRayDirection[0] = REF_FLT(WorldRayDirection[0]);
  147. spills->WorldRayDirection[1] = REF_FLT(WorldRayDirection[1]);
  148. spills->WorldRayDirection[2] = REF_FLT(WorldRayDirection[2]);
  149. spills->ObjectRayOrigin[0] = REF_FLT(ObjectRayOrigin[0]);
  150. spills->ObjectRayOrigin[1] = REF_FLT(ObjectRayOrigin[1]);
  151. spills->ObjectRayOrigin[2] = REF_FLT(ObjectRayOrigin[2]);
  152. spills->ObjectRayDirection[0] = REF_FLT(ObjectRayDirection[0]);
  153. spills->ObjectRayDirection[1] = REF_FLT(ObjectRayDirection[1]);
  154. spills->ObjectRayDirection[2] = REF_FLT(ObjectRayDirection[2]);
  155. spills->PrimitiveIndex = REF(PrimitiveIndex);
  156. spills->InstanceIndex = REF(InstanceIndex);
  157. spills->InstanceID = REF(InstanceID);
  158. spills->HitKind = REF(HitKind);
  159. spills->ShaderRecordOffset = REF(ShaderRecordOffset);
  160. }
  161. void traceRayRestore_ClosestHit(RuntimeDataType runtimeData, TraceRaySpills_ClosestHit* spills)
  162. {
  163. REF(RayFlags) = spills->RayFlags;
  164. REF_FLT(RayTCurrent) = spills->RayTCurrent;
  165. REF_FLT(RayTMin) = spills->RayTMin;
  166. REF_FLT(WorldRayOrigin[0]) = spills->WorldRayOrigin[0];
  167. REF_FLT(WorldRayOrigin[1]) = spills->WorldRayOrigin[1];
  168. REF_FLT(WorldRayOrigin[2]) = spills->WorldRayOrigin[2];
  169. REF_FLT(WorldRayDirection[0]) = spills->WorldRayDirection[0];
  170. REF_FLT(WorldRayDirection[1]) = spills->WorldRayDirection[1];
  171. REF_FLT(WorldRayDirection[2]) = spills->WorldRayDirection[2];
  172. REF_FLT(ObjectRayOrigin[0]) = spills->ObjectRayOrigin[0];
  173. REF_FLT(ObjectRayOrigin[1]) = spills->ObjectRayOrigin[1];
  174. REF_FLT(ObjectRayOrigin[2]) = spills->ObjectRayOrigin[2];
  175. REF_FLT(ObjectRayDirection[0]) = spills->ObjectRayDirection[0];
  176. REF_FLT(ObjectRayDirection[1]) = spills->ObjectRayDirection[1];
  177. REF_FLT(ObjectRayDirection[2]) = spills->ObjectRayDirection[2];
  178. REF(PrimitiveIndex) = spills->PrimitiveIndex;
  179. REF(InstanceIndex) = spills->InstanceIndex;
  180. REF(InstanceID) = spills->InstanceID;
  181. REF(HitKind) = spills->HitKind;
  182. REF(ShaderRecordOffset) = spills->ShaderRecordOffset;
  183. }
  184. void traceRaySave_Miss(RuntimeDataType runtimeData, TraceRaySpills_Miss* spills)
  185. {
  186. spills->RayFlags = REF(RayFlags);
  187. spills->RayTCurrent = REF_FLT(RayTCurrent);
  188. spills->RayTMin = REF_FLT(RayTMin);
  189. spills->WorldRayOrigin[0] = REF_FLT(WorldRayOrigin[0]);
  190. spills->WorldRayOrigin[1] = REF_FLT(WorldRayOrigin[1]);
  191. spills->WorldRayOrigin[2] = REF_FLT(WorldRayOrigin[2]);
  192. spills->WorldRayDirection[0] = REF_FLT(WorldRayDirection[0]);
  193. spills->WorldRayDirection[1] = REF_FLT(WorldRayDirection[1]);
  194. spills->WorldRayDirection[2] = REF_FLT(WorldRayDirection[2]);
  195. spills->ShaderRecordOffset = REF(ShaderRecordOffset);
  196. }
  197. void traceRayRestore_Miss(RuntimeDataType runtimeData, TraceRaySpills_Miss* spills)
  198. {
  199. REF(RayFlags) = spills->RayFlags;
  200. REF_FLT(RayTCurrent) = spills->RayTCurrent;
  201. REF_FLT(RayTMin) = spills->RayTMin;
  202. REF_FLT(WorldRayOrigin[0]) = spills->WorldRayOrigin[0];
  203. REF_FLT(WorldRayOrigin[1]) = spills->WorldRayOrigin[1];
  204. REF_FLT(WorldRayOrigin[2]) = spills->WorldRayOrigin[2];
  205. REF_FLT(WorldRayDirection[0]) = spills->WorldRayDirection[0];
  206. REF_FLT(WorldRayDirection[1]) = spills->WorldRayDirection[1];
  207. REF_FLT(WorldRayDirection[2]) = spills->WorldRayDirection[2];
  208. REF(ShaderRecordOffset) = spills->ShaderRecordOffset;
  209. }
  210. //////////////////////////////////////////////////////////////////////////
  211. //
  212. // Intrinsics for the fallback layer
  213. //
  214. //////////////////////////////////////////////////////////////////////////
  215. void fb_Fallback_Scheduler(int initialStateId, unsigned dimx, unsigned dimy)
  216. {
  217. StackType* theStack = rewrite_createStack();
  218. RuntimeData theRuntimeData;
  219. RuntimeDataType runtimeData = &theRuntimeData;
  220. rewrite_setLaunchParams(runtimeData, dimx, dimy);
  221. if(REF(DispatchRaysIndex[0]) >= REF(DispatchRaysDimensions[0]) ||
  222. REF(DispatchRaysIndex[1]) >= REF(DispatchRaysDimensions[1]))
  223. {
  224. return;
  225. }
  226. // Set final return stateID into reserved area at stack top
  227. unsigned stackSize = rewrite_getStackSize();
  228. stackInit(runtimeData, theStack, stackSize);
  229. int stackFrameOffs = stackFrameOffset(runtimeData);
  230. *stackIntPtr(runtimeData, stackFrameOffs, 0) = -1;
  231. int stateId = initialStateId;
  232. int count = 0;
  233. while( stateId >= 0 )
  234. {
  235. stateId = rewrite_dispatch(runtimeData, stateId);
  236. }
  237. }
  238. void fb_Fallback_SetLaunchParams(RuntimeDataType runtimeData, unsigned DTidx, unsigned DTidy, unsigned dimx, unsigned dimy, unsigned groupIndex)
  239. {
  240. REF(DispatchRaysIndex[0]) = DTidx;
  241. REF(DispatchRaysIndex[1]) = DTidy;
  242. REF(DispatchRaysDimensions[0]) = dimx;
  243. REF(DispatchRaysDimensions[1]) = dimy;
  244. REF(GroupIndex) = groupIndex;
  245. }
  246. int fb_Fallback_TraceRayBegin(RuntimeDataType runtimeData, unsigned rayFlags, float ox, float oy, float oz, float tmin, float dx, float dy, float dz, float tmax, int newPayloadOffset)
  247. {
  248. REF(RayFlags) = rayFlags;
  249. REF_FLT(WorldRayOrigin[0]) = ox;
  250. REF_FLT(WorldRayOrigin[1]) = oy;
  251. REF_FLT(WorldRayOrigin[2]) = oz;
  252. REF_FLT(WorldRayDirection[0]) = dx;
  253. REF_FLT(WorldRayDirection[1]) = dy;
  254. REF_FLT(WorldRayDirection[2]) = dz;
  255. REF_FLT(RayTCurrent) = tmax;
  256. REF_FLT(RayTMin) = tmin;
  257. int oldOffset = REF(PayloadOffset);
  258. REF(PayloadOffset) = newPayloadOffset;
  259. return oldOffset;
  260. }
  261. void fb_Fallback_TraceRayEnd(RuntimeDataType runtimeData, int oldPayloadOffset)
  262. {
  263. REF(PayloadOffset) = oldPayloadOffset;
  264. }
  265. void fb_Fallback_SetPendingTriVals(RuntimeDataType runtimeData, unsigned shaderRecordOffset, unsigned primitiveIndex, unsigned instanceIndex, unsigned instanceID, float t, unsigned hitKind)
  266. {
  267. REF(PendingShaderRecordOffset) = shaderRecordOffset;
  268. REF(PendingPrimitiveIndex) = primitiveIndex;
  269. REF(PendingInstanceIndex) = instanceIndex;
  270. REF(PendingInstanceID) = instanceID;
  271. REF_FLT(PendingRayTCurrent) = t;
  272. REF(PendingHitKind) = hitKind;
  273. }
  274. void fb_Fallback_SetPendingCustomVals(RuntimeDataType runtimeData, unsigned shaderRecordOffset, unsigned primitiveIndex, unsigned instanceIndex, unsigned instanceID)
  275. {
  276. REF(PendingShaderRecordOffset) = shaderRecordOffset;
  277. REF(PendingPrimitiveIndex) = primitiveIndex;
  278. REF(PendingInstanceIndex) = instanceIndex;
  279. REF(PendingInstanceID) = instanceID;
  280. }
  281. void fb_Fallback_CommitHit(RuntimeDataType runtimeData)
  282. {
  283. REF_FLT(RayTCurrent) = REF_FLT(PendingRayTCurrent);
  284. REF(ShaderRecordOffset) = REF(PendingShaderRecordOffset);
  285. REF(PrimitiveIndex) = REF(PendingPrimitiveIndex);
  286. REF(InstanceIndex) = REF(PendingInstanceIndex);
  287. REF(InstanceID) = REF(PendingInstanceID);
  288. REF(HitKind) = REF(PendingHitKind);
  289. int PendingAttrOffset = REF(PendingAttrOffset);
  290. REF(PendingAttrOffset) = REF(CommittedAttrOffset);
  291. REF(CommittedAttrOffset) = PendingAttrOffset;
  292. }
  293. int fb_Fallback_RuntimeDataLoadInt(RuntimeDataType runtimeData, int offset)
  294. {
  295. return (*runtimeData->Stack)[offset];
  296. }
  297. void fb_Fallback_RuntimeDataStoreInt(RuntimeDataType runtimeData, int offset, int val)
  298. {
  299. (*runtimeData->Stack)[offset] = val;
  300. }
  301. unsigned fb_dxop_dispatchRaysIndex(RuntimeDataType runtimeData, byte i)
  302. {
  303. return REF(DispatchRaysIndex[i]);
  304. }
  305. unsigned fb_dxop_dispatchRaysDimensions(RuntimeDataType runtimeData, byte i)
  306. {
  307. return REF(DispatchRaysDimensions[i]);
  308. }
  309. float fb_dxop_rayTMin(RuntimeDataType runtimeData)
  310. {
  311. return REF_FLT(RayTMin);
  312. }
  313. float fb_Fallback_RayTMin(RuntimeDataType runtimeData)
  314. {
  315. return REF_FLT(RayTMin);
  316. }
  317. void fb_Fallback_SetRayTMin(RuntimeDataType runtimeData, float t)
  318. {
  319. REF_FLT(RayTMin) = t;
  320. }
  321. float fb_dxop_rayTCurrent(RuntimeDataType runtimeData)
  322. {
  323. return REF_FLT(RayTCurrent);
  324. }
  325. float fb_Fallback_RayTCurrent(RuntimeDataType runtimeData)
  326. {
  327. return REF_FLT(RayTCurrent);
  328. }
  329. void fb_Fallback_SetRayTCurrent(RuntimeDataType runtimeData, float t)
  330. {
  331. REF_FLT(RayTCurrent) = t;
  332. }
  333. unsigned fb_dxop_rayFlags(RuntimeDataType runtimeData)
  334. {
  335. return REF(RayFlags);
  336. }
  337. unsigned fb_Fallback_RayFlags(RuntimeDataType runtimeData)
  338. {
  339. return REF(RayFlags);
  340. }
  341. void fb_Fallback_SetRayFlags(RuntimeDataType runtimeData, unsigned flags)
  342. {
  343. REF(RayFlags) = flags;
  344. }
  345. float fb_dxop_worldRayOrigin(RuntimeDataType runtimeData, byte i)
  346. {
  347. return REF_FLT(WorldRayOrigin[i]);
  348. }
  349. float fb_Fallback_WorldRayOrigin(RuntimeDataType runtimeData, byte i)
  350. {
  351. return REF_FLT(WorldRayOrigin[i]);
  352. }
  353. void fb_Fallback_SetWorldRayOrigin(RuntimeDataType runtimeData, float x, float y, float z)
  354. {
  355. REF_FLT(WorldRayOrigin[0]) = x;
  356. REF_FLT(WorldRayOrigin[1]) = y;
  357. REF_FLT(WorldRayOrigin[2]) = z;
  358. }
  359. float fb_dxop_worldRayDirection(RuntimeDataType runtimeData, byte i)
  360. {
  361. return REF_FLT(WorldRayDirection[i]);
  362. }
  363. float fb_Fallback_WorldRayDirection(RuntimeDataType runtimeData, byte i)
  364. {
  365. return REF_FLT(WorldRayDirection[i]);
  366. }
  367. void fb_Fallback_SetWorldRayDirection(RuntimeDataType runtimeData, float x, float y, float z)
  368. {
  369. REF_FLT(WorldRayDirection[0]) = x;
  370. REF_FLT(WorldRayDirection[1]) = y;
  371. REF_FLT(WorldRayDirection[2]) = z;
  372. }
  373. float fb_dxop_objectRayOrigin(RuntimeDataType runtimeData, byte i)
  374. {
  375. return REF_FLT(ObjectRayOrigin[i]);
  376. }
  377. float fb_Fallback_ObjectRayOrigin(RuntimeDataType runtimeData, byte i)
  378. {
  379. return REF_FLT(ObjectRayOrigin[i]);
  380. }
  381. void fb_Fallback_SetObjectRayOrigin(RuntimeDataType runtimeData, float x, float y, float z)
  382. {
  383. REF_FLT(ObjectRayOrigin[0]) = x;
  384. REF_FLT(ObjectRayOrigin[1]) = y;
  385. REF_FLT(ObjectRayOrigin[2]) = z;
  386. }
  387. float fb_dxop_objectRayDirection(RuntimeDataType runtimeData, byte i)
  388. {
  389. return REF_FLT(ObjectRayDirection[i]);
  390. }
  391. float fb_Fallback_ObjectRayDirection(RuntimeDataType runtimeData, byte i)
  392. {
  393. return REF_FLT(ObjectRayDirection[i]);
  394. }
  395. void fb_Fallback_SetObjectRayDirection(RuntimeDataType runtimeData, float x, float y, float z)
  396. {
  397. REF_FLT(ObjectRayDirection[0]) = x;
  398. REF_FLT(ObjectRayDirection[1]) = y;
  399. REF_FLT(ObjectRayDirection[2]) = z;
  400. }
  401. float fb_dxop_objectToWorld(RuntimeDataType runtimeData, int r, byte c)
  402. {
  403. int i = r * 4 + c;
  404. return REF_FLT_OFS(ObjectToWorld, i);
  405. }
  406. void fb_Fallback_SetObjectToWorld(RuntimeDataType runtimeData, float12 M)
  407. {
  408. REF_FLT_OFS(ObjectToWorld, 0) = M[0];
  409. REF_FLT_OFS(ObjectToWorld, 1) = M[1];
  410. REF_FLT_OFS(ObjectToWorld, 2) = M[2];
  411. REF_FLT_OFS(ObjectToWorld, 3) = M[3];
  412. REF_FLT_OFS(ObjectToWorld, 4) = M[4];
  413. REF_FLT_OFS(ObjectToWorld, 5) = M[5];
  414. REF_FLT_OFS(ObjectToWorld, 6) = M[6];
  415. REF_FLT_OFS(ObjectToWorld, 7) = M[7];
  416. REF_FLT_OFS(ObjectToWorld, 8) = M[8];
  417. REF_FLT_OFS(ObjectToWorld, 9) = M[9];
  418. REF_FLT_OFS(ObjectToWorld, 10) = M[10];
  419. REF_FLT_OFS(ObjectToWorld, 11) = M[11];
  420. }
  421. float fb_dxop_worldToObject(RuntimeDataType runtimeData, int r, byte c)
  422. {
  423. int i = r * 4 + c;
  424. return REF_FLT_OFS(WorldToObject, i);
  425. }
  426. void fb_Fallback_SetWorldToObject(RuntimeDataType runtimeData, float12 M)
  427. {
  428. REF_FLT_OFS(WorldToObject, 0) = M[0];
  429. REF_FLT_OFS(WorldToObject, 1) = M[1];
  430. REF_FLT_OFS(WorldToObject, 2) = M[2];
  431. REF_FLT_OFS(WorldToObject, 3) = M[3];
  432. REF_FLT_OFS(WorldToObject, 4) = M[4];
  433. REF_FLT_OFS(WorldToObject, 5) = M[5];
  434. REF_FLT_OFS(WorldToObject, 6) = M[6];
  435. REF_FLT_OFS(WorldToObject, 7) = M[7];
  436. REF_FLT_OFS(WorldToObject, 8) = M[8];
  437. REF_FLT_OFS(WorldToObject, 9) = M[9];
  438. REF_FLT_OFS(WorldToObject, 10) = M[10];
  439. REF_FLT_OFS(WorldToObject, 11) = M[11];
  440. }
  441. unsigned fb_dxop_primitiveIndex(RuntimeDataType runtimeData)
  442. {
  443. return REF(PrimitiveIndex);
  444. }
  445. unsigned fb_Fallback_PrimitiveIndex(RuntimeDataType runtimeData)
  446. {
  447. return REF(PrimitiveIndex);
  448. }
  449. void fb_Fallback_SetPrimitiveIndex(RuntimeDataType runtimeData, unsigned i)
  450. {
  451. REF(PrimitiveIndex) = i;
  452. }
  453. unsigned fb_Fallback_ShaderRecordOffset(RuntimeDataType runtimeData)
  454. {
  455. return REF(ShaderRecordOffset);
  456. }
  457. void fb_Fallback_SetShaderRecordOffset(RuntimeDataType runtimeData, unsigned shaderRecordOffset)
  458. {
  459. REF(ShaderRecordOffset) = shaderRecordOffset;
  460. }
  461. unsigned fb_dxop_instanceIndex(RuntimeDataType runtimeData)
  462. {
  463. return REF(InstanceIndex);
  464. }
  465. unsigned fb_Fallback_InstanceIndex(RuntimeDataType runtimeData)
  466. {
  467. return REF(InstanceIndex);
  468. }
  469. void fb_Fallback_SetInstanceIndex(RuntimeDataType runtimeData, unsigned i)
  470. {
  471. REF(InstanceIndex) = i;
  472. }
  473. unsigned fb_dxop_instanceID(RuntimeDataType runtimeData)
  474. {
  475. return REF(InstanceID);
  476. }
  477. unsigned fb_Fallback_InstanceID(RuntimeDataType runtimeData)
  478. {
  479. return REF(InstanceID);
  480. }
  481. void fb_Fallback_SetInstanceID(RuntimeDataType runtimeData, unsigned i)
  482. {
  483. REF(InstanceID) = i;
  484. }
  485. unsigned fb_dxop_hitKind(RuntimeDataType runtimeData)
  486. {
  487. return REF(HitKind);
  488. }
  489. unsigned fb_Fallback_HitKind(RuntimeDataType runtimeData)
  490. {
  491. return REF(HitKind);
  492. }
  493. void fb_Fallback_SetHitKind(RuntimeDataType runtimeData, unsigned i)
  494. {
  495. REF(HitKind) = i;
  496. }
  497. float fb_dxop_pending_rayTCurrent(RuntimeDataType runtimeData)
  498. {
  499. return REF_FLT(PendingRayTCurrent);
  500. }
  501. void fb_Fallback_SetPendingRayTCurrent(RuntimeDataType runtimeData, float t)
  502. {
  503. REF_FLT(PendingRayTCurrent) = t;
  504. }
  505. unsigned fb_dxop_pending_primitiveID(RuntimeDataType runtimeData)
  506. //unsigned fb_dxop_pending_primitiveIndex(RuntimeDataType runtimeData)
  507. {
  508. return REF(PendingPrimitiveIndex);
  509. }
  510. unsigned fb_Fallback_PendingShaderRecordOffset(RuntimeDataType runtimeData)
  511. {
  512. return REF(PendingShaderRecordOffset);
  513. }
  514. unsigned fb_dxop_pending_instanceIndex(RuntimeDataType runtimeData)
  515. {
  516. return REF(PendingInstanceIndex);
  517. }
  518. unsigned fb_dxop_pending_instanceID(RuntimeDataType runtimeData)
  519. {
  520. return REF(PendingInstanceID);
  521. }
  522. unsigned fb_dxop_pending_hitKind(RuntimeDataType runtimeData)
  523. {
  524. return REF(PendingHitKind);
  525. }
  526. void fb_Fallback_SetPendingHitKind(RuntimeDataType runtimeData, unsigned i)
  527. {
  528. REF(PendingHitKind) = i;
  529. }
  530. unsigned fb_Fallback_GroupIndex(RuntimeDataType runtimeData)
  531. {
  532. return REF(GroupIndex);
  533. }
  534. int fb_Fallback_AnyHitResult(RuntimeDataType runtimeData)
  535. {
  536. return REF(AnyHitResult);
  537. }
  538. void fb_Fallback_SetAnyHitResult(RuntimeDataType runtimeData, int result)
  539. {
  540. REF(AnyHitResult) = result;
  541. }
  542. int fb_Fallback_AnyHitStateId(RuntimeDataType runtimeData)
  543. {
  544. return REF(AnyHitStateId);
  545. }
  546. void fb_Fallback_SetAnyHitStateId(RuntimeDataType runtimeData, int id)
  547. {
  548. REF(AnyHitStateId) = id;
  549. }
  550. #endif
  551. static const char* runtimeString[] = { R"AAA(
  552. target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f:64:64-n8:16:32:64"
  553. target triple = "dxil-ms-dx"
  554. %struct.RuntimeDataStruct = type { [2 x i32], [2 x i32], float, float, i32, [3 x float], [3 x float], [3 x float], [3 x float], [12 x float], [12 x float], i32, i32, i32, i32, i32, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [256 x i32]* }
  555. %struct.TraceRaySpills_ClosestHit = type { float, float, i32, [3 x float], [3 x float], [3 x float], [3 x float], i32, i32, i32, i32, i32 }
  556. %struct.TraceRaySpills_Miss = type { float, float, i32, [3 x float], [3 x float], i32 }
  557. ; Function Attrs: nounwind
  558. define void @stackInit(%struct.RuntimeDataStruct* %runtimeData, [256 x i32]* %theStack, i32 %stackSize) #0 {
  559. entry:
  560. %Stack = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 29
  561. store [256 x i32]* %theStack, [256 x i32]** %Stack, align 4
  562. %div = udiv i32 %stackSize, 4
  563. %sub = sub i32 %div, 1
  564. %StackOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 28
  565. store i32 %sub, i32* %StackOffset, align 4
  566. %PayloadOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 25
  567. store i32 1111, i32* %PayloadOffset, align 4
  568. %CommittedAttrOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 26
  569. store i32 2222, i32* %CommittedAttrOffset, align 4
  570. %PendingAttrOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 27
  571. store i32 3333, i32* %PendingAttrOffset, align 4
  572. ret void
  573. }
  574. ; Function Attrs: nounwind
  575. define void @stackFramePush(%struct.RuntimeDataStruct* %runtimeData, i32 %size) #0 {
  576. entry:
  577. %StackOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 28
  578. %0 = load i32, i32* %StackOffset, align 4
  579. %sub = sub nsw i32 %0, %size
  580. store i32 %sub, i32* %StackOffset, align 4
  581. ret void
  582. }
  583. ; Function Attrs: nounwind
  584. define void @stackFramePop(%struct.RuntimeDataStruct* %runtimeData, i32 %size) #0 {
  585. entry:
  586. %StackOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 28
  587. %0 = load i32, i32* %StackOffset, align 4
  588. %add = add nsw i32 %0, %size
  589. store i32 %add, i32* %StackOffset, align 4
  590. ret void
  591. }
  592. ; Function Attrs: nounwind
  593. define i32 @stackFrameOffset(%struct.RuntimeDataStruct* %runtimeData) #0 {
  594. entry:
  595. %StackOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 28
  596. %0 = load i32, i32* %StackOffset, align 4
  597. ret i32 %0
  598. }
  599. ; Function Attrs: nounwind
  600. define i32 @payloadOffset(%struct.RuntimeDataStruct* %runtimeData) #0 {
  601. entry:
  602. %PayloadOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 25
  603. %0 = load i32, i32* %PayloadOffset, align 4
  604. ret i32 %0
  605. }
  606. ; Function Attrs: nounwind
  607. define i32 @committedAttrOffset(%struct.RuntimeDataStruct* %runtimeData) #0 {
  608. entry:
  609. %CommittedAttrOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 26
  610. %0 = load i32, i32* %CommittedAttrOffset, align 4
  611. ret i32 %0
  612. }
  613. ; Function Attrs: nounwind
  614. define i32 @pendingAttrOffset(%struct.RuntimeDataStruct* %runtimeData) #0 {
  615. entry:
  616. %PendingAttrOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 27
  617. %0 = load i32, i32* %PendingAttrOffset, align 4
  618. ret i32 %0
  619. }
  620. ; Function Attrs: nounwind
  621. define i32* @stackIntPtr(%struct.RuntimeDataStruct* %runtimeData, i32 %baseOffset, i32 %offset) #0 {
  622. entry:
  623. %add = add nsw i32 %baseOffset, %offset
  624. %Stack = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 29
  625. %0 = load [256 x i32]*, [256 x i32]** %Stack, align 4
  626. %arrayidx = getelementptr inbounds [256 x i32], [256 x i32]* %0, i32 0, i32 %add
  627. ret i32* %arrayidx
  628. }
  629. ; Function Attrs: nounwind
  630. define void @traceFramePush(%struct.RuntimeDataStruct* %runtimeData, i32 %attrSize) #0 {
  631. entry:
  632. %CommittedAttrOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 26
  633. %0 = load i32, i32* %CommittedAttrOffset, align 4
  634. %StackOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 28
  635. %1 = load i32, i32* %StackOffset, align 4
  636. %add = add nsw i32 %1, -1
  637. %Stack = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 29
  638. %2 = load [256 x i32]*, [256 x i32]** %Stack, align 4
  639. %arrayidx = getelementptr inbounds [256 x i32], [256 x i32]* %2, i32 0, i32 %add
  640. store i32 %0, i32* %arrayidx, align 4
  641. %PendingAttrOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 27
  642. %3 = load i32, i32* %PendingAttrOffset, align 4
  643. %StackOffset1 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 28
  644. %4 = load i32, i32* %StackOffset1, align 4
  645. %add2 = add nsw i32 %4, -2
  646. %Stack3 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 29
  647. %5 = load [256 x i32]*, [256 x i32]** %Stack3, align 4
  648. %arrayidx4 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i32 0, i32 %add2
  649. store i32 %3, i32* %arrayidx4, align 4
  650. %StackOffset5 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 28
  651. %6 = load i32, i32* %StackOffset5, align 4
  652. %sub = sub nsw i32 %6, 2
  653. %sub6 = sub nsw i32 %sub, %attrSize
  654. %CommittedAttrOffset7 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 26
  655. store i32 %sub6, i32* %CommittedAttrOffset7, align 4
  656. %StackOffset8 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 28
  657. %7 = load i32, i32* %StackOffset8, align 4
  658. %sub9 = sub nsw i32 %7, 2
  659. %mul = mul nsw i32 2, %attrSize
  660. %sub10 = sub nsw i32 %sub9, %mul
  661. %PendingAttrOffset11 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 27
  662. store i32 %sub10, i32* %PendingAttrOffset11, align 4
  663. ret void
  664. }
  665. ; Function Attrs: nounwind
  666. define void @traceFramePop(%struct.RuntimeDataStruct* %runtimeData) #0 {
  667. entry:
  668. %StackOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 28
  669. %0 = load i32, i32* %StackOffset, align 4
  670. %add = add nsw i32 %0, -1
  671. %Stack = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 29
  672. %1 = load [256 x i32]*, [256 x i32]** %Stack, align 4
  673. %arrayidx = getelementptr inbounds [256 x i32], [256 x i32]* %1, i32 0, i32 %add
  674. %2 = load i32, i32* %arrayidx, align 4
  675. %CommittedAttrOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 26
  676. store i32 %2, i32* %CommittedAttrOffset, align 4
  677. %StackOffset1 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 28
  678. %3 = load i32, i32* %StackOffset1, align 4
  679. %add2 = add nsw i32 %3, -2
  680. %Stack3 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 29
  681. %4 = load [256 x i32]*, [256 x i32]** %Stack3, align 4
  682. %arrayidx4 = getelementptr inbounds [256 x i32], [256 x i32]* %4, i32 0, i32 %add2
  683. %5 = load i32, i32* %arrayidx4, align 4
  684. %PendingAttrOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 27
  685. store i32 %5, i32* %PendingAttrOffset, align 4
  686. ret void
  687. }
  688. ; Function Attrs: nounwind
  689. define void @traceRaySave_ClosestHit(%struct.RuntimeDataStruct* %runtimeData, %struct.TraceRaySpills_ClosestHit* %spills) #0 {
  690. entry:
  691. %RayFlags = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 4
  692. %0 = load i32, i32* %RayFlags, align 4
  693. %RayFlags1 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 2
  694. store i32 %0, i32* %RayFlags1, align 4
  695. %RayTCurrent = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 3
  696. %1 = load float, float* %RayTCurrent, align 4
  697. %RayTCurrent2 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 1
  698. store float %1, float* %RayTCurrent2, align 4
  699. %RayTMin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 2
  700. %2 = load float, float* %RayTMin, align 4
  701. %RayTMin3 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 0
  702. store float %2, float* %RayTMin3, align 4
  703. %WorldRayOrigin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  704. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin, i32 0, i32 0
  705. %3 = load float, float* %arrayidx, align 4
  706. %WorldRayOrigin4 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 3
  707. %arrayidx5 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin4, i32 0, i32 0
  708. store float %3, float* %arrayidx5, align 4
  709. %WorldRayOrigin6 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  710. %arrayidx7 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin6, i32 0, i32 1
  711. %4 = load float, float* %arrayidx7, align 4
  712. %WorldRayOrigin8 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 3
  713. %arrayidx9 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin8, i32 0, i32 1
  714. store float %4, float* %arrayidx9, align 4
  715. %WorldRayOrigin10 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  716. )AAA",
  717. R"AAA(
  718. %arrayidx11 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin10, i32 0, i32 2
  719. %5 = load float, float* %arrayidx11, align 4
  720. %WorldRayOrigin12 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 3
  721. %arrayidx13 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin12, i32 0, i32 2
  722. store float %5, float* %arrayidx13, align 4
  723. %WorldRayDirection = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  724. %arrayidx14 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection, i32 0, i32 0
  725. %6 = load float, float* %arrayidx14, align 4
  726. %WorldRayDirection15 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 4
  727. %arrayidx16 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection15, i32 0, i32 0
  728. store float %6, float* %arrayidx16, align 4
  729. %WorldRayDirection17 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  730. %arrayidx18 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection17, i32 0, i32 1
  731. %7 = load float, float* %arrayidx18, align 4
  732. %WorldRayDirection19 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 4
  733. %arrayidx20 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection19, i32 0, i32 1
  734. store float %7, float* %arrayidx20, align 4
  735. %WorldRayDirection21 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  736. %arrayidx22 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection21, i32 0, i32 2
  737. %8 = load float, float* %arrayidx22, align 4
  738. %WorldRayDirection23 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 4
  739. %arrayidx24 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection23, i32 0, i32 2
  740. store float %8, float* %arrayidx24, align 4
  741. %ObjectRayOrigin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 7
  742. %arrayidx25 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin, i32 0, i32 0
  743. %9 = load float, float* %arrayidx25, align 4
  744. %ObjectRayOrigin26 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 5
  745. %arrayidx27 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin26, i32 0, i32 0
  746. store float %9, float* %arrayidx27, align 4
  747. %ObjectRayOrigin28 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 7
  748. %arrayidx29 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin28, i32 0, i32 1
  749. %10 = load float, float* %arrayidx29, align 4
  750. %ObjectRayOrigin30 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 5
  751. %arrayidx31 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin30, i32 0, i32 1
  752. store float %10, float* %arrayidx31, align 4
  753. %ObjectRayOrigin32 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 7
  754. %arrayidx33 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin32, i32 0, i32 2
  755. %11 = load float, float* %arrayidx33, align 4
  756. %ObjectRayOrigin34 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 5
  757. %arrayidx35 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin34, i32 0, i32 2
  758. store float %11, float* %arrayidx35, align 4
  759. %ObjectRayDirection = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 8
  760. %arrayidx36 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection, i32 0, i32 0
  761. %12 = load float, float* %arrayidx36, align 4
  762. %ObjectRayDirection37 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 6
  763. %arrayidx38 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection37, i32 0, i32 0
  764. store float %12, float* %arrayidx38, align 4
  765. %ObjectRayDirection39 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 8
  766. %arrayidx40 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection39, i32 0, i32 1
  767. %13 = load float, float* %arrayidx40, align 4
  768. %ObjectRayDirection41 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 6
  769. %arrayidx42 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection41, i32 0, i32 1
  770. store float %13, float* %arrayidx42, align 4
  771. %ObjectRayDirection43 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 8
  772. %arrayidx44 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection43, i32 0, i32 2
  773. %14 = load float, float* %arrayidx44, align 4
  774. %ObjectRayDirection45 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 6
  775. %arrayidx46 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection45, i32 0, i32 2
  776. store float %14, float* %arrayidx46, align 4
  777. %PrimitiveIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 11
  778. %15 = load i32, i32* %PrimitiveIndex, align 4
  779. %PrimitiveIndex47 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 7
  780. store i32 %15, i32* %PrimitiveIndex47, align 4
  781. %InstanceIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 12
  782. %16 = load i32, i32* %InstanceIndex, align 4
  783. %InstanceIndex48 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 8
  784. store i32 %16, i32* %InstanceIndex48, align 4
  785. %InstanceID = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 13
  786. %17 = load i32, i32* %InstanceID, align 4
  787. %InstanceID49 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 9
  788. store i32 %17, i32* %InstanceID49, align 4
  789. %HitKind = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 14
  790. %18 = load i32, i32* %HitKind, align 4
  791. %HitKind50 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 10
  792. store i32 %18, i32* %HitKind50, align 4
  793. %ShaderRecordOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 15
  794. %19 = load i32, i32* %ShaderRecordOffset, align 4
  795. %ShaderRecordOffset51 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 11
  796. store i32 %19, i32* %ShaderRecordOffset51, align 4
  797. ret void
  798. }
  799. ; Function Attrs: nounwind
  800. define void @traceRayRestore_ClosestHit(%struct.RuntimeDataStruct* %runtimeData, %struct.TraceRaySpills_ClosestHit* %spills) #0 {
  801. entry:
  802. %RayFlags = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 2
  803. %0 = load i32, i32* %RayFlags, align 4
  804. %RayFlags1 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 4
  805. store i32 %0, i32* %RayFlags1, align 4
  806. %RayTCurrent = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 1
  807. %1 = load float, float* %RayTCurrent, align 4
  808. %RayTCurrent2 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 3
  809. store float %1, float* %RayTCurrent2, align 4
  810. %RayTMin = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 0
  811. %2 = load float, float* %RayTMin, align 4
  812. %RayTMin3 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 2
  813. store float %2, float* %RayTMin3, align 4
  814. %WorldRayOrigin = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 3
  815. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin, i32 0, i32 0
  816. %3 = load float, float* %arrayidx, align 4
  817. %WorldRayOrigin4 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  818. %arrayidx5 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin4, i32 0, i32 0
  819. store float %3, float* %arrayidx5, align 4
  820. %WorldRayOrigin6 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 3
  821. %arrayidx7 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin6, i32 0, i32 1
  822. %4 = load float, float* %arrayidx7, align 4
  823. %WorldRayOrigin8 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  824. %arrayidx9 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin8, i32 0, i32 1
  825. store float %4, float* %arrayidx9, align 4
  826. %WorldRayOrigin10 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 3
  827. %arrayidx11 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin10, i32 0, i32 2
  828. %5 = load float, float* %arrayidx11, align 4
  829. %WorldRayOrigin12 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  830. %arrayidx13 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin12, i32 0, i32 2
  831. store float %5, float* %arrayidx13, align 4
  832. %WorldRayDirection = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 4
  833. )AAA",
  834. R"AAA(
  835. %arrayidx14 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection, i32 0, i32 0
  836. %6 = load float, float* %arrayidx14, align 4
  837. %WorldRayDirection15 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  838. %arrayidx16 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection15, i32 0, i32 0
  839. store float %6, float* %arrayidx16, align 4
  840. %WorldRayDirection17 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 4
  841. %arrayidx18 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection17, i32 0, i32 1
  842. %7 = load float, float* %arrayidx18, align 4
  843. %WorldRayDirection19 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  844. %arrayidx20 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection19, i32 0, i32 1
  845. store float %7, float* %arrayidx20, align 4
  846. %WorldRayDirection21 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 4
  847. %arrayidx22 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection21, i32 0, i32 2
  848. %8 = load float, float* %arrayidx22, align 4
  849. %WorldRayDirection23 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  850. %arrayidx24 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection23, i32 0, i32 2
  851. store float %8, float* %arrayidx24, align 4
  852. %ObjectRayOrigin = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 5
  853. %arrayidx25 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin, i32 0, i32 0
  854. %9 = load float, float* %arrayidx25, align 4
  855. %ObjectRayOrigin26 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 7
  856. %arrayidx27 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin26, i32 0, i32 0
  857. store float %9, float* %arrayidx27, align 4
  858. %ObjectRayOrigin28 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 5
  859. %arrayidx29 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin28, i32 0, i32 1
  860. %10 = load float, float* %arrayidx29, align 4
  861. %ObjectRayOrigin30 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 7
  862. %arrayidx31 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin30, i32 0, i32 1
  863. store float %10, float* %arrayidx31, align 4
  864. %ObjectRayOrigin32 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 5
  865. %arrayidx33 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin32, i32 0, i32 2
  866. %11 = load float, float* %arrayidx33, align 4
  867. %ObjectRayOrigin34 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 7
  868. %arrayidx35 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin34, i32 0, i32 2
  869. store float %11, float* %arrayidx35, align 4
  870. %ObjectRayDirection = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 6
  871. %arrayidx36 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection, i32 0, i32 0
  872. %12 = load float, float* %arrayidx36, align 4
  873. %ObjectRayDirection37 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 8
  874. %arrayidx38 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection37, i32 0, i32 0
  875. store float %12, float* %arrayidx38, align 4
  876. %ObjectRayDirection39 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 6
  877. %arrayidx40 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection39, i32 0, i32 1
  878. %13 = load float, float* %arrayidx40, align 4
  879. %ObjectRayDirection41 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 8
  880. %arrayidx42 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection41, i32 0, i32 1
  881. store float %13, float* %arrayidx42, align 4
  882. %ObjectRayDirection43 = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 6
  883. %arrayidx44 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection43, i32 0, i32 2
  884. %14 = load float, float* %arrayidx44, align 4
  885. %ObjectRayDirection45 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 8
  886. %arrayidx46 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection45, i32 0, i32 2
  887. store float %14, float* %arrayidx46, align 4
  888. %PrimitiveIndex = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 7
  889. %15 = load i32, i32* %PrimitiveIndex, align 4
  890. %PrimitiveIndex47 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 11
  891. store i32 %15, i32* %PrimitiveIndex47, align 4
  892. %InstanceIndex = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 8
  893. %16 = load i32, i32* %InstanceIndex, align 4
  894. %InstanceIndex48 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 12
  895. store i32 %16, i32* %InstanceIndex48, align 4
  896. %InstanceID = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 9
  897. %17 = load i32, i32* %InstanceID, align 4
  898. %InstanceID49 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 13
  899. store i32 %17, i32* %InstanceID49, align 4
  900. %HitKind = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 10
  901. %18 = load i32, i32* %HitKind, align 4
  902. %HitKind50 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 14
  903. store i32 %18, i32* %HitKind50, align 4
  904. %ShaderRecordOffset = getelementptr inbounds %struct.TraceRaySpills_ClosestHit, %struct.TraceRaySpills_ClosestHit* %spills, i32 0, i32 11
  905. %19 = load i32, i32* %ShaderRecordOffset, align 4
  906. %ShaderRecordOffset51 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 15
  907. store i32 %19, i32* %ShaderRecordOffset51, align 4
  908. ret void
  909. }
  910. ; Function Attrs: nounwind
  911. define void @traceRaySave_Miss(%struct.RuntimeDataStruct* %runtimeData, %struct.TraceRaySpills_Miss* %spills) #0 {
  912. entry:
  913. %RayFlags = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 4
  914. %0 = load i32, i32* %RayFlags, align 4
  915. %RayFlags1 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 2
  916. store i32 %0, i32* %RayFlags1, align 4
  917. %RayTCurrent = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 3
  918. %1 = load float, float* %RayTCurrent, align 4
  919. %RayTCurrent2 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 1
  920. store float %1, float* %RayTCurrent2, align 4
  921. %RayTMin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 2
  922. %2 = load float, float* %RayTMin, align 4
  923. %RayTMin3 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 0
  924. store float %2, float* %RayTMin3, align 4
  925. %WorldRayOrigin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  926. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin, i32 0, i32 0
  927. %3 = load float, float* %arrayidx, align 4
  928. %WorldRayOrigin4 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 3
  929. %arrayidx5 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin4, i32 0, i32 0
  930. store float %3, float* %arrayidx5, align 4
  931. %WorldRayOrigin6 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  932. %arrayidx7 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin6, i32 0, i32 1
  933. %4 = load float, float* %arrayidx7, align 4
  934. %WorldRayOrigin8 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 3
  935. %arrayidx9 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin8, i32 0, i32 1
  936. store float %4, float* %arrayidx9, align 4
  937. %WorldRayOrigin10 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  938. %arrayidx11 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin10, i32 0, i32 2
  939. %5 = load float, float* %arrayidx11, align 4
  940. %WorldRayOrigin12 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 3
  941. %arrayidx13 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin12, i32 0, i32 2
  942. store float %5, float* %arrayidx13, align 4
  943. %WorldRayDirection = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  944. %arrayidx14 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection, i32 0, i32 0
  945. %6 = load float, float* %arrayidx14, align 4
  946. %WorldRayDirection15 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 4
  947. %arrayidx16 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection15, i32 0, i32 0
  948. store float %6, float* %arrayidx16, align 4
  949. %WorldRayDirection17 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  950. %arrayidx18 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection17, i32 0, i32 1
  951. )AAA",
  952. R"AAA(
  953. %7 = load float, float* %arrayidx18, align 4
  954. %WorldRayDirection19 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 4
  955. %arrayidx20 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection19, i32 0, i32 1
  956. store float %7, float* %arrayidx20, align 4
  957. %WorldRayDirection21 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  958. %arrayidx22 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection21, i32 0, i32 2
  959. %8 = load float, float* %arrayidx22, align 4
  960. %WorldRayDirection23 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 4
  961. %arrayidx24 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection23, i32 0, i32 2
  962. store float %8, float* %arrayidx24, align 4
  963. %ShaderRecordOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 15
  964. %9 = load i32, i32* %ShaderRecordOffset, align 4
  965. %ShaderRecordOffset25 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 5
  966. store i32 %9, i32* %ShaderRecordOffset25, align 4
  967. ret void
  968. }
  969. ; Function Attrs: nounwind
  970. define void @traceRayRestore_Miss(%struct.RuntimeDataStruct* %runtimeData, %struct.TraceRaySpills_Miss* %spills) #0 {
  971. entry:
  972. %RayFlags = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 2
  973. %0 = load i32, i32* %RayFlags, align 4
  974. %RayFlags1 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 4
  975. store i32 %0, i32* %RayFlags1, align 4
  976. %RayTCurrent = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 1
  977. %1 = load float, float* %RayTCurrent, align 4
  978. %RayTCurrent2 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 3
  979. store float %1, float* %RayTCurrent2, align 4
  980. %RayTMin = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 0
  981. %2 = load float, float* %RayTMin, align 4
  982. %RayTMin3 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 2
  983. store float %2, float* %RayTMin3, align 4
  984. %WorldRayOrigin = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 3
  985. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin, i32 0, i32 0
  986. %3 = load float, float* %arrayidx, align 4
  987. %WorldRayOrigin4 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  988. %arrayidx5 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin4, i32 0, i32 0
  989. store float %3, float* %arrayidx5, align 4
  990. %WorldRayOrigin6 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 3
  991. %arrayidx7 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin6, i32 0, i32 1
  992. %4 = load float, float* %arrayidx7, align 4
  993. %WorldRayOrigin8 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  994. %arrayidx9 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin8, i32 0, i32 1
  995. store float %4, float* %arrayidx9, align 4
  996. %WorldRayOrigin10 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 3
  997. %arrayidx11 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin10, i32 0, i32 2
  998. %5 = load float, float* %arrayidx11, align 4
  999. %WorldRayOrigin12 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  1000. %arrayidx13 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin12, i32 0, i32 2
  1001. store float %5, float* %arrayidx13, align 4
  1002. %WorldRayDirection = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 4
  1003. %arrayidx14 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection, i32 0, i32 0
  1004. %6 = load float, float* %arrayidx14, align 4
  1005. %WorldRayDirection15 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  1006. %arrayidx16 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection15, i32 0, i32 0
  1007. store float %6, float* %arrayidx16, align 4
  1008. %WorldRayDirection17 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 4
  1009. %arrayidx18 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection17, i32 0, i32 1
  1010. %7 = load float, float* %arrayidx18, align 4
  1011. %WorldRayDirection19 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  1012. %arrayidx20 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection19, i32 0, i32 1
  1013. store float %7, float* %arrayidx20, align 4
  1014. %WorldRayDirection21 = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 4
  1015. %arrayidx22 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection21, i32 0, i32 2
  1016. %8 = load float, float* %arrayidx22, align 4
  1017. %WorldRayDirection23 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  1018. %arrayidx24 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection23, i32 0, i32 2
  1019. store float %8, float* %arrayidx24, align 4
  1020. %ShaderRecordOffset = getelementptr inbounds %struct.TraceRaySpills_Miss, %struct.TraceRaySpills_Miss* %spills, i32 0, i32 5
  1021. %9 = load i32, i32* %ShaderRecordOffset, align 4
  1022. %ShaderRecordOffset25 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 15
  1023. store i32 %9, i32* %ShaderRecordOffset25, align 4
  1024. ret void
  1025. }
  1026. ; Function Attrs: nounwind
  1027. define void @fb_Fallback_Scheduler(i32 %initialStateId, i32 %dimx, i32 %dimy) #0 {
  1028. entry:
  1029. %theRuntimeData = alloca %struct.RuntimeDataStruct, align 4
  1030. %call = call [256 x i32]* @rewrite_createStack()
  1031. %call1 = call i8* @rewrite_setLaunchParams(%struct.RuntimeDataStruct* %theRuntimeData, i32 %dimx, i32 %dimy)
  1032. %DispatchRaysIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %theRuntimeData, i32 0, i32 0
  1033. %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %DispatchRaysIndex, i32 0, i32 0
  1034. %0 = load i32, i32* %arrayidx, align 4
  1035. %DispatchRaysDimensions = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %theRuntimeData, i32 0, i32 1
  1036. %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %DispatchRaysDimensions, i32 0, i32 0
  1037. %1 = load i32, i32* %arrayidx2, align 4
  1038. %cmp = icmp sge i32 %0, %1
  1039. br i1 %cmp, label %if.then, label %lor.lhs.false
  1040. lor.lhs.false: ; preds = %entry
  1041. %DispatchRaysIndex3 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %theRuntimeData, i32 0, i32 0
  1042. %arrayidx4 = getelementptr inbounds [2 x i32], [2 x i32]* %DispatchRaysIndex3, i32 0, i32 1
  1043. %2 = load i32, i32* %arrayidx4, align 4
  1044. %DispatchRaysDimensions5 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %theRuntimeData, i32 0, i32 1
  1045. %arrayidx6 = getelementptr inbounds [2 x i32], [2 x i32]* %DispatchRaysDimensions5, i32 0, i32 1
  1046. %3 = load i32, i32* %arrayidx6, align 4
  1047. %cmp7 = icmp sge i32 %2, %3
  1048. br i1 %cmp7, label %if.then, label %if.end
  1049. if.then: ; preds = %lor.lhs.false, %entry
  1050. br label %while.end
  1051. if.end: ; preds = %lor.lhs.false
  1052. %call8 = call i32 @rewrite_getStackSize()
  1053. call void @stackInit(%struct.RuntimeDataStruct* %theRuntimeData, [256 x i32]* %call, i32 %call8)
  1054. %call9 = call i32 @stackFrameOffset(%struct.RuntimeDataStruct* %theRuntimeData)
  1055. %call10 = call i32* @stackIntPtr(%struct.RuntimeDataStruct* %theRuntimeData, i32 %call9, i32 0)
  1056. store i32 -1, i32* %call10, align 4
  1057. br label %while.cond
  1058. while.cond: ; preds = %while.body, %if.end
  1059. %stateId.0 = phi i32 [ %initialStateId, %if.end ], [ %call12, %while.body ]
  1060. %cmp11 = icmp sge i32 %stateId.0, 0
  1061. br i1 %cmp11, label %while.body, label %while.end
  1062. while.body: ; preds = %while.cond
  1063. %call12 = call i32 @rewrite_dispatch(%struct.RuntimeDataStruct* %theRuntimeData, i32 %stateId.0)
  1064. br label %while.cond
  1065. while.end: ; preds = %while.cond, %if.then
  1066. ret void
  1067. }
  1068. declare [256 x i32]* @rewrite_createStack() #1
  1069. declare i8* @rewrite_setLaunchParams(%struct.RuntimeDataStruct*, i32, i32) #1
  1070. declare i32 @rewrite_getStackSize() #1
  1071. declare i32 @rewrite_dispatch(%struct.RuntimeDataStruct*, i32) #1
  1072. ; Function Attrs: nounwind
  1073. define void @fb_Fallback_SetLaunchParams(%struct.RuntimeDataStruct* %runtimeData, i32 %DTidx, i32 %DTidy, i32 %dimx, i32 %dimy, i32 %groupIndex) #0 {
  1074. entry:
  1075. %DispatchRaysIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 0
  1076. %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %DispatchRaysIndex, i32 0, i32 0
  1077. store i32 %DTidx, i32* %arrayidx, align 4
  1078. %DispatchRaysIndex1 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 0
  1079. %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %DispatchRaysIndex1, i32 0, i32 1
  1080. store i32 %DTidy, i32* %arrayidx2, align 4
  1081. %DispatchRaysDimensions = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 1
  1082. %arrayidx3 = getelementptr inbounds [2 x i32], [2 x i32]* %DispatchRaysDimensions, i32 0, i32 0
  1083. store i32 %dimx, i32* %arrayidx3, align 4
  1084. %DispatchRaysDimensions4 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 1
  1085. %arrayidx5 = getelementptr inbounds [2 x i32], [2 x i32]* %DispatchRaysDimensions4, i32 0, i32 1
  1086. )AAA",
  1087. R"AAA(
  1088. store i32 %dimy, i32* %arrayidx5, align 4
  1089. %GroupIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 22
  1090. store i32 %groupIndex, i32* %GroupIndex, align 4
  1091. ret void
  1092. }
  1093. ; Function Attrs: nounwind
  1094. define i32 @fb_Fallback_TraceRayBegin(%struct.RuntimeDataStruct* %runtimeData, i32 %rayFlags, float %ox, float %oy, float %oz, float %tmin, float %dx, float %dy, float %dz, float %tmax, i32 %newPayloadOffset) #0 {
  1095. entry:
  1096. %RayFlags = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 4
  1097. store i32 %rayFlags, i32* %RayFlags, align 4
  1098. %WorldRayOrigin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  1099. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin, i32 0, i32 0
  1100. store float %ox, float* %arrayidx, align 4
  1101. %WorldRayOrigin1 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  1102. %arrayidx2 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin1, i32 0, i32 1
  1103. store float %oy, float* %arrayidx2, align 4
  1104. %WorldRayOrigin3 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  1105. %arrayidx4 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin3, i32 0, i32 2
  1106. store float %oz, float* %arrayidx4, align 4
  1107. %WorldRayDirection = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  1108. %arrayidx5 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection, i32 0, i32 0
  1109. store float %dx, float* %arrayidx5, align 4
  1110. %WorldRayDirection6 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  1111. %arrayidx7 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection6, i32 0, i32 1
  1112. store float %dy, float* %arrayidx7, align 4
  1113. %WorldRayDirection8 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  1114. %arrayidx9 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection8, i32 0, i32 2
  1115. store float %dz, float* %arrayidx9, align 4
  1116. %RayTCurrent = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 3
  1117. store float %tmax, float* %RayTCurrent, align 4
  1118. %RayTMin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 2
  1119. store float %tmin, float* %RayTMin, align 4
  1120. %PayloadOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 25
  1121. %0 = load i32, i32* %PayloadOffset, align 4
  1122. %PayloadOffset10 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 25
  1123. store i32 %newPayloadOffset, i32* %PayloadOffset10, align 4
  1124. ret i32 %0
  1125. }
  1126. ; Function Attrs: nounwind
  1127. define void @fb_Fallback_TraceRayEnd(%struct.RuntimeDataStruct* %runtimeData, i32 %oldPayloadOffset) #0 {
  1128. entry:
  1129. %PayloadOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 25
  1130. store i32 %oldPayloadOffset, i32* %PayloadOffset, align 4
  1131. ret void
  1132. }
  1133. ; Function Attrs: nounwind
  1134. define void @fb_Fallback_SetPendingTriVals(%struct.RuntimeDataStruct* %runtimeData, i32 %shaderRecordOffset, i32 %primitiveIndex, i32 %instanceIndex, i32 %instanceID, float %t, i32 %hitKind) #0 {
  1135. entry:
  1136. %PendingShaderRecordOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 21
  1137. store i32 %shaderRecordOffset, i32* %PendingShaderRecordOffset, align 4
  1138. %PendingPrimitiveIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 17
  1139. store i32 %primitiveIndex, i32* %PendingPrimitiveIndex, align 4
  1140. %PendingInstanceIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 18
  1141. store i32 %instanceIndex, i32* %PendingInstanceIndex, align 4
  1142. %PendingInstanceID = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 19
  1143. store i32 %instanceID, i32* %PendingInstanceID, align 4
  1144. %PendingRayTCurrent = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 16
  1145. store float %t, float* %PendingRayTCurrent, align 4
  1146. %PendingHitKind = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 20
  1147. store i32 %hitKind, i32* %PendingHitKind, align 4
  1148. ret void
  1149. }
  1150. ; Function Attrs: nounwind
  1151. define void @fb_Fallback_SetPendingCustomVals(%struct.RuntimeDataStruct* %runtimeData, i32 %shaderRecordOffset, i32 %primitiveIndex, i32 %instanceIndex, i32 %instanceID) #0 {
  1152. entry:
  1153. %PendingShaderRecordOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 21
  1154. store i32 %shaderRecordOffset, i32* %PendingShaderRecordOffset, align 4
  1155. %PendingPrimitiveIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 17
  1156. store i32 %primitiveIndex, i32* %PendingPrimitiveIndex, align 4
  1157. %PendingInstanceIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 18
  1158. store i32 %instanceIndex, i32* %PendingInstanceIndex, align 4
  1159. %PendingInstanceID = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 19
  1160. store i32 %instanceID, i32* %PendingInstanceID, align 4
  1161. ret void
  1162. }
  1163. ; Function Attrs: nounwind
  1164. define void @fb_Fallback_CommitHit(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1165. entry:
  1166. %PendingRayTCurrent = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 16
  1167. %0 = load float, float* %PendingRayTCurrent, align 4
  1168. %RayTCurrent = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 3
  1169. store float %0, float* %RayTCurrent, align 4
  1170. %PendingShaderRecordOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 21
  1171. %1 = load i32, i32* %PendingShaderRecordOffset, align 4
  1172. %ShaderRecordOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 15
  1173. store i32 %1, i32* %ShaderRecordOffset, align 4
  1174. %PendingPrimitiveIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 17
  1175. %2 = load i32, i32* %PendingPrimitiveIndex, align 4
  1176. %PrimitiveIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 11
  1177. store i32 %2, i32* %PrimitiveIndex, align 4
  1178. %PendingInstanceIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 18
  1179. %3 = load i32, i32* %PendingInstanceIndex, align 4
  1180. %InstanceIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 12
  1181. store i32 %3, i32* %InstanceIndex, align 4
  1182. %PendingInstanceID = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 19
  1183. %4 = load i32, i32* %PendingInstanceID, align 4
  1184. %InstanceID = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 13
  1185. store i32 %4, i32* %InstanceID, align 4
  1186. %PendingHitKind = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 20
  1187. %5 = load i32, i32* %PendingHitKind, align 4
  1188. %HitKind = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 14
  1189. store i32 %5, i32* %HitKind, align 4
  1190. %PendingAttrOffset1 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 27
  1191. %6 = load i32, i32* %PendingAttrOffset1, align 4
  1192. %CommittedAttrOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 26
  1193. %7 = load i32, i32* %CommittedAttrOffset, align 4
  1194. %PendingAttrOffset2 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 27
  1195. store i32 %7, i32* %PendingAttrOffset2, align 4
  1196. %CommittedAttrOffset3 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 26
  1197. store i32 %6, i32* %CommittedAttrOffset3, align 4
  1198. ret void
  1199. }
  1200. ; Function Attrs: nounwind
  1201. define i32 @fb_Fallback_RuntimeDataLoadInt(%struct.RuntimeDataStruct* %runtimeData, i32 %offset) #0 {
  1202. entry:
  1203. %Stack = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 29
  1204. %0 = load [256 x i32]*, [256 x i32]** %Stack, align 4
  1205. %arrayidx = getelementptr inbounds [256 x i32], [256 x i32]* %0, i32 0, i32 %offset
  1206. %1 = load i32, i32* %arrayidx, align 4
  1207. ret i32 %1
  1208. }
  1209. ; Function Attrs: nounwind
  1210. define void @fb_Fallback_RuntimeDataStoreInt(%struct.RuntimeDataStruct* %runtimeData, i32 %offset, i32 %val) #0 {
  1211. entry:
  1212. %Stack = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 29
  1213. %0 = load [256 x i32]*, [256 x i32]** %Stack, align 4
  1214. %arrayidx = getelementptr inbounds [256 x i32], [256 x i32]* %0, i32 0, i32 %offset
  1215. store i32 %val, i32* %arrayidx, align 4
  1216. ret void
  1217. }
  1218. ; Function Attrs: nounwind
  1219. define i32 @fb_dxop_dispatchRaysIndex(%struct.RuntimeDataStruct* %runtimeData, i8 zeroext %i) #0 {
  1220. entry:
  1221. %idxprom = zext i8 %i to i32
  1222. %DispatchRaysIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 0
  1223. %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %DispatchRaysIndex, i32 0, i32 %idxprom
  1224. %0 = load i32, i32* %arrayidx, align 4
  1225. ret i32 %0
  1226. }
  1227. ; Function Attrs: nounwind
  1228. define i32 @fb_dxop_dispatchRaysDimensions(%struct.RuntimeDataStruct* %runtimeData, i8 zeroext %i) #0 {
  1229. )AAA",
  1230. R"AAA(
  1231. entry:
  1232. %idxprom = zext i8 %i to i32
  1233. %DispatchRaysDimensions = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 1
  1234. %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %DispatchRaysDimensions, i32 0, i32 %idxprom
  1235. %0 = load i32, i32* %arrayidx, align 4
  1236. ret i32 %0
  1237. }
  1238. ; Function Attrs: nounwind
  1239. define float @fb_dxop_rayTMin(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1240. entry:
  1241. %RayTMin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 2
  1242. %0 = load float, float* %RayTMin, align 4
  1243. ret float %0
  1244. }
  1245. ; Function Attrs: nounwind
  1246. define float @fb_Fallback_RayTMin(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1247. entry:
  1248. %RayTMin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 2
  1249. %0 = load float, float* %RayTMin, align 4
  1250. ret float %0
  1251. }
  1252. ; Function Attrs: nounwind
  1253. define void @fb_Fallback_SetRayTMin(%struct.RuntimeDataStruct* %runtimeData, float %t) #0 {
  1254. entry:
  1255. %RayTMin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 2
  1256. store float %t, float* %RayTMin, align 4
  1257. ret void
  1258. }
  1259. ; Function Attrs: nounwind
  1260. define float @fb_dxop_rayTCurrent(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1261. entry:
  1262. %RayTCurrent = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 3
  1263. %0 = load float, float* %RayTCurrent, align 4
  1264. ret float %0
  1265. }
  1266. ; Function Attrs: nounwind
  1267. define float @fb_Fallback_RayTCurrent(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1268. entry:
  1269. %RayTCurrent = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 3
  1270. %0 = load float, float* %RayTCurrent, align 4
  1271. ret float %0
  1272. }
  1273. ; Function Attrs: nounwind
  1274. define void @fb_Fallback_SetRayTCurrent(%struct.RuntimeDataStruct* %runtimeData, float %t) #0 {
  1275. entry:
  1276. %RayTCurrent = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 3
  1277. store float %t, float* %RayTCurrent, align 4
  1278. ret void
  1279. }
  1280. ; Function Attrs: nounwind
  1281. define i32 @fb_dxop_rayFlags(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1282. entry:
  1283. %RayFlags = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 4
  1284. %0 = load i32, i32* %RayFlags, align 4
  1285. ret i32 %0
  1286. }
  1287. ; Function Attrs: nounwind
  1288. define i32 @fb_Fallback_RayFlags(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1289. entry:
  1290. %RayFlags = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 4
  1291. %0 = load i32, i32* %RayFlags, align 4
  1292. ret i32 %0
  1293. }
  1294. ; Function Attrs: nounwind
  1295. define void @fb_Fallback_SetRayFlags(%struct.RuntimeDataStruct* %runtimeData, i32 %flags) #0 {
  1296. entry:
  1297. %RayFlags = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 4
  1298. store i32 %flags, i32* %RayFlags, align 4
  1299. ret void
  1300. }
  1301. ; Function Attrs: nounwind
  1302. define float @fb_dxop_worldRayOrigin(%struct.RuntimeDataStruct* %runtimeData, i8 zeroext %i) #0 {
  1303. entry:
  1304. %idxprom = zext i8 %i to i32
  1305. %WorldRayOrigin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  1306. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin, i32 0, i32 %idxprom
  1307. %0 = load float, float* %arrayidx, align 4
  1308. ret float %0
  1309. }
  1310. ; Function Attrs: nounwind
  1311. define float @fb_Fallback_WorldRayOrigin(%struct.RuntimeDataStruct* %runtimeData, i8 zeroext %i) #0 {
  1312. entry:
  1313. %idxprom = zext i8 %i to i32
  1314. %WorldRayOrigin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  1315. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin, i32 0, i32 %idxprom
  1316. %0 = load float, float* %arrayidx, align 4
  1317. ret float %0
  1318. }
  1319. ; Function Attrs: nounwind
  1320. define void @fb_Fallback_SetWorldRayOrigin(%struct.RuntimeDataStruct* %runtimeData, float %x, float %y, float %z) #0 {
  1321. entry:
  1322. %WorldRayOrigin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  1323. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin, i32 0, i32 0
  1324. store float %x, float* %arrayidx, align 4
  1325. %WorldRayOrigin1 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  1326. %arrayidx2 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin1, i32 0, i32 1
  1327. store float %y, float* %arrayidx2, align 4
  1328. %WorldRayOrigin3 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 5
  1329. %arrayidx4 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayOrigin3, i32 0, i32 2
  1330. store float %z, float* %arrayidx4, align 4
  1331. ret void
  1332. }
  1333. ; Function Attrs: nounwind
  1334. define float @fb_dxop_worldRayDirection(%struct.RuntimeDataStruct* %runtimeData, i8 zeroext %i) #0 {
  1335. entry:
  1336. %idxprom = zext i8 %i to i32
  1337. %WorldRayDirection = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  1338. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection, i32 0, i32 %idxprom
  1339. %0 = load float, float* %arrayidx, align 4
  1340. ret float %0
  1341. }
  1342. ; Function Attrs: nounwind
  1343. define float @fb_Fallback_WorldRayDirection(%struct.RuntimeDataStruct* %runtimeData, i8 zeroext %i) #0 {
  1344. entry:
  1345. %idxprom = zext i8 %i to i32
  1346. %WorldRayDirection = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  1347. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection, i32 0, i32 %idxprom
  1348. %0 = load float, float* %arrayidx, align 4
  1349. ret float %0
  1350. }
  1351. ; Function Attrs: nounwind
  1352. define void @fb_Fallback_SetWorldRayDirection(%struct.RuntimeDataStruct* %runtimeData, float %x, float %y, float %z) #0 {
  1353. entry:
  1354. %WorldRayDirection = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  1355. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection, i32 0, i32 0
  1356. store float %x, float* %arrayidx, align 4
  1357. %WorldRayDirection1 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  1358. %arrayidx2 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection1, i32 0, i32 1
  1359. store float %y, float* %arrayidx2, align 4
  1360. %WorldRayDirection3 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 6
  1361. %arrayidx4 = getelementptr inbounds [3 x float], [3 x float]* %WorldRayDirection3, i32 0, i32 2
  1362. store float %z, float* %arrayidx4, align 4
  1363. ret void
  1364. }
  1365. ; Function Attrs: nounwind
  1366. define float @fb_dxop_objectRayOrigin(%struct.RuntimeDataStruct* %runtimeData, i8 zeroext %i) #0 {
  1367. entry:
  1368. %idxprom = zext i8 %i to i32
  1369. %ObjectRayOrigin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 7
  1370. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin, i32 0, i32 %idxprom
  1371. %0 = load float, float* %arrayidx, align 4
  1372. ret float %0
  1373. }
  1374. ; Function Attrs: nounwind
  1375. define float @fb_Fallback_ObjectRayOrigin(%struct.RuntimeDataStruct* %runtimeData, i8 zeroext %i) #0 {
  1376. entry:
  1377. %idxprom = zext i8 %i to i32
  1378. %ObjectRayOrigin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 7
  1379. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin, i32 0, i32 %idxprom
  1380. %0 = load float, float* %arrayidx, align 4
  1381. ret float %0
  1382. }
  1383. ; Function Attrs: nounwind
  1384. define void @fb_Fallback_SetObjectRayOrigin(%struct.RuntimeDataStruct* %runtimeData, float %x, float %y, float %z) #0 {
  1385. entry:
  1386. %ObjectRayOrigin = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 7
  1387. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin, i32 0, i32 0
  1388. store float %x, float* %arrayidx, align 4
  1389. %ObjectRayOrigin1 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 7
  1390. %arrayidx2 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin1, i32 0, i32 1
  1391. store float %y, float* %arrayidx2, align 4
  1392. %ObjectRayOrigin3 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 7
  1393. %arrayidx4 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayOrigin3, i32 0, i32 2
  1394. store float %z, float* %arrayidx4, align 4
  1395. ret void
  1396. }
  1397. ; Function Attrs: nounwind
  1398. define float @fb_dxop_objectRayDirection(%struct.RuntimeDataStruct* %runtimeData, i8 zeroext %i) #0 {
  1399. entry:
  1400. %idxprom = zext i8 %i to i32
  1401. %ObjectRayDirection = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 8
  1402. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection, i32 0, i32 %idxprom
  1403. %0 = load float, float* %arrayidx, align 4
  1404. ret float %0
  1405. }
  1406. ; Function Attrs: nounwind
  1407. define float @fb_Fallback_ObjectRayDirection(%struct.RuntimeDataStruct* %runtimeData, i8 zeroext %i) #0 {
  1408. entry:
  1409. %idxprom = zext i8 %i to i32
  1410. %ObjectRayDirection = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 8
  1411. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection, i32 0, i32 %idxprom
  1412. %0 = load float, float* %arrayidx, align 4
  1413. ret float %0
  1414. }
  1415. ; Function Attrs: nounwind
  1416. define void @fb_Fallback_SetObjectRayDirection(%struct.RuntimeDataStruct* %runtimeData, float %x, float %y, float %z) #0 {
  1417. entry:
  1418. %ObjectRayDirection = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 8
  1419. %arrayidx = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection, i32 0, i32 0
  1420. store float %x, float* %arrayidx, align 4
  1421. %ObjectRayDirection1 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 8
  1422. %arrayidx2 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection1, i32 0, i32 1
  1423. )AAA",
  1424. R"AAA(
  1425. store float %y, float* %arrayidx2, align 4
  1426. %ObjectRayDirection3 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 8
  1427. %arrayidx4 = getelementptr inbounds [3 x float], [3 x float]* %ObjectRayDirection3, i32 0, i32 2
  1428. store float %z, float* %arrayidx4, align 4
  1429. ret void
  1430. }
  1431. ; Function Attrs: nounwind
  1432. define float @fb_dxop_objectToWorld(%struct.RuntimeDataStruct* %runtimeData, i32 %r, i8 zeroext %c) #0 {
  1433. entry:
  1434. %mul = mul nsw i32 %r, 4
  1435. %conv = zext i8 %c to i32
  1436. %add = add nsw i32 %mul, %conv
  1437. %ObjectToWorld = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1438. %arrayidx = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld, i32 0, i32 %add
  1439. %0 = load float, float* %arrayidx, align 4
  1440. ret float %0
  1441. }
  1442. ; Function Attrs: nounwind
  1443. define void @fb_Fallback_SetObjectToWorld(%struct.RuntimeDataStruct* %runtimeData, <12 x float> %M) #0 {
  1444. entry:
  1445. %vecext = extractelement <12 x float> %M, i32 0
  1446. %ObjectToWorld = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1447. %arrayidx = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld, i32 0, i32 0
  1448. store float %vecext, float* %arrayidx, align 4
  1449. %vecext1 = extractelement <12 x float> %M, i32 1
  1450. %ObjectToWorld2 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1451. %arrayidx3 = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld2, i32 0, i32 1
  1452. store float %vecext1, float* %arrayidx3, align 4
  1453. %vecext4 = extractelement <12 x float> %M, i32 2
  1454. %ObjectToWorld5 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1455. %arrayidx6 = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld5, i32 0, i32 2
  1456. store float %vecext4, float* %arrayidx6, align 4
  1457. %vecext7 = extractelement <12 x float> %M, i32 3
  1458. %ObjectToWorld8 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1459. %arrayidx9 = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld8, i32 0, i32 3
  1460. store float %vecext7, float* %arrayidx9, align 4
  1461. %vecext10 = extractelement <12 x float> %M, i32 4
  1462. %ObjectToWorld11 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1463. %arrayidx12 = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld11, i32 0, i32 4
  1464. store float %vecext10, float* %arrayidx12, align 4
  1465. %vecext13 = extractelement <12 x float> %M, i32 5
  1466. %ObjectToWorld14 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1467. %arrayidx15 = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld14, i32 0, i32 5
  1468. store float %vecext13, float* %arrayidx15, align 4
  1469. %vecext16 = extractelement <12 x float> %M, i32 6
  1470. %ObjectToWorld17 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1471. %arrayidx18 = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld17, i32 0, i32 6
  1472. store float %vecext16, float* %arrayidx18, align 4
  1473. %vecext19 = extractelement <12 x float> %M, i32 7
  1474. %ObjectToWorld20 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1475. %arrayidx21 = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld20, i32 0, i32 7
  1476. store float %vecext19, float* %arrayidx21, align 4
  1477. %vecext22 = extractelement <12 x float> %M, i32 8
  1478. %ObjectToWorld23 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1479. %arrayidx24 = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld23, i32 0, i32 8
  1480. store float %vecext22, float* %arrayidx24, align 4
  1481. %vecext25 = extractelement <12 x float> %M, i32 9
  1482. %ObjectToWorld26 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1483. %arrayidx27 = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld26, i32 0, i32 9
  1484. store float %vecext25, float* %arrayidx27, align 4
  1485. %vecext28 = extractelement <12 x float> %M, i32 10
  1486. %ObjectToWorld29 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1487. %arrayidx30 = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld29, i32 0, i32 10
  1488. store float %vecext28, float* %arrayidx30, align 4
  1489. %vecext31 = extractelement <12 x float> %M, i32 11
  1490. %ObjectToWorld32 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 9
  1491. %arrayidx33 = getelementptr inbounds [12 x float], [12 x float]* %ObjectToWorld32, i32 0, i32 11
  1492. store float %vecext31, float* %arrayidx33, align 4
  1493. ret void
  1494. }
  1495. ; Function Attrs: nounwind
  1496. define float @fb_dxop_worldToObject(%struct.RuntimeDataStruct* %runtimeData, i32 %r, i8 zeroext %c) #0 {
  1497. entry:
  1498. %mul = mul nsw i32 %r, 4
  1499. %conv = zext i8 %c to i32
  1500. %add = add nsw i32 %mul, %conv
  1501. %WorldToObject = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1502. %arrayidx = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject, i32 0, i32 %add
  1503. %0 = load float, float* %arrayidx, align 4
  1504. ret float %0
  1505. }
  1506. ; Function Attrs: nounwind
  1507. define void @fb_Fallback_SetWorldToObject(%struct.RuntimeDataStruct* %runtimeData, <12 x float> %M) #0 {
  1508. entry:
  1509. %vecext = extractelement <12 x float> %M, i32 0
  1510. %WorldToObject = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1511. %arrayidx = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject, i32 0, i32 0
  1512. store float %vecext, float* %arrayidx, align 4
  1513. %vecext1 = extractelement <12 x float> %M, i32 1
  1514. %WorldToObject2 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1515. %arrayidx3 = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject2, i32 0, i32 1
  1516. store float %vecext1, float* %arrayidx3, align 4
  1517. %vecext4 = extractelement <12 x float> %M, i32 2
  1518. %WorldToObject5 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1519. %arrayidx6 = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject5, i32 0, i32 2
  1520. store float %vecext4, float* %arrayidx6, align 4
  1521. %vecext7 = extractelement <12 x float> %M, i32 3
  1522. %WorldToObject8 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1523. %arrayidx9 = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject8, i32 0, i32 3
  1524. store float %vecext7, float* %arrayidx9, align 4
  1525. %vecext10 = extractelement <12 x float> %M, i32 4
  1526. %WorldToObject11 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1527. %arrayidx12 = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject11, i32 0, i32 4
  1528. store float %vecext10, float* %arrayidx12, align 4
  1529. %vecext13 = extractelement <12 x float> %M, i32 5
  1530. %WorldToObject14 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1531. %arrayidx15 = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject14, i32 0, i32 5
  1532. store float %vecext13, float* %arrayidx15, align 4
  1533. %vecext16 = extractelement <12 x float> %M, i32 6
  1534. %WorldToObject17 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1535. %arrayidx18 = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject17, i32 0, i32 6
  1536. store float %vecext16, float* %arrayidx18, align 4
  1537. %vecext19 = extractelement <12 x float> %M, i32 7
  1538. %WorldToObject20 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1539. %arrayidx21 = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject20, i32 0, i32 7
  1540. store float %vecext19, float* %arrayidx21, align 4
  1541. %vecext22 = extractelement <12 x float> %M, i32 8
  1542. %WorldToObject23 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1543. %arrayidx24 = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject23, i32 0, i32 8
  1544. store float %vecext22, float* %arrayidx24, align 4
  1545. %vecext25 = extractelement <12 x float> %M, i32 9
  1546. %WorldToObject26 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1547. %arrayidx27 = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject26, i32 0, i32 9
  1548. store float %vecext25, float* %arrayidx27, align 4
  1549. %vecext28 = extractelement <12 x float> %M, i32 10
  1550. %WorldToObject29 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1551. %arrayidx30 = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject29, i32 0, i32 10
  1552. store float %vecext28, float* %arrayidx30, align 4
  1553. %vecext31 = extractelement <12 x float> %M, i32 11
  1554. %WorldToObject32 = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 10
  1555. %arrayidx33 = getelementptr inbounds [12 x float], [12 x float]* %WorldToObject32, i32 0, i32 11
  1556. store float %vecext31, float* %arrayidx33, align 4
  1557. ret void
  1558. }
  1559. ; Function Attrs: nounwind
  1560. define i32 @fb_dxop_primitiveIndex(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1561. entry:
  1562. %PrimitiveIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 11
  1563. %0 = load i32, i32* %PrimitiveIndex, align 4
  1564. ret i32 %0
  1565. }
  1566. ; Function Attrs: nounwind
  1567. define i32 @fb_Fallback_PrimitiveIndex(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1568. entry:
  1569. %PrimitiveIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 11
  1570. %0 = load i32, i32* %PrimitiveIndex, align 4
  1571. ret i32 %0
  1572. }
  1573. ; Function Attrs: nounwind
  1574. define void @fb_Fallback_SetPrimitiveIndex(%struct.RuntimeDataStruct* %runtimeData, i32 %i) #0 {
  1575. )AAA",
  1576. R"AAA(
  1577. entry:
  1578. %PrimitiveIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 11
  1579. store i32 %i, i32* %PrimitiveIndex, align 4
  1580. ret void
  1581. }
  1582. ; Function Attrs: nounwind
  1583. define i32 @fb_Fallback_ShaderRecordOffset(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1584. entry:
  1585. %ShaderRecordOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 15
  1586. %0 = load i32, i32* %ShaderRecordOffset, align 4
  1587. ret i32 %0
  1588. }
  1589. ; Function Attrs: nounwind
  1590. define void @fb_Fallback_SetShaderRecordOffset(%struct.RuntimeDataStruct* %runtimeData, i32 %shaderRecordOffset) #0 {
  1591. entry:
  1592. %ShaderRecordOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 15
  1593. store i32 %shaderRecordOffset, i32* %ShaderRecordOffset, align 4
  1594. ret void
  1595. }
  1596. ; Function Attrs: nounwind
  1597. define i32 @fb_dxop_instanceIndex(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1598. entry:
  1599. %InstanceIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 12
  1600. %0 = load i32, i32* %InstanceIndex, align 4
  1601. ret i32 %0
  1602. }
  1603. ; Function Attrs: nounwind
  1604. define i32 @fb_Fallback_InstanceIndex(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1605. entry:
  1606. %InstanceIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 12
  1607. %0 = load i32, i32* %InstanceIndex, align 4
  1608. ret i32 %0
  1609. }
  1610. ; Function Attrs: nounwind
  1611. define void @fb_Fallback_SetInstanceIndex(%struct.RuntimeDataStruct* %runtimeData, i32 %i) #0 {
  1612. entry:
  1613. %InstanceIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 12
  1614. store i32 %i, i32* %InstanceIndex, align 4
  1615. ret void
  1616. }
  1617. ; Function Attrs: nounwind
  1618. define i32 @fb_dxop_instanceID(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1619. entry:
  1620. %InstanceID = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 13
  1621. %0 = load i32, i32* %InstanceID, align 4
  1622. ret i32 %0
  1623. }
  1624. ; Function Attrs: nounwind
  1625. define i32 @fb_Fallback_InstanceID(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1626. entry:
  1627. %InstanceID = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 13
  1628. %0 = load i32, i32* %InstanceID, align 4
  1629. ret i32 %0
  1630. }
  1631. ; Function Attrs: nounwind
  1632. define void @fb_Fallback_SetInstanceID(%struct.RuntimeDataStruct* %runtimeData, i32 %i) #0 {
  1633. entry:
  1634. %InstanceID = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 13
  1635. store i32 %i, i32* %InstanceID, align 4
  1636. ret void
  1637. }
  1638. ; Function Attrs: nounwind
  1639. define i32 @fb_dxop_hitKind(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1640. entry:
  1641. %HitKind = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 14
  1642. %0 = load i32, i32* %HitKind, align 4
  1643. ret i32 %0
  1644. }
  1645. ; Function Attrs: nounwind
  1646. define i32 @fb_Fallback_HitKind(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1647. entry:
  1648. %HitKind = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 14
  1649. %0 = load i32, i32* %HitKind, align 4
  1650. ret i32 %0
  1651. }
  1652. ; Function Attrs: nounwind
  1653. define void @fb_Fallback_SetHitKind(%struct.RuntimeDataStruct* %runtimeData, i32 %i) #0 {
  1654. entry:
  1655. %HitKind = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 14
  1656. store i32 %i, i32* %HitKind, align 4
  1657. ret void
  1658. }
  1659. ; Function Attrs: nounwind
  1660. define float @fb_dxop_pending_rayTCurrent(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1661. entry:
  1662. %PendingRayTCurrent = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 16
  1663. %0 = load float, float* %PendingRayTCurrent, align 4
  1664. ret float %0
  1665. }
  1666. ; Function Attrs: nounwind
  1667. define void @fb_Fallback_SetPendingRayTCurrent(%struct.RuntimeDataStruct* %runtimeData, float %t) #0 {
  1668. entry:
  1669. %PendingRayTCurrent = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 16
  1670. store float %t, float* %PendingRayTCurrent, align 4
  1671. ret void
  1672. }
  1673. ; Function Attrs: nounwind
  1674. define i32 @fb_dxop_pending_primitiveID(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1675. entry:
  1676. %PendingPrimitiveIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 17
  1677. %0 = load i32, i32* %PendingPrimitiveIndex, align 4
  1678. ret i32 %0
  1679. }
  1680. ; Function Attrs: nounwind
  1681. define i32 @fb_Fallback_PendingShaderRecordOffset(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1682. entry:
  1683. %PendingShaderRecordOffset = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 21
  1684. %0 = load i32, i32* %PendingShaderRecordOffset, align 4
  1685. ret i32 %0
  1686. }
  1687. ; Function Attrs: nounwind
  1688. define i32 @fb_dxop_pending_instanceIndex(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1689. entry:
  1690. %PendingInstanceIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 18
  1691. %0 = load i32, i32* %PendingInstanceIndex, align 4
  1692. ret i32 %0
  1693. }
  1694. ; Function Attrs: nounwind
  1695. define i32 @fb_dxop_pending_instanceID(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1696. entry:
  1697. %PendingInstanceID = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 19
  1698. %0 = load i32, i32* %PendingInstanceID, align 4
  1699. ret i32 %0
  1700. }
  1701. ; Function Attrs: nounwind
  1702. define i32 @fb_dxop_pending_hitKind(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1703. entry:
  1704. %PendingHitKind = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 20
  1705. %0 = load i32, i32* %PendingHitKind, align 4
  1706. ret i32 %0
  1707. }
  1708. ; Function Attrs: nounwind
  1709. define void @fb_Fallback_SetPendingHitKind(%struct.RuntimeDataStruct* %runtimeData, i32 %i) #0 {
  1710. entry:
  1711. %PendingHitKind = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 20
  1712. store i32 %i, i32* %PendingHitKind, align 4
  1713. ret void
  1714. }
  1715. ; Function Attrs: nounwind
  1716. define i32 @fb_Fallback_GroupIndex(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1717. entry:
  1718. %GroupIndex = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 22
  1719. %0 = load i32, i32* %GroupIndex, align 4
  1720. ret i32 %0
  1721. }
  1722. ; Function Attrs: nounwind
  1723. define i32 @fb_Fallback_AnyHitResult(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1724. entry:
  1725. %AnyHitResult = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 23
  1726. %0 = load i32, i32* %AnyHitResult, align 4
  1727. ret i32 %0
  1728. }
  1729. ; Function Attrs: nounwind
  1730. define void @fb_Fallback_SetAnyHitResult(%struct.RuntimeDataStruct* %runtimeData, i32 %result) #0 {
  1731. entry:
  1732. %AnyHitResult = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 23
  1733. store i32 %result, i32* %AnyHitResult, align 4
  1734. ret void
  1735. }
  1736. ; Function Attrs: nounwind
  1737. define i32 @fb_Fallback_AnyHitStateId(%struct.RuntimeDataStruct* %runtimeData) #0 {
  1738. entry:
  1739. %AnyHitStateId = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 24
  1740. %0 = load i32, i32* %AnyHitStateId, align 4
  1741. ret i32 %0
  1742. }
  1743. ; Function Attrs: nounwind
  1744. define void @fb_Fallback_SetAnyHitStateId(%struct.RuntimeDataStruct* %runtimeData, i32 %id) #0 {
  1745. entry:
  1746. %AnyHitStateId = getelementptr inbounds %struct.RuntimeDataStruct, %struct.RuntimeDataStruct* %runtimeData, i32 0, i32 24
  1747. store i32 %id, i32* %AnyHitStateId, align 4
  1748. ret void
  1749. }
  1750. attributes #0 = { nounwind }
  1751. attributes #1 = { nounwind }
  1752. )AAA"
  1753. };
  1754. #include <sstream>
  1755. static std::string getRuntimeString()
  1756. {
  1757. std::ostringstream out;
  1758. for( size_t i=0; i < _countof(runtimeString); ++i)
  1759. out << runtimeString[i];
  1760. return out.str();
  1761. }