sokol_gl.h 209 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319
  1. #if defined(SOKOL_IMPL) && !defined(SOKOL_GL_IMPL)
  2. #define SOKOL_GL_IMPL
  3. #endif
  4. #ifndef SOKOL_GL_INCLUDED
  5. /*
  6. sokol_gl.h -- OpenGL 1.x style rendering on top of sokol_gfx.h
  7. Project URL: https://github.com/floooh/sokol
  8. Do this:
  9. #define SOKOL_IMPL or
  10. #define SOKOL_GL_IMPL
  11. before you include this file in *one* C or C++ file to create the
  12. implementation.
  13. The following defines are used by the implementation to select the
  14. platform-specific embedded shader code (these are the same defines as
  15. used by sokol_gfx.h and sokol_app.h):
  16. SOKOL_GLCORE33
  17. SOKOL_GLES3
  18. SOKOL_D3D11
  19. SOKOL_METAL
  20. SOKOL_WGPU
  21. ...optionally provide the following macros to override defaults:
  22. SOKOL_ASSERT(c) - your own assert macro (default: assert(c))
  23. SOKOL_GL_API_DECL - public function declaration prefix (default: extern)
  24. SOKOL_API_DECL - same as SOKOL_GL_API_DECL
  25. SOKOL_API_IMPL - public function implementation prefix (default: -)
  26. SOKOL_UNREACHABLE() - a guard macro for unreachable code (default: assert(false))
  27. If sokol_gl.h is compiled as a DLL, define the following before
  28. including the declaration or implementation:
  29. SOKOL_DLL
  30. On Windows, SOKOL_DLL will define SOKOL_GL_API_DECL as __declspec(dllexport)
  31. or __declspec(dllimport) as needed.
  32. Include the following headers before including sokol_gl.h:
  33. sokol_gfx.h
  34. Matrix functions have been taken from MESA and Regal.
  35. FEATURE OVERVIEW:
  36. =================
  37. sokol_gl.h implements a subset of the OpenGLES 1.x feature set useful for
  38. when you just want to quickly render a bunch of colored triangles or
  39. lines without having to mess with buffers and shaders.
  40. The current feature set is mostly useful for debug visualizations
  41. and simple UI-style 2D rendering:
  42. What's implemented:
  43. - vertex components:
  44. - position (x, y, z)
  45. - 2D texture coords (u, v)
  46. - color (r, g, b, a)
  47. - primitive types:
  48. - triangle list and strip
  49. - line list and strip
  50. - quad list (TODO: quad strips)
  51. - point list
  52. - one texture layer (no multi-texturing)
  53. - viewport and scissor-rect with selectable origin (top-left or bottom-left)
  54. - all GL 1.x matrix stack functions, and additionally equivalent
  55. functions for gluPerspective and gluLookat
  56. Notable GLES 1.x features that are *NOT* implemented:
  57. - vertex lighting (this is the most likely GL feature that might be added later)
  58. - vertex arrays (although providing whole chunks of vertex data at once
  59. might be a useful feature for a later version)
  60. - texture coordinate generation
  61. - line width
  62. - all pixel store functions
  63. - no ALPHA_TEST
  64. - no clear functions (clearing is handled by the sokol-gfx render pass)
  65. - fog
  66. Notable differences to GL:
  67. - No "enum soup" for render states etc, instead there's a
  68. 'pipeline stack', this is similar to GL's matrix stack,
  69. but for pipeline-state-objects. The pipeline object at
  70. the top of the pipeline stack defines the active set of render states
  71. - All angles are in radians, not degrees (note the sgl_rad() and
  72. sgl_deg() conversion functions)
  73. - No enable/disable state for scissor test, this is always enabled
  74. STEP BY STEP:
  75. =============
  76. --- To initialize sokol-gl, call:
  77. sgl_setup(const sgl_desc_t* desc)
  78. NOTE that sgl_setup() must be called *after* initializing sokol-gfx
  79. (via sg_setup). This is because sgl_setup() needs to create
  80. sokol-gfx resource objects.
  81. If you're intending to render to the default pass, and also don't
  82. want to tweak memory usage, and don't want any logging output you can
  83. just keep sgl_desc_t zero-initialized:
  84. sgl_setup(&(sgl_desc_t*){ 0 });
  85. In this case, sokol-gl will create internal sg_pipeline objects that
  86. are compatible with the sokol-app default framebuffer.
  87. I would recommend to at least install a logging callback so that
  88. you'll see any warnings and errors. The easiest way is through
  89. sokol_log.h:
  90. #include "sokol_log.h"
  91. sgl_setup(&(sgl_desc_t){
  92. .logger.func = slog_func.
  93. });
  94. If you want to render into a framebuffer with different pixel-format
  95. and MSAA attributes you need to provide the matching attributes in the
  96. sgl_setup() call:
  97. sgl_setup(&(sgl_desc_t*){
  98. .color_format = SG_PIXELFORMAT_...,
  99. .depth_format = SG_PIXELFORMAT_...,
  100. .sample_count = ...,
  101. });
  102. To reduce memory usage, or if you need to create more then the default number of
  103. contexts, pipelines, vertices or draw commands, set the following sgl_desc_t
  104. members:
  105. .context_pool_size (default: 4)
  106. .pipeline_pool_size (default: 64)
  107. .max_vertices (default: 64k)
  108. .max_commands (default: 16k)
  109. Finally you can change the face winding for front-facing triangles
  110. and quads:
  111. .face_winding - default is SG_FACEWINDING_CCW
  112. The default winding for front faces is counter-clock-wise. This is
  113. the same as OpenGL's default, but different from sokol-gfx.
  114. --- Optionally create additional context objects if you want to render into
  115. multiple sokol-gfx render passes (or generally if you want to
  116. use multiple independent sokol-gl "state buckets")
  117. sgl_context ctx = sgl_make_context(const sgl_context_desc_t* desc)
  118. For details on rendering with sokol-gl contexts, search below for
  119. WORKING WITH CONTEXTS.
  120. --- Optionally create pipeline-state-objects if you need render state
  121. that differs from sokol-gl's default state:
  122. sgl_pipeline pip = sgl_make_pipeline(const sg_pipeline_desc* desc)
  123. ...this creates a pipeline object that's compatible with the currently
  124. active context, alternatively call:
  125. sgl_pipeline_pip = sgl_context_make_pipeline(sgl_context ctx, const sg_pipeline_desc* desc)
  126. ...to create a pipeline object that's compatible with an explicitly
  127. provided context.
  128. The similarity with sokol_gfx.h's sg_pipeline type and sg_make_pipeline()
  129. function is intended. sgl_make_pipeline() also takes a standard
  130. sokol-gfx sg_pipeline_desc object to describe the render state, but
  131. without:
  132. - shader
  133. - vertex layout
  134. - color- and depth-pixel-formats
  135. - primitive type (lines, triangles, ...)
  136. - MSAA sample count
  137. Those will be filled in by sgl_make_pipeline(). Note that each
  138. call to sgl_make_pipeline() needs to create several sokol-gfx
  139. pipeline objects (one for each primitive type).
  140. 'depth.write_enabled' will be forced to 'false' if the context this
  141. pipeline object is intended for has its depth pixel format set to
  142. SG_PIXELFORMAT_NONE (which means the framebuffer this context is used
  143. with doesn't have a depth-stencil surface).
  144. --- if you need to destroy sgl_pipeline objects before sgl_shutdown():
  145. sgl_destroy_pipeline(sgl_pipeline pip)
  146. --- After sgl_setup() you can call any of the sokol-gl functions anywhere
  147. in a frame, *except* sgl_draw(). The 'vanilla' functions
  148. will only change internal sokol-gl state, and not call any sokol-gfx
  149. functions.
  150. --- Unlike OpenGL, sokol-gl has a function to reset internal state to
  151. a known default. This is useful at the start of a sequence of
  152. rendering operations:
  153. void sgl_defaults(void)
  154. This will set the following default state:
  155. - current texture coordinate to u=0.0f, v=0.0f
  156. - current color to white (rgba all 1.0f)
  157. - current point size to 1.0f
  158. - unbind the current texture and texturing will be disabled
  159. - *all* matrices will be set to identity (also the projection matrix)
  160. - the default render state will be set by loading the 'default pipeline'
  161. into the top of the pipeline stack
  162. The current matrix- and pipeline-stack-depths will not be changed by
  163. sgl_defaults().
  164. --- change the currently active renderstate through the
  165. pipeline-stack functions, this works similar to the
  166. traditional GL matrix stack:
  167. ...load the default pipeline state on the top of the pipeline stack:
  168. sgl_load_default_pipeline()
  169. ...load a specific pipeline on the top of the pipeline stack:
  170. sgl_load_pipeline(sgl_pipeline pip)
  171. ...push and pop the pipeline stack:
  172. sgl_push_pipeline()
  173. sgl_pop_pipeline()
  174. --- control texturing with:
  175. sgl_enable_texture()
  176. sgl_disable_texture()
  177. sgl_texture(sg_image img)
  178. --- set the current viewport and scissor rect with:
  179. sgl_viewport(int x, int y, int w, int h, bool origin_top_left)
  180. sgl_scissor_rect(int x, int y, int w, int h, bool origin_top_left)
  181. ...or call these alternatives which take float arguments (this might allow
  182. to avoid casting between float and integer in more strongly typed languages
  183. when floating point pixel coordinates are used):
  184. sgl_viewportf(float x, float y, float w, float h, bool origin_top_left)
  185. sgl_scissor_rectf(float x, float y, float w, float h, bool origin_top_left)
  186. ...these calls add a new command to the internal command queue, so
  187. that the viewport or scissor rect are set at the right time relative
  188. to other sokol-gl calls.
  189. --- adjust the transform matrices, matrix manipulation works just like
  190. the OpenGL matrix stack:
  191. ...set the current matrix mode:
  192. sgl_matrix_mode_modelview()
  193. sgl_matrix_mode_projection()
  194. sgl_matrix_mode_texture()
  195. ...load the identity matrix into the current matrix:
  196. sgl_load_identity()
  197. ...translate, rotate and scale the current matrix:
  198. sgl_translate(float x, float y, float z)
  199. sgl_rotate(float angle_rad, float x, float y, float z)
  200. sgl_scale(float x, float y, float z)
  201. NOTE that all angles in sokol-gl are in radians, not in degree.
  202. Convert between radians and degree with the helper functions:
  203. float sgl_rad(float deg) - degrees to radians
  204. float sgl_deg(float rad) - radians to degrees
  205. ...directly load the current matrix from a float[16] array:
  206. sgl_load_matrix(const float m[16])
  207. sgl_load_transpose_matrix(const float m[16])
  208. ...directly multiply the current matrix from a float[16] array:
  209. sgl_mult_matrix(const float m[16])
  210. sgl_mult_transpose_matrix(const float m[16])
  211. The memory layout of those float[16] arrays is the same as in OpenGL.
  212. ...more matrix functions:
  213. sgl_frustum(float left, float right, float bottom, float top, float near, float far)
  214. sgl_ortho(float left, float right, float bottom, float top, float near, float far)
  215. sgl_perspective(float fov_y, float aspect, float near, float far)
  216. sgl_lookat(float eye_x, float eye_y, float eye_z, float center_x, float center_y, float center_z, float up_x, float up_y, float up_z)
  217. These functions work the same as glFrustum(), glOrtho(), gluPerspective()
  218. and gluLookAt().
  219. ...and finally to push / pop the current matrix stack:
  220. sgl_push_matrix(void)
  221. sgl_pop_matrix(void)
  222. Again, these work the same as glPushMatrix() and glPopMatrix().
  223. --- perform primitive rendering:
  224. ...set the current texture coordinate and color 'registers' with or
  225. point size with:
  226. sgl_t2f(float u, float v) - set current texture coordinate
  227. sgl_c*(...) - set current color
  228. sgl_point_size(float size) - set current point size
  229. There are several functions for setting the color (as float values,
  230. unsigned byte values, packed as unsigned 32-bit integer, with
  231. and without alpha).
  232. NOTE that these are the only functions that can be called both inside
  233. sgl_begin_*() / sgl_end() and outside.
  234. Also NOTE that point size is currently hardwired to 1.0f if the D3D11
  235. backend is used.
  236. ...start a primitive vertex sequence with:
  237. sgl_begin_points()
  238. sgl_begin_lines()
  239. sgl_begin_line_strip()
  240. sgl_begin_triangles()
  241. sgl_begin_triangle_strip()
  242. sgl_begin_quads()
  243. ...after sgl_begin_*() specify vertices:
  244. sgl_v*(...)
  245. sgl_v*_t*(...)
  246. sgl_v*_c*(...)
  247. sgl_v*_t*_c*(...)
  248. These functions write a new vertex to sokol-gl's internal vertex buffer,
  249. optionally with texture-coords and color. If the texture coordinate
  250. and/or color is missing, it will be taken from the current texture-coord
  251. and color 'register'.
  252. ...finally, after specifying vertices, call:
  253. sgl_end()
  254. This will record a new draw command in sokol-gl's internal command
  255. list, or it will extend the previous draw command if no relevant
  256. state has changed since the last sgl_begin/end pair.
  257. --- inside a sokol-gfx rendering pass, call the sgl_draw() function
  258. to render the currently active context:
  259. sgl_draw()
  260. ...or alternatively call:
  261. sgl_context_draw(ctx)
  262. ...to render an explicitly provided context.
  263. This will render everything that has been recorded in the context since
  264. the last call to sgl_draw() through sokol-gfx, and will 'rewind' the internal
  265. vertex-, uniform- and command-buffers.
  266. --- each sokol-gl context tracks an internal error code, to query the
  267. current error code for the currently active context call:
  268. sgl_error_t sgl_error()
  269. ...alternatively with an explicit context argument:
  270. sgl_error_t sgl_context_error(ctx);
  271. ...which can return the following error codes:
  272. SGL_NO_ERROR - all OK, no error occurred since last sgl_draw()
  273. SGL_ERROR_VERTICES_FULL - internal vertex buffer is full (checked in sgl_end())
  274. SGL_ERROR_UNIFORMS_FULL - the internal uniforms buffer is full (checked in sgl_end())
  275. SGL_ERROR_COMMANDS_FULL - the internal command buffer is full (checked in sgl_end())
  276. SGL_ERROR_STACK_OVERFLOW - matrix- or pipeline-stack overflow
  277. SGL_ERROR_STACK_UNDERFLOW - matrix- or pipeline-stack underflow
  278. SGL_ERROR_NO_CONTEXT - the active context no longer exists
  279. ...if sokol-gl is in an error-state, sgl_draw() will skip any rendering,
  280. and reset the error code to SGL_NO_ERROR.
  281. RENDER LAYERS
  282. =============
  283. Render layers allow to split sokol-gl rendering into separate draw-command
  284. groups which can then be rendered separately in a sokol-gfx draw pass. This
  285. allows to mix/interleave sokol-gl rendering with other render operations.
  286. Layered rendering is controlled through two functions:
  287. sgl_layer(int layer_id)
  288. sgl_draw_layer(int layer_id)
  289. (and the context-variant sgl_draw_layer(): sgl_context_draw_layer()
  290. The sgl_layer() function sets the 'current layer', any sokol-gl calls
  291. which internally record draw commands will also store the current layer
  292. in the draw command, and later in a sokol-gfx render pass, a call
  293. to sgl_draw_layer() will only render the draw commands that have
  294. a matching layer.
  295. The default layer is '0', this is active after sokol-gl setup, and
  296. is also restored at the start of a new frame (but *not* by calling
  297. sgl_defaults()).
  298. NOTE that calling sgl_draw() is equivalent with sgl_draw_layer(0)
  299. (in general you should either use either use sgl_draw() or
  300. sgl_draw_layer() in an application, but not both).
  301. WORKING WITH CONTEXTS:
  302. ======================
  303. If you want to render to more than one sokol-gfx render pass you need to
  304. work with additional sokol-gl context objects (one context object for
  305. each offscreen rendering pass, in addition to the implicitly created
  306. 'default context'.
  307. All sokol-gl state is tracked per context, and there is always a "current
  308. context" (with the notable exception that the currently set context is
  309. destroyed, more on that later).
  310. Using multiple contexts can also be useful if you only render in
  311. a single pass, but want to maintain multiple independent "state buckets".
  312. To create new context object, call:
  313. sgl_context ctx = sgl_make_context(&(sgl_context_desc){
  314. .max_vertices = ..., // default: 64k
  315. .max_commands = ..., // default: 16k
  316. .color_format = ...,
  317. .depth_format = ...,
  318. .sample_count = ...,
  319. });
  320. The color_format, depth_format and sample_count items must be compatible
  321. with the render pass the sgl_draw() or sgL_context_draw() function
  322. will be called in.
  323. Creating a context does *not* make the context current. To do this, call:
  324. sgl_set_context(ctx);
  325. The currently active context will implicitely be used by most sokol-gl functions
  326. which don't take an explicit context handle as argument.
  327. To switch back to the default context, pass the global constant SGL_DEFAULT_CONTEXT:
  328. sgl_set_context(SGL_DEFAULT_CONTEXT);
  329. ...or alternatively use the function sgl_default_context() instead of the
  330. global constant:
  331. sgl_set_context(sgl_default_context());
  332. To get the currently active context, call:
  333. sgl_context cur_ctx = sgl_get_context();
  334. The following functions exist in two variants, one which use the currently
  335. active context (set with sgl_set_context()), and another version which
  336. takes an explicit context handle instead:
  337. sgl_make_pipeline() vs sgl_context_make_pipeline()
  338. sgl_error() vs sgl_context_error();
  339. sgl_draw() vs sgl_context_draw();
  340. Except for using the currently active context versus a provided context
  341. handle, the two variants are exactlyidentical, e.g. the following
  342. code sequences do the same thing:
  343. sgl_set_context(ctx);
  344. sgl_pipeline pip = sgl_make_pipeline(...);
  345. sgl_error_t err = sgl_error();
  346. sgl_draw();
  347. vs
  348. sgl_pipeline pip = sgl_context_make_pipeline(ctx, ...);
  349. sgl_error_t err = sgl_context_error(ctx);
  350. sgl_context_draw(ctx);
  351. Destroying the currently active context is a 'soft error'. All following
  352. calls which require a currently active context will silently fail,
  353. and sgl_error() will return SGL_ERROR_NO_CONTEXT.
  354. UNDER THE HOOD:
  355. ===============
  356. sokol_gl.h works by recording vertex data and rendering commands into
  357. memory buffers, and then drawing the recorded commands via sokol_gfx.h
  358. The only functions which call into sokol_gfx.h are:
  359. - sgl_setup()
  360. - sgl_shutdown()
  361. - sgl_draw() (and variants)
  362. sgl_setup() must be called after initializing sokol-gfx.
  363. sgl_shutdown() must be called before shutting down sokol-gfx.
  364. sgl_draw() must be called once per frame inside a sokol-gfx render pass.
  365. All other sokol-gl function can be called anywhere in a frame, since
  366. they just record data into memory buffers owned by sokol-gl.
  367. What happens in:
  368. sgl_setup():
  369. Unique resources shared by all contexts are created:
  370. - a shader object (using embedded shader source or byte code)
  371. - an 8x8 white default texture
  372. The default context is created, which involves:
  373. - 3 memory buffers are created, one for vertex data,
  374. one for uniform data, and one for commands
  375. - a dynamic vertex buffer is created
  376. - the default sgl_pipeline object is created, which involves
  377. creating 5 sg_pipeline objects
  378. One vertex is 24 bytes:
  379. - float3 position
  380. - float2 texture coords
  381. - uint32_t color
  382. One uniform block is 128 bytes:
  383. - mat4 model-view-projection matrix
  384. - mat4 texture matrix
  385. One draw command is ca. 24 bytes for the actual
  386. command code plus command arguments.
  387. Each sgl_end() consumes one command, and one uniform block
  388. (only when the matrices have changed).
  389. The required size for one sgl_begin/end pair is (at most):
  390. (152 + 24 * num_verts) bytes
  391. sgl_shutdown():
  392. - all sokol-gfx resources (buffer, shader, default-texture and
  393. all pipeline objects) are destroyed
  394. - the 3 memory buffers are freed
  395. sgl_draw() (and variants)
  396. - copy all recorded vertex data into the dynamic sokol-gfx buffer
  397. via a call to sg_update_buffer()
  398. - for each recorded command:
  399. - if the layer number stored in the command doesn't match
  400. the layer that's to be rendered, skip to the next
  401. command
  402. - if it's a viewport command, call sg_apply_viewport()
  403. - if it's a scissor-rect command, call sg_apply_scissor_rect()
  404. - if it's a draw command:
  405. - depending on what has changed since the last draw command,
  406. call sg_apply_pipeline(), sg_apply_bindings() and
  407. sg_apply_uniforms()
  408. - finally call sg_draw()
  409. All other functions only modify the internally tracked state, add
  410. data to the vertex, uniform and command buffers, or manipulate
  411. the matrix stack.
  412. ON DRAW COMMAND MERGING
  413. =======================
  414. Not every call to sgl_end() will automatically record a new draw command.
  415. If possible, the previous draw command will simply be extended,
  416. resulting in fewer actual draw calls later in sgl_draw().
  417. A draw command will be merged with the previous command if "no relevant
  418. state has changed" since the last sgl_end(), meaning:
  419. - no calls to sgl_viewport() and sgl_scissor_rect()
  420. - the primitive type hasn't changed
  421. - the primitive type isn't a 'strip type' (no line or triangle strip)
  422. - the pipeline state object hasn't changed
  423. - the current layer hasn't changed
  424. - none of the matrices has changed
  425. - none of the texture state has changed
  426. Merging a draw command simply means that the number of vertices
  427. to render in the previous draw command will be incremented by the
  428. number of vertices in the new draw command.
  429. MEMORY ALLOCATION OVERRIDE
  430. ==========================
  431. You can override the memory allocation functions at initialization time
  432. like this:
  433. void* my_alloc(size_t size, void* user_data) {
  434. return malloc(size);
  435. }
  436. void my_free(void* ptr, void* user_data) {
  437. free(ptr);
  438. }
  439. ...
  440. sgl_setup(&(sgl_desc_t){
  441. // ...
  442. .allocator = {
  443. .alloc = my_alloc,
  444. .free = my_free,
  445. .user_data = ...;
  446. }
  447. });
  448. ...
  449. If no overrides are provided, malloc and free will be used.
  450. ERROR REPORTING AND LOGGING
  451. ===========================
  452. To get any logging information at all you need to provide a logging callback in the setup call,
  453. the easiest way is to use sokol_log.h:
  454. #include "sokol_log.h"
  455. sgl_setup(&(sgl_desc_t){
  456. // ...
  457. .logger.func = slog_func
  458. });
  459. To override logging with your own callback, first write a logging function like this:
  460. void my_log(const char* tag, // e.g. 'sgl'
  461. uint32_t log_level, // 0=panic, 1=error, 2=warn, 3=info
  462. uint32_t log_item_id, // SGL_LOGITEM_*
  463. const char* message_or_null, // a message string, may be nullptr in release mode
  464. uint32_t line_nr, // line number in sokol_gl.h
  465. const char* filename_or_null, // source filename, may be nullptr in release mode
  466. void* user_data)
  467. {
  468. ...
  469. }
  470. ...and then setup sokol-gl like this:
  471. sgl_setup(&(sgl_desc_t){
  472. .logger = {
  473. .func = my_log,
  474. .user_data = my_user_data,
  475. }
  476. });
  477. The provided logging function must be reentrant (e.g. be callable from
  478. different threads).
  479. If you don't want to provide your own custom logger it is highly recommended to use
  480. the standard logger in sokol_log.h instead, otherwise you won't see any warnings or
  481. errors.
  482. LICENSE
  483. =======
  484. zlib/libpng license
  485. Copyright (c) 2018 Andre Weissflog
  486. This software is provided 'as-is', without any express or implied warranty.
  487. In no event will the authors be held liable for any damages arising from the
  488. use of this software.
  489. Permission is granted to anyone to use this software for any purpose,
  490. including commercial applications, and to alter it and redistribute it
  491. freely, subject to the following restrictions:
  492. 1. The origin of this software must not be misrepresented; you must not
  493. claim that you wrote the original software. If you use this software in a
  494. product, an acknowledgment in the product documentation would be
  495. appreciated but is not required.
  496. 2. Altered source versions must be plainly marked as such, and must not
  497. be misrepresented as being the original software.
  498. 3. This notice may not be removed or altered from any source
  499. distribution.
  500. */
  501. #define SOKOL_GL_INCLUDED (1)
  502. #include <stdint.h>
  503. #include <stdbool.h>
  504. #include <stddef.h> // size_t, offsetof
  505. #if !defined(SOKOL_GFX_INCLUDED)
  506. #error "Please include sokol_gfx.h before sokol_gl.h"
  507. #endif
  508. #if defined(SOKOL_API_DECL) && !defined(SOKOL_GL_API_DECL)
  509. #define SOKOL_GL_API_DECL SOKOL_API_DECL
  510. #endif
  511. #ifndef SOKOL_GL_API_DECL
  512. #if defined(_WIN32) && defined(SOKOL_DLL) && defined(SOKOL_GL_IMPL)
  513. #define SOKOL_GL_API_DECL __declspec(dllexport)
  514. #elif defined(_WIN32) && defined(SOKOL_DLL)
  515. #define SOKOL_GL_API_DECL __declspec(dllimport)
  516. #else
  517. #define SOKOL_GL_API_DECL extern
  518. #endif
  519. #endif
  520. #ifdef __cplusplus
  521. extern "C" {
  522. #endif
  523. /*
  524. sgl_log_item_t
  525. Log items are defined via X-Macros, and expanded to an
  526. enum 'sgl_log_item' - and in debug mode only - corresponding strings.
  527. Used as parameter in the logging callback.
  528. */
  529. #define _SGL_LOG_ITEMS \
  530. _SGL_LOGITEM_XMACRO(OK, "Ok") \
  531. _SGL_LOGITEM_XMACRO(MALLOC_FAILED, "memory allocation failed") \
  532. _SGL_LOGITEM_XMACRO(MAKE_PIPELINE_FAILED, "sg_make_pipeline() failed") \
  533. _SGL_LOGITEM_XMACRO(PIPELINE_POOL_EXHAUSTED, "pipeline pool exhausted (use sgl_desc_t.pipeline_pool_size to adjust)") \
  534. _SGL_LOGITEM_XMACRO(ADD_COMMIT_LISTENER_FAILED, "sg_add_commit_listener() failed") \
  535. _SGL_LOGITEM_XMACRO(CONTEXT_POOL_EXHAUSTED, "context pool exhausted (use sgl_desc_t.context_pool_size to adjust)") \
  536. _SGL_LOGITEM_XMACRO(CANNOT_DESTROY_DEFAULT_CONTEXT, "cannot destroy default context") \
  537. #define _SGL_LOGITEM_XMACRO(item,msg) SGL_LOGITEM_##item,
  538. typedef enum sgl_log_item_t {
  539. _SGL_LOG_ITEMS
  540. } sgl_log_item_t;
  541. #undef _SGL_LOGITEM_XMACRO
  542. /*
  543. sgl_logger_t
  544. Used in sgl_desc_t to provide a custom logging and error reporting
  545. callback to sokol-gl.
  546. */
  547. typedef struct sgl_logger_t {
  548. void (*func)(
  549. const char* tag, // always "sgl"
  550. uint32_t log_level, // 0=panic, 1=error, 2=warning, 3=info
  551. uint32_t log_item_id, // SGL_LOGITEM_*
  552. const char* message_or_null, // a message string, may be nullptr in release mode
  553. uint32_t line_nr, // line number in sokol_gl.h
  554. const char* filename_or_null, // source filename, may be nullptr in release mode
  555. void* user_data);
  556. void* user_data;
  557. } sgl_logger_t;
  558. /* sokol_gl pipeline handle (created with sgl_make_pipeline()) */
  559. typedef struct sgl_pipeline { uint32_t id; } sgl_pipeline;
  560. /* a context handle (created with sgl_make_context()) */
  561. typedef struct sgl_context { uint32_t id; } sgl_context;
  562. /*
  563. sgl_error_t
  564. Errors are reset each frame after calling sgl_draw(),
  565. get the last error code with sgl_error()
  566. */
  567. typedef enum sgl_error_t {
  568. SGL_NO_ERROR = 0,
  569. SGL_ERROR_VERTICES_FULL,
  570. SGL_ERROR_UNIFORMS_FULL,
  571. SGL_ERROR_COMMANDS_FULL,
  572. SGL_ERROR_STACK_OVERFLOW,
  573. SGL_ERROR_STACK_UNDERFLOW,
  574. SGL_ERROR_NO_CONTEXT,
  575. } sgl_error_t;
  576. /*
  577. sgl_context_desc_t
  578. Describes the initialization parameters of a rendering context.
  579. Creating additional contexts is useful if you want to render
  580. in separate sokol-gfx passes.
  581. */
  582. typedef struct sgl_context_desc_t {
  583. int max_vertices; // default: 64k
  584. int max_commands; // default: 16k
  585. sg_pixel_format color_format;
  586. sg_pixel_format depth_format;
  587. int sample_count;
  588. } sgl_context_desc_t;
  589. /*
  590. sgl_allocator_t
  591. Used in sgl_desc_t to provide custom memory-alloc and -free functions
  592. to sokol_gl.h. If memory management should be overridden, both the
  593. alloc and free function must be provided (e.g. it's not valid to
  594. override one function but not the other).
  595. */
  596. typedef struct sgl_allocator_t {
  597. void* (*alloc)(size_t size, void* user_data);
  598. void (*free)(void* ptr, void* user_data);
  599. void* user_data;
  600. } sgl_allocator_t;
  601. typedef struct sgl_desc_t {
  602. int max_vertices; // default: 64k
  603. int max_commands; // default: 16k
  604. int context_pool_size; // max number of contexts (including default context), default: 4
  605. int pipeline_pool_size; // size of internal pipeline pool, default: 64
  606. sg_pixel_format color_format;
  607. sg_pixel_format depth_format;
  608. int sample_count;
  609. sg_face_winding face_winding; // default: SG_FACEWINDING_CCW
  610. sgl_allocator_t allocator; // optional memory allocation overrides (default: malloc/free)
  611. sgl_logger_t logger; // optional log function override (default: NO LOGGING)
  612. } sgl_desc_t;
  613. /* the default context handle */
  614. static const sgl_context SGL_DEFAULT_CONTEXT = { 0x00010001 };
  615. /* setup/shutdown/misc */
  616. SOKOL_GL_API_DECL void sgl_setup(const sgl_desc_t* desc);
  617. SOKOL_GL_API_DECL void sgl_shutdown(void);
  618. SOKOL_GL_API_DECL float sgl_rad(float deg);
  619. SOKOL_GL_API_DECL float sgl_deg(float rad);
  620. SOKOL_GL_API_DECL sgl_error_t sgl_error(void);
  621. SOKOL_GL_API_DECL sgl_error_t sgl_context_error(sgl_context ctx);
  622. /* context functions */
  623. SOKOL_GL_API_DECL sgl_context sgl_make_context(const sgl_context_desc_t* desc);
  624. SOKOL_GL_API_DECL void sgl_destroy_context(sgl_context ctx);
  625. SOKOL_GL_API_DECL void sgl_set_context(sgl_context ctx);
  626. SOKOL_GL_API_DECL sgl_context sgl_get_context(void);
  627. SOKOL_GL_API_DECL sgl_context sgl_default_context(void);
  628. /* draw recorded commands (call inside a sokol-gfx render pass) */
  629. SOKOL_GL_API_DECL void sgl_draw();
  630. SOKOL_GL_API_DECL void sgl_context_draw(sgl_context ctx);
  631. SOKOL_GL_API_DECL void sgl_draw_layer(int layer_id);
  632. SOKOL_GL_API_DECL void sgl_context_draw_layer(sgl_context ctx, int layer_id);
  633. /* create and destroy pipeline objects */
  634. SOKOL_GL_API_DECL sgl_pipeline sgl_make_pipeline(const sg_pipeline_desc* desc);
  635. SOKOL_GL_API_DECL sgl_pipeline sgl_context_make_pipeline(sgl_context ctx, const sg_pipeline_desc* desc);
  636. SOKOL_GL_API_DECL void sgl_destroy_pipeline(sgl_pipeline pip);
  637. /* render state functions */
  638. SOKOL_GL_API_DECL void sgl_defaults(void);
  639. SOKOL_GL_API_DECL void sgl_viewport(int x, int y, int w, int h, bool origin_top_left);
  640. SOKOL_GL_API_DECL void sgl_viewportf(float x, float y, float w, float h, bool origin_top_left);
  641. SOKOL_GL_API_DECL void sgl_scissor_rect(int x, int y, int w, int h, bool origin_top_left);
  642. SOKOL_GL_API_DECL void sgl_scissor_rectf(float x, float y, float w, float h, bool origin_top_left);
  643. SOKOL_GL_API_DECL void sgl_enable_texture(void);
  644. SOKOL_GL_API_DECL void sgl_disable_texture(void);
  645. SOKOL_GL_API_DECL void sgl_texture(sg_image img);
  646. SOKOL_GL_API_DECL void sgl_layer(int layer_id);
  647. /* pipeline stack functions */
  648. SOKOL_GL_API_DECL void sgl_load_default_pipeline(void);
  649. SOKOL_GL_API_DECL void sgl_load_pipeline(sgl_pipeline pip);
  650. SOKOL_GL_API_DECL void sgl_push_pipeline(void);
  651. SOKOL_GL_API_DECL void sgl_pop_pipeline(void);
  652. /* matrix stack functions */
  653. SOKOL_GL_API_DECL void sgl_matrix_mode_modelview(void);
  654. SOKOL_GL_API_DECL void sgl_matrix_mode_projection(void);
  655. SOKOL_GL_API_DECL void sgl_matrix_mode_texture(void);
  656. SOKOL_GL_API_DECL void sgl_load_identity(void);
  657. SOKOL_GL_API_DECL void sgl_load_matrix(const float m[16]);
  658. SOKOL_GL_API_DECL void sgl_load_transpose_matrix(const float m[16]);
  659. SOKOL_GL_API_DECL void sgl_mult_matrix(const float m[16]);
  660. SOKOL_GL_API_DECL void sgl_mult_transpose_matrix(const float m[16]);
  661. SOKOL_GL_API_DECL void sgl_rotate(float angle_rad, float x, float y, float z);
  662. SOKOL_GL_API_DECL void sgl_scale(float x, float y, float z);
  663. SOKOL_GL_API_DECL void sgl_translate(float x, float y, float z);
  664. SOKOL_GL_API_DECL void sgl_frustum(float l, float r, float b, float t, float n, float f);
  665. SOKOL_GL_API_DECL void sgl_ortho(float l, float r, float b, float t, float n, float f);
  666. SOKOL_GL_API_DECL void sgl_perspective(float fov_y, float aspect, float z_near, float z_far);
  667. SOKOL_GL_API_DECL void sgl_lookat(float eye_x, float eye_y, float eye_z, float center_x, float center_y, float center_z, float up_x, float up_y, float up_z);
  668. SOKOL_GL_API_DECL void sgl_push_matrix(void);
  669. SOKOL_GL_API_DECL void sgl_pop_matrix(void);
  670. /* these functions only set the internal 'current texcoord / color / point size' (valid inside or outside begin/end) */
  671. SOKOL_GL_API_DECL void sgl_t2f(float u, float v);
  672. SOKOL_GL_API_DECL void sgl_c3f(float r, float g, float b);
  673. SOKOL_GL_API_DECL void sgl_c4f(float r, float g, float b, float a);
  674. SOKOL_GL_API_DECL void sgl_c3b(uint8_t r, uint8_t g, uint8_t b);
  675. SOKOL_GL_API_DECL void sgl_c4b(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
  676. SOKOL_GL_API_DECL void sgl_c1i(uint32_t rgba);
  677. SOKOL_GL_API_DECL void sgl_point_size(float s);
  678. /* define primitives, each begin/end is one draw command */
  679. SOKOL_GL_API_DECL void sgl_begin_points(void);
  680. SOKOL_GL_API_DECL void sgl_begin_lines(void);
  681. SOKOL_GL_API_DECL void sgl_begin_line_strip(void);
  682. SOKOL_GL_API_DECL void sgl_begin_triangles(void);
  683. SOKOL_GL_API_DECL void sgl_begin_triangle_strip(void);
  684. SOKOL_GL_API_DECL void sgl_begin_quads(void);
  685. SOKOL_GL_API_DECL void sgl_v2f(float x, float y);
  686. SOKOL_GL_API_DECL void sgl_v3f(float x, float y, float z);
  687. SOKOL_GL_API_DECL void sgl_v2f_t2f(float x, float y, float u, float v);
  688. SOKOL_GL_API_DECL void sgl_v3f_t2f(float x, float y, float z, float u, float v);
  689. SOKOL_GL_API_DECL void sgl_v2f_c3f(float x, float y, float r, float g, float b);
  690. SOKOL_GL_API_DECL void sgl_v2f_c3b(float x, float y, uint8_t r, uint8_t g, uint8_t b);
  691. SOKOL_GL_API_DECL void sgl_v2f_c4f(float x, float y, float r, float g, float b, float a);
  692. SOKOL_GL_API_DECL void sgl_v2f_c4b(float x, float y, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
  693. SOKOL_GL_API_DECL void sgl_v2f_c1i(float x, float y, uint32_t rgba);
  694. SOKOL_GL_API_DECL void sgl_v3f_c3f(float x, float y, float z, float r, float g, float b);
  695. SOKOL_GL_API_DECL void sgl_v3f_c3b(float x, float y, float z, uint8_t r, uint8_t g, uint8_t b);
  696. SOKOL_GL_API_DECL void sgl_v3f_c4f(float x, float y, float z, float r, float g, float b, float a);
  697. SOKOL_GL_API_DECL void sgl_v3f_c4b(float x, float y, float z, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
  698. SOKOL_GL_API_DECL void sgl_v3f_c1i(float x, float y, float z, uint32_t rgba);
  699. SOKOL_GL_API_DECL void sgl_v2f_t2f_c3f(float x, float y, float u, float v, float r, float g, float b);
  700. SOKOL_GL_API_DECL void sgl_v2f_t2f_c3b(float x, float y, float u, float v, uint8_t r, uint8_t g, uint8_t b);
  701. SOKOL_GL_API_DECL void sgl_v2f_t2f_c4f(float x, float y, float u, float v, float r, float g, float b, float a);
  702. SOKOL_GL_API_DECL void sgl_v2f_t2f_c4b(float x, float y, float u, float v, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
  703. SOKOL_GL_API_DECL void sgl_v2f_t2f_c1i(float x, float y, float u, float v, uint32_t rgba);
  704. SOKOL_GL_API_DECL void sgl_v3f_t2f_c3f(float x, float y, float z, float u, float v, float r, float g, float b);
  705. SOKOL_GL_API_DECL void sgl_v3f_t2f_c3b(float x, float y, float z, float u, float v, uint8_t r, uint8_t g, uint8_t b);
  706. SOKOL_GL_API_DECL void sgl_v3f_t2f_c4f(float x, float y, float z, float u, float v, float r, float g, float b, float a);
  707. SOKOL_GL_API_DECL void sgl_v3f_t2f_c4b(float x, float y, float z, float u, float v, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
  708. SOKOL_GL_API_DECL void sgl_v3f_t2f_c1i(float x, float y, float z, float u, float v, uint32_t rgba);
  709. SOKOL_GL_API_DECL void sgl_end(void);
  710. #ifdef __cplusplus
  711. } /* extern "C" */
  712. /* reference-based equivalents for C++ */
  713. inline void sgl_setup(const sgl_desc_t& desc) { return sgl_setup(&desc); }
  714. inline sgl_context sgl_make_context(const sgl_context_desc_t& desc) { return sgl_make_context(&desc); }
  715. inline sgl_pipeline sgl_make_pipeline(const sg_pipeline_desc& desc) { return sgl_make_pipeline(&desc); }
  716. inline sgl_pipeline sgl_context_make_pipeline(sgl_context ctx, const sg_pipeline_desc& desc) { return sgl_context_make_pipeline(ctx, &desc); }
  717. #endif
  718. #endif /* SOKOL_GL_INCLUDED */
  719. // ██ ███ ███ ██████ ██ ███████ ███ ███ ███████ ███ ██ ████████ █████ ████████ ██ ██████ ███ ██
  720. // ██ ████ ████ ██ ██ ██ ██ ████ ████ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
  721. // ██ ██ ████ ██ ██████ ██ █████ ██ ████ ██ █████ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██
  722. // ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
  723. // ██ ██ ██ ██ ███████ ███████ ██ ██ ███████ ██ ████ ██ ██ ██ ██ ██ ██████ ██ ████
  724. //
  725. // >>implementation
  726. #ifdef SOKOL_GL_IMPL
  727. #define SOKOL_GL_IMPL_INCLUDED (1)
  728. #if defined(SOKOL_MALLOC) || defined(SOKOL_CALLOC) || defined(SOKOL_FREE)
  729. #error "SOKOL_MALLOC/CALLOC/FREE macros are no longer supported, please use sgl_desc_t.allocator to override memory allocation functions"
  730. #endif
  731. #include <stdlib.h> // malloc/free
  732. #include <string.h> // memset
  733. #include <math.h> // M_PI, sqrtf, sinf, cosf
  734. #ifndef M_PI
  735. #define M_PI 3.14159265358979323846264338327
  736. #endif
  737. #ifndef SOKOL_API_IMPL
  738. #define SOKOL_API_IMPL
  739. #endif
  740. #ifndef SOKOL_DEBUG
  741. #ifndef NDEBUG
  742. #define SOKOL_DEBUG
  743. #endif
  744. #endif
  745. #ifndef SOKOL_ASSERT
  746. #include <assert.h>
  747. #define SOKOL_ASSERT(c) assert(c)
  748. #endif
  749. #define _sgl_def(val, def) (((val) == 0) ? (def) : (val))
  750. #define _SGL_INIT_COOKIE (0xABCDABCD)
  751. /*
  752. Embedded source code compiled with:
  753. sokol-shdc -i sgl.glsl -o sgl.h -l glsl330:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgpu -b
  754. (not that for Metal and D3D11 byte code, sokol-shdc must be run
  755. on macOS and Windows)
  756. @vs vs
  757. uniform vs_params {
  758. mat4 mvp;
  759. mat4 tm;
  760. };
  761. in vec4 position;
  762. in vec2 texcoord0;
  763. in vec4 color0;
  764. in float psize;
  765. out vec4 uv;
  766. out vec4 color;
  767. void main() {
  768. gl_Position = mvp * position;
  769. gl_PointSize = psize;
  770. uv = tm * vec4(texcoord0, 0.0, 1.0);
  771. color = color0;
  772. }
  773. @end
  774. @fs fs
  775. uniform sampler2D tex;
  776. in vec4 uv;
  777. in vec4 color;
  778. out vec4 frag_color;
  779. void main() {
  780. frag_color = texture(tex, uv.xy) * color;
  781. }
  782. @end
  783. @program sgl vs fs
  784. */
  785. #if defined(SOKOL_GLCORE33)
  786. static const char _sgl_vs_source_glsl330[478] = {
  787. 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e,
  788. 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x70,0x61,
  789. 0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,
  790. 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,
  791. 0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
  792. 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
  793. 0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x73,
  794. 0x69,0x7a,0x65,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,
  795. 0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
  796. 0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x74,
  797. 0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,
  798. 0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
  799. 0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,
  800. 0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,
  801. 0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,
  802. 0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
  803. 0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,
  804. 0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,
  805. 0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,
  806. 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,
  807. 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,
  808. 0x50,0x6f,0x69,0x6e,0x74,0x53,0x69,0x7a,0x65,0x20,0x3d,0x20,0x70,0x73,0x69,0x7a,
  809. 0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,
  810. 0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2c,0x20,0x76,
  811. 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,0x76,0x73,0x5f,
  812. 0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,
  813. 0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,
  814. 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,
  815. 0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,
  816. 0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
  817. };
  818. static const char _sgl_fs_source_glsl330[172] = {
  819. 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e,
  820. 0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,
  821. 0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,
  822. 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,
  823. 0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,
  824. 0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,0x3b,0x0a,0x69,0x6e,0x20,0x76,
  825. 0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,
  826. 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,
  827. 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,
  828. 0x72,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x75,0x76,0x2e,0x78,0x79,0x29,0x20,0x2a,
  829. 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
  830. };
  831. #elif defined(SOKOL_GLES3)
  832. static const char _sgl_vs_source_glsl300es[481] = {
  833. 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
  834. 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,
  835. 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,
  836. 0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,
  837. 0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
  838. 0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,
  839. 0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,
  840. 0x20,0x70,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,
  841. 0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
  842. 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
  843. 0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x6f,0x75,0x74,
  844. 0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,
  845. 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,
  846. 0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,
  847. 0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
  848. 0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
  849. 0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
  850. 0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
  851. 0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,
  852. 0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,
  853. 0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,
  854. 0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74,0x53,0x69,0x7a,0x65,0x20,0x3d,0x20,0x70,
  855. 0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x6d,
  856. 0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,
  857. 0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,
  858. 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2c,0x20,0x76,0x73,
  859. 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,
  860. 0x63,0x34,0x28,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x2c,0x20,0x30,0x2e,
  861. 0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,
  862. 0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,
  863. 0x00,
  864. };
  865. static const char _sgl_fs_source_glsl300es[245] = {
  866. 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
  867. 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
  868. 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
  869. 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75,
  870. 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d,
  871. 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79,
  872. 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,
  873. 0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,
  874. 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,
  875. 0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,0x3b,0x0a,0x69,
  876. 0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,
  877. 0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,
  878. 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
  879. 0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x2c,
  880. 0x20,0x75,0x76,0x2e,0x78,0x79,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,
  881. 0x0a,0x7d,0x0a,0x0a,0x00,
  882. };
  883. #elif defined(SOKOL_METAL)
  884. static const uint8_t _sgl_vs_bytecode_metal_macos[3321] = {
  885. 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x06,0x00,0x00,0x81,0x0a,0x00,0x0b,0x00,
  886. 0xf9,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  887. 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  888. 0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
  889. 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
  890. 0xe0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00,
  891. 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45,
  892. 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x80,0x27,0x7a,0x67,0xc7,0xfc,0xfd,
  893. 0xe3,0x47,0x44,0x1b,0xf3,0x40,0x18,0x72,0x5a,0xd3,0x6e,0xad,0xec,0x58,0x70,0xc5,
  894. 0x20,0xfe,0x98,0x5e,0x82,0x7f,0xed,0xf9,0x89,0x4f,0x46,0x46,0x54,0x18,0x00,0x00,
  895. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  896. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08,
  897. 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x40,0x00,0x00,
  898. 0x00,0x56,0x41,0x54,0x54,0x2a,0x00,0x04,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
  899. 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,
  900. 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x70,0x73,0x69,0x7a,0x65,0x00,0x03,
  901. 0x80,0x56,0x41,0x54,0x59,0x06,0x00,0x04,0x00,0x06,0x04,0x06,0x03,0x45,0x4e,0x44,
  902. 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,
  903. 0x00,0x14,0x00,0x00,0x00,0xc0,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0,
  904. 0xde,0x21,0x0c,0x00,0x00,0xed,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00,
  905. 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32,
  906. 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45,
  907. 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44,
  908. 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,
  909. 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00,
  910. 0x00,0x81,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x90,0x80,
  911. 0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,
  912. 0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20,0x87,0x74,0xb0,
  913. 0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87,0x36,0x30,0x07,
  914. 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,
  915. 0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,
  916. 0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,
  917. 0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79,0x68,0x03,0x78,
  918. 0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x76,0x08,
  919. 0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,
  920. 0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,
  921. 0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,
  922. 0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87,0x76,0x28,0x87,
  923. 0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36,0x28,0x07,0x76,
  924. 0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28,0x87,0x70,0x30,
  925. 0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87,0x36,0x30,0x07,
  926. 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,
  927. 0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,
  928. 0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,
  929. 0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,
  930. 0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,
  931. 0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,
  932. 0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,
  933. 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x7a,0x90,
  934. 0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,
  935. 0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,
  936. 0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,
  937. 0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,
  938. 0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73,0x28,0x87,0x36,
  939. 0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,
  940. 0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,
  941. 0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,
  942. 0x00,0x36,0x18,0x42,0x01,0x2c,0x40,0x05,0x00,0x49,0x18,0x00,0x00,0x01,0x00,0x00,
  943. 0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48,
  944. 0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,
  945. 0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x44,0x33,0x00,0xc3,0x08,0x04,
  946. 0x60,0x89,0x10,0x02,0x18,0x46,0x10,0x80,0x24,0x08,0x33,0x51,0xf3,0x40,0x0f,0xf2,
  947. 0x50,0x0f,0xe3,0x40,0x0f,0x6e,0xd0,0x0e,0xe5,0x40,0x0f,0xe1,0xc0,0x0e,0x7a,0xa0,
  948. 0x07,0xed,0x10,0x0e,0xf4,0x20,0x0f,0xe9,0x80,0x0f,0x28,0x20,0x07,0x49,0x53,0x44,
  949. 0x09,0x93,0x5f,0x49,0xff,0x03,0x44,0x00,0x23,0x21,0xa1,0x94,0x41,0x04,0x43,0x28,
  950. 0x86,0x08,0x23,0x80,0x43,0x68,0x20,0x60,0x8e,0x00,0x0c,0x52,0x60,0xcd,0x11,0x80,
  951. 0xc2,0x20,0x42,0x20,0x0c,0x23,0x10,0xcb,0x08,0x00,0x00,0x00,0x00,0x13,0xb2,0x70,
  952. 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,
  953. 0x83,0x76,0x08,0x87,0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83,
  954. 0x38,0x70,0x03,0x38,0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07,
  955. 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78,
  956. 0xa0,0x07,0x78,0xd0,0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,
  957. 0x0e,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e,
  958. 0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76,
  959. 0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20,
  960. 0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07,
  961. 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71,0x60,0x07,0x7a,
  962. 0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07,0x7a,0x30,
  963. 0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a,0x30,0x07,
  964. 0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60,0x07,0x74,
  965. 0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,
  966. 0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,
  967. 0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,
  968. 0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x79,0x20,
  969. 0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,
  970. 0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,
  971. 0xd0,0x06,0xf6,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,
  972. 0x07,0x71,0x20,0x07,0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,
  973. 0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0xe0,0x0e,0x78,
  974. 0xa0,0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x49,0x00,0x00,0x08,0x00,
  975. 0x00,0x00,0x00,0x00,0xc8,0x02,0x01,0x00,0x00,0x0b,0x00,0x00,0x00,0x32,0x1e,0x98,
  976. 0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,
  977. 0x50,0x04,0x05,0x18,0x50,0x08,0x65,0x50,0x80,0x02,0x05,0x51,0x20,0xd4,0x46,0x00,
  978. 0x88,0x8d,0x25,0x30,0x00,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x01,0x01,0x00,
  979. 0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,
  980. 0xb7,0x21,0xc6,0x32,0x28,0x00,0xb3,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,
  981. 0xd3,0x2b,0x1b,0x62,0x2c,0x81,0x22,0x2c,0x05,0xe3,0x20,0x08,0x0e,0x8e,0xad,0x0c,
  982. 0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,
  983. 0x06,0x06,0x26,0xc6,0x65,0x66,0x46,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,
  984. 0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0x65,0x66,0x46,0x26,0x65,0x88,0xa0,0x10,0x43,
  985. 0x8c,0x25,0x58,0x90,0x45,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25,
  986. 0x58,0x82,0x45,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,
  987. 0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,
  988. 0x44,0x50,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,
  989. 0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,
  990. 0x43,0x04,0x65,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,
  991. 0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,
  992. 0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x94,0x86,0x51,0x58,
  993. 0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d,
  994. 0x97,0xba,0xb9,0x32,0x39,0x14,0xb6,0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72,
  995. 0x2e,0x61,0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc,
  996. 0xd8,0xde,0xc2,0xe8,0x68,0xc8,0x84,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85,
  997. 0xb5,0x95,0x51,0xa8,0xb3,0x1b,0xc2,0x28,0x8f,0x02,0x29,0x91,0x22,0x29,0x93,0x42,
  998. 0x71,0xa9,0x9b,0x2b,0x93,0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0x61,0x31,0xf6,0xc6,
  999. 0xf6,0x26,0x37,0x84,0x51,0x1e,0xc5,0x52,0x22,0x45,0x52,0x26,0xe5,0x22,0x13,0x96,
  1000. 0x26,0xe7,0x02,0xf7,0x36,0x97,0x46,0x97,0xf6,0xe6,0xc6,0xe5,0x8c,0xed,0x0b,0xea,
  1001. 0x6d,0x2e,0x8d,0x2e,0xed,0xcd,0x6d,0x88,0xa2,0x64,0x4a,0xa4,0x48,0xca,0xa4,0x68,
  1002. 0x74,0xc2,0xd2,0xe4,0x5c,0xe0,0xde,0xd2,0xdc,0xe8,0xbe,0xe6,0xd2,0xf4,0xca,0x58,
  1003. 0x98,0xb1,0xbd,0x85,0xd1,0x91,0x39,0x63,0xfb,0x82,0x7a,0x4b,0x73,0xa3,0x9b,0x4a,
  1004. 0xd3,0x2b,0x1b,0xa2,0x28,0x9c,0x12,0x29,0x9d,0x32,0x29,0xde,0x10,0x44,0xa9,0x14,
  1005. 0x4c,0xd9,0x94,0x8f,0x50,0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0x57,
  1006. 0x9a,0x1b,0x5c,0x1d,0x1d,0xa5,0xb0,0x34,0x39,0x17,0xb6,0xb7,0xb1,0x30,0xba,0xb4,
  1007. 0x37,0xb7,0xaf,0x34,0x37,0xb2,0x32,0x3c,0x7a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,
  1008. 0x65,0x64,0x28,0x5f,0x5f,0x61,0x69,0x72,0x5f,0x70,0x6c,0x61,0x63,0x65,0x68,0x6f,
  1009. 0x6c,0x64,0x65,0x72,0x5f,0x5f,0x29,0x44,0xe0,0xde,0xe6,0xd2,0xe8,0xd2,0xde,0xdc,
  1010. 0x86,0x50,0x8b,0xa0,0x84,0x81,0x22,0x06,0x8b,0xb0,0x04,0xca,0x18,0x28,0x91,0x22,
  1011. 0x29,0x93,0x42,0x06,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x98,0xd0,0x95,0xe1,0x8d,
  1012. 0xbd,0xbd,0xc9,0x91,0xc1,0x0c,0xa1,0x96,0x40,0x09,0x03,0x45,0x0c,0x96,0x60,0x09,
  1013. 0x94,0x31,0x50,0x22,0xc5,0x0c,0x94,0x49,0x39,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,
  1014. 0x30,0x43,0xa8,0x65,0x50,0xc2,0x40,0x11,0x83,0x65,0x58,0x02,0x65,0x0c,0x94,0x48,
  1015. 0x91,0x94,0x49,0x49,0x03,0x16,0x70,0x73,0x69,0x7a,0x65,0x43,0xa8,0xc5,0x50,0xc2,
  1016. 0x40,0x11,0x83,0xc5,0x58,0x02,0x65,0x0c,0x94,0x48,0xe9,0x94,0x49,0x59,0x03,0x2a,
  1017. 0x61,0x69,0x72,0x2e,0x62,0x75,0x66,0x66,0x65,0x72,0x7c,0xc2,0xd2,0xe4,0x5c,0xc4,
  1018. 0xea,0xcc,0xcc,0xca,0xe4,0xbe,0xe6,0xd2,0xf4,0xca,0x88,0x84,0xa5,0xc9,0xb9,0xc8,
  1019. 0x95,0x85,0x91,0x91,0x0a,0x4b,0x93,0x73,0x99,0xa3,0x93,0xab,0x1b,0xa3,0xfb,0xa2,
  1020. 0xcb,0x83,0x2b,0xfb,0x4a,0x73,0x33,0x7b,0x23,0x62,0xc6,0xf6,0x16,0x46,0x47,0x83,
  1021. 0x47,0xc3,0xa1,0xcd,0x0e,0x8e,0x02,0x5d,0xdb,0x10,0x6a,0x11,0x16,0x62,0x11,0x94,
  1022. 0x38,0x50,0xe4,0x60,0x21,0x16,0x62,0x11,0x94,0x38,0x50,0xe6,0x80,0x51,0x58,0x9a,
  1023. 0x9c,0x4b,0x98,0xdc,0xd9,0x17,0x5d,0x1e,0x5c,0xd9,0xd7,0x5c,0x9a,0x5e,0x19,0xaf,
  1024. 0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x30,0xb6,0xb4,
  1025. 0x33,0xb7,0xaf,0xb9,0x34,0xbd,0x32,0x26,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
  1026. 0x73,0x1c,0xbe,0x64,0x62,0x86,0x90,0xc1,0x52,0x28,0x6d,0xa0,0xb8,0xc1,0x72,0x28,
  1027. 0x62,0xb0,0x08,0x4b,0xa0,0xbc,0x81,0x02,0x07,0x0a,0x1d,0x28,0x75,0xb0,0x1c,0x8a,
  1028. 0x1d,0x2c,0x89,0x12,0x29,0x77,0xa0,0x4c,0x0a,0x1e,0x0c,0x51,0x94,0x32,0x50,0xd0,
  1029. 0x40,0x51,0x03,0x85,0x0d,0x94,0x3c,0x18,0x62,0x24,0x80,0x02,0x06,0x8a,0x1e,0xf0,
  1030. 0x79,0x6b,0x73,0x4b,0x83,0x7b,0xa3,0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3,
  1031. 0x33,0x95,0xd6,0x06,0xc7,0x56,0x06,0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34,
  1032. 0x44,0x50,0xfa,0x60,0x88,0xa1,0xf0,0x81,0xe2,0x07,0x8d,0x32,0xc4,0x50,0xfe,0x40,
  1033. 0xf9,0x83,0x46,0x19,0x11,0xb1,0x03,0x3b,0xd8,0x43,0x3b,0xb8,0x41,0x3b,0xbc,0x03,
  1034. 0x39,0xd4,0x03,0x3b,0x94,0x83,0x1b,0x98,0x03,0x3b,0x84,0xc3,0x39,0xcc,0xc3,0x14,
  1035. 0x21,0x18,0x46,0x28,0xec,0xc0,0x0e,0xf6,0xd0,0x0e,0x6e,0x90,0x0e,0xe4,0x50,0x0e,
  1036. 0xee,0x40,0x0f,0x53,0x82,0x62,0xc4,0x12,0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5,
  1037. 0x20,0x0f,0xf3,0x90,0x0e,0xef,0xe0,0x0e,0x53,0x02,0x63,0x04,0x15,0x0e,0xe9,0x20,
  1038. 0x0f,0x6e,0xc0,0x0e,0xe1,0xe0,0x0e,0xe7,0x50,0x0f,0xe1,0x70,0x0e,0xe5,0xf0,0x0b,
  1039. 0xf6,0x50,0x0e,0xf2,0x30,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,0x40,0x46,0x4c,0xe1,
  1040. 0x90,0x0e,0xf2,0xe0,0x06,0xe3,0xf0,0x0e,0xed,0x00,0x0f,0xe9,0xc0,0x0e,0xe5,0xf0,
  1041. 0x0b,0xef,0x00,0x0f,0xf4,0x90,0x0e,0xef,0xe0,0x0e,0xf3,0x30,0x65,0x50,0x18,0x67,
  1042. 0x84,0x12,0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f,0xf4,0x50,0x0e,0xf8,
  1043. 0x30,0x25,0xd8,0x03,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,
  1044. 0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,
  1045. 0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,
  1046. 0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,
  1047. 0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,
  1048. 0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,
  1049. 0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,
  1050. 0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,
  1051. 0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,
  1052. 0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,
  1053. 0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,
  1054. 0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,
  1055. 0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,
  1056. 0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,
  1057. 0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,
  1058. 0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,
  1059. 0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,
  1060. 0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,
  1061. 0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,
  1062. 0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,
  1063. 0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,
  1064. 0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,
  1065. 0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,
  1066. 0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,
  1067. 0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,
  1068. 0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,
  1069. 0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,
  1070. 0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,
  1071. 0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,
  1072. 0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,
  1073. 0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,
  1074. 0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,
  1075. 0x00,0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x3e,0x00,0x00,
  1076. 0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0xf4,0xc6,0x22,
  1077. 0x86,0x61,0x18,0xc6,0x22,0x04,0x41,0x10,0xc6,0x22,0x82,0x20,0x08,0xa8,0x95,0x40,
  1078. 0x19,0x14,0x01,0xbd,0x11,0x00,0x1a,0x33,0x00,0x24,0x66,0x00,0x28,0xcc,0x00,0x00,
  1079. 0x00,0xe3,0x15,0x4b,0x94,0x65,0x11,0x05,0x65,0x90,0x21,0x1a,0x0c,0x13,0x02,0xf9,
  1080. 0x8c,0x57,0x3c,0x55,0xd7,0x2d,0x14,0x94,0x41,0x86,0xea,0x70,0x4c,0x08,0xe4,0x63,
  1081. 0x41,0x01,0x9f,0xf1,0x0a,0x4a,0x13,0x03,0x31,0x70,0x28,0x28,0x83,0x0c,0x1a,0x43,
  1082. 0x99,0x10,0xc8,0xc7,0x8a,0x00,0x3e,0xe3,0x15,0xd9,0x77,0x06,0x67,0x40,0x51,0x50,
  1083. 0x06,0x19,0xbe,0x48,0x33,0x21,0x90,0x8f,0x15,0x01,0x7c,0xc6,0x2b,0x3c,0x32,0x68,
  1084. 0x03,0x36,0x20,0x03,0x0a,0xca,0x20,0xc3,0x18,0x60,0x99,0x09,0x81,0x7c,0xc6,0x2b,
  1085. 0xc4,0x00,0x0d,0xe2,0x00,0x0e,0x3c,0x0a,0xca,0x20,0xc3,0x19,0x70,0x61,0x60,0x42,
  1086. 0x20,0x1f,0x0b,0x0a,0xf8,0x8c,0x57,0x9c,0x41,0x1b,0xd8,0x41,0x1d,0x88,0x01,0x05,
  1087. 0xc5,0x86,0x00,0x3e,0xb3,0x0d,0x61,0x10,0x00,0xb3,0x0d,0x41,0x1b,0x04,0xb3,0x0d,
  1088. 0xc1,0x23,0xcc,0x36,0x04,0x6e,0x30,0x64,0x10,0x10,0x03,0x00,0x00,0x09,0x00,0x00,
  1089. 0x00,0x5b,0x86,0x20,0x00,0x85,0x2d,0x43,0x11,0x80,0xc2,0x96,0x41,0x09,0x40,0x61,
  1090. 0xcb,0xf0,0x04,0xa0,0xb0,0x65,0xa0,0x02,0x50,0xd8,0x32,0x60,0x01,0x28,0x6c,0x19,
  1091. 0xba,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1092. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1093. };
  1094. static const uint8_t _sgl_fs_bytecode_metal_macos[2829] = {
  1095. 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x06,0x00,0x00,0x81,0x0a,0x00,0x0b,0x00,
  1096. 0x0d,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1097. 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1098. 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1099. 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1100. 0x30,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00,
  1101. 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45,
  1102. 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xeb,0xd5,0xe5,0x1e,0x0a,0x10,0x1a,
  1103. 0x32,0xd3,0xbd,0xd9,0xe3,0x31,0x39,0x1e,0x13,0x0d,0xe0,0xb8,0x26,0xfa,0x4f,0x40,
  1104. 0xeb,0xf7,0x82,0x75,0x70,0x8a,0xc9,0x08,0x0c,0x4f,0x46,0x46,0x54,0x18,0x00,0x00,
  1105. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1106. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08,
  1107. 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,
  1108. 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,
  1109. 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x14,0x0a,0x00,0x00,0xff,0xff,0xff,
  1110. 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x82,0x02,0x00,0x00,0x0b,0x82,0x20,
  1111. 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,
  1112. 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,
  1113. 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,
  1114. 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,
  1115. 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,
  1116. 0x00,0x51,0x18,0x00,0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,
  1117. 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,
  1118. 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,
  1119. 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,
  1120. 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,
  1121. 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,
  1122. 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,
  1123. 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,
  1124. 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,
  1125. 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,
  1126. 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,
  1127. 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,
  1128. 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,
  1129. 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,
  1130. 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,
  1131. 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,
  1132. 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,
  1133. 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,
  1134. 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,
  1135. 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,
  1136. 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,
  1137. 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,
  1138. 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,
  1139. 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,
  1140. 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,
  1141. 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,
  1142. 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,
  1143. 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,
  1144. 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,
  1145. 0x70,0x30,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,
  1146. 0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,
  1147. 0xde,0xc1,0x1c,0xe8,0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,
  1148. 0x70,0x60,0x87,0x79,0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,
  1149. 0x00,0x16,0xa0,0xda,0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,
  1150. 0x06,0xa3,0x08,0x80,0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,
  1151. 0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,
  1152. 0x00,0x89,0x20,0x00,0x00,0x1d,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,
  1153. 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,
  1154. 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x70,0x94,
  1155. 0x34,0x45,0x94,0x30,0xf9,0xff,0x44,0x5c,0x13,0x15,0x11,0xbf,0x3d,0xfc,0xd3,0x18,
  1156. 0x01,0x30,0x88,0x30,0x04,0x17,0x49,0x53,0x44,0x09,0x93,0xff,0x4b,0x00,0xf3,0x2c,
  1157. 0x44,0xf4,0x4f,0x63,0x04,0xc0,0x20,0x42,0x21,0x94,0x42,0x84,0x40,0x0c,0x9d,0x61,
  1158. 0x04,0x01,0x98,0x23,0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0x88,0x49,
  1159. 0x8a,0x29,0x40,0x6d,0x20,0x20,0x05,0xd6,0x08,0x00,0x00,0x00,0x00,0x13,0xb2,0x70,
  1160. 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,
  1161. 0x83,0x76,0x08,0x87,0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83,
  1162. 0x38,0x70,0x03,0x38,0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07,
  1163. 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78,
  1164. 0xa0,0x07,0x78,0xd0,0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,
  1165. 0x0e,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e,
  1166. 0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76,
  1167. 0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20,
  1168. 0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07,
  1169. 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71,0x60,0x07,0x7a,
  1170. 0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07,0x7a,0x30,
  1171. 0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a,0x30,0x07,
  1172. 0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60,0x07,0x74,
  1173. 0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,
  1174. 0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,
  1175. 0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,
  1176. 0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x79,0x20,
  1177. 0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,
  1178. 0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,
  1179. 0xd0,0x06,0xf6,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,
  1180. 0x07,0x71,0x20,0x07,0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,
  1181. 0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0xe0,0x0e,0x78,
  1182. 0xa0,0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x41,0x00,0x00,0x08,0x00,
  1183. 0x00,0x00,0x00,0x00,0x18,0xc2,0x38,0x40,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x64,
  1184. 0x81,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,
  1185. 0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x85,0x50,
  1186. 0x10,0x65,0x40,0x70,0x2c,0x81,0x01,0x00,0x00,0x79,0x18,0x00,0x00,0xb8,0x00,0x00,
  1187. 0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,
  1188. 0xb7,0x21,0xc6,0x42,0x3c,0x00,0x84,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,
  1189. 0xd3,0x2b,0x1b,0x62,0x2c,0xc2,0x23,0x2c,0x05,0xe3,0x20,0x08,0x0e,0x8e,0xad,0x0c,
  1190. 0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,
  1191. 0x06,0x06,0x26,0xc6,0x65,0x66,0x46,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,
  1192. 0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0x65,0x66,0x46,0x26,0x65,0x88,0xf0,0x10,0x43,
  1193. 0x8c,0x45,0x58,0x8c,0x65,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x45,
  1194. 0x58,0x84,0x65,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,
  1195. 0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,
  1196. 0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,
  1197. 0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,
  1198. 0x43,0x84,0x67,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,
  1199. 0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,
  1200. 0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86,0x51,0x58,
  1201. 0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17,0x5d,0x98,0xdc,0x59,0x19,0x1d,
  1202. 0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0x2f,0xb7,0xb0,
  1203. 0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,
  1204. 0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85,0x9d,0x7d,0x8d,0xbd,0xb1,0xbd,
  1205. 0xc9,0x0d,0x61,0x9e,0x67,0x19,0x1e,0xe8,0x89,0x1e,0xe9,0x99,0x86,0x08,0x0f,0x45,
  1206. 0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad,0xcc,0x8d,0xee,0x2b,0xcd,0x0d,
  1207. 0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb,0x98,0x1b,0x4c,0x0a,0x95,
  1208. 0xb0,0x34,0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39,0x3e,0x61,0x69,0x72,0x2e,0x70,
  1209. 0x65,0x72,0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65,0x14,0xea,0xec,0x86,0x48,0xcb,
  1210. 0xf0,0x58,0xcf,0xf5,0x60,0x4f,0xf6,0x40,0x4f,0xf4,0x48,0x8f,0xc6,0xa5,0x6e,0xae,
  1211. 0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x2d,0x26,0x85,0xc5,0xd8,0x1b,0xdb,0x9b,0xdc,0x10,
  1212. 0x69,0x11,0x1e,0xeb,0xe1,0x1e,0xec,0xc9,0x1e,0xe8,0x89,0x1e,0xe9,0xe9,0xb8,0x84,
  1213. 0xa5,0xc9,0xb9,0xd0,0x95,0xe1,0xd1,0xd5,0xc9,0x95,0x51,0x0a,0x4b,0x93,0x73,0x61,
  1214. 0x7b,0x1b,0x0b,0xa3,0x4b,0x7b,0x73,0xfb,0x4a,0x73,0x23,0x2b,0xc3,0xa3,0x12,0x96,
  1215. 0x26,0xe7,0x32,0x17,0xd6,0x06,0xc7,0x56,0x46,0x8c,0xae,0x0c,0x8f,0xae,0x4e,0xae,
  1216. 0x4c,0x86,0x8c,0xc7,0x8c,0xed,0x2d,0x8c,0x8e,0x05,0x64,0x2e,0xac,0x0d,0x8e,0xad,
  1217. 0xcc,0x87,0x03,0x5d,0x19,0xde,0x10,0x6a,0x21,0x9e,0xef,0x01,0x83,0x65,0x58,0x84,
  1218. 0x27,0x0c,0x1e,0xe8,0x11,0x83,0x47,0x7a,0xc6,0x80,0x4b,0x58,0x9a,0x9c,0xcb,0x5c,
  1219. 0x58,0x1b,0x1c,0x5b,0x99,0x1c,0x8f,0xb9,0xb0,0x36,0x38,0xb6,0x32,0x39,0x22,0x74,
  1220. 0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x43,0xa4,0xe5,0x78,0xca,0xe0,0x01,0x83,0x65,
  1221. 0x58,0x84,0x07,0x7a,0xcc,0xe0,0x91,0x9e,0x33,0x18,0x82,0x3c,0xdb,0xe3,0x3d,0x64,
  1222. 0xf0,0xa0,0xc1,0x10,0x03,0x01,0x9e,0xea,0x49,0x83,0x11,0x11,0x3b,0xb0,0x83,0x3d,
  1223. 0xb4,0x83,0x1b,0xb4,0xc3,0x3b,0x90,0x43,0x3d,0xb0,0x43,0x39,0xb8,0x81,0x39,0xb0,
  1224. 0x43,0x38,0x9c,0xc3,0x3c,0x4c,0x11,0x82,0x61,0x84,0xc2,0x0e,0xec,0x60,0x0f,0xed,
  1225. 0xe0,0x06,0xe9,0x40,0x0e,0xe5,0xe0,0x0e,0xf4,0x30,0x25,0x28,0x46,0x2c,0xe1,0x90,
  1226. 0x0e,0xf2,0xe0,0x06,0xf6,0x50,0x0e,0xf2,0x30,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,
  1227. 0x30,0x46,0x50,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xec,0x10,0x0e,0xee,0x70,0x0e,0xf5,
  1228. 0x10,0x0e,0xe7,0x50,0x0e,0xbf,0x60,0x0f,0xe5,0x20,0x0f,0xf3,0x90,0x0e,0xef,0xe0,
  1229. 0x0e,0x53,0x02,0x64,0xc4,0x14,0x0e,0xe9,0x20,0x0f,0x6e,0x30,0x0e,0xef,0xd0,0x0e,
  1230. 0xf0,0x90,0x0e,0xec,0x50,0x0e,0xbf,0xf0,0x0e,0xf0,0x40,0x0f,0xe9,0xf0,0x0e,0xee,
  1231. 0x30,0x0f,0x53,0x06,0x85,0x71,0x46,0x30,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xe6,0x20,
  1232. 0x0f,0xe1,0x70,0x0e,0xed,0x50,0x0e,0xee,0x40,0x0f,0x53,0x02,0x35,0x00,0x00,0x00,
  1233. 0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,
  1234. 0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,
  1235. 0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,
  1236. 0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,
  1237. 0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,
  1238. 0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70,
  1239. 0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,
  1240. 0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,
  1241. 0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,
  1242. 0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,
  1243. 0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07,
  1244. 0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72,
  1245. 0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,
  1246. 0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,
  1247. 0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,
  1248. 0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03,
  1249. 0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,
  1250. 0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74,
  1251. 0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,
  1252. 0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,
  1253. 0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,
  1254. 0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,
  1255. 0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51,
  1256. 0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,
  1257. 0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,
  1258. 0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,
  1259. 0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,
  1260. 0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,
  1261. 0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,
  1262. 0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,
  1263. 0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,
  1264. 0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01,
  1265. 0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,
  1266. 0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,
  1267. 0x00,0x0f,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x06,0x00,0x00,
  1268. 0x00,0xc4,0x46,0x00,0xc6,0x12,0x80,0x80,0xd4,0x08,0x40,0x0d,0x90,0x98,0x01,0xa0,
  1269. 0x30,0x03,0x40,0x60,0x04,0x00,0x00,0x00,0x00,0x83,0x0c,0x8b,0x60,0x8c,0x18,0x28,
  1270. 0x42,0x40,0x29,0x49,0x50,0x20,0x86,0x60,0x01,0x23,0x9f,0xd9,0x06,0x23,0x00,0x32,
  1271. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1272. };
  1273. static const uint8_t _sgl_vs_bytecode_metal_ios[3305] = {
  1274. 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x06,0x00,0x00,0x82,0x09,0x00,0x00,0x00,
  1275. 0xe9,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1276. 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1277. 0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
  1278. 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
  1279. 0xd0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00,
  1280. 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45,
  1281. 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x77,0x3d,0x05,0xbd,0x9f,0x26,0xc1,
  1282. 0xae,0x87,0x1d,0xc4,0x7e,0x6d,0x86,0xc6,0x23,0xd4,0x40,0x35,0xfc,0x64,0x3f,0x25,
  1283. 0xe4,0xe3,0x19,0x09,0x7d,0xba,0xe3,0x12,0x70,0x4f,0x46,0x46,0x54,0x18,0x00,0x00,
  1284. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1285. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08,
  1286. 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x40,0x00,0x00,
  1287. 0x00,0x56,0x41,0x54,0x54,0x2a,0x00,0x04,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
  1288. 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,
  1289. 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x70,0x73,0x69,0x7a,0x65,0x00,0x03,
  1290. 0x80,0x56,0x41,0x54,0x59,0x06,0x00,0x04,0x00,0x06,0x04,0x06,0x03,0x45,0x4e,0x44,
  1291. 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,
  1292. 0x00,0x14,0x00,0x00,0x00,0xbc,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0,
  1293. 0xde,0x21,0x0c,0x00,0x00,0xec,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00,
  1294. 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32,
  1295. 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45,
  1296. 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44,
  1297. 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,
  1298. 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00,
  1299. 0x00,0x82,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x90,0x80,
  1300. 0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,
  1301. 0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20,0x87,0x74,0xb0,
  1302. 0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87,0x36,0x30,0x07,
  1303. 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,
  1304. 0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,
  1305. 0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,
  1306. 0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79,0x68,0x03,0x78,
  1307. 0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x76,0x08,
  1308. 0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,
  1309. 0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,
  1310. 0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,
  1311. 0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87,0x76,0x28,0x87,
  1312. 0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36,0x28,0x07,0x76,
  1313. 0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28,0x87,0x70,0x30,
  1314. 0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87,0x36,0x30,0x07,
  1315. 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,
  1316. 0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,
  1317. 0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,
  1318. 0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,
  1319. 0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,
  1320. 0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,
  1321. 0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,
  1322. 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x7a,0x90,
  1323. 0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,
  1324. 0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,
  1325. 0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,
  1326. 0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,
  1327. 0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73,0x28,0x87,0x36,
  1328. 0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,
  1329. 0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,
  1330. 0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,
  1331. 0x00,0x36,0x20,0x42,0x01,0x24,0xc0,0x02,0x54,0x00,0x00,0x00,0x00,0x49,0x18,0x00,
  1332. 0x00,0x01,0x00,0x00,0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,
  1333. 0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,
  1334. 0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x44,0x33,
  1335. 0x00,0xc3,0x08,0x04,0x60,0x89,0x10,0x02,0x18,0x46,0x10,0x80,0x24,0x08,0x33,0x51,
  1336. 0xf3,0x40,0x0f,0xf2,0x50,0x0f,0xe3,0x40,0x0f,0x6e,0xd0,0x0e,0xe5,0x40,0x0f,0xe1,
  1337. 0xc0,0x0e,0x7a,0xa0,0x07,0xed,0x10,0x0e,0xf4,0x20,0x0f,0xe9,0x80,0x0f,0x28,0x20,
  1338. 0x07,0x49,0x53,0x44,0x09,0x93,0x5f,0x49,0xff,0x03,0x44,0x00,0x23,0x21,0xa1,0x94,
  1339. 0x41,0x04,0x43,0x28,0x86,0x08,0x23,0x80,0x43,0x68,0x20,0x60,0x8e,0x00,0x0c,0x52,
  1340. 0x60,0xcd,0x11,0x80,0xc2,0x20,0x42,0x20,0x0c,0x23,0x10,0xcb,0x08,0x00,0x00,0x00,
  1341. 0x00,0x13,0xa8,0x70,0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,
  1342. 0x60,0x87,0x72,0x68,0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,
  1343. 0x83,0x0d,0xb7,0x51,0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,
  1344. 0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,
  1345. 0x6d,0x90,0x0e,0x78,0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,
  1346. 0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,
  1347. 0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,
  1348. 0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,
  1349. 0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,
  1350. 0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,
  1351. 0x7a,0x10,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,
  1352. 0x30,0x07,0x72,0xd0,0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,
  1353. 0x07,0x72,0xd0,0x06,0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,
  1354. 0x74,0xd0,0x06,0xf6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,
  1355. 0xd0,0x06,0xf6,0x90,0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,
  1356. 0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,
  1357. 0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,
  1358. 0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,
  1359. 0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,
  1360. 0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,
  1361. 0xd0,0x06,0xf6,0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,
  1362. 0x07,0x7a,0x10,0x07,0x70,0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,
  1363. 0x76,0xa0,0x07,0x73,0x20,0x07,0x43,0x98,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,
  1364. 0x80,0x2c,0x10,0x00,0x00,0x0b,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,
  1365. 0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x05,0x18,
  1366. 0x50,0x08,0x65,0x50,0x80,0x02,0x05,0x51,0x20,0xd4,0x46,0x00,0x88,0x8d,0x25,0x3c,
  1367. 0x00,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x01,0x01,0x00,0x00,0x1a,0x03,0x4c,
  1368. 0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x32,
  1369. 0x28,0x00,0xb3,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,
  1370. 0x2c,0x81,0x22,0x2c,0x05,0xe3,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,
  1371. 0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,
  1372. 0x65,0x46,0xa6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,
  1373. 0x06,0x26,0xc6,0x65,0x46,0xa6,0x26,0x65,0x88,0xa0,0x10,0x43,0x8c,0x25,0x58,0x90,
  1374. 0x45,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25,0x58,0x84,0x45,0xe0,
  1375. 0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,
  1376. 0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x50,0x12,0x72,
  1377. 0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,
  1378. 0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x65,0x21,
  1379. 0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,
  1380. 0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,
  1381. 0xb9,0x85,0x89,0xb1,0x95,0x0d,0x11,0x94,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5d,0x99,
  1382. 0x1c,0x5d,0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d,0x97,0xba,0xb9,0x32,0x39,
  1383. 0x14,0xb6,0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,
  1384. 0x74,0x79,0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x68,
  1385. 0xc8,0x84,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85,0xb5,0x95,0x51,0xa8,0xb3,
  1386. 0x1b,0xc2,0x28,0x8f,0x02,0x29,0x91,0x22,0x29,0x93,0x42,0x71,0xa9,0x9b,0x2b,0x93,
  1387. 0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0x61,0x31,0xf6,0xc6,0xf6,0x26,0x37,0x84,0x51,
  1388. 0x1e,0xc5,0x52,0x22,0x45,0x52,0x26,0xe5,0x22,0x13,0x96,0x26,0xe7,0x02,0xf7,0x36,
  1389. 0x97,0x46,0x97,0xf6,0xe6,0xc6,0xe5,0x8c,0xed,0x0b,0xea,0x6d,0x2e,0x8d,0x2e,0xed,
  1390. 0xcd,0x6d,0x88,0xa2,0x64,0x4a,0xa4,0x48,0xca,0xa4,0x68,0x74,0xc2,0xd2,0xe4,0x5c,
  1391. 0xe0,0xde,0xd2,0xdc,0xe8,0xbe,0xe6,0xd2,0xf4,0xca,0x58,0x98,0xb1,0xbd,0x85,0xd1,
  1392. 0x91,0x39,0x63,0xfb,0x82,0x7a,0x4b,0x73,0xa3,0x9b,0x4a,0xd3,0x2b,0x1b,0xa2,0x28,
  1393. 0x9c,0x12,0x29,0x9d,0x32,0x29,0xde,0x10,0x44,0xa9,0x14,0x4c,0xd9,0x94,0x8f,0x50,
  1394. 0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0x57,0x9a,0x1b,0x5c,0x1d,0x1d,
  1395. 0xa5,0xb0,0x34,0x39,0x17,0xb6,0xb7,0xb1,0x30,0xba,0xb4,0x37,0xb7,0xaf,0x34,0x37,
  1396. 0xb2,0x32,0x3c,0x7a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x28,0x5f,0x5f,
  1397. 0x61,0x69,0x72,0x5f,0x70,0x6c,0x61,0x63,0x65,0x68,0x6f,0x6c,0x64,0x65,0x72,0x5f,
  1398. 0x5f,0x29,0x44,0xe0,0xde,0xe6,0xd2,0xe8,0xd2,0xde,0xdc,0x86,0x50,0x8b,0xa0,0x84,
  1399. 0x81,0x22,0x06,0x8b,0xb0,0x04,0xca,0x18,0x28,0x91,0x22,0x29,0x93,0x42,0x06,0x34,
  1400. 0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x98,0xd0,0x95,0xe1,0x8d,0xbd,0xbd,0xc9,0x91,0xc1,
  1401. 0x0c,0xa1,0x96,0x40,0x09,0x03,0x45,0x0c,0x96,0x60,0x09,0x94,0x31,0x50,0x22,0xc5,
  1402. 0x0c,0x94,0x49,0x39,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x43,0xa8,0x65,0x50,
  1403. 0xc2,0x40,0x11,0x83,0x65,0x58,0x02,0x65,0x0c,0x94,0x48,0x91,0x94,0x49,0x49,0x03,
  1404. 0x16,0x70,0x73,0x69,0x7a,0x65,0x43,0xa8,0xc5,0x50,0xc2,0x40,0x11,0x83,0xc5,0x58,
  1405. 0x02,0x65,0x0c,0x94,0x48,0xe9,0x94,0x49,0x59,0x03,0x2a,0x61,0x69,0x72,0x2e,0x62,
  1406. 0x75,0x66,0x66,0x65,0x72,0x7c,0xc2,0xd2,0xe4,0x5c,0xc4,0xea,0xcc,0xcc,0xca,0xe4,
  1407. 0xbe,0xe6,0xd2,0xf4,0xca,0x88,0x84,0xa5,0xc9,0xb9,0xc8,0x95,0x85,0x91,0x91,0x0a,
  1408. 0x4b,0x93,0x73,0x99,0xa3,0x93,0xab,0x1b,0xa3,0xfb,0xa2,0xcb,0x83,0x2b,0xfb,0x4a,
  1409. 0x73,0x33,0x7b,0x23,0x62,0xc6,0xf6,0x16,0x46,0x47,0x83,0x47,0xc3,0xa1,0xcd,0x0e,
  1410. 0x8e,0x02,0x5d,0xdb,0x10,0x6a,0x11,0x16,0x62,0x11,0x94,0x38,0x50,0xe4,0x60,0x21,
  1411. 0x16,0x62,0x11,0x94,0x38,0x50,0xe6,0x80,0x51,0x58,0x9a,0x9c,0x4b,0x98,0xdc,0xd9,
  1412. 0x17,0x5d,0x1e,0x5c,0xd9,0xd7,0x5c,0x9a,0x5e,0x19,0xaf,0xb0,0x34,0x39,0x97,0x30,
  1413. 0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x30,0xb6,0xb4,0x33,0xb7,0xaf,0xb9,0x34,
  1414. 0xbd,0x32,0x26,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x1c,0xbe,0x64,0x62,
  1415. 0x86,0x90,0xc1,0x52,0x28,0x6d,0xa0,0xb8,0xc1,0x72,0x28,0x62,0xb0,0x08,0x4b,0xa0,
  1416. 0xbc,0x81,0x02,0x07,0x0a,0x1d,0x28,0x75,0xb0,0x1c,0x8a,0x1d,0x2c,0x89,0x12,0x29,
  1417. 0x77,0xa0,0x4c,0x0a,0x1e,0x0c,0x51,0x94,0x32,0x50,0xd0,0x40,0x51,0x03,0x85,0x0d,
  1418. 0x94,0x3c,0x18,0x62,0x24,0x80,0x02,0x06,0x8a,0x1e,0xf0,0x79,0x6b,0x73,0x4b,0x83,
  1419. 0x7b,0xa3,0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3,0x33,0x95,0xd6,0x06,0xc7,
  1420. 0x56,0x06,0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34,0x44,0x50,0xfa,0x60,0x88,
  1421. 0xa1,0xf0,0x81,0xe2,0x07,0x8d,0x32,0xc4,0x50,0xfe,0x40,0xf9,0x83,0x46,0x19,0x11,
  1422. 0xb1,0x03,0x3b,0xd8,0x43,0x3b,0xb8,0x41,0x3b,0xbc,0x03,0x39,0xd4,0x03,0x3b,0x94,
  1423. 0x83,0x1b,0x98,0x03,0x3b,0x84,0xc3,0x39,0xcc,0xc3,0x14,0x21,0x18,0x46,0x28,0xec,
  1424. 0xc0,0x0e,0xf6,0xd0,0x0e,0x6e,0x90,0x0e,0xe4,0x50,0x0e,0xee,0x40,0x0f,0x53,0x82,
  1425. 0x62,0xc4,0x12,0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f,0xf3,0x90,0x0e,
  1426. 0xef,0xe0,0x0e,0x53,0x02,0x63,0x04,0x15,0x0e,0xe9,0x20,0x0f,0x6e,0xc0,0x0e,0xe1,
  1427. 0xe0,0x0e,0xe7,0x50,0x0f,0xe1,0x70,0x0e,0xe5,0xf0,0x0b,0xf6,0x50,0x0e,0xf2,0x30,
  1428. 0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,0x40,0x46,0x4c,0xe1,0x90,0x0e,0xf2,0xe0,0x06,
  1429. 0xe3,0xf0,0x0e,0xed,0x00,0x0f,0xe9,0xc0,0x0e,0xe5,0xf0,0x0b,0xef,0x00,0x0f,0xf4,
  1430. 0x90,0x0e,0xef,0xe0,0x0e,0xf3,0x30,0x65,0x50,0x18,0x67,0x84,0x12,0x0e,0xe9,0x20,
  1431. 0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f,0xf4,0x50,0x0e,0xf8,0x30,0x25,0xd8,0x03,0x00,
  1432. 0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,
  1433. 0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,
  1434. 0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,
  1435. 0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,
  1436. 0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,
  1437. 0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70,
  1438. 0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,
  1439. 0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,
  1440. 0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,
  1441. 0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,
  1442. 0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07,
  1443. 0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72,
  1444. 0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,
  1445. 0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,
  1446. 0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,
  1447. 0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03,
  1448. 0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,
  1449. 0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74,
  1450. 0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,
  1451. 0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,
  1452. 0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,
  1453. 0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,
  1454. 0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51,
  1455. 0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,
  1456. 0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,
  1457. 0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,
  1458. 0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,
  1459. 0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,
  1460. 0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,
  1461. 0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,
  1462. 0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,
  1463. 0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x50,0x30,
  1464. 0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x3e,0x00,0x00,0x00,0x13,0x04,0x41,
  1465. 0x2c,0x10,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0xf4,0xc6,0x22,0x86,0x61,0x18,0xc6,
  1466. 0x22,0x04,0x41,0x10,0xc6,0x22,0x82,0x20,0x08,0xa8,0x95,0x40,0x19,0x14,0x01,0xbd,
  1467. 0x11,0x00,0x1a,0x33,0x00,0x24,0x66,0x00,0x28,0xcc,0x00,0x00,0x00,0xe3,0x15,0x4b,
  1468. 0x94,0x65,0x11,0x05,0x65,0x90,0x21,0x1a,0x0c,0x13,0x02,0xf9,0x8c,0x57,0x3c,0x55,
  1469. 0xd7,0x2d,0x14,0x94,0x41,0x86,0xea,0x70,0x4c,0x08,0xe4,0x63,0x41,0x01,0x9f,0xf1,
  1470. 0x0a,0x4a,0x13,0x03,0x31,0x70,0x28,0x28,0x83,0x0c,0x1a,0x43,0x99,0x10,0xc8,0xc7,
  1471. 0x8a,0x00,0x3e,0xe3,0x15,0xd9,0x77,0x06,0x67,0x40,0x51,0x50,0x06,0x19,0xbe,0x48,
  1472. 0x33,0x21,0x90,0x8f,0x15,0x01,0x7c,0xc6,0x2b,0x3c,0x32,0x68,0x03,0x36,0x20,0x03,
  1473. 0x0a,0xca,0x20,0xc3,0x18,0x60,0x99,0x09,0x81,0x7c,0xc6,0x2b,0xc4,0x00,0x0d,0xe2,
  1474. 0x00,0x0e,0x3c,0x0a,0xca,0x20,0xc3,0x19,0x70,0x61,0x60,0x42,0x20,0x1f,0x0b,0x0a,
  1475. 0xf8,0x8c,0x57,0x9c,0x41,0x1b,0xd8,0x41,0x1d,0x88,0x01,0x05,0xc5,0x86,0x00,0x3e,
  1476. 0xb3,0x0d,0x61,0x10,0x00,0xb3,0x0d,0x41,0x1b,0x04,0xb3,0x0d,0xc1,0x23,0xcc,0x36,
  1477. 0x04,0x6e,0x30,0x64,0x10,0x10,0x03,0x00,0x00,0x09,0x00,0x00,0x00,0x5b,0x86,0x20,
  1478. 0x00,0x85,0x2d,0x43,0x11,0x80,0xc2,0x96,0x41,0x09,0x40,0x61,0xcb,0xf0,0x04,0xa0,
  1479. 0xb0,0x65,0xa0,0x02,0x50,0xd8,0x32,0x60,0x01,0x28,0x6c,0x19,0xba,0x00,0x14,0x00,
  1480. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1481. };
  1482. static const uint8_t _sgl_fs_bytecode_metal_ios[2813] = {
  1483. 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x06,0x00,0x00,0x82,0x09,0x00,0x00,0x00,
  1484. 0xfd,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1485. 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1486. 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1487. 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1488. 0x20,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00,
  1489. 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45,
  1490. 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xa2,0xfb,0x9e,0x58,0x9a,0x22,0x99,
  1491. 0x8e,0xdc,0x41,0x5a,0x15,0xf4,0x1f,0xbc,0xfa,0xdd,0xa2,0x32,0xf3,0xff,0x3e,0xe2,
  1492. 0x2c,0x7f,0x20,0x9e,0x14,0xb3,0xef,0x8e,0x56,0x4f,0x46,0x46,0x54,0x18,0x00,0x00,
  1493. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1494. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08,
  1495. 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,
  1496. 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,
  1497. 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x08,0x0a,0x00,0x00,0xff,0xff,0xff,
  1498. 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x7f,0x02,0x00,0x00,0x0b,0x82,0x20,
  1499. 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,
  1500. 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,
  1501. 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,
  1502. 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,
  1503. 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,
  1504. 0x00,0x51,0x18,0x00,0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,
  1505. 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,
  1506. 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,
  1507. 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,
  1508. 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,
  1509. 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,
  1510. 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,
  1511. 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,
  1512. 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,
  1513. 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,
  1514. 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,
  1515. 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,
  1516. 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,
  1517. 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,
  1518. 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,
  1519. 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,
  1520. 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,
  1521. 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,
  1522. 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,
  1523. 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,
  1524. 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,
  1525. 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,
  1526. 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,
  1527. 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,
  1528. 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,
  1529. 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,
  1530. 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,
  1531. 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,
  1532. 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,
  1533. 0x70,0x30,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,
  1534. 0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,
  1535. 0xde,0xc1,0x1c,0xe8,0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,
  1536. 0x70,0x60,0x87,0x79,0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,
  1537. 0x00,0x16,0xa0,0xda,0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,
  1538. 0x06,0xa3,0x08,0x80,0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,
  1539. 0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,
  1540. 0x00,0x89,0x20,0x00,0x00,0x1d,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,
  1541. 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,
  1542. 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x70,0x94,
  1543. 0x34,0x45,0x94,0x30,0xf9,0xff,0x44,0x5c,0x13,0x15,0x11,0xbf,0x3d,0xfc,0xd3,0x18,
  1544. 0x01,0x30,0x88,0x30,0x04,0x17,0x49,0x53,0x44,0x09,0x93,0xff,0x4b,0x00,0xf3,0x2c,
  1545. 0x44,0xf4,0x4f,0x63,0x04,0xc0,0x20,0x42,0x21,0x94,0x42,0x84,0x40,0x0c,0x9d,0x61,
  1546. 0x04,0x01,0x98,0x23,0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0x88,0x49,
  1547. 0x8a,0x29,0x40,0x6d,0x20,0x20,0x05,0xd6,0x08,0x00,0x00,0x00,0x00,0x13,0xa8,0x70,
  1548. 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,
  1549. 0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51,
  1550. 0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,
  1551. 0x74,0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78,
  1552. 0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,
  1553. 0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,
  1554. 0x7a,0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,
  1555. 0x60,0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,
  1556. 0x07,0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,
  1557. 0x74,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,
  1558. 0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,
  1559. 0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,
  1560. 0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,
  1561. 0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x90,
  1562. 0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,
  1563. 0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,
  1564. 0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,
  1565. 0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,
  1566. 0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x75,0x10,0x07,0x72,
  1567. 0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xd0,0x06,0xf6,0x10,
  1568. 0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,
  1569. 0x70,0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73,
  1570. 0x20,0x07,0x43,0x18,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x21,0x8c,0x03,
  1571. 0x04,0x80,0x00,0x00,0x00,0x00,0x00,0x40,0x16,0x08,0x00,0x00,0x00,0x08,0x00,0x00,
  1572. 0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,
  1573. 0x5a,0x23,0x00,0x25,0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70,0x2c,0xe1,0x01,0x00,
  1574. 0x00,0x79,0x18,0x00,0x00,0xb7,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,
  1575. 0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x42,0x3c,0x00,0x84,0x50,
  1576. 0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0xc3,0x23,0x2c,
  1577. 0x05,0xe3,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,
  1578. 0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0x65,0x46,0xa6,0x06,
  1579. 0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0x65,
  1580. 0x46,0xa6,0x26,0x65,0x88,0xf0,0x10,0x43,0x8c,0x65,0x58,0x8c,0x45,0x60,0xd1,0x54,
  1581. 0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x65,0x58,0x84,0x45,0xe0,0x16,0x96,0x26,0xe7,
  1582. 0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,
  1583. 0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e,
  1584. 0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,
  1585. 0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x21,0x19,0x84,0xa5,0xc9,
  1586. 0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,
  1587. 0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85,0x89,0xb1,
  1588. 0x95,0x0d,0x11,0x9e,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,
  1589. 0x17,0x5d,0x98,0xdc,0x59,0x19,0x1d,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,
  1590. 0xba,0x3c,0xb8,0xb2,0x2f,0xb7,0xb0,0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,
  1591. 0x64,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,
  1592. 0x85,0x9d,0x7d,0x8d,0xbd,0xb1,0xbd,0xc9,0x0d,0x61,0x9e,0x67,0x11,0x1e,0xe8,0x89,
  1593. 0x1e,0xe9,0x99,0x86,0x08,0x0f,0x45,0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,
  1594. 0xad,0xcc,0x8d,0xee,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,
  1595. 0xdb,0xdb,0x98,0x1b,0x4c,0x0a,0x95,0xb0,0x34,0x39,0x97,0xb1,0x32,0x37,0xba,0x32,
  1596. 0x39,0x3e,0x61,0x69,0x72,0x2e,0x70,0x65,0x72,0x73,0x70,0x65,0x63,0x74,0x69,0x76,
  1597. 0x65,0x14,0xea,0xec,0x86,0x48,0x8b,0xf0,0x58,0xcf,0xf5,0x60,0x4f,0xf6,0x40,0x4f,
  1598. 0xf4,0x48,0x8f,0xc6,0xa5,0x6e,0xae,0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x2d,0x26,0x85,
  1599. 0xc5,0xd8,0x1b,0xdb,0x9b,0xdc,0x10,0x69,0x19,0x1e,0xeb,0xe1,0x1e,0xec,0xc9,0x1e,
  1600. 0xe8,0x89,0x1e,0xe9,0xe9,0xb8,0x84,0xa5,0xc9,0xb9,0xd0,0x95,0xe1,0xd1,0xd5,0xc9,
  1601. 0x95,0x51,0x0a,0x4b,0x93,0x73,0x61,0x7b,0x1b,0x0b,0xa3,0x4b,0x7b,0x73,0xfb,0x4a,
  1602. 0x73,0x23,0x2b,0xc3,0xa3,0x12,0x96,0x26,0xe7,0x32,0x17,0xd6,0x06,0xc7,0x56,0x46,
  1603. 0x8c,0xae,0x0c,0x8f,0xae,0x4e,0xae,0x4c,0x86,0x8c,0xc7,0x8c,0xed,0x2d,0x8c,0x8e,
  1604. 0x05,0x64,0x2e,0xac,0x0d,0x8e,0xad,0xcc,0x87,0x03,0x5d,0x19,0xde,0x10,0x6a,0x21,
  1605. 0x9e,0xef,0x01,0x83,0x45,0x58,0x86,0x27,0x0c,0x1e,0xe8,0x11,0x83,0x47,0x7a,0xc6,
  1606. 0x80,0x4b,0x58,0x9a,0x9c,0xcb,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x1c,0x8f,0xb9,0xb0,
  1607. 0x36,0x38,0xb6,0x32,0x39,0x22,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x43,0xa4,
  1608. 0xe5,0x78,0xca,0xe0,0x01,0x83,0x45,0x58,0x86,0x07,0x7a,0xcc,0xe0,0x91,0x9e,0x33,
  1609. 0x18,0x82,0x3c,0xdb,0xe3,0x3d,0x64,0xf0,0xa0,0xc1,0x10,0x03,0x01,0x9e,0xea,0x49,
  1610. 0x83,0x11,0x11,0x3b,0xb0,0x83,0x3d,0xb4,0x83,0x1b,0xb4,0xc3,0x3b,0x90,0x43,0x3d,
  1611. 0xb0,0x43,0x39,0xb8,0x81,0x39,0xb0,0x43,0x38,0x9c,0xc3,0x3c,0x4c,0x11,0x82,0x61,
  1612. 0x84,0xc2,0x0e,0xec,0x60,0x0f,0xed,0xe0,0x06,0xe9,0x40,0x0e,0xe5,0xe0,0x0e,0xf4,
  1613. 0x30,0x25,0x28,0x46,0x2c,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xf6,0x50,0x0e,0xf2,0x30,
  1614. 0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,0x30,0x46,0x50,0xe1,0x90,0x0e,0xf2,0xe0,0x06,
  1615. 0xec,0x10,0x0e,0xee,0x70,0x0e,0xf5,0x10,0x0e,0xe7,0x50,0x0e,0xbf,0x60,0x0f,0xe5,
  1616. 0x20,0x0f,0xf3,0x90,0x0e,0xef,0xe0,0x0e,0x53,0x02,0x64,0xc4,0x14,0x0e,0xe9,0x20,
  1617. 0x0f,0x6e,0x30,0x0e,0xef,0xd0,0x0e,0xf0,0x90,0x0e,0xec,0x50,0x0e,0xbf,0xf0,0x0e,
  1618. 0xf0,0x40,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x0f,0x53,0x06,0x85,0x71,0x46,0x30,0xe1,
  1619. 0x90,0x0e,0xf2,0xe0,0x06,0xe6,0x20,0x0f,0xe1,0x70,0x0e,0xed,0x50,0x0e,0xee,0x40,
  1620. 0x0f,0x53,0x02,0x35,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,
  1621. 0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,
  1622. 0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,
  1623. 0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,
  1624. 0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,
  1625. 0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,
  1626. 0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,
  1627. 0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,
  1628. 0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,
  1629. 0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,
  1630. 0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,
  1631. 0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,
  1632. 0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,
  1633. 0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,
  1634. 0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,
  1635. 0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,
  1636. 0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,
  1637. 0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,
  1638. 0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,
  1639. 0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,
  1640. 0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,
  1641. 0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,
  1642. 0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,
  1643. 0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,
  1644. 0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,
  1645. 0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,
  1646. 0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,
  1647. 0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,
  1648. 0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,
  1649. 0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,
  1650. 0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,
  1651. 0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,
  1652. 0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,
  1653. 0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,
  1654. 0x00,0x61,0x20,0x00,0x00,0x0f,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,
  1655. 0x00,0x06,0x00,0x00,0x00,0xc4,0x46,0x00,0xc6,0x12,0x80,0x80,0xd4,0x08,0x40,0x0d,
  1656. 0x90,0x98,0x01,0xa0,0x30,0x03,0x40,0x60,0x04,0x00,0x00,0x00,0x00,0x83,0x0c,0x8b,
  1657. 0x60,0x8c,0x18,0x28,0x42,0x40,0x29,0x49,0x50,0x20,0x86,0x60,0x01,0x23,0x9f,0xd9,
  1658. 0x06,0x23,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1659. };
  1660. static const char _sgl_vs_source_metal_sim[856] = {
  1661. 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
  1662. 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
  1663. 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
  1664. 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
  1665. 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x76,
  1666. 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
  1667. 0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x6d,0x76,0x70,0x3b,0x0a,0x20,0x20,0x20,
  1668. 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x74,0x6d,0x3b,0x0a,0x7d,0x3b,
  1669. 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,
  1670. 0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
  1671. 0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,
  1672. 0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,
  1673. 0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,
  1674. 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
  1675. 0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,
  1676. 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
  1677. 0x6c,0x6f,0x61,0x74,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74,0x53,0x69,0x7a,
  1678. 0x65,0x20,0x5b,0x5b,0x70,0x6f,0x69,0x6e,0x74,0x5f,0x73,0x69,0x7a,0x65,0x5d,0x5d,
  1679. 0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,
  1680. 0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
  1681. 0x74,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x61,0x74,
  1682. 0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,
  1683. 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,
  1684. 0x64,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x31,
  1685. 0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
  1686. 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,
  1687. 0x74,0x65,0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
  1688. 0x61,0x74,0x20,0x70,0x73,0x69,0x7a,0x65,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,
  1689. 0x62,0x75,0x74,0x65,0x28,0x33,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,
  1690. 0x6c,0x69,0x6e,0x65,0x20,0x31,0x37,0x20,0x22,0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73,
  1691. 0x6c,0x22,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
  1692. 0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,
  1693. 0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,
  1694. 0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76,0x73,0x5f,
  1695. 0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x32,0x31,0x20,0x5b,0x5b,0x62,0x75,
  1696. 0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
  1697. 0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,
  1698. 0x20,0x7b,0x7d,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x37,0x20,0x22,0x73,
  1699. 0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,
  1700. 0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,
  1701. 0x32,0x31,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,
  1702. 0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x38,0x20,0x22,
  1703. 0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,
  1704. 0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74,0x53,0x69,0x7a,0x65,0x20,0x3d,
  1705. 0x20,0x69,0x6e,0x2e,0x70,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,
  1706. 0x20,0x31,0x39,0x20,0x22,0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,
  1707. 0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,0x5f,0x32,0x31,0x2e,
  1708. 0x74,0x6d,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x74,
  1709. 0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,
  1710. 0x2e,0x30,0x29,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x32,0x30,0x20,0x22,0x73,
  1711. 0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,
  1712. 0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,
  1713. 0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,
  1714. 0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
  1715. };
  1716. static const char _sgl_fs_source_metal_sim[489] = {
  1717. 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
  1718. 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
  1719. 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
  1720. 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
  1721. 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
  1722. 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
  1723. 0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
  1724. 0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,
  1725. 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
  1726. 0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
  1727. 0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,
  1728. 0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,
  1729. 0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,
  1730. 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,
  1731. 0x31,0x31,0x20,0x22,0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x66,0x72,
  1732. 0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,
  1733. 0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,
  1734. 0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,
  1735. 0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,
  1736. 0x3e,0x20,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,
  1737. 0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x74,0x65,
  1738. 0x78,0x53,0x6d,0x70,0x6c,0x72,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,
  1739. 0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,
  1740. 0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,
  1741. 0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x31,0x20,0x22,0x73,0x67,0x6c,0x2e,0x67,
  1742. 0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,
  1743. 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x73,0x61,
  1744. 0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x2c,0x20,0x69,
  1745. 0x6e,0x2e,0x75,0x76,0x2e,0x78,0x79,0x29,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f,
  1746. 0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,
  1747. 0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
  1748. };
  1749. #elif defined(SOKOL_D3D11)
  1750. static const uint8_t _sgl_vs_bytecode_hlsl4[1032] = {
  1751. 0x44,0x58,0x42,0x43,0x09,0x96,0xbb,0xbb,0xfc,0x44,0x44,0xa8,0xa4,0x1c,0x9e,0x45,
  1752. 0x50,0x97,0xf1,0xde,0x01,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x05,0x00,0x00,0x00,
  1753. 0x34,0x00,0x00,0x00,0x14,0x01,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x02,0x00,0x00,
  1754. 0x8c,0x03,0x00,0x00,0x52,0x44,0x45,0x46,0xd8,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1755. 0x48,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xfe,0xff,
  1756. 0x10,0x81,0x00,0x00,0xaf,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1757. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1758. 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
  1759. 0x73,0x00,0xab,0xab,0x3c,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x60,0x00,0x00,0x00,
  1760. 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x00,0x00,0x00,
  1761. 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x98,0x00,0x00,0x00,
  1762. 0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
  1763. 0x02,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0x32,0x31,0x5f,
  1764. 0x6d,0x76,0x70,0x00,0x02,0x00,0x03,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
  1765. 0x00,0x00,0x00,0x00,0x5f,0x32,0x31,0x5f,0x74,0x6d,0x00,0x4d,0x69,0x63,0x72,0x6f,
  1766. 0x73,0x6f,0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68,
  1767. 0x61,0x64,0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31,0x30,
  1768. 0x2e,0x31,0x00,0xab,0x49,0x53,0x47,0x4e,0x74,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
  1769. 0x08,0x00,0x00,0x00,0x68,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1770. 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x0f,0x00,0x00,0x68,0x00,0x00,0x00,
  1771. 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1772. 0x03,0x03,0x00,0x00,0x68,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1773. 0x03,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x0f,0x0f,0x00,0x00,0x68,0x00,0x00,0x00,
  1774. 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
  1775. 0x01,0x00,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x00,0xab,0xab,0xab,
  1776. 0x4f,0x53,0x47,0x4e,0x68,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
  1777. 0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
  1778. 0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1779. 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,
  1780. 0x59,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
  1781. 0x02,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,
  1782. 0x00,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0xab,0xab,0xab,
  1783. 0x53,0x48,0x44,0x52,0x84,0x01,0x00,0x00,0x40,0x00,0x01,0x00,0x61,0x00,0x00,0x00,
  1784. 0x59,0x00,0x00,0x04,0x46,0x8e,0x20,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
  1785. 0x5f,0x00,0x00,0x03,0xf2,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x5f,0x00,0x00,0x03,
  1786. 0x32,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x5f,0x00,0x00,0x03,0xf2,0x10,0x10,0x00,
  1787. 0x02,0x00,0x00,0x00,0x65,0x00,0x00,0x03,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,
  1788. 0x65,0x00,0x00,0x03,0xf2,0x20,0x10,0x00,0x01,0x00,0x00,0x00,0x67,0x00,0x00,0x04,
  1789. 0xf2,0x20,0x10,0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x68,0x00,0x00,0x02,
  1790. 0x01,0x00,0x00,0x00,0x38,0x00,0x00,0x08,0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,
  1791. 0x56,0x15,0x10,0x00,0x01,0x00,0x00,0x00,0x46,0x8e,0x20,0x00,0x00,0x00,0x00,0x00,
  1792. 0x05,0x00,0x00,0x00,0x32,0x00,0x00,0x0a,0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,
  1793. 0x06,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x46,0x8e,0x20,0x00,0x00,0x00,0x00,0x00,
  1794. 0x04,0x00,0x00,0x00,0x46,0x0e,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
  1795. 0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x0e,0x10,0x00,0x00,0x00,0x00,0x00,
  1796. 0x46,0x8e,0x20,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x36,0x00,0x00,0x05,
  1797. 0xf2,0x20,0x10,0x00,0x01,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x02,0x00,0x00,0x00,
  1798. 0x38,0x00,0x00,0x08,0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x56,0x15,0x10,0x00,
  1799. 0x00,0x00,0x00,0x00,0x46,0x8e,0x20,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1800. 0x32,0x00,0x00,0x0a,0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x06,0x10,0x10,0x00,
  1801. 0x00,0x00,0x00,0x00,0x46,0x8e,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1802. 0x46,0x0e,0x10,0x00,0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x0a,0xf2,0x00,0x10,0x00,
  1803. 0x00,0x00,0x00,0x00,0xa6,0x1a,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x8e,0x20,0x00,
  1804. 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x46,0x0e,0x10,0x00,0x00,0x00,0x00,0x00,
  1805. 0x32,0x00,0x00,0x0a,0xf2,0x20,0x10,0x00,0x02,0x00,0x00,0x00,0xf6,0x1f,0x10,0x00,
  1806. 0x00,0x00,0x00,0x00,0x46,0x8e,0x20,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
  1807. 0x46,0x0e,0x10,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x01,0x53,0x54,0x41,0x54,
  1808. 0x74,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1809. 0x06,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1810. 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1811. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1812. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1813. 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1814. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1815. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1816. };
  1817. static const uint8_t _sgl_fs_bytecode_hlsl4[620] = {
  1818. 0x44,0x58,0x42,0x43,0x4f,0x7a,0xe1,0xcf,0x0c,0x89,0xc0,0x09,0x50,0x5a,0xca,0xe9,
  1819. 0x75,0x77,0xd1,0x26,0x01,0x00,0x00,0x00,0x6c,0x02,0x00,0x00,0x05,0x00,0x00,0x00,
  1820. 0x34,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0x20,0x01,0x00,0x00,0x54,0x01,0x00,0x00,
  1821. 0xf0,0x01,0x00,0x00,0x52,0x44,0x45,0x46,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1822. 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xff,0xff,
  1823. 0x10,0x81,0x00,0x00,0x6d,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
  1824. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1825. 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x69,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
  1826. 0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
  1827. 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d,
  1828. 0x70,0x6c,0x65,0x72,0x00,0x74,0x65,0x78,0x00,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,
  1829. 0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68,0x61,0x64,
  1830. 0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31,0x30,0x2e,0x31,
  1831. 0x00,0xab,0xab,0xab,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
  1832. 0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1833. 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x03,0x00,0x00,0x38,0x00,0x00,0x00,
  1834. 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1835. 0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x00,0xab,0xab,0xab,
  1836. 0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
  1837. 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
  1838. 0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,
  1839. 0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0x94,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
  1840. 0x25,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00,
  1841. 0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00,0x55,0x55,0x00,0x00,
  1842. 0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x62,0x10,0x00,0x03,
  1843. 0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03,0xf2,0x20,0x10,0x00,
  1844. 0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x45,0x00,0x00,0x09,
  1845. 0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00,0x00,0x00,0x00,0x00,
  1846. 0x46,0x7e,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00,
  1847. 0x38,0x00,0x00,0x07,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x0e,0x10,0x00,
  1848. 0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00,0x3e,0x00,0x00,0x01,
  1849. 0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1850. 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1851. 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1852. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1853. 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1854. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1855. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1856. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1857. };
  1858. #elif defined(SOKOL_WGPU)
  1859. static const uint8_t _sgl_vs_bytecode_wgpu[1968] = {
  1860. 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x35,0x00,0x00,0x00,
  1861. 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00,
  1862. 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30,
  1863. 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1864. 0x0f,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,
  1865. 0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x21,0x00,0x00,0x00,
  1866. 0x25,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x33,0x00,0x00,0x00,
  1867. 0x07,0x00,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x05,0x00,
  1868. 0x07,0x00,0x00,0x00,0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x00,0x00,0x00,0x00,
  1869. 0x03,0x00,0x37,0x00,0x02,0x00,0x00,0x00,0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00,
  1870. 0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,
  1871. 0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b,
  1872. 0x61,0x6e,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,
  1873. 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,
  1874. 0x74,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,
  1875. 0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,
  1876. 0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b,
  1877. 0x61,0x6e,0x31,0x2e,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,
  1878. 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65,
  1879. 0x74,0x2d,0x65,0x6e,0x76,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20,
  1880. 0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,
  1881. 0x64,0x20,0x65,0x6e,0x74,0x72,0x79,0x2d,0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61,
  1882. 0x69,0x6e,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00,
  1883. 0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00,
  1884. 0x0d,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x65,0x72,0x56,0x65,0x72,0x74,0x65,0x78,
  1885. 0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1886. 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x06,0x00,0x07,0x00,
  1887. 0x0d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74,
  1888. 0x53,0x69,0x7a,0x65,0x00,0x00,0x00,0x00,0x06,0x00,0x07,0x00,0x0d,0x00,0x00,0x00,
  1889. 0x02,0x00,0x00,0x00,0x67,0x6c,0x5f,0x43,0x6c,0x69,0x70,0x44,0x69,0x73,0x74,0x61,
  1890. 0x6e,0x63,0x65,0x00,0x06,0x00,0x07,0x00,0x0d,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
  1891. 0x67,0x6c,0x5f,0x43,0x75,0x6c,0x6c,0x44,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x00,
  1892. 0x05,0x00,0x03,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,
  1893. 0x13,0x00,0x00,0x00,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x00,0x00,0x00,
  1894. 0x06,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6d,0x76,0x70,0x00,
  1895. 0x06,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x74,0x6d,0x00,0x00,
  1896. 0x05,0x00,0x03,0x00,0x15,0x00,0x00,0x00,0x5f,0x32,0x31,0x00,0x05,0x00,0x05,0x00,
  1897. 0x1a,0x00,0x00,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x00,0x00,
  1898. 0x05,0x00,0x04,0x00,0x21,0x00,0x00,0x00,0x70,0x73,0x69,0x7a,0x65,0x00,0x00,0x00,
  1899. 0x05,0x00,0x03,0x00,0x25,0x00,0x00,0x00,0x75,0x76,0x00,0x00,0x05,0x00,0x05,0x00,
  1900. 0x2a,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x00,0x00,
  1901. 0x05,0x00,0x04,0x00,0x32,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x00,
  1902. 0x05,0x00,0x04,0x00,0x33,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x00,
  1903. 0x48,0x00,0x05,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,
  1904. 0x00,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1905. 0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0d,0x00,0x00,0x00,
  1906. 0x02,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x48,0x00,0x05,0x00,
  1907. 0x0d,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
  1908. 0x47,0x00,0x03,0x00,0x0d,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x48,0x00,0x04,0x00,
  1909. 0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x48,0x00,0x05,0x00,
  1910. 0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1911. 0x48,0x00,0x05,0x00,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
  1912. 0x10,0x00,0x00,0x00,0x48,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1913. 0x05,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1914. 0x23,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x13,0x00,0x00,0x00,
  1915. 0x01,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x47,0x00,0x03,0x00,
  1916. 0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x15,0x00,0x00,0x00,
  1917. 0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x15,0x00,0x00,0x00,
  1918. 0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1a,0x00,0x00,0x00,
  1919. 0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x21,0x00,0x00,0x00,
  1920. 0x1e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x25,0x00,0x00,0x00,
  1921. 0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x2a,0x00,0x00,0x00,
  1922. 0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x32,0x00,0x00,0x00,
  1923. 0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x33,0x00,0x00,0x00,
  1924. 0x1e,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00,
  1925. 0x21,0x00,0x03,0x00,0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00,
  1926. 0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x09,0x00,0x00,0x00,
  1927. 0x08,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x15,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,
  1928. 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,
  1929. 0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x04,0x00,0x0c,0x00,0x00,0x00,
  1930. 0x08,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x1e,0x00,0x06,0x00,0x0d,0x00,0x00,0x00,
  1931. 0x09,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,
  1932. 0x20,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,
  1933. 0x3b,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
  1934. 0x15,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1935. 0x2b,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1936. 0x18,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
  1937. 0x1e,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
  1938. 0x20,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x13,0x00,0x00,0x00,
  1939. 0x3b,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
  1940. 0x20,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
  1941. 0x20,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x09,0x00,0x00,0x00,
  1942. 0x3b,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1943. 0x20,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x09,0x00,0x00,0x00,
  1944. 0x2b,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1945. 0x20,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
  1946. 0x3b,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1947. 0x20,0x00,0x04,0x00,0x23,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
  1948. 0x3b,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
  1949. 0x17,0x00,0x04,0x00,0x28,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
  1950. 0x20,0x00,0x04,0x00,0x29,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x28,0x00,0x00,0x00,
  1951. 0x3b,0x00,0x04,0x00,0x29,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1952. 0x2b,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1953. 0x2b,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x00,0x00,0x80,0x3f,
  1954. 0x3b,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
  1955. 0x3b,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1956. 0x36,0x00,0x05,0x00,0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  1957. 0x04,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x06,0x00,0x00,0x00,0x08,0x00,0x04,0x00,
  1958. 0x07,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x05,0x00,
  1959. 0x16,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
  1960. 0x3d,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
  1961. 0x3d,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,
  1962. 0x91,0x00,0x05,0x00,0x09,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
  1963. 0x1b,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x1d,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
  1964. 0x0f,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x1e,0x00,0x00,0x00,
  1965. 0x1c,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x13,0x00,0x00,0x00,
  1966. 0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x22,0x00,0x00,0x00,
  1967. 0x21,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x23,0x00,0x00,0x00,0x24,0x00,0x00,0x00,
  1968. 0x0f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x24,0x00,0x00,0x00,
  1969. 0x22,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
  1970. 0x00,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x16,0x00,0x00,0x00,0x26,0x00,0x00,0x00,
  1971. 0x15,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x12,0x00,0x00,0x00,
  1972. 0x27,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x28,0x00,0x00,0x00,
  1973. 0x2b,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x51,0x00,0x05,0x00,0x08,0x00,0x00,0x00,
  1974. 0x2e,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x51,0x00,0x05,0x00,
  1975. 0x08,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1976. 0x50,0x00,0x07,0x00,0x09,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x2e,0x00,0x00,0x00,
  1977. 0x2f,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x91,0x00,0x05,0x00,
  1978. 0x09,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x27,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
  1979. 0x3e,0x00,0x03,0x00,0x25,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x08,0x00,0x04,0x00,
  1980. 0x07,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,
  1981. 0x09,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,
  1982. 0x32,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00,
  1983. };
  1984. static const uint8_t _sgl_fs_bytecode_wgpu[936] = {
  1985. 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x1a,0x00,0x00,0x00,
  1986. 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00,
  1987. 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30,
  1988. 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  1989. 0x0f,0x00,0x08,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,
  1990. 0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
  1991. 0x10,0x00,0x03,0x00,0x05,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x03,0x00,
  1992. 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x05,0x00,0x07,0x00,0x00,0x00,
  1993. 0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x00,0x00,0x00,0x00,0x03,0x00,0x37,0x00,
  1994. 0x02,0x00,0x00,0x00,0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x2f,0x2f,0x20,0x4f,
  1995. 0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,
  1996. 0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x30,
  1997. 0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,
  1998. 0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x6f,0x70,
  1999. 0x65,0x6e,0x67,0x6c,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,
  2000. 0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,
  2001. 0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x2e,
  2002. 0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,
  2003. 0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e,
  2004. 0x76,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,
  2005. 0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x65,0x6e,
  2006. 0x74,0x72,0x79,0x2d,0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x0a,0x23,
  2007. 0x6c,0x69,0x6e,0x65,0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00,0x05,0x00,0x00,0x00,
  2008. 0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,0x0b,0x00,0x00,0x00,
  2009. 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x05,0x00,0x03,0x00,
  2010. 0x0f,0x00,0x00,0x00,0x74,0x65,0x78,0x00,0x05,0x00,0x03,0x00,0x12,0x00,0x00,0x00,
  2011. 0x75,0x76,0x00,0x00,0x05,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,
  2012. 0x72,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0b,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
  2013. 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
  2014. 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x22,0x00,0x00,0x00,
  2015. 0x02,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x21,0x00,0x00,0x00,
  2016. 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
  2017. 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
  2018. 0x01,0x00,0x00,0x00,0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x21,0x00,0x03,0x00,
  2019. 0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00,0x08,0x00,0x00,0x00,
  2020. 0x20,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
  2021. 0x04,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
  2022. 0x09,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,
  2023. 0x03,0x00,0x00,0x00,0x19,0x00,0x09,0x00,0x0c,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
  2024. 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  2025. 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x03,0x00,0x0d,0x00,0x00,0x00,
  2026. 0x0c,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  2027. 0x0d,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,
  2028. 0x00,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  2029. 0x09,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
  2030. 0x01,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
  2031. 0x02,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
  2032. 0x01,0x00,0x00,0x00,0x36,0x00,0x05,0x00,0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
  2033. 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x06,0x00,0x00,0x00,
  2034. 0x08,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  2035. 0x3d,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,
  2036. 0x3d,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
  2037. 0x4f,0x00,0x07,0x00,0x13,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
  2038. 0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x57,0x00,0x05,0x00,
  2039. 0x09,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x15,0x00,0x00,0x00,
  2040. 0x3d,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
  2041. 0x85,0x00,0x05,0x00,0x09,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x16,0x00,0x00,0x00,
  2042. 0x18,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x0b,0x00,0x00,0x00,0x19,0x00,0x00,0x00,
  2043. 0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00,
  2044. };
  2045. #elif defined(SOKOL_DUMMY_BACKEND)
  2046. static const char* _sgl_vs_source_dummy = "";
  2047. static const char* _sgl_fs_source_dummy = "";
  2048. #else
  2049. #error "Please define one of SOKOL_GLCORE33, SOKOL_GLES3, SOKOL_D3D11, SOKOL_METAL, SOKOL_WGPU or SOKOL_DUMMY_BACKEND!"
  2050. #endif
  2051. // ████████ ██ ██ ██████ ███████ ███████
  2052. // ██ ██ ██ ██ ██ ██ ██
  2053. // ██ ████ ██████ █████ ███████
  2054. // ██ ██ ██ ██ ██
  2055. // ██ ██ ██ ███████ ███████
  2056. //
  2057. // >>types
  2058. typedef enum {
  2059. SGL_PRIMITIVETYPE_POINTS = 0,
  2060. SGL_PRIMITIVETYPE_LINES,
  2061. SGL_PRIMITIVETYPE_LINE_STRIP,
  2062. SGL_PRIMITIVETYPE_TRIANGLES,
  2063. SGL_PRIMITIVETYPE_TRIANGLE_STRIP,
  2064. SGL_PRIMITIVETYPE_QUADS,
  2065. SGL_NUM_PRIMITIVE_TYPES,
  2066. } _sgl_primitive_type_t;
  2067. typedef struct {
  2068. uint32_t id;
  2069. sg_resource_state state;
  2070. } _sgl_slot_t;
  2071. typedef struct {
  2072. int size;
  2073. int queue_top;
  2074. uint32_t* gen_ctrs;
  2075. int* free_queue;
  2076. } _sgl_pool_t;
  2077. typedef struct {
  2078. _sgl_slot_t slot;
  2079. sg_pipeline pip[SGL_NUM_PRIMITIVE_TYPES];
  2080. } _sgl_pipeline_t;
  2081. typedef struct {
  2082. _sgl_pool_t pool;
  2083. _sgl_pipeline_t* pips;
  2084. } _sgl_pipeline_pool_t;
  2085. typedef enum {
  2086. SGL_MATRIXMODE_MODELVIEW,
  2087. SGL_MATRIXMODE_PROJECTION,
  2088. SGL_MATRIXMODE_TEXTURE,
  2089. SGL_NUM_MATRIXMODES
  2090. } _sgl_matrix_mode_t;
  2091. typedef struct {
  2092. float pos[3];
  2093. float uv[2];
  2094. uint32_t rgba;
  2095. float psize;
  2096. } _sgl_vertex_t;
  2097. typedef struct {
  2098. float v[4][4];
  2099. } _sgl_matrix_t;
  2100. typedef struct {
  2101. _sgl_matrix_t mvp; /* model-view-projection matrix */
  2102. _sgl_matrix_t tm; /* texture matrix */
  2103. } _sgl_uniform_t;
  2104. typedef enum {
  2105. SGL_COMMAND_DRAW,
  2106. SGL_COMMAND_VIEWPORT,
  2107. SGL_COMMAND_SCISSOR_RECT,
  2108. } _sgl_command_type_t;
  2109. typedef struct {
  2110. sg_pipeline pip;
  2111. sg_image img;
  2112. int base_vertex;
  2113. int num_vertices;
  2114. int uniform_index;
  2115. } _sgl_draw_args_t;
  2116. typedef struct {
  2117. int x, y, w, h;
  2118. bool origin_top_left;
  2119. } _sgl_viewport_args_t;
  2120. typedef struct {
  2121. int x, y, w, h;
  2122. bool origin_top_left;
  2123. } _sgl_scissor_rect_args_t;
  2124. typedef union {
  2125. _sgl_draw_args_t draw;
  2126. _sgl_viewport_args_t viewport;
  2127. _sgl_scissor_rect_args_t scissor_rect;
  2128. } _sgl_args_t;
  2129. typedef struct {
  2130. _sgl_command_type_t cmd;
  2131. int layer_id;
  2132. _sgl_args_t args;
  2133. } _sgl_command_t;
  2134. #define _SGL_INVALID_SLOT_INDEX (0)
  2135. #define _SGL_MAX_STACK_DEPTH (64)
  2136. #define _SGL_DEFAULT_CONTEXT_POOL_SIZE (4)
  2137. #define _SGL_DEFAULT_PIPELINE_POOL_SIZE (64)
  2138. #define _SGL_DEFAULT_MAX_VERTICES (1<<16)
  2139. #define _SGL_DEFAULT_MAX_COMMANDS (1<<14)
  2140. #define _SGL_SLOT_SHIFT (16)
  2141. #define _SGL_MAX_POOL_SIZE (1<<_SGL_SLOT_SHIFT)
  2142. #define _SGL_SLOT_MASK (_SGL_MAX_POOL_SIZE-1)
  2143. typedef struct {
  2144. _sgl_slot_t slot;
  2145. sgl_context_desc_t desc;
  2146. uint32_t frame_id;
  2147. uint32_t update_frame_id;
  2148. struct {
  2149. int cap;
  2150. int next;
  2151. _sgl_vertex_t* ptr;
  2152. } vertices;
  2153. struct {
  2154. int cap;
  2155. int next;
  2156. _sgl_uniform_t* ptr;
  2157. } uniforms;
  2158. struct {
  2159. int cap;
  2160. int next;
  2161. _sgl_command_t* ptr;
  2162. } commands;
  2163. /* state tracking */
  2164. int base_vertex;
  2165. int vtx_count; /* number of times vtx function has been called, used for non-triangle primitives */
  2166. sgl_error_t error;
  2167. bool in_begin;
  2168. int layer_id;
  2169. float u, v;
  2170. uint32_t rgba;
  2171. float point_size;
  2172. _sgl_primitive_type_t cur_prim_type;
  2173. sg_image cur_img;
  2174. bool texturing_enabled;
  2175. bool matrix_dirty; /* reset in sgl_end(), set in any of the matrix stack functions */
  2176. /* sokol-gfx resources */
  2177. sg_buffer vbuf;
  2178. sgl_pipeline def_pip;
  2179. sg_bindings bind;
  2180. /* pipeline stack */
  2181. int pip_tos;
  2182. sgl_pipeline pip_stack[_SGL_MAX_STACK_DEPTH];
  2183. /* matrix stacks */
  2184. _sgl_matrix_mode_t cur_matrix_mode;
  2185. int matrix_tos[SGL_NUM_MATRIXMODES];
  2186. _sgl_matrix_t matrix_stack[SGL_NUM_MATRIXMODES][_SGL_MAX_STACK_DEPTH];
  2187. } _sgl_context_t;
  2188. typedef struct {
  2189. _sgl_pool_t pool;
  2190. _sgl_context_t* contexts;
  2191. } _sgl_context_pool_t;
  2192. typedef struct {
  2193. uint32_t init_cookie;
  2194. sgl_desc_t desc;
  2195. sg_image def_img; // a default white texture
  2196. sg_shader shd; // same shader for all contexts
  2197. sgl_context def_ctx_id;
  2198. sgl_context cur_ctx_id;
  2199. _sgl_context_t* cur_ctx; // may be 0!
  2200. _sgl_pipeline_pool_t pip_pool;
  2201. _sgl_context_pool_t context_pool;
  2202. } _sgl_t;
  2203. static _sgl_t _sgl;
  2204. // ██ ██████ ██████ ██████ ██ ███ ██ ██████
  2205. // ██ ██ ██ ██ ██ ██ ████ ██ ██
  2206. // ██ ██ ██ ██ ███ ██ ███ ██ ██ ██ ██ ██ ███
  2207. // ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
  2208. // ███████ ██████ ██████ ██████ ██ ██ ████ ██████
  2209. //
  2210. // >>logging
  2211. #if defined(SOKOL_DEBUG)
  2212. #define _SGL_LOGITEM_XMACRO(item,msg) #item ": " msg,
  2213. static const char* _sgl_log_messages[] = {
  2214. _SGL_LOG_ITEMS
  2215. };
  2216. #undef _SGL_LOGITEM_XMACRO
  2217. #endif // SOKOL_DEBUG
  2218. #define _SGL_PANIC(code) _sgl_log(SGL_LOGITEM_ ##code, 0, __LINE__)
  2219. #define _SGL_ERROR(code) _sgl_log(SGL_LOGITEM_ ##code, 1, __LINE__)
  2220. #define _SGL_WARN(code) _sgl_log(SGL_LOGITEM_ ##code, 2, __LINE__)
  2221. #define _SGL_INFO(code) _sgl_log(SGL_LOGITEM_ ##code, 3, __LINE__)
  2222. static void _sgl_log(sgl_log_item_t log_item, uint32_t log_level, uint32_t line_nr) {
  2223. if (_sgl.desc.logger.func) {
  2224. #if defined(SOKOL_DEBUG)
  2225. const char* filename = __FILE__;
  2226. const char* message = _sgl_log_messages[log_item];
  2227. #else
  2228. const char* filename = 0;
  2229. const char* message = 0;
  2230. #endif
  2231. _sgl.desc.logger.func("sgl", log_level, log_item, message, line_nr, filename, _sgl.desc.logger.user_data);
  2232. }
  2233. else {
  2234. // for log level PANIC it would be 'undefined behaviour' to continue
  2235. if (log_level == 0) {
  2236. abort();
  2237. }
  2238. }
  2239. }
  2240. // ███ ███ ███████ ███ ███ ██████ ██████ ██ ██
  2241. // ████ ████ ██ ████ ████ ██ ██ ██ ██ ██ ██
  2242. // ██ ████ ██ █████ ██ ████ ██ ██ ██ ██████ ████
  2243. // ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
  2244. // ██ ██ ███████ ██ ██ ██████ ██ ██ ██
  2245. //
  2246. // >>memory
  2247. static void _sgl_clear(void* ptr, size_t size) {
  2248. SOKOL_ASSERT(ptr && (size > 0));
  2249. memset(ptr, 0, size);
  2250. }
  2251. static void* _sgl_malloc(size_t size) {
  2252. SOKOL_ASSERT(size > 0);
  2253. void* ptr;
  2254. if (_sgl.desc.allocator.alloc) {
  2255. ptr = _sgl.desc.allocator.alloc(size, _sgl.desc.allocator.user_data);
  2256. }
  2257. else {
  2258. ptr = malloc(size);
  2259. }
  2260. if (0 == ptr) {
  2261. _SGL_PANIC(MALLOC_FAILED);
  2262. }
  2263. return ptr;
  2264. }
  2265. static void* _sgl_malloc_clear(size_t size) {
  2266. void* ptr = _sgl_malloc(size);
  2267. _sgl_clear(ptr, size);
  2268. return ptr;
  2269. }
  2270. static void _sgl_free(void* ptr) {
  2271. if (_sgl.desc.allocator.free) {
  2272. _sgl.desc.allocator.free(ptr, _sgl.desc.allocator.user_data);
  2273. }
  2274. else {
  2275. free(ptr);
  2276. }
  2277. }
  2278. // ██████ ██████ ██████ ██
  2279. // ██ ██ ██ ██ ██ ██ ██
  2280. // ██████ ██ ██ ██ ██ ██
  2281. // ██ ██ ██ ██ ██ ██
  2282. // ██ ██████ ██████ ███████
  2283. //
  2284. // >>pool
  2285. static void _sgl_init_pool(_sgl_pool_t* pool, int num) {
  2286. SOKOL_ASSERT(pool && (num >= 1));
  2287. /* slot 0 is reserved for the 'invalid id', so bump the pool size by 1 */
  2288. pool->size = num + 1;
  2289. pool->queue_top = 0;
  2290. /* generation counters indexable by pool slot index, slot 0 is reserved */
  2291. size_t gen_ctrs_size = sizeof(uint32_t) * (size_t)pool->size;
  2292. pool->gen_ctrs = (uint32_t*) _sgl_malloc_clear(gen_ctrs_size);
  2293. /* it's not a bug to only reserve 'num' here */
  2294. pool->free_queue = (int*) _sgl_malloc_clear(sizeof(int) * (size_t)num);
  2295. /* never allocate the zero-th pool item since the invalid id is 0 */
  2296. for (int i = pool->size-1; i >= 1; i--) {
  2297. pool->free_queue[pool->queue_top++] = i;
  2298. }
  2299. }
  2300. static void _sgl_discard_pool(_sgl_pool_t* pool) {
  2301. SOKOL_ASSERT(pool);
  2302. SOKOL_ASSERT(pool->free_queue);
  2303. _sgl_free(pool->free_queue);
  2304. pool->free_queue = 0;
  2305. SOKOL_ASSERT(pool->gen_ctrs);
  2306. _sgl_free(pool->gen_ctrs);
  2307. pool->gen_ctrs = 0;
  2308. pool->size = 0;
  2309. pool->queue_top = 0;
  2310. }
  2311. static int _sgl_pool_alloc_index(_sgl_pool_t* pool) {
  2312. SOKOL_ASSERT(pool);
  2313. SOKOL_ASSERT(pool->free_queue);
  2314. if (pool->queue_top > 0) {
  2315. int slot_index = pool->free_queue[--pool->queue_top];
  2316. SOKOL_ASSERT((slot_index > 0) && (slot_index < pool->size));
  2317. return slot_index;
  2318. }
  2319. else {
  2320. /* pool exhausted */
  2321. return _SGL_INVALID_SLOT_INDEX;
  2322. }
  2323. }
  2324. static void _sgl_pool_free_index(_sgl_pool_t* pool, int slot_index) {
  2325. SOKOL_ASSERT((slot_index > _SGL_INVALID_SLOT_INDEX) && (slot_index < pool->size));
  2326. SOKOL_ASSERT(pool);
  2327. SOKOL_ASSERT(pool->free_queue);
  2328. SOKOL_ASSERT(pool->queue_top < pool->size);
  2329. #ifdef SOKOL_DEBUG
  2330. /* debug check against double-free */
  2331. for (int i = 0; i < pool->queue_top; i++) {
  2332. SOKOL_ASSERT(pool->free_queue[i] != slot_index);
  2333. }
  2334. #endif
  2335. pool->free_queue[pool->queue_top++] = slot_index;
  2336. SOKOL_ASSERT(pool->queue_top <= (pool->size-1));
  2337. }
  2338. /* allocate the slot at slot_index:
  2339. - bump the slot's generation counter
  2340. - create a resource id from the generation counter and slot index
  2341. - set the slot's id to this id
  2342. - set the slot's state to ALLOC
  2343. - return the resource id
  2344. */
  2345. static uint32_t _sgl_slot_alloc(_sgl_pool_t* pool, _sgl_slot_t* slot, int slot_index) {
  2346. /* FIXME: add handling for an overflowing generation counter,
  2347. for now, just overflow (another option is to disable
  2348. the slot)
  2349. */
  2350. SOKOL_ASSERT(pool && pool->gen_ctrs);
  2351. SOKOL_ASSERT((slot_index > _SGL_INVALID_SLOT_INDEX) && (slot_index < pool->size));
  2352. SOKOL_ASSERT((slot->state == SG_RESOURCESTATE_INITIAL) && (slot->id == SG_INVALID_ID));
  2353. uint32_t ctr = ++pool->gen_ctrs[slot_index];
  2354. slot->id = (ctr<<_SGL_SLOT_SHIFT)|(slot_index & _SGL_SLOT_MASK);
  2355. slot->state = SG_RESOURCESTATE_ALLOC;
  2356. return slot->id;
  2357. }
  2358. /* extract slot index from id */
  2359. static int _sgl_slot_index(uint32_t id) {
  2360. int slot_index = (int) (id & _SGL_SLOT_MASK);
  2361. SOKOL_ASSERT(_SGL_INVALID_SLOT_INDEX != slot_index);
  2362. return slot_index;
  2363. }
  2364. // ██████ ██ ██████ ███████ ██ ██ ███ ██ ███████ ███████
  2365. // ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██
  2366. // ██████ ██ ██████ █████ ██ ██ ██ ██ ██ █████ ███████
  2367. // ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
  2368. // ██ ██ ██ ███████ ███████ ██ ██ ████ ███████ ███████
  2369. //
  2370. // >>pipelines
  2371. static void _sgl_reset_pipeline(_sgl_pipeline_t* pip) {
  2372. SOKOL_ASSERT(pip);
  2373. _sgl_clear(pip, sizeof(_sgl_pipeline_t));
  2374. }
  2375. static void _sgl_setup_pipeline_pool(int pool_size) {
  2376. /* note: the pools here will have an additional item, since slot 0 is reserved */
  2377. SOKOL_ASSERT((pool_size > 0) && (pool_size < _SGL_MAX_POOL_SIZE));
  2378. _sgl_init_pool(&_sgl.pip_pool.pool, pool_size);
  2379. size_t pool_byte_size = sizeof(_sgl_pipeline_t) * (size_t)_sgl.pip_pool.pool.size;
  2380. _sgl.pip_pool.pips = (_sgl_pipeline_t*) _sgl_malloc_clear(pool_byte_size);
  2381. }
  2382. static void _sgl_discard_pipeline_pool(void) {
  2383. SOKOL_ASSERT(0 != _sgl.pip_pool.pips);
  2384. _sgl_free(_sgl.pip_pool.pips); _sgl.pip_pool.pips = 0;
  2385. _sgl_discard_pool(&_sgl.pip_pool.pool);
  2386. }
  2387. /* get pipeline pointer without id-check */
  2388. static _sgl_pipeline_t* _sgl_pipeline_at(uint32_t pip_id) {
  2389. SOKOL_ASSERT(SG_INVALID_ID != pip_id);
  2390. int slot_index = _sgl_slot_index(pip_id);
  2391. SOKOL_ASSERT((slot_index > _SGL_INVALID_SLOT_INDEX) && (slot_index < _sgl.pip_pool.pool.size));
  2392. return &_sgl.pip_pool.pips[slot_index];
  2393. }
  2394. /* get pipeline pointer with id-check, returns 0 if no match */
  2395. static _sgl_pipeline_t* _sgl_lookup_pipeline(uint32_t pip_id) {
  2396. if (SG_INVALID_ID != pip_id) {
  2397. _sgl_pipeline_t* pip = _sgl_pipeline_at(pip_id);
  2398. if (pip->slot.id == pip_id) {
  2399. return pip;
  2400. }
  2401. }
  2402. return 0;
  2403. }
  2404. /* make pipeline id from uint32_t id */
  2405. static sgl_pipeline _sgl_make_pip_id(uint32_t pip_id) {
  2406. sgl_pipeline pip = { pip_id };
  2407. return pip;
  2408. }
  2409. static sgl_pipeline _sgl_alloc_pipeline(void) {
  2410. sgl_pipeline res;
  2411. int slot_index = _sgl_pool_alloc_index(&_sgl.pip_pool.pool);
  2412. if (_SGL_INVALID_SLOT_INDEX != slot_index) {
  2413. res = _sgl_make_pip_id(_sgl_slot_alloc(&_sgl.pip_pool.pool, &_sgl.pip_pool.pips[slot_index].slot, slot_index));
  2414. }
  2415. else {
  2416. /* pool is exhausted */
  2417. res = _sgl_make_pip_id(SG_INVALID_ID);
  2418. }
  2419. return res;
  2420. }
  2421. static void _sgl_init_pipeline(sgl_pipeline pip_id, const sg_pipeline_desc* in_desc, const sgl_context_desc_t* ctx_desc) {
  2422. SOKOL_ASSERT((pip_id.id != SG_INVALID_ID) && in_desc && ctx_desc);
  2423. /* create a new desc with 'patched' shader and pixel format state */
  2424. sg_pipeline_desc desc = *in_desc;
  2425. desc.layout.buffers[0].stride = sizeof(_sgl_vertex_t);
  2426. {
  2427. sg_vertex_attr_desc* pos = &desc.layout.attrs[0];
  2428. pos->offset = offsetof(_sgl_vertex_t, pos);
  2429. pos->format = SG_VERTEXFORMAT_FLOAT3;
  2430. }
  2431. {
  2432. sg_vertex_attr_desc* uv = &desc.layout.attrs[1];
  2433. uv->offset = offsetof(_sgl_vertex_t, uv);
  2434. uv->format = SG_VERTEXFORMAT_FLOAT2;
  2435. }
  2436. {
  2437. sg_vertex_attr_desc* rgba = &desc.layout.attrs[2];
  2438. rgba->offset = offsetof(_sgl_vertex_t, rgba);
  2439. rgba->format = SG_VERTEXFORMAT_UBYTE4N;
  2440. }
  2441. {
  2442. sg_vertex_attr_desc* psize = &desc.layout.attrs[3];
  2443. psize->offset = offsetof(_sgl_vertex_t, psize);
  2444. psize->format = SG_VERTEXFORMAT_FLOAT;
  2445. }
  2446. if (in_desc->shader.id == SG_INVALID_ID) {
  2447. desc.shader = _sgl.shd;
  2448. }
  2449. desc.index_type = SG_INDEXTYPE_NONE;
  2450. desc.sample_count = ctx_desc->sample_count;
  2451. if (desc.face_winding == _SG_FACEWINDING_DEFAULT) {
  2452. desc.face_winding = _sgl.desc.face_winding;
  2453. }
  2454. desc.depth.pixel_format = ctx_desc->depth_format;
  2455. if (ctx_desc->depth_format == SG_PIXELFORMAT_NONE) {
  2456. desc.depth.write_enabled = false;
  2457. }
  2458. desc.colors[0].pixel_format = ctx_desc->color_format;
  2459. if (desc.colors[0].write_mask == _SG_COLORMASK_DEFAULT) {
  2460. desc.colors[0].write_mask = SG_COLORMASK_RGB;
  2461. }
  2462. _sgl_pipeline_t* pip = _sgl_lookup_pipeline(pip_id.id);
  2463. SOKOL_ASSERT(pip && (pip->slot.state == SG_RESOURCESTATE_ALLOC));
  2464. pip->slot.state = SG_RESOURCESTATE_VALID;
  2465. for (int i = 0; i < SGL_NUM_PRIMITIVE_TYPES; i++) {
  2466. switch (i) {
  2467. case SGL_PRIMITIVETYPE_POINTS:
  2468. desc.primitive_type = SG_PRIMITIVETYPE_POINTS;
  2469. break;
  2470. case SGL_PRIMITIVETYPE_LINES:
  2471. desc.primitive_type = SG_PRIMITIVETYPE_LINES;
  2472. break;
  2473. case SGL_PRIMITIVETYPE_LINE_STRIP:
  2474. desc.primitive_type = SG_PRIMITIVETYPE_LINE_STRIP;
  2475. break;
  2476. case SGL_PRIMITIVETYPE_TRIANGLES:
  2477. desc.primitive_type = SG_PRIMITIVETYPE_TRIANGLES;
  2478. break;
  2479. case SGL_PRIMITIVETYPE_TRIANGLE_STRIP:
  2480. case SGL_PRIMITIVETYPE_QUADS:
  2481. desc.primitive_type = SG_PRIMITIVETYPE_TRIANGLE_STRIP;
  2482. break;
  2483. }
  2484. if (SGL_PRIMITIVETYPE_QUADS == i) {
  2485. /* quads are emulated via triangles, use the same pipeline object */
  2486. pip->pip[i] = pip->pip[SGL_PRIMITIVETYPE_TRIANGLES];
  2487. }
  2488. else {
  2489. pip->pip[i] = sg_make_pipeline(&desc);
  2490. if (pip->pip[i].id == SG_INVALID_ID) {
  2491. _SGL_ERROR(MAKE_PIPELINE_FAILED);
  2492. pip->slot.state = SG_RESOURCESTATE_FAILED;
  2493. }
  2494. }
  2495. }
  2496. }
  2497. static sgl_pipeline _sgl_make_pipeline(const sg_pipeline_desc* desc, const sgl_context_desc_t* ctx_desc) {
  2498. SOKOL_ASSERT(desc && ctx_desc);
  2499. sgl_pipeline pip_id = _sgl_alloc_pipeline();
  2500. if (pip_id.id != SG_INVALID_ID) {
  2501. _sgl_init_pipeline(pip_id, desc, ctx_desc);
  2502. }
  2503. else {
  2504. _SGL_ERROR(PIPELINE_POOL_EXHAUSTED);
  2505. }
  2506. return pip_id;
  2507. }
  2508. static void _sgl_destroy_pipeline(sgl_pipeline pip_id) {
  2509. _sgl_pipeline_t* pip = _sgl_lookup_pipeline(pip_id.id);
  2510. if (pip) {
  2511. sg_push_debug_group("sokol-gl");
  2512. for (int i = 0; i < SGL_NUM_PRIMITIVE_TYPES; i++) {
  2513. if (i != SGL_PRIMITIVETYPE_QUADS) {
  2514. sg_destroy_pipeline(pip->pip[i]);
  2515. }
  2516. }
  2517. sg_pop_debug_group();
  2518. _sgl_reset_pipeline(pip);
  2519. _sgl_pool_free_index(&_sgl.pip_pool.pool, _sgl_slot_index(pip_id.id));
  2520. }
  2521. }
  2522. static sg_pipeline _sgl_get_pipeline(sgl_pipeline pip_id, _sgl_primitive_type_t prim_type) {
  2523. _sgl_pipeline_t* pip = _sgl_lookup_pipeline(pip_id.id);
  2524. if (pip) {
  2525. return pip->pip[prim_type];
  2526. }
  2527. else {
  2528. sg_pipeline dummy_id = { SG_INVALID_ID };
  2529. return dummy_id;
  2530. }
  2531. }
  2532. // ██████ ██████ ███ ██ ████████ ███████ ██ ██ ████████ ███████
  2533. // ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██
  2534. // ██ ██ ██ ██ ██ ██ ██ █████ ███ ██ ███████
  2535. // ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
  2536. // ██████ ██████ ██ ████ ██ ███████ ██ ██ ██ ███████
  2537. //
  2538. // >>contexts
  2539. static void _sgl_reset_context(_sgl_context_t* ctx) {
  2540. SOKOL_ASSERT(ctx);
  2541. SOKOL_ASSERT(0 == ctx->vertices.ptr);
  2542. SOKOL_ASSERT(0 == ctx->uniforms.ptr);
  2543. SOKOL_ASSERT(0 == ctx->commands.ptr);
  2544. _sgl_clear(ctx, sizeof(_sgl_context_t));
  2545. }
  2546. static void _sgl_setup_context_pool(int pool_size) {
  2547. /* note: the pools here will have an additional item, since slot 0 is reserved */
  2548. SOKOL_ASSERT((pool_size > 0) && (pool_size < _SGL_MAX_POOL_SIZE));
  2549. _sgl_init_pool(&_sgl.context_pool.pool, pool_size);
  2550. size_t pool_byte_size = sizeof(_sgl_context_t) * (size_t)_sgl.context_pool.pool.size;
  2551. _sgl.context_pool.contexts = (_sgl_context_t*) _sgl_malloc_clear(pool_byte_size);
  2552. }
  2553. static void _sgl_discard_context_pool(void) {
  2554. SOKOL_ASSERT(0 != _sgl.context_pool.contexts);
  2555. _sgl_free(_sgl.context_pool.contexts); _sgl.context_pool.contexts = 0;
  2556. _sgl_discard_pool(&_sgl.context_pool.pool);
  2557. }
  2558. // get context pointer without id-check
  2559. static _sgl_context_t* _sgl_context_at(uint32_t ctx_id) {
  2560. SOKOL_ASSERT(SG_INVALID_ID != ctx_id);
  2561. int slot_index = _sgl_slot_index(ctx_id);
  2562. SOKOL_ASSERT((slot_index > _SGL_INVALID_SLOT_INDEX) && (slot_index < _sgl.context_pool.pool.size));
  2563. return &_sgl.context_pool.contexts[slot_index];
  2564. }
  2565. // get context pointer with id-check, returns 0 if no match
  2566. static _sgl_context_t* _sgl_lookup_context(uint32_t ctx_id) {
  2567. if (SG_INVALID_ID != ctx_id) {
  2568. _sgl_context_t* ctx = _sgl_context_at(ctx_id);
  2569. if (ctx->slot.id == ctx_id) {
  2570. return ctx;
  2571. }
  2572. }
  2573. return 0;
  2574. }
  2575. // make context id from uint32_t id
  2576. static sgl_context _sgl_make_ctx_id(uint32_t ctx_id) {
  2577. sgl_context ctx = { ctx_id };
  2578. return ctx;
  2579. }
  2580. static sgl_context _sgl_alloc_context(void) {
  2581. sgl_context res;
  2582. int slot_index = _sgl_pool_alloc_index(&_sgl.context_pool.pool);
  2583. if (_SGL_INVALID_SLOT_INDEX != slot_index) {
  2584. res = _sgl_make_ctx_id(_sgl_slot_alloc(&_sgl.context_pool.pool, &_sgl.context_pool.contexts[slot_index].slot, slot_index));
  2585. }
  2586. else {
  2587. // pool is exhausted
  2588. res = _sgl_make_ctx_id(SG_INVALID_ID);
  2589. }
  2590. return res;
  2591. }
  2592. // return sgl_context_desc_t with patched defaults
  2593. static sgl_context_desc_t _sgl_context_desc_defaults(const sgl_context_desc_t* desc) {
  2594. sgl_context_desc_t res = *desc;
  2595. res.max_vertices = _sgl_def(desc->max_vertices, _SGL_DEFAULT_MAX_VERTICES);
  2596. res.max_commands = _sgl_def(desc->max_commands, _SGL_DEFAULT_MAX_COMMANDS);
  2597. return res;
  2598. }
  2599. static void _sgl_identity(_sgl_matrix_t*);
  2600. static sg_commit_listener _sgl_make_commit_listener(_sgl_context_t* ctx);
  2601. static void _sgl_init_context(sgl_context ctx_id, const sgl_context_desc_t* in_desc) {
  2602. SOKOL_ASSERT((ctx_id.id != SG_INVALID_ID) && in_desc);
  2603. _sgl_context_t* ctx = _sgl_lookup_context(ctx_id.id);
  2604. SOKOL_ASSERT(ctx);
  2605. ctx->desc = _sgl_context_desc_defaults(in_desc);
  2606. // NOTE: frame_id must be non-zero, so that updates trigger in first frame
  2607. ctx->frame_id = 1;
  2608. ctx->cur_img = _sgl.def_img;
  2609. // allocate buffers and pools
  2610. ctx->vertices.cap = ctx->desc.max_vertices;
  2611. ctx->commands.cap = ctx->uniforms.cap = ctx->desc.max_commands;
  2612. ctx->vertices.ptr = (_sgl_vertex_t*) _sgl_malloc((size_t)ctx->vertices.cap * sizeof(_sgl_vertex_t));
  2613. ctx->uniforms.ptr = (_sgl_uniform_t*) _sgl_malloc((size_t)ctx->uniforms.cap * sizeof(_sgl_uniform_t));
  2614. ctx->commands.ptr = (_sgl_command_t*) _sgl_malloc((size_t)ctx->commands.cap * sizeof(_sgl_command_t));
  2615. // create sokol-gfx resource objects
  2616. sg_push_debug_group("sokol-gl");
  2617. sg_buffer_desc vbuf_desc;
  2618. _sgl_clear(&vbuf_desc, sizeof(vbuf_desc));
  2619. vbuf_desc.size = (size_t)ctx->vertices.cap * sizeof(_sgl_vertex_t);
  2620. vbuf_desc.type = SG_BUFFERTYPE_VERTEXBUFFER;
  2621. vbuf_desc.usage = SG_USAGE_STREAM;
  2622. vbuf_desc.label = "sgl-vertex-buffer";
  2623. ctx->vbuf = sg_make_buffer(&vbuf_desc);
  2624. SOKOL_ASSERT(SG_INVALID_ID != ctx->vbuf.id);
  2625. ctx->bind.vertex_buffers[0] = ctx->vbuf;
  2626. sg_pipeline_desc def_pip_desc;
  2627. _sgl_clear(&def_pip_desc, sizeof(def_pip_desc));
  2628. def_pip_desc.depth.write_enabled = true;
  2629. ctx->def_pip = _sgl_make_pipeline(&def_pip_desc, &ctx->desc);
  2630. if (!sg_add_commit_listener(_sgl_make_commit_listener(ctx))) {
  2631. _SGL_ERROR(ADD_COMMIT_LISTENER_FAILED);
  2632. }
  2633. sg_pop_debug_group();
  2634. // default state
  2635. ctx->rgba = 0xFFFFFFFF;
  2636. ctx->point_size = 1.0f;
  2637. for (int i = 0; i < SGL_NUM_MATRIXMODES; i++) {
  2638. _sgl_identity(&ctx->matrix_stack[i][0]);
  2639. }
  2640. ctx->pip_stack[0] = ctx->def_pip;
  2641. ctx->matrix_dirty = true;
  2642. }
  2643. static sgl_context _sgl_make_context(const sgl_context_desc_t* desc) {
  2644. SOKOL_ASSERT(desc);
  2645. sgl_context ctx_id = _sgl_alloc_context();
  2646. if (ctx_id.id != SG_INVALID_ID) {
  2647. _sgl_init_context(ctx_id, desc);
  2648. }
  2649. else {
  2650. _SGL_ERROR(CONTEXT_POOL_EXHAUSTED);
  2651. }
  2652. return ctx_id;
  2653. }
  2654. static void _sgl_destroy_context(sgl_context ctx_id) {
  2655. _sgl_context_t* ctx = _sgl_lookup_context(ctx_id.id);
  2656. if (ctx) {
  2657. SOKOL_ASSERT(ctx->vertices.ptr);
  2658. SOKOL_ASSERT(ctx->uniforms.ptr);
  2659. SOKOL_ASSERT(ctx->commands.ptr);
  2660. _sgl_free(ctx->vertices.ptr);
  2661. _sgl_free(ctx->uniforms.ptr);
  2662. _sgl_free(ctx->commands.ptr);
  2663. ctx->vertices.ptr = 0;
  2664. ctx->uniforms.ptr = 0;
  2665. ctx->commands.ptr = 0;
  2666. sg_push_debug_group("sokol-gl");
  2667. sg_destroy_buffer(ctx->vbuf);
  2668. _sgl_destroy_pipeline(ctx->def_pip);
  2669. sg_remove_commit_listener(_sgl_make_commit_listener(ctx));
  2670. sg_pop_debug_group();
  2671. _sgl_reset_context(ctx);
  2672. _sgl_pool_free_index(&_sgl.context_pool.pool, _sgl_slot_index(ctx_id.id));
  2673. }
  2674. }
  2675. // ███ ███ ██ ███████ ██████
  2676. // ████ ████ ██ ██ ██
  2677. // ██ ████ ██ ██ ███████ ██
  2678. // ██ ██ ██ ██ ██ ██
  2679. // ██ ██ ██ ███████ ██████
  2680. //
  2681. // >>misc
  2682. static void _sgl_begin(_sgl_context_t* ctx, _sgl_primitive_type_t mode) {
  2683. ctx->in_begin = true;
  2684. ctx->base_vertex = ctx->vertices.next;
  2685. ctx->vtx_count = 0;
  2686. ctx->cur_prim_type = mode;
  2687. }
  2688. static void _sgl_rewind(_sgl_context_t* ctx) {
  2689. ctx->frame_id++;
  2690. ctx->vertices.next = 0;
  2691. ctx->uniforms.next = 0;
  2692. ctx->commands.next = 0;
  2693. ctx->base_vertex = 0;
  2694. ctx->error = SGL_NO_ERROR;
  2695. ctx->layer_id = 0;
  2696. ctx->matrix_dirty = true;
  2697. }
  2698. // called from inside sokol-gfx sg_commit()
  2699. static void _sgl_commit_listener(void* userdata) {
  2700. _sgl_context_t* ctx = _sgl_lookup_context((uint32_t)(uintptr_t)userdata);
  2701. if (ctx) {
  2702. _sgl_rewind(ctx);
  2703. }
  2704. }
  2705. static sg_commit_listener _sgl_make_commit_listener(_sgl_context_t* ctx) {
  2706. sg_commit_listener listener = { _sgl_commit_listener, (void*)(uintptr_t)(ctx->slot.id) };
  2707. return listener;
  2708. }
  2709. static _sgl_vertex_t* _sgl_next_vertex(_sgl_context_t* ctx) {
  2710. if (ctx->vertices.next < ctx->vertices.cap) {
  2711. return &ctx->vertices.ptr[ctx->vertices.next++];
  2712. }
  2713. else {
  2714. ctx->error = SGL_ERROR_VERTICES_FULL;
  2715. return 0;
  2716. }
  2717. }
  2718. static _sgl_uniform_t* _sgl_next_uniform(_sgl_context_t* ctx) {
  2719. if (ctx->uniforms.next < ctx->uniforms.cap) {
  2720. return &ctx->uniforms.ptr[ctx->uniforms.next++];
  2721. }
  2722. else {
  2723. ctx->error = SGL_ERROR_UNIFORMS_FULL;
  2724. return 0;
  2725. }
  2726. }
  2727. static _sgl_command_t* _sgl_cur_command(_sgl_context_t* ctx) {
  2728. if (ctx->commands.next > 0) {
  2729. return &ctx->commands.ptr[ctx->commands.next - 1];
  2730. }
  2731. else {
  2732. return 0;
  2733. }
  2734. }
  2735. static _sgl_command_t* _sgl_next_command(_sgl_context_t* ctx) {
  2736. if (ctx->commands.next < ctx->commands.cap) {
  2737. return &ctx->commands.ptr[ctx->commands.next++];
  2738. }
  2739. else {
  2740. ctx->error = SGL_ERROR_COMMANDS_FULL;
  2741. return 0;
  2742. }
  2743. }
  2744. static uint32_t _sgl_pack_rgbab(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
  2745. return (uint32_t)(((uint32_t)a<<24)|((uint32_t)b<<16)|((uint32_t)g<<8)|r);
  2746. }
  2747. static float _sgl_clamp(float v, float lo, float hi) {
  2748. if (v < lo) return lo;
  2749. else if (v > hi) return hi;
  2750. else return v;
  2751. }
  2752. static uint32_t _sgl_pack_rgbaf(float r, float g, float b, float a) {
  2753. uint8_t r_u8 = (uint8_t) (_sgl_clamp(r, 0.0f, 1.0f) * 255.0f);
  2754. uint8_t g_u8 = (uint8_t) (_sgl_clamp(g, 0.0f, 1.0f) * 255.0f);
  2755. uint8_t b_u8 = (uint8_t) (_sgl_clamp(b, 0.0f, 1.0f) * 255.0f);
  2756. uint8_t a_u8 = (uint8_t) (_sgl_clamp(a, 0.0f, 1.0f) * 255.0f);
  2757. return _sgl_pack_rgbab(r_u8, g_u8, b_u8, a_u8);
  2758. }
  2759. static void _sgl_vtx(_sgl_context_t* ctx, float x, float y, float z, float u, float v, uint32_t rgba) {
  2760. SOKOL_ASSERT(ctx->in_begin);
  2761. _sgl_vertex_t* vtx;
  2762. /* handle non-native primitive types */
  2763. if ((ctx->cur_prim_type == SGL_PRIMITIVETYPE_QUADS) && ((ctx->vtx_count & 3) == 3)) {
  2764. /* for quads, before writing the last quad vertex, reuse
  2765. the first and third vertex to start the second triangle in the quad
  2766. */
  2767. vtx = _sgl_next_vertex(ctx);
  2768. if (vtx) { *vtx = *(vtx - 3); }
  2769. vtx = _sgl_next_vertex(ctx);
  2770. if (vtx) { *vtx = *(vtx - 2); }
  2771. }
  2772. vtx = _sgl_next_vertex(ctx);
  2773. if (vtx) {
  2774. vtx->pos[0] = x; vtx->pos[1] = y; vtx->pos[2] = z;
  2775. vtx->uv[0] = u; vtx->uv[1] = v;
  2776. vtx->rgba = rgba;
  2777. vtx->psize = ctx->point_size;
  2778. }
  2779. ctx->vtx_count++;
  2780. }
  2781. static void _sgl_identity(_sgl_matrix_t* m) {
  2782. for (int c = 0; c < 4; c++) {
  2783. for (int r = 0; r < 4; r++) {
  2784. m->v[c][r] = (r == c) ? 1.0f : 0.0f;
  2785. }
  2786. }
  2787. }
  2788. static void _sgl_transpose(_sgl_matrix_t* dst, const _sgl_matrix_t* m) {
  2789. SOKOL_ASSERT(dst != m);
  2790. for (int c = 0; c < 4; c++) {
  2791. for (int r = 0; r < 4; r++) {
  2792. dst->v[r][c] = m->v[c][r];
  2793. }
  2794. }
  2795. }
  2796. /* _sgl_rotate, _sgl_frustum, _sgl_ortho from MESA m_matric.c */
  2797. static void _sgl_matmul4(_sgl_matrix_t* p, const _sgl_matrix_t* a, const _sgl_matrix_t* b) {
  2798. for (int r = 0; r < 4; r++) {
  2799. float ai0=a->v[0][r], ai1=a->v[1][r], ai2=a->v[2][r], ai3=a->v[3][r];
  2800. p->v[0][r] = ai0*b->v[0][0] + ai1*b->v[0][1] + ai2*b->v[0][2] + ai3*b->v[0][3];
  2801. p->v[1][r] = ai0*b->v[1][0] + ai1*b->v[1][1] + ai2*b->v[1][2] + ai3*b->v[1][3];
  2802. p->v[2][r] = ai0*b->v[2][0] + ai1*b->v[2][1] + ai2*b->v[2][2] + ai3*b->v[2][3];
  2803. p->v[3][r] = ai0*b->v[3][0] + ai1*b->v[3][1] + ai2*b->v[3][2] + ai3*b->v[3][3];
  2804. }
  2805. }
  2806. static void _sgl_mul(_sgl_matrix_t* dst, const _sgl_matrix_t* m) {
  2807. _sgl_matmul4(dst, dst, m);
  2808. }
  2809. static void _sgl_rotate(_sgl_matrix_t* dst, float a, float x, float y, float z) {
  2810. float s = sinf(a);
  2811. float c = cosf(a);
  2812. float mag = sqrtf(x*x + y*y + z*z);
  2813. if (mag < 1.0e-4F) {
  2814. return;
  2815. }
  2816. x /= mag;
  2817. y /= mag;
  2818. z /= mag;
  2819. float xx = x * x;
  2820. float yy = y * y;
  2821. float zz = z * z;
  2822. float xy = x * y;
  2823. float yz = y * z;
  2824. float zx = z * x;
  2825. float xs = x * s;
  2826. float ys = y * s;
  2827. float zs = z * s;
  2828. float one_c = 1.0f - c;
  2829. _sgl_matrix_t m;
  2830. m.v[0][0] = (one_c * xx) + c;
  2831. m.v[1][0] = (one_c * xy) - zs;
  2832. m.v[2][0] = (one_c * zx) + ys;
  2833. m.v[3][0] = 0.0f;
  2834. m.v[0][1] = (one_c * xy) + zs;
  2835. m.v[1][1] = (one_c * yy) + c;
  2836. m.v[2][1] = (one_c * yz) - xs;
  2837. m.v[3][1] = 0.0f;
  2838. m.v[0][2] = (one_c * zx) - ys;
  2839. m.v[1][2] = (one_c * yz) + xs;
  2840. m.v[2][2] = (one_c * zz) + c;
  2841. m.v[3][2] = 0.0f;
  2842. m.v[0][3] = 0.0f;
  2843. m.v[1][3] = 0.0f;
  2844. m.v[2][3] = 0.0f;
  2845. m.v[3][3] = 1.0f;
  2846. _sgl_mul(dst, &m);
  2847. }
  2848. static void _sgl_scale(_sgl_matrix_t* dst, float x, float y, float z) {
  2849. for (int r = 0; r < 4; r++) {
  2850. dst->v[0][r] *= x;
  2851. dst->v[1][r] *= y;
  2852. dst->v[2][r] *= z;
  2853. }
  2854. }
  2855. static void _sgl_translate(_sgl_matrix_t* dst, float x, float y, float z) {
  2856. for (int r = 0; r < 4; r++) {
  2857. dst->v[3][r] = dst->v[0][r]*x + dst->v[1][r]*y + dst->v[2][r]*z + dst->v[3][r];
  2858. }
  2859. }
  2860. static void _sgl_frustum(_sgl_matrix_t* dst, float left, float right, float bottom, float top, float znear, float zfar) {
  2861. float x = (2.0f * znear) / (right - left);
  2862. float y = (2.0f * znear) / (top - bottom);
  2863. float a = (right + left) / (right - left);
  2864. float b = (top + bottom) / (top - bottom);
  2865. float c = -(zfar + znear) / (zfar - znear);
  2866. float d = -(2.0f * zfar * znear) / (zfar - znear);
  2867. _sgl_matrix_t m;
  2868. m.v[0][0] = x; m.v[0][1] = 0.0f; m.v[0][2] = 0.0f; m.v[0][3] = 0.0f;
  2869. m.v[1][0] = 0.0f; m.v[1][1] = y; m.v[1][2] = 0.0f; m.v[1][3] = 0.0f;
  2870. m.v[2][0] = a; m.v[2][1] = b; m.v[2][2] = c; m.v[2][3] = -1.0f;
  2871. m.v[3][0] = 0.0f; m.v[3][1] = 0.0f; m.v[3][2] = d; m.v[3][3] = 0.0f;
  2872. _sgl_mul(dst, &m);
  2873. }
  2874. static void _sgl_ortho(_sgl_matrix_t* dst, float left, float right, float bottom, float top, float znear, float zfar) {
  2875. _sgl_matrix_t m;
  2876. m.v[0][0] = 2.0f / (right - left);
  2877. m.v[1][0] = 0.0f;
  2878. m.v[2][0] = 0.0f;
  2879. m.v[3][0] = -(right + left) / (right - left);
  2880. m.v[0][1] = 0.0f;
  2881. m.v[1][1] = 2.0f / (top - bottom);
  2882. m.v[2][1] = 0.0f;
  2883. m.v[3][1] = -(top + bottom) / (top - bottom);
  2884. m.v[0][2] = 0.0f;
  2885. m.v[1][2] = 0.0f;
  2886. m.v[2][2] = -2.0f / (zfar - znear);
  2887. m.v[3][2] = -(zfar + znear) / (zfar - znear);
  2888. m.v[0][3] = 0.0f;
  2889. m.v[1][3] = 0.0f;
  2890. m.v[2][3] = 0.0f;
  2891. m.v[3][3] = 1.0f;
  2892. _sgl_mul(dst, &m);
  2893. }
  2894. /* _sgl_perspective, _sgl_lookat from Regal project.c */
  2895. static void _sgl_perspective(_sgl_matrix_t* dst, float fovy, float aspect, float znear, float zfar) {
  2896. float sine = sinf(fovy / 2.0f);
  2897. float delta_z = zfar - znear;
  2898. if ((delta_z == 0.0f) || (sine == 0.0f) || (aspect == 0.0f)) {
  2899. return;
  2900. }
  2901. float cotan = cosf(fovy / 2.0f) / sine;
  2902. _sgl_matrix_t m;
  2903. _sgl_identity(&m);
  2904. m.v[0][0] = cotan / aspect;
  2905. m.v[1][1] = cotan;
  2906. m.v[2][2] = -(zfar + znear) / delta_z;
  2907. m.v[2][3] = -1.0f;
  2908. m.v[3][2] = -2.0f * znear * zfar / delta_z;
  2909. m.v[3][3] = 0.0f;
  2910. _sgl_mul(dst, &m);
  2911. }
  2912. static void _sgl_normalize(float v[3]) {
  2913. float r = sqrtf(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
  2914. if (r == 0.0f) {
  2915. return;
  2916. }
  2917. v[0] /= r;
  2918. v[1] /= r;
  2919. v[2] /= r;
  2920. }
  2921. static void _sgl_cross(float v1[3], float v2[3], float res[3]) {
  2922. res[0] = v1[1]*v2[2] - v1[2]*v2[1];
  2923. res[1] = v1[2]*v2[0] - v1[0]*v2[2];
  2924. res[2] = v1[0]*v2[1] - v1[1]*v2[0];
  2925. }
  2926. static void _sgl_lookat(_sgl_matrix_t* dst,
  2927. float eye_x, float eye_y, float eye_z,
  2928. float center_x, float center_y, float center_z,
  2929. float up_x, float up_y, float up_z)
  2930. {
  2931. float fwd[3], side[3], up[3];
  2932. fwd[0] = center_x - eye_x; fwd[1] = center_y - eye_y; fwd[2] = center_z - eye_z;
  2933. up[0] = up_x; up[1] = up_y; up[2] = up_z;
  2934. _sgl_normalize(fwd);
  2935. _sgl_cross(fwd, up, side);
  2936. _sgl_normalize(side);
  2937. _sgl_cross(side, fwd, up);
  2938. _sgl_matrix_t m;
  2939. _sgl_identity(&m);
  2940. m.v[0][0] = side[0];
  2941. m.v[1][0] = side[1];
  2942. m.v[2][0] = side[2];
  2943. m.v[0][1] = up[0];
  2944. m.v[1][1] = up[1];
  2945. m.v[2][1] = up[2];
  2946. m.v[0][2] = -fwd[0];
  2947. m.v[1][2] = -fwd[1];
  2948. m.v[2][2] = -fwd[2];
  2949. _sgl_mul(dst, &m);
  2950. _sgl_translate(dst, -eye_x, -eye_y, -eye_z);
  2951. }
  2952. /* current top-of-stack projection matrix */
  2953. static _sgl_matrix_t* _sgl_matrix_projection(_sgl_context_t* ctx) {
  2954. return &ctx->matrix_stack[SGL_MATRIXMODE_PROJECTION][ctx->matrix_tos[SGL_MATRIXMODE_PROJECTION]];
  2955. }
  2956. /* get top-of-stack modelview matrix */
  2957. static _sgl_matrix_t* _sgl_matrix_modelview(_sgl_context_t* ctx) {
  2958. return &ctx->matrix_stack[SGL_MATRIXMODE_MODELVIEW][ctx->matrix_tos[SGL_MATRIXMODE_MODELVIEW]];
  2959. }
  2960. /* get top-of-stack texture matrix */
  2961. static _sgl_matrix_t* _sgl_matrix_texture(_sgl_context_t* ctx) {
  2962. return &ctx->matrix_stack[SGL_MATRIXMODE_TEXTURE][ctx->matrix_tos[SGL_MATRIXMODE_TEXTURE]];
  2963. }
  2964. /* get pointer to current top-of-stack of current matrix mode */
  2965. static _sgl_matrix_t* _sgl_matrix(_sgl_context_t* ctx) {
  2966. return &ctx->matrix_stack[ctx->cur_matrix_mode][ctx->matrix_tos[ctx->cur_matrix_mode]];
  2967. }
  2968. // return sg_context_desc_t with patched defaults
  2969. static sgl_desc_t _sgl_desc_defaults(const sgl_desc_t* desc) {
  2970. SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free));
  2971. sgl_desc_t res = *desc;
  2972. res.max_vertices = _sgl_def(desc->max_vertices, _SGL_DEFAULT_MAX_VERTICES);
  2973. res.max_commands = _sgl_def(desc->max_commands, _SGL_DEFAULT_MAX_COMMANDS);
  2974. res.context_pool_size = _sgl_def(desc->context_pool_size, _SGL_DEFAULT_CONTEXT_POOL_SIZE);
  2975. res.pipeline_pool_size = _sgl_def(desc->pipeline_pool_size, _SGL_DEFAULT_PIPELINE_POOL_SIZE);
  2976. res.face_winding = _sgl_def(desc->face_winding, SG_FACEWINDING_CCW);
  2977. return res;
  2978. }
  2979. // create resources which are shared between all contexts
  2980. static void _sgl_setup_common(void) {
  2981. sg_push_debug_group("sokol-gl");
  2982. uint32_t pixels[64];
  2983. for (int i = 0; i < 64; i++) {
  2984. pixels[i] = 0xFFFFFFFF;
  2985. }
  2986. sg_image_desc img_desc;
  2987. _sgl_clear(&img_desc, sizeof(img_desc));
  2988. img_desc.type = SG_IMAGETYPE_2D;
  2989. img_desc.width = 8;
  2990. img_desc.height = 8;
  2991. img_desc.num_mipmaps = 1;
  2992. img_desc.pixel_format = SG_PIXELFORMAT_RGBA8;
  2993. img_desc.min_filter = SG_FILTER_NEAREST;
  2994. img_desc.mag_filter = SG_FILTER_NEAREST;
  2995. img_desc.data.subimage[0][0] = SG_RANGE(pixels);
  2996. img_desc.label = "sgl-default-texture";
  2997. _sgl.def_img = sg_make_image(&img_desc);
  2998. SOKOL_ASSERT(SG_INVALID_ID != _sgl.def_img.id);
  2999. // one shader for all contexts
  3000. sg_shader_desc shd_desc;
  3001. _sgl_clear(&shd_desc, sizeof(shd_desc));
  3002. shd_desc.attrs[0].name = "position";
  3003. shd_desc.attrs[1].name = "texcoord0";
  3004. shd_desc.attrs[2].name = "color0";
  3005. shd_desc.attrs[3].name = "psize";
  3006. shd_desc.attrs[0].sem_name = "TEXCOORD";
  3007. shd_desc.attrs[0].sem_index = 0;
  3008. shd_desc.attrs[1].sem_name = "TEXCOORD";
  3009. shd_desc.attrs[1].sem_index = 1;
  3010. shd_desc.attrs[2].sem_name = "TEXCOORD";
  3011. shd_desc.attrs[2].sem_index = 2;
  3012. shd_desc.attrs[3].sem_name = "TEXCOORD";
  3013. shd_desc.attrs[3].sem_index = 3;
  3014. sg_shader_uniform_block_desc* ub = &shd_desc.vs.uniform_blocks[0];
  3015. ub->size = sizeof(_sgl_uniform_t);
  3016. ub->uniforms[0].name = "vs_params";
  3017. ub->uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
  3018. ub->uniforms[0].array_count = 8;
  3019. shd_desc.fs.images[0].name = "tex";
  3020. shd_desc.fs.images[0].image_type = SG_IMAGETYPE_2D;
  3021. shd_desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT;
  3022. shd_desc.label = "sgl-shader";
  3023. #if defined(SOKOL_GLCORE33)
  3024. shd_desc.vs.source = _sgl_vs_source_glsl330;
  3025. shd_desc.fs.source = _sgl_fs_source_glsl330;
  3026. #elif defined(SOKOL_GLES3)
  3027. shd_desc.vs.source = _sgl_vs_source_glsl300es;
  3028. shd_desc.fs.source = _sgl_fs_source_glsl300es;
  3029. #elif defined(SOKOL_METAL)
  3030. shd_desc.vs.entry = "main0";
  3031. shd_desc.fs.entry = "main0";
  3032. switch (sg_query_backend()) {
  3033. case SG_BACKEND_METAL_MACOS:
  3034. shd_desc.vs.bytecode = SG_RANGE(_sgl_vs_bytecode_metal_macos);
  3035. shd_desc.fs.bytecode = SG_RANGE(_sgl_fs_bytecode_metal_macos);
  3036. break;
  3037. case SG_BACKEND_METAL_IOS:
  3038. shd_desc.vs.bytecode = SG_RANGE(_sgl_vs_bytecode_metal_ios);
  3039. shd_desc.fs.bytecode = SG_RANGE(_sgl_fs_bytecode_metal_ios);
  3040. break;
  3041. default:
  3042. shd_desc.vs.source = _sgl_vs_source_metal_sim;
  3043. shd_desc.fs.source = _sgl_fs_source_metal_sim;
  3044. break;
  3045. }
  3046. #elif defined(SOKOL_D3D11)
  3047. shd_desc.vs.bytecode = SG_RANGE(_sgl_vs_bytecode_hlsl4);
  3048. shd_desc.fs.bytecode = SG_RANGE(_sgl_fs_bytecode_hlsl4);
  3049. #elif defined(SOKOL_WGPU)
  3050. shd_desc.vs.bytecode = SG_RANGE(_sgl_vs_bytecode_wgpu);
  3051. shd_desc.fs.bytecode = SG_RANGE(_sgl_fs_bytecode_wgpu);
  3052. #else
  3053. shd_desc.vs.source = _sgl_vs_source_dummy;
  3054. shd_desc.fs.source = _sgl_fs_source_dummy;
  3055. #endif
  3056. _sgl.shd = sg_make_shader(&shd_desc);
  3057. SOKOL_ASSERT(SG_INVALID_ID != _sgl.shd.id);
  3058. sg_pop_debug_group();
  3059. }
  3060. // discard resources which are shared between all contexts
  3061. static void _sgl_discard_common(void) {
  3062. sg_push_debug_group("sokol-gl");
  3063. sg_destroy_image(_sgl.def_img);
  3064. sg_destroy_shader(_sgl.shd);
  3065. sg_pop_debug_group();
  3066. }
  3067. static bool _sgl_is_default_context(sgl_context ctx_id) {
  3068. return ctx_id.id == SGL_DEFAULT_CONTEXT.id;
  3069. }
  3070. static void _sgl_draw(_sgl_context_t* ctx, int layer_id) {
  3071. SOKOL_ASSERT(ctx);
  3072. if ((ctx->error == SGL_NO_ERROR) && (ctx->vertices.next > 0) && (ctx->commands.next > 0)) {
  3073. sg_push_debug_group("sokol-gl");
  3074. uint32_t cur_pip_id = SG_INVALID_ID;
  3075. uint32_t cur_img_id = SG_INVALID_ID;
  3076. int cur_uniform_index = -1;
  3077. if (ctx->update_frame_id != ctx->frame_id) {
  3078. ctx->update_frame_id = ctx->frame_id;
  3079. const sg_range range = { ctx->vertices.ptr, (size_t)ctx->vertices.next * sizeof(_sgl_vertex_t) };
  3080. sg_update_buffer(ctx->vbuf, &range);
  3081. }
  3082. for (int i = 0; i < ctx->commands.next; i++) {
  3083. const _sgl_command_t* cmd = &ctx->commands.ptr[i];
  3084. if (cmd->layer_id != layer_id) {
  3085. continue;
  3086. }
  3087. switch (cmd->cmd) {
  3088. case SGL_COMMAND_VIEWPORT:
  3089. {
  3090. const _sgl_viewport_args_t* args = &cmd->args.viewport;
  3091. sg_apply_viewport(args->x, args->y, args->w, args->h, args->origin_top_left);
  3092. }
  3093. break;
  3094. case SGL_COMMAND_SCISSOR_RECT:
  3095. {
  3096. const _sgl_scissor_rect_args_t* args = &cmd->args.scissor_rect;
  3097. sg_apply_scissor_rect(args->x, args->y, args->w, args->h, args->origin_top_left);
  3098. }
  3099. break;
  3100. case SGL_COMMAND_DRAW:
  3101. {
  3102. const _sgl_draw_args_t* args = &cmd->args.draw;
  3103. if (args->pip.id != cur_pip_id) {
  3104. sg_apply_pipeline(args->pip);
  3105. cur_pip_id = args->pip.id;
  3106. /* when pipeline changes, also need to re-apply uniforms and bindings */
  3107. cur_img_id = SG_INVALID_ID;
  3108. cur_uniform_index = -1;
  3109. }
  3110. if (cur_img_id != args->img.id) {
  3111. ctx->bind.fs_images[0] = args->img;
  3112. sg_apply_bindings(&ctx->bind);
  3113. cur_img_id = args->img.id;
  3114. }
  3115. if (cur_uniform_index != args->uniform_index) {
  3116. const sg_range ub_range = { &ctx->uniforms.ptr[args->uniform_index], sizeof(_sgl_uniform_t) };
  3117. sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, &ub_range);
  3118. cur_uniform_index = args->uniform_index;
  3119. }
  3120. /* FIXME: what if number of vertices doesn't match the primitive type? */
  3121. if (args->num_vertices > 0) {
  3122. sg_draw(args->base_vertex, args->num_vertices, 1);
  3123. }
  3124. }
  3125. break;
  3126. }
  3127. }
  3128. sg_pop_debug_group();
  3129. }
  3130. }
  3131. static sgl_context_desc_t _sgl_as_context_desc(const sgl_desc_t* desc) {
  3132. sgl_context_desc_t ctx_desc;
  3133. _sgl_clear(&ctx_desc, sizeof(ctx_desc));
  3134. ctx_desc.max_vertices = desc->max_vertices;
  3135. ctx_desc.max_commands = desc->max_commands;
  3136. ctx_desc.color_format = desc->color_format;
  3137. ctx_desc.depth_format = desc->depth_format;
  3138. ctx_desc.sample_count = desc->sample_count;
  3139. return ctx_desc;
  3140. }
  3141. // ██████ ██ ██ ██████ ██ ██ ██████
  3142. // ██ ██ ██ ██ ██ ██ ██ ██ ██
  3143. // ██████ ██ ██ ██████ ██ ██ ██
  3144. // ██ ██ ██ ██ ██ ██ ██ ██
  3145. // ██ ██████ ██████ ███████ ██ ██████
  3146. //
  3147. // >>public
  3148. SOKOL_API_IMPL void sgl_setup(const sgl_desc_t* desc) {
  3149. SOKOL_ASSERT(desc);
  3150. _sgl_clear(&_sgl, sizeof(_sgl));
  3151. _sgl.init_cookie = _SGL_INIT_COOKIE;
  3152. _sgl.desc = _sgl_desc_defaults(desc);
  3153. _sgl_setup_pipeline_pool(_sgl.desc.pipeline_pool_size);
  3154. _sgl_setup_context_pool(_sgl.desc.context_pool_size);
  3155. _sgl_setup_common();
  3156. const sgl_context_desc_t ctx_desc = _sgl_as_context_desc(&_sgl.desc);
  3157. _sgl.def_ctx_id = sgl_make_context(&ctx_desc);
  3158. SOKOL_ASSERT(SGL_DEFAULT_CONTEXT.id == _sgl.def_ctx_id.id);
  3159. sgl_set_context(_sgl.def_ctx_id);
  3160. }
  3161. SOKOL_API_IMPL void sgl_shutdown(void) {
  3162. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3163. // contexts own a pipeline, so destroy contexts before pipelines
  3164. for (int i = 0; i < _sgl.context_pool.pool.size; i++) {
  3165. _sgl_context_t* ctx = &_sgl.context_pool.contexts[i];
  3166. _sgl_destroy_context(_sgl_make_ctx_id(ctx->slot.id));
  3167. }
  3168. for (int i = 0; i < _sgl.pip_pool.pool.size; i++) {
  3169. _sgl_pipeline_t* pip = &_sgl.pip_pool.pips[i];
  3170. _sgl_destroy_pipeline(_sgl_make_pip_id(pip->slot.id));
  3171. }
  3172. _sgl_discard_context_pool();
  3173. _sgl_discard_pipeline_pool();
  3174. _sgl_discard_common();
  3175. _sgl.init_cookie = 0;
  3176. }
  3177. SOKOL_API_IMPL sgl_error_t sgl_error(void) {
  3178. _sgl_context_t* ctx = _sgl.cur_ctx;
  3179. if (ctx) {
  3180. return ctx->error;
  3181. }
  3182. else {
  3183. return SGL_ERROR_NO_CONTEXT;
  3184. }
  3185. }
  3186. SOKOL_API_IMPL sgl_error_t sgl_context_error(sgl_context ctx_id) {
  3187. const _sgl_context_t* ctx = _sgl_lookup_context(ctx_id.id);
  3188. if (ctx) {
  3189. return ctx->error;
  3190. }
  3191. else {
  3192. return SGL_ERROR_NO_CONTEXT;
  3193. }
  3194. }
  3195. SOKOL_API_IMPL float sgl_rad(float deg) {
  3196. return (deg * (float)M_PI) / 180.0f;
  3197. }
  3198. SOKOL_API_IMPL float sgl_deg(float rad) {
  3199. return (rad * 180.0f) / (float)M_PI;
  3200. }
  3201. SOKOL_API_IMPL sgl_context sgl_make_context(const sgl_context_desc_t* desc) {
  3202. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3203. return _sgl_make_context(desc);
  3204. }
  3205. SOKOL_API_IMPL void sgl_destroy_context(sgl_context ctx_id) {
  3206. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3207. if (_sgl_is_default_context(ctx_id)) {
  3208. _SGL_WARN(CANNOT_DESTROY_DEFAULT_CONTEXT);
  3209. return;
  3210. }
  3211. _sgl_destroy_context(ctx_id);
  3212. // re-validate the current context pointer (this will return a nullptr
  3213. // if we just destroyed the current context)
  3214. _sgl.cur_ctx = _sgl_lookup_context(_sgl.cur_ctx_id.id);
  3215. }
  3216. SOKOL_API_IMPL void sgl_set_context(sgl_context ctx_id) {
  3217. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3218. if (_sgl_is_default_context(ctx_id)) {
  3219. _sgl.cur_ctx_id = _sgl.def_ctx_id;
  3220. }
  3221. else {
  3222. _sgl.cur_ctx_id = ctx_id;
  3223. }
  3224. // this will return null if the handle isn't valid
  3225. _sgl.cur_ctx = _sgl_lookup_context(_sgl.cur_ctx_id.id);
  3226. }
  3227. SOKOL_API_IMPL sgl_context sgl_get_context(void) {
  3228. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3229. return _sgl.cur_ctx_id;
  3230. }
  3231. SOKOL_API_IMPL sgl_context sgl_default_context(void) {
  3232. return SGL_DEFAULT_CONTEXT;
  3233. }
  3234. SOKOL_API_IMPL sgl_pipeline sgl_make_pipeline(const sg_pipeline_desc* desc) {
  3235. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3236. _sgl_context_t* ctx = _sgl.cur_ctx;
  3237. if (ctx) {
  3238. return _sgl_make_pipeline(desc, &ctx->desc);
  3239. }
  3240. else {
  3241. return _sgl_make_pip_id(SG_INVALID_ID);
  3242. }
  3243. }
  3244. SOKOL_API_IMPL sgl_pipeline sgl_context_make_pipeline(sgl_context ctx_id, const sg_pipeline_desc* desc) {
  3245. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3246. const _sgl_context_t* ctx = _sgl_lookup_context(ctx_id.id);
  3247. if (ctx) {
  3248. return _sgl_make_pipeline(desc, &ctx->desc);
  3249. }
  3250. else {
  3251. return _sgl_make_pip_id(SG_INVALID_ID);
  3252. }
  3253. }
  3254. SOKOL_API_IMPL void sgl_destroy_pipeline(sgl_pipeline pip_id) {
  3255. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3256. _sgl_destroy_pipeline(pip_id);
  3257. }
  3258. SOKOL_API_IMPL void sgl_load_pipeline(sgl_pipeline pip_id) {
  3259. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3260. _sgl_context_t* ctx = _sgl.cur_ctx;
  3261. if (!ctx) {
  3262. return;
  3263. }
  3264. SOKOL_ASSERT((ctx->pip_tos >= 0) && (ctx->pip_tos < _SGL_MAX_STACK_DEPTH));
  3265. ctx->pip_stack[ctx->pip_tos] = pip_id;
  3266. }
  3267. SOKOL_API_IMPL void sgl_load_default_pipeline(void) {
  3268. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3269. _sgl_context_t* ctx = _sgl.cur_ctx;
  3270. if (!ctx) {
  3271. return;
  3272. }
  3273. SOKOL_ASSERT((ctx->pip_tos >= 0) && (ctx->pip_tos < _SGL_MAX_STACK_DEPTH));
  3274. ctx->pip_stack[ctx->pip_tos] = ctx->def_pip;
  3275. }
  3276. SOKOL_API_IMPL void sgl_push_pipeline(void) {
  3277. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3278. _sgl_context_t* ctx = _sgl.cur_ctx;
  3279. if (!ctx) {
  3280. return;
  3281. }
  3282. if (ctx->pip_tos < (_SGL_MAX_STACK_DEPTH - 1)) {
  3283. ctx->pip_tos++;
  3284. ctx->pip_stack[ctx->pip_tos] = ctx->pip_stack[ctx->pip_tos-1];
  3285. }
  3286. else {
  3287. ctx->error = SGL_ERROR_STACK_OVERFLOW;
  3288. }
  3289. }
  3290. SOKOL_API_IMPL void sgl_pop_pipeline(void) {
  3291. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3292. _sgl_context_t* ctx = _sgl.cur_ctx;
  3293. if (!ctx) {
  3294. return;
  3295. }
  3296. if (ctx->pip_tos > 0) {
  3297. ctx->pip_tos--;
  3298. }
  3299. else {
  3300. ctx->error = SGL_ERROR_STACK_UNDERFLOW;
  3301. }
  3302. }
  3303. SOKOL_API_IMPL void sgl_defaults(void) {
  3304. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3305. _sgl_context_t* ctx = _sgl.cur_ctx;
  3306. if (!ctx) {
  3307. return;
  3308. }
  3309. SOKOL_ASSERT(!ctx->in_begin);
  3310. ctx->u = 0.0f; ctx->v = 0.0f;
  3311. ctx->rgba = 0xFFFFFFFF;
  3312. ctx->point_size = 1.0f;
  3313. ctx->texturing_enabled = false;
  3314. ctx->cur_img = _sgl.def_img;
  3315. sgl_load_default_pipeline();
  3316. _sgl_identity(_sgl_matrix_texture(ctx));
  3317. _sgl_identity(_sgl_matrix_modelview(ctx));
  3318. _sgl_identity(_sgl_matrix_projection(ctx));
  3319. ctx->cur_matrix_mode = SGL_MATRIXMODE_MODELVIEW;
  3320. ctx->matrix_dirty = true;
  3321. }
  3322. SOKOL_API_IMPL void sgl_layer(int layer_id) {
  3323. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3324. _sgl_context_t* ctx = _sgl.cur_ctx;
  3325. if (!ctx) {
  3326. return;
  3327. }
  3328. SOKOL_ASSERT(!ctx->in_begin);
  3329. ctx->layer_id = layer_id;
  3330. }
  3331. SOKOL_API_IMPL void sgl_viewport(int x, int y, int w, int h, bool origin_top_left) {
  3332. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3333. _sgl_context_t* ctx = _sgl.cur_ctx;
  3334. if (!ctx) {
  3335. return;
  3336. }
  3337. SOKOL_ASSERT(!ctx->in_begin);
  3338. _sgl_command_t* cmd = _sgl_next_command(ctx);
  3339. if (cmd) {
  3340. cmd->cmd = SGL_COMMAND_VIEWPORT;
  3341. cmd->layer_id = ctx->layer_id;
  3342. cmd->args.viewport.x = x;
  3343. cmd->args.viewport.y = y;
  3344. cmd->args.viewport.w = w;
  3345. cmd->args.viewport.h = h;
  3346. cmd->args.viewport.origin_top_left = origin_top_left;
  3347. }
  3348. }
  3349. SOKOL_API_IMPL void sgl_viewportf(float x, float y, float w, float h, bool origin_top_left) {
  3350. sgl_viewport((int)x, (int)y, (int)w, (int)h, origin_top_left);
  3351. }
  3352. SOKOL_API_IMPL void sgl_scissor_rect(int x, int y, int w, int h, bool origin_top_left) {
  3353. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3354. _sgl_context_t* ctx = _sgl.cur_ctx;
  3355. if (!ctx) {
  3356. return;
  3357. }
  3358. SOKOL_ASSERT(!ctx->in_begin);
  3359. _sgl_command_t* cmd = _sgl_next_command(ctx);
  3360. if (cmd) {
  3361. cmd->cmd = SGL_COMMAND_SCISSOR_RECT;
  3362. cmd->layer_id = ctx->layer_id;
  3363. cmd->args.scissor_rect.x = x;
  3364. cmd->args.scissor_rect.y = y;
  3365. cmd->args.scissor_rect.w = w;
  3366. cmd->args.scissor_rect.h = h;
  3367. cmd->args.scissor_rect.origin_top_left = origin_top_left;
  3368. }
  3369. }
  3370. SOKOL_API_IMPL void sgl_scissor_rectf(float x, float y, float w, float h, bool origin_top_left) {
  3371. sgl_scissor_rect((int)x, (int)y, (int)w, (int)h, origin_top_left);
  3372. }
  3373. SOKOL_API_IMPL void sgl_enable_texture(void) {
  3374. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3375. _sgl_context_t* ctx = _sgl.cur_ctx;
  3376. if (!ctx) {
  3377. return;
  3378. }
  3379. SOKOL_ASSERT(!ctx->in_begin);
  3380. ctx->texturing_enabled = true;
  3381. }
  3382. SOKOL_API_IMPL void sgl_disable_texture(void) {
  3383. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3384. _sgl_context_t* ctx = _sgl.cur_ctx;
  3385. if (!ctx) {
  3386. return;
  3387. }
  3388. SOKOL_ASSERT(!ctx->in_begin);
  3389. ctx->texturing_enabled = false;
  3390. }
  3391. SOKOL_API_IMPL void sgl_texture(sg_image img) {
  3392. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3393. _sgl_context_t* ctx = _sgl.cur_ctx;
  3394. if (!ctx) {
  3395. return;
  3396. }
  3397. SOKOL_ASSERT(!ctx->in_begin);
  3398. if (SG_INVALID_ID != img.id) {
  3399. ctx->cur_img = img;
  3400. }
  3401. else {
  3402. ctx->cur_img = _sgl.def_img;
  3403. }
  3404. }
  3405. SOKOL_API_IMPL void sgl_begin_points(void) {
  3406. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3407. _sgl_context_t* ctx = _sgl.cur_ctx;
  3408. if (!ctx) {
  3409. return;
  3410. }
  3411. SOKOL_ASSERT(!ctx->in_begin);
  3412. _sgl_begin(ctx, SGL_PRIMITIVETYPE_POINTS);
  3413. }
  3414. SOKOL_API_IMPL void sgl_begin_lines(void) {
  3415. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3416. _sgl_context_t* ctx = _sgl.cur_ctx;
  3417. if (!ctx) {
  3418. return;
  3419. }
  3420. SOKOL_ASSERT(!ctx->in_begin);
  3421. _sgl_begin(ctx, SGL_PRIMITIVETYPE_LINES);
  3422. }
  3423. SOKOL_API_IMPL void sgl_begin_line_strip(void) {
  3424. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3425. _sgl_context_t* ctx = _sgl.cur_ctx;
  3426. if (!ctx) {
  3427. return;
  3428. }
  3429. SOKOL_ASSERT(!ctx->in_begin);
  3430. _sgl_begin(ctx, SGL_PRIMITIVETYPE_LINE_STRIP);
  3431. }
  3432. SOKOL_API_IMPL void sgl_begin_triangles(void) {
  3433. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3434. _sgl_context_t* ctx = _sgl.cur_ctx;
  3435. if (!ctx) {
  3436. return;
  3437. }
  3438. SOKOL_ASSERT(!ctx->in_begin);
  3439. _sgl_begin(ctx, SGL_PRIMITIVETYPE_TRIANGLES);
  3440. }
  3441. SOKOL_API_IMPL void sgl_begin_triangle_strip(void) {
  3442. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3443. _sgl_context_t* ctx = _sgl.cur_ctx;
  3444. if (!ctx) {
  3445. return;
  3446. }
  3447. SOKOL_ASSERT(!ctx->in_begin);
  3448. _sgl_begin(ctx, SGL_PRIMITIVETYPE_TRIANGLE_STRIP);
  3449. }
  3450. SOKOL_API_IMPL void sgl_begin_quads(void) {
  3451. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3452. _sgl_context_t* ctx = _sgl.cur_ctx;
  3453. if (!ctx) {
  3454. return;
  3455. }
  3456. SOKOL_ASSERT(!ctx->in_begin);
  3457. _sgl_begin(ctx, SGL_PRIMITIVETYPE_QUADS);
  3458. }
  3459. SOKOL_API_IMPL void sgl_end(void) {
  3460. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3461. _sgl_context_t* ctx = _sgl.cur_ctx;
  3462. if (!ctx) {
  3463. return;
  3464. }
  3465. SOKOL_ASSERT(ctx->in_begin);
  3466. SOKOL_ASSERT(ctx->vertices.next >= ctx->base_vertex);
  3467. ctx->in_begin = false;
  3468. bool matrix_dirty = ctx->matrix_dirty;
  3469. if (matrix_dirty) {
  3470. ctx->matrix_dirty = false;
  3471. _sgl_uniform_t* uni = _sgl_next_uniform(ctx);
  3472. if (uni) {
  3473. _sgl_matmul4(&uni->mvp, _sgl_matrix_projection(ctx), _sgl_matrix_modelview(ctx));
  3474. uni->tm = *_sgl_matrix_texture(ctx);
  3475. }
  3476. }
  3477. /* check if command can be merged with current command */
  3478. sg_pipeline pip = _sgl_get_pipeline(ctx->pip_stack[ctx->pip_tos], ctx->cur_prim_type);
  3479. sg_image img = ctx->texturing_enabled ? ctx->cur_img : _sgl.def_img;
  3480. _sgl_command_t* cur_cmd = _sgl_cur_command(ctx);
  3481. bool merge_cmd = false;
  3482. if (cur_cmd) {
  3483. if ((cur_cmd->cmd == SGL_COMMAND_DRAW) &&
  3484. (cur_cmd->layer_id == ctx->layer_id) &&
  3485. (ctx->cur_prim_type != SGL_PRIMITIVETYPE_LINE_STRIP) &&
  3486. (ctx->cur_prim_type != SGL_PRIMITIVETYPE_TRIANGLE_STRIP) &&
  3487. !matrix_dirty &&
  3488. (cur_cmd->args.draw.img.id == img.id) &&
  3489. (cur_cmd->args.draw.pip.id == pip.id))
  3490. {
  3491. merge_cmd = true;
  3492. }
  3493. }
  3494. if (merge_cmd) {
  3495. /* draw command can be merged with the previous command */
  3496. cur_cmd->args.draw.num_vertices += ctx->vertices.next - ctx->base_vertex;
  3497. }
  3498. else {
  3499. /* append a new draw command */
  3500. _sgl_command_t* cmd = _sgl_next_command(ctx);
  3501. if (cmd) {
  3502. SOKOL_ASSERT(ctx->uniforms.next > 0);
  3503. cmd->cmd = SGL_COMMAND_DRAW;
  3504. cmd->layer_id = ctx->layer_id;
  3505. cmd->args.draw.img = img;
  3506. cmd->args.draw.pip = _sgl_get_pipeline(ctx->pip_stack[ctx->pip_tos], ctx->cur_prim_type);
  3507. cmd->args.draw.base_vertex = ctx->base_vertex;
  3508. cmd->args.draw.num_vertices = ctx->vertices.next - ctx->base_vertex;
  3509. cmd->args.draw.uniform_index = ctx->uniforms.next - 1;
  3510. }
  3511. }
  3512. }
  3513. SOKOL_API_IMPL void sgl_point_size(float s) {
  3514. _sgl_context_t* ctx = _sgl.cur_ctx;
  3515. if (ctx) {
  3516. ctx->point_size = s;
  3517. }
  3518. }
  3519. SOKOL_API_IMPL void sgl_t2f(float u, float v) {
  3520. _sgl_context_t* ctx = _sgl.cur_ctx;
  3521. if (ctx) {
  3522. ctx->u = u;
  3523. ctx->v = v;
  3524. }
  3525. }
  3526. SOKOL_API_IMPL void sgl_c3f(float r, float g, float b) {
  3527. _sgl_context_t* ctx = _sgl.cur_ctx;
  3528. if (ctx) {
  3529. ctx->rgba = _sgl_pack_rgbaf(r, g, b, 1.0f);
  3530. }
  3531. }
  3532. SOKOL_API_IMPL void sgl_c4f(float r, float g, float b, float a) {
  3533. _sgl_context_t* ctx = _sgl.cur_ctx;
  3534. if (ctx) {
  3535. ctx->rgba = _sgl_pack_rgbaf(r, g, b, a);
  3536. }
  3537. }
  3538. SOKOL_API_IMPL void sgl_c3b(uint8_t r, uint8_t g, uint8_t b) {
  3539. _sgl_context_t* ctx = _sgl.cur_ctx;
  3540. if (ctx) {
  3541. ctx->rgba = _sgl_pack_rgbab(r, g, b, 255);
  3542. }
  3543. }
  3544. SOKOL_API_IMPL void sgl_c4b(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
  3545. _sgl_context_t* ctx = _sgl.cur_ctx;
  3546. if (ctx) {
  3547. ctx->rgba = _sgl_pack_rgbab(r, g, b, a);
  3548. }
  3549. }
  3550. SOKOL_API_IMPL void sgl_c1i(uint32_t rgba) {
  3551. _sgl_context_t* ctx = _sgl.cur_ctx;
  3552. if (ctx) {
  3553. ctx->rgba = rgba;
  3554. }
  3555. }
  3556. SOKOL_API_IMPL void sgl_v2f(float x, float y) {
  3557. _sgl_context_t* ctx = _sgl.cur_ctx;
  3558. if (ctx) {
  3559. _sgl_vtx(ctx, x, y, 0.0f, ctx->u, ctx->v, ctx->rgba);
  3560. }
  3561. }
  3562. SOKOL_API_IMPL void sgl_v3f(float x, float y, float z) {
  3563. _sgl_context_t* ctx = _sgl.cur_ctx;
  3564. if (ctx) {
  3565. _sgl_vtx(ctx, x, y, z, ctx->u, ctx->v, ctx->rgba);
  3566. }
  3567. }
  3568. SOKOL_API_IMPL void sgl_v2f_t2f(float x, float y, float u, float v) {
  3569. _sgl_context_t* ctx = _sgl.cur_ctx;
  3570. if (ctx) {
  3571. _sgl_vtx(ctx, x, y, 0.0f, u, v, ctx->rgba);
  3572. }
  3573. }
  3574. SOKOL_API_IMPL void sgl_v3f_t2f(float x, float y, float z, float u, float v) {
  3575. _sgl_context_t* ctx = _sgl.cur_ctx;
  3576. if (ctx) {
  3577. _sgl_vtx(ctx, x, y, z, u, v, ctx->rgba);
  3578. }
  3579. }
  3580. SOKOL_API_IMPL void sgl_v2f_c3f(float x, float y, float r, float g, float b) {
  3581. _sgl_context_t* ctx = _sgl.cur_ctx;
  3582. if (ctx) {
  3583. _sgl_vtx(ctx, x, y, 0.0f, ctx->u, ctx->v, _sgl_pack_rgbaf(r, g, b, 1.0f));
  3584. }
  3585. }
  3586. SOKOL_API_IMPL void sgl_v2f_c3b(float x, float y, uint8_t r, uint8_t g, uint8_t b) {
  3587. _sgl_context_t* ctx = _sgl.cur_ctx;
  3588. if (ctx) {
  3589. _sgl_vtx(ctx, x, y, 0.0f, ctx->u, ctx->v, _sgl_pack_rgbab(r, g, b, 255));
  3590. }
  3591. }
  3592. SOKOL_API_IMPL void sgl_v2f_c4f(float x, float y, float r, float g, float b, float a) {
  3593. _sgl_context_t* ctx = _sgl.cur_ctx;
  3594. if (ctx) {
  3595. _sgl_vtx(ctx, x, y, 0.0f, ctx->u, ctx->v, _sgl_pack_rgbaf(r, g, b, a));
  3596. }
  3597. }
  3598. SOKOL_API_IMPL void sgl_v2f_c4b(float x, float y, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
  3599. _sgl_context_t* ctx = _sgl.cur_ctx;
  3600. if (ctx) {
  3601. _sgl_vtx(ctx, x, y, 0.0f, ctx->u, ctx->v, _sgl_pack_rgbab(r, g, b, a));
  3602. }
  3603. }
  3604. SOKOL_API_IMPL void sgl_v2f_c1i(float x, float y, uint32_t rgba) {
  3605. _sgl_context_t* ctx = _sgl.cur_ctx;
  3606. if (ctx) {
  3607. _sgl_vtx(ctx, x, y, 0.0f, ctx->u, ctx->v, rgba);
  3608. }
  3609. }
  3610. SOKOL_API_IMPL void sgl_v3f_c3f(float x, float y, float z, float r, float g, float b) {
  3611. _sgl_context_t* ctx = _sgl.cur_ctx;
  3612. if (ctx) {
  3613. _sgl_vtx(ctx, x, y, z, ctx->u, ctx->v, _sgl_pack_rgbaf(r, g, b, 1.0f));
  3614. }
  3615. }
  3616. SOKOL_API_IMPL void sgl_v3f_c3b(float x, float y, float z, uint8_t r, uint8_t g, uint8_t b) {
  3617. _sgl_context_t* ctx = _sgl.cur_ctx;
  3618. if (ctx) {
  3619. _sgl_vtx(ctx, x, y, z, ctx->u, ctx->v, _sgl_pack_rgbab(r, g, b, 255));
  3620. }
  3621. }
  3622. SOKOL_API_IMPL void sgl_v3f_c4f(float x, float y, float z, float r, float g, float b, float a) {
  3623. _sgl_context_t* ctx = _sgl.cur_ctx;
  3624. if (ctx) {
  3625. _sgl_vtx(ctx, x, y, z, ctx->u, ctx->v, _sgl_pack_rgbaf(r, g, b, a));
  3626. }
  3627. }
  3628. SOKOL_API_IMPL void sgl_v3f_c4b(float x, float y, float z, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
  3629. _sgl_context_t* ctx = _sgl.cur_ctx;
  3630. if (ctx) {
  3631. _sgl_vtx(ctx, x, y, z, ctx->u, ctx->v, _sgl_pack_rgbab(r, g, b, a));
  3632. }
  3633. }
  3634. SOKOL_API_IMPL void sgl_v3f_c1i(float x, float y, float z, uint32_t rgba) {
  3635. _sgl_context_t* ctx = _sgl.cur_ctx;
  3636. if (ctx) {
  3637. _sgl_vtx(ctx, x, y, z, ctx->u, ctx->v, rgba);
  3638. }
  3639. }
  3640. SOKOL_API_IMPL void sgl_v2f_t2f_c3f(float x, float y, float u, float v, float r, float g, float b) {
  3641. _sgl_context_t* ctx = _sgl.cur_ctx;
  3642. if (ctx) {
  3643. _sgl_vtx(ctx, x, y, 0.0f, u, v, _sgl_pack_rgbaf(r, g, b, 1.0f));
  3644. }
  3645. }
  3646. SOKOL_API_IMPL void sgl_v2f_t2f_c3b(float x, float y, float u, float v, uint8_t r, uint8_t g, uint8_t b) {
  3647. _sgl_context_t* ctx = _sgl.cur_ctx;
  3648. if (ctx) {
  3649. _sgl_vtx(ctx, x, y, 0.0f, u, v, _sgl_pack_rgbab(r, g, b, 255));
  3650. }
  3651. }
  3652. SOKOL_API_IMPL void sgl_v2f_t2f_c4f(float x, float y, float u, float v, float r, float g, float b, float a) {
  3653. _sgl_context_t* ctx = _sgl.cur_ctx;
  3654. if (ctx) {
  3655. _sgl_vtx(ctx, x, y, 0.0f, u, v, _sgl_pack_rgbaf(r, g, b, a));
  3656. }
  3657. }
  3658. SOKOL_API_IMPL void sgl_v2f_t2f_c4b(float x, float y, float u, float v, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
  3659. _sgl_context_t* ctx = _sgl.cur_ctx;
  3660. if (ctx) {
  3661. _sgl_vtx(ctx, x, y, 0.0f, u, v, _sgl_pack_rgbab(r, g, b, a));
  3662. }
  3663. }
  3664. SOKOL_API_IMPL void sgl_v2f_t2f_c1i(float x, float y, float u, float v, uint32_t rgba) {
  3665. _sgl_context_t* ctx = _sgl.cur_ctx;
  3666. if (ctx) {
  3667. _sgl_vtx(ctx, x, y, 0.0f, u, v, rgba);
  3668. }
  3669. }
  3670. SOKOL_API_IMPL void sgl_v3f_t2f_c3f(float x, float y, float z, float u, float v, float r, float g, float b) {
  3671. _sgl_context_t* ctx = _sgl.cur_ctx;
  3672. if (ctx) {
  3673. _sgl_vtx(ctx, x, y, z, u, v, _sgl_pack_rgbaf(r, g, b, 1.0f));
  3674. }
  3675. }
  3676. SOKOL_API_IMPL void sgl_v3f_t2f_c3b(float x, float y, float z, float u, float v, uint8_t r, uint8_t g, uint8_t b) {
  3677. _sgl_context_t* ctx = _sgl.cur_ctx;
  3678. if (ctx) {
  3679. _sgl_vtx(ctx, x, y, z, u, v, _sgl_pack_rgbab(r, g, b, 255));
  3680. }
  3681. }
  3682. SOKOL_API_IMPL void sgl_v3f_t2f_c4f(float x, float y, float z, float u, float v, float r, float g, float b, float a) {
  3683. _sgl_context_t* ctx = _sgl.cur_ctx;
  3684. if (ctx) {
  3685. _sgl_vtx(ctx, x, y, z, u, v, _sgl_pack_rgbaf(r, g, b, a));
  3686. }
  3687. }
  3688. SOKOL_API_IMPL void sgl_v3f_t2f_c4b(float x, float y, float z, float u, float v, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
  3689. _sgl_context_t* ctx = _sgl.cur_ctx;
  3690. if (ctx) {
  3691. _sgl_vtx(ctx, x, y, z, u, v, _sgl_pack_rgbab(r, g, b, a));
  3692. }
  3693. }
  3694. SOKOL_API_IMPL void sgl_v3f_t2f_c1i(float x, float y, float z, float u, float v, uint32_t rgba) {
  3695. _sgl_context_t* ctx = _sgl.cur_ctx;
  3696. if (ctx) {
  3697. _sgl_vtx(ctx,x, y, z, u, v, rgba);
  3698. }
  3699. }
  3700. SOKOL_API_IMPL void sgl_matrix_mode_modelview(void) {
  3701. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3702. _sgl_context_t* ctx = _sgl.cur_ctx;
  3703. if (ctx) {
  3704. ctx->cur_matrix_mode = SGL_MATRIXMODE_MODELVIEW;
  3705. }
  3706. }
  3707. SOKOL_API_IMPL void sgl_matrix_mode_projection(void) {
  3708. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3709. _sgl_context_t* ctx = _sgl.cur_ctx;
  3710. if (ctx) {
  3711. ctx->cur_matrix_mode = SGL_MATRIXMODE_PROJECTION;
  3712. }
  3713. }
  3714. SOKOL_API_IMPL void sgl_matrix_mode_texture(void) {
  3715. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3716. _sgl_context_t* ctx = _sgl.cur_ctx;
  3717. if (ctx) {
  3718. ctx->cur_matrix_mode = SGL_MATRIXMODE_TEXTURE;
  3719. }
  3720. }
  3721. SOKOL_API_IMPL void sgl_load_identity(void) {
  3722. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3723. _sgl_context_t* ctx = _sgl.cur_ctx;
  3724. if (!ctx) {
  3725. return;
  3726. }
  3727. ctx->matrix_dirty = true;
  3728. _sgl_identity(_sgl_matrix(ctx));
  3729. }
  3730. SOKOL_API_IMPL void sgl_load_matrix(const float m[16]) {
  3731. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3732. _sgl_context_t* ctx = _sgl.cur_ctx;
  3733. if (!ctx) {
  3734. return;
  3735. }
  3736. ctx->matrix_dirty = true;
  3737. memcpy(&_sgl_matrix(ctx)->v[0][0], &m[0], 64);
  3738. }
  3739. SOKOL_API_IMPL void sgl_load_transpose_matrix(const float m[16]) {
  3740. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3741. _sgl_context_t* ctx = _sgl.cur_ctx;
  3742. if (!ctx) {
  3743. return;
  3744. }
  3745. ctx->matrix_dirty = true;
  3746. _sgl_transpose(_sgl_matrix(ctx), (const _sgl_matrix_t*) &m[0]);
  3747. }
  3748. SOKOL_API_IMPL void sgl_mult_matrix(const float m[16]) {
  3749. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3750. _sgl_context_t* ctx = _sgl.cur_ctx;
  3751. if (!ctx) {
  3752. return;
  3753. }
  3754. ctx->matrix_dirty = true;
  3755. const _sgl_matrix_t* m0 = (const _sgl_matrix_t*) &m[0];
  3756. _sgl_mul(_sgl_matrix(ctx), m0);
  3757. }
  3758. SOKOL_API_IMPL void sgl_mult_transpose_matrix(const float m[16]) {
  3759. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3760. _sgl_context_t* ctx = _sgl.cur_ctx;
  3761. if (!ctx) {
  3762. return;
  3763. }
  3764. ctx->matrix_dirty = true;
  3765. _sgl_matrix_t m0;
  3766. _sgl_transpose(&m0, (const _sgl_matrix_t*) &m[0]);
  3767. _sgl_mul(_sgl_matrix(ctx), &m0);
  3768. }
  3769. SOKOL_API_IMPL void sgl_rotate(float angle_rad, float x, float y, float z) {
  3770. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3771. _sgl_context_t* ctx = _sgl.cur_ctx;
  3772. if (!ctx) {
  3773. return;
  3774. }
  3775. ctx->matrix_dirty = true;
  3776. _sgl_rotate(_sgl_matrix(ctx), angle_rad, x, y, z);
  3777. }
  3778. SOKOL_API_IMPL void sgl_scale(float x, float y, float z) {
  3779. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3780. _sgl_context_t* ctx = _sgl.cur_ctx;
  3781. if (!ctx) {
  3782. return;
  3783. }
  3784. ctx->matrix_dirty = true;
  3785. _sgl_scale(_sgl_matrix(ctx), x, y, z);
  3786. }
  3787. SOKOL_API_IMPL void sgl_translate(float x, float y, float z) {
  3788. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3789. _sgl_context_t* ctx = _sgl.cur_ctx;
  3790. if (!ctx) {
  3791. return;
  3792. }
  3793. ctx->matrix_dirty = true;
  3794. _sgl_translate(_sgl_matrix(ctx), x, y, z);
  3795. }
  3796. SOKOL_API_IMPL void sgl_frustum(float l, float r, float b, float t, float n, float f) {
  3797. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3798. _sgl_context_t* ctx = _sgl.cur_ctx;
  3799. if (!ctx) {
  3800. return;
  3801. }
  3802. ctx->matrix_dirty = true;
  3803. _sgl_frustum(_sgl_matrix(ctx), l, r, b, t, n, f);
  3804. }
  3805. SOKOL_API_IMPL void sgl_ortho(float l, float r, float b, float t, float n, float f) {
  3806. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3807. _sgl_context_t* ctx = _sgl.cur_ctx;
  3808. if (!ctx) {
  3809. return;
  3810. }
  3811. ctx->matrix_dirty = true;
  3812. _sgl_ortho(_sgl_matrix(ctx), l, r, b, t, n, f);
  3813. }
  3814. SOKOL_API_IMPL void sgl_perspective(float fov_y, float aspect, float z_near, float z_far) {
  3815. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3816. _sgl_context_t* ctx = _sgl.cur_ctx;
  3817. if (!ctx) {
  3818. return;
  3819. }
  3820. ctx->matrix_dirty = true;
  3821. _sgl_perspective(_sgl_matrix(ctx), fov_y, aspect, z_near, z_far);
  3822. }
  3823. SOKOL_API_IMPL void sgl_lookat(float eye_x, float eye_y, float eye_z, float center_x, float center_y, float center_z, float up_x, float up_y, float up_z) {
  3824. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3825. _sgl_context_t* ctx = _sgl.cur_ctx;
  3826. if (!ctx) {
  3827. return;
  3828. }
  3829. ctx->matrix_dirty = true;
  3830. _sgl_lookat(_sgl_matrix(ctx), eye_x, eye_y, eye_z, center_x, center_y, center_z, up_x, up_y, up_z);
  3831. }
  3832. SOKOL_GL_API_DECL void sgl_push_matrix(void) {
  3833. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3834. _sgl_context_t* ctx = _sgl.cur_ctx;
  3835. if (!ctx) {
  3836. return;
  3837. }
  3838. SOKOL_ASSERT((ctx->cur_matrix_mode >= 0) && (ctx->cur_matrix_mode < SGL_NUM_MATRIXMODES));
  3839. ctx->matrix_dirty = true;
  3840. if (ctx->matrix_tos[ctx->cur_matrix_mode] < (_SGL_MAX_STACK_DEPTH - 1)) {
  3841. const _sgl_matrix_t* src = _sgl_matrix(ctx);
  3842. ctx->matrix_tos[ctx->cur_matrix_mode]++;
  3843. _sgl_matrix_t* dst = _sgl_matrix(ctx);
  3844. *dst = *src;
  3845. }
  3846. else {
  3847. ctx->error = SGL_ERROR_STACK_OVERFLOW;
  3848. }
  3849. }
  3850. SOKOL_GL_API_DECL void sgl_pop_matrix(void) {
  3851. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3852. _sgl_context_t* ctx = _sgl.cur_ctx;
  3853. if (!ctx) {
  3854. return;
  3855. }
  3856. SOKOL_ASSERT((ctx->cur_matrix_mode >= 0) && (ctx->cur_matrix_mode < SGL_NUM_MATRIXMODES));
  3857. ctx->matrix_dirty = true;
  3858. if (ctx->matrix_tos[ctx->cur_matrix_mode] > 0) {
  3859. ctx->matrix_tos[ctx->cur_matrix_mode]--;
  3860. }
  3861. else {
  3862. ctx->error = SGL_ERROR_STACK_UNDERFLOW;
  3863. }
  3864. }
  3865. SOKOL_API_IMPL void sgl_draw(void) {
  3866. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3867. _sgl_context_t* ctx = _sgl.cur_ctx;
  3868. if (ctx) {
  3869. _sgl_draw(ctx, 0);
  3870. }
  3871. }
  3872. SOKOL_API_IMPL void sgl_draw_layer(int layer_id) {
  3873. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3874. _sgl_context_t* ctx = _sgl.cur_ctx;
  3875. if (ctx) {
  3876. _sgl_draw(ctx, layer_id);
  3877. }
  3878. }
  3879. SOKOL_API_IMPL void sgl_context_draw(sgl_context ctx_id) {
  3880. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3881. _sgl_context_t* ctx = _sgl_lookup_context(ctx_id.id);
  3882. if (ctx) {
  3883. _sgl_draw(ctx, 0);
  3884. }
  3885. }
  3886. SOKOL_API_IMPL void sgl_context_draw_layer(sgl_context ctx_id, int layer_id) {
  3887. SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
  3888. _sgl_context_t* ctx = _sgl_lookup_context(ctx_id.id);
  3889. if (ctx) {
  3890. _sgl_draw(ctx, layer_id);
  3891. }
  3892. }
  3893. #endif /* SOKOL_GL_IMPL */