Getting Started with Metal Shading Language

Getting Started with Metal Shading Language

Nagoya iOS meetup vol. 2

6500a96a5f0786d7ff0c53429d691ae6?s=128

kazuhiro4949

March 16, 2018
Tweet

Transcript

  1. (FUUJOH4UBSUFEXJUI .FUBM4IBEJOH-BOHVBHF ,B[VIJSP)":"4)* /BHPZBJ04NFFUVQWPM

  2. ࣗݾ঺հ wྛ࿨߂ w5XJUUFSɿLB[VIJSP wHJUIVCɿLB[VIJSP wRJJUBɿLB[VIJSP w:BIPP+BQBO$PSQ wJ04ΞϓϦΤϯδχΞ wJ04ΞϓϦࠇଳ

  3. $16ͱ(16 0QOF(- IUUQTXXXOUVFEVTHIPNFFIDIVBQSPHSBNNJOHPQFOHM$(@#BTJDT5IFPSZIUNM

  4. (16ͷϨϯμϦϯάύΠϓϥΠϯ 0QFO(- IUUQTXXXOUVFEVTHIPNFFIDIVBQSPHSBNNJOHPQFOHM$(@#BTJDT5IFPSZIUNM w ௖఺΍ϓϦϛςΟϒ ਤܗߏ੒ཁૉ σʔλΛ༻ҙ͢Δͱ͜Ζ͔Βελʔτ a

  5. (16ͷϨϯμϦϯάύΠϓϥΠϯ 0QFO(- IUUQTXXXOUVFEVTHIPNFFIDIVBQSPHSBNNJOHPQFOHM$(@#BTJDT5IFPSZIUNM a w ࠲ඪσʔλͷม׵ 7FSUFY4IBEFSΛγΣʔμʔ༻ݴޠͰॻ͘

  6. (16ͷϨϯμϦϯάύΠϓϥΠϯ 0QFO(- IUUQTXXXOUVFEVTHIPNFFIDIVBQSPHSBNNJOHPQFOHM$(@#BTJDT5IFPSZIUNM a w ϥελϥΠζ͞Εͨσʔλʹ৭ॲཧΛͯ͠ग़ྗ 'SBHNFOU4IBEFSΛγΣʔμʔ ༻ݴޠͰॻ͘

  7. ৄ͘͠͸ͪ͜Β શ෦লུ w ৄࡉ͸5SZ4XJGU5PLZP"GUFS 5BMLͷͪ͜Βͷࢿྉ͕ࢀߟʹͳΓ·͢ w *OUSPEVDUJPO5P%1SPHSBNNJOH (SBQIJDT1JQFMJOF w IUUQTTQFBLFSEFDLDPN

    UB@LB@UTVJOUSPEVDUJPOUPE QSPHSBNNJOHHSBQIJDTQJQFMJOF
  8. .FUBM w ೥ʹൃද͞Εͨ"QQMFಠࣗͷ (16ϓϩάϥϛϯά"1* w $16ͱͷڞ༗ϝϞϦྖҬ͕͋Δ w 0QFO(-ΑΓ΋ΑΓந৅౓͕௿͘ɺ ύϑΥʔϚϯε͕ߴ͍ .FUBM

    .FUBM
  9. ैདྷͷ(161SPHSBNNJOH"1* w ඳըॲཧͷ$16(16ͷ੾Γସ ͑͸ίετ͕͔͔Δ w 4UBUF7BMJEBUJPO w γΣʔμʔͷίϯύΠϧ w ίϚϯυૹ৴

    IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZNFUBMΑΓ
  10. .FUBMͷಛ௃ w .FUBM͸ଟ͘ͷ΋ͷΛ%SBX5JNF ͷ֎Ͱߦ͏ͷͰΦʔόʔϔου͕ ௿͍ IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZNFUBMΑΓ

  11. ࣮૷͢Δ΋ͷ w $16ଆͰ7JFXΛ༻ҙͯ͠ɺ(16΁ૹ৴͢ΔίϚϯυΛهड़͍ͯ͘͠ w γΣʔμʔͱݺ͹ΕΔ΋ͷͰ௖఺ॲཧɾ৭ॲཧΛهड़͍ͯ͠%SBX $BMMຖʹ࣮ߦ

  12. $16ଆͷίʔυͰهड़͢Δ΋ͷ  %FWJDFͷऔಘ  $PNNBOE2VFVF࡞੒  5FYUVSF΍#V⒎FSͳͲͷϦιʔεͷ࡞੒  3FOEFS1JQFMJOFͷ࡞੒ 

    7JFXΛ༻ҙͯ͠ඳը
  13. $16ଆͷίʔυͰهड़͢Δ΋ͷ

  14. $16ଆͷίʔυͰهड़͢Δ΋ͷ

  15. ৄ͘͠͸ͪ͜Β શ෦লུ IUUQTQFBLTDDCPPLTJ04ΑΓ w ষʹ.FUBMͷ࿩͕͋Γ·͢ w ඞཁ࠷খݶͷ࣮૷Λஸೡʹઆ໌ͯ͘͠Ε ͍ͯΔͷͰऔֻ͔ͬΓͱͯࣸ͠ܦ͢Δͷ ͕͓͢͢Ί

  16. .FUBM4IBEJOH-BOHVBHF .4-

  17. .4- w $ Λϕʔεʹ։ൃ͞ΕͨγΣʔμʔݴޠ w ಠࣗ"UUSJCVUFT͕৭ʑ͋Δ w جຊσʔλߏ଄͸4DBMBS 7FDUPS .BUSJY

    5FYUVSFͳͲγϯϓϧͳ΋ͷ w NFUBMϑΝΠϧͱͯ͠هड़ͯ͠ɺ4XJGUଆ͔ΒίϯύΠϧͨͦ͠ΕΛ3FOEFS1JQFMJOF΁౉͢ w 7FSUFY4IBEFSɾ'SBHNFOU4IBEFSͦΕͧΕ΁ͷΠϯɾΞ΢τΛؔ਺Ͱهड़
  18. 3FOEFS1JQFMJOF IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPONFUBMIFMMP@USJBOHMFΑΓ ;

  19. 3FOEFS1JQFMJOF a a ͜͜ͱ͜͜Λ.4-Ͱॻ͘ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPONFUBMIFMMP@USJBOHMFΑΓ

  20. .4-ͰͷγΣʔμʔ࣮૷ͷྲྀΕ w $16ଆͱڞ༗ͨ͠ΓγΣʔμʔؒͰ΍ΓऔΓ͢Δσʔλߏ଄ͷ࡞੒ w 7FSUFY4IBEFSͰΠϯϓοτΛॲཧͯ͠ɺ'SBHNFOU4IBEFS΁Ξ΢τϓοτ ͢Δ w 'SBHNFOU4IBEFSͷΠϯϓοτΛॲཧͯ͠ɺϐΫηϧ͝ͱͷ৭ͷ7FDUPSΛ Ξ΢τϓοτ͢Δ

  21. 7FSUFY4IBEFS

  22. 7FSUFY4IBEFS ࠲ඪΛҾ਺ʹ'SBHNFOU4IBOEFSʹ౉͢σʔλߏ଄Λ࡞੒ͯ͠ฦ͢

  23. 7FSUFY'SBHNFOUͷσʔλߏ଄

  24. 'SBHNFOU4IBEFS

  25. 'SBHNFOU4IBEFS ϥελϥΠζ͞ΕͨσʔλΛड͚औͬͯ࠷ऴతʹ৭৘ใΛฦ͢

  26. ਖ਼௚Α͘Θ͔ΒΜ

  27. .4-ͷֶशํ๏ w جຊతʹ৘ใ͕ͦΕ΄Ͳଟ͘͸ͳ͍ w $16ଆͷॲཧ͸ܾ·͍ͬͯΔͷͰ֮͑Ε͹ऴΘΓ͕ͩɺγΣʔμʔ͸Ͳ͏ֶश͢Ε͹͍͍ͷ͔ w ݴޠͦͷ΋ͷ͸೉͘͠ͳ͍͕ɺͲ͏ܭࢉͨ͠ΒͲ͏දࣔ͞ΕΔͷ͔ཧղ͕͍ͨ͠ w ωοτΛړΔͱ0QFO(-༻ͷγΣʔμʔݴޠ (-4-

    ͔Β.4-΁ͷҠ২ͨ͠ͱ͍͏࿩୊Λݟ͔ ͚Δ w <J04>.FUBMγΣʔμ͜ͱ͸͡Ί8FC(-(-4-ͷ๛෋ͳαϯϓϧΛࢀߟʹ͢Δ IUUQTRJJUBDPNTIVJUFNT EEBCDBCFGD w 6*ʹ.FUBM͕࢖͑ͳ͍͔͍Ζ͍Ζࢼͯ͠Έͨ࿩ IUUQTFOHJOFFSJOHMJOFDPSQDPNKBCMPHEFUBJM
  28. HMTMTBOECPYDPN w (-4-Ͱهड़͞ΕͨγΣʔμʔ ͕๛෋ʹܝࡌ͞Ε͍ͯΔ

  29. HMTMTBOECPYDPN w ίʔυͱ࣮ߦ݁Ռ͕Θ͔Γ΍ ͘͢දࣔ͞Ε͍ͯΔ IUUQHMTMTBOECPYDPNFΑΓ

  30. (-4-.4- w ػցతͳҠ২͕ՄೳΒ͍͠ w ΄Μͱʹʁ w ΍ͬͯΈͨ w ෼ޙ

  31. (-4-.4- w ػցతͳҠ২͕ՄೳΒ͍͠ w ΄Μͱʹʁ w ΍ͬͯΈͨ w ෼ޙ

  32. (-4-.4- w ػցతͳҠ২͕ՄೳΒ͍͠ w ΄Μͱʹʁ w ΍ͬͯΈͨ w ෼ޙ

  33. (-4-.4- w ػցతͳҠ২͕ՄೳΒ͍͠ w ΄Μͱʹʁ w ΍ͬͯΈͨ w ਺෼ޙʜ

  34. ಈ͍ͨ IUUQHMTMTBOECPYDPNFΛ.4-΁ม׵ͯ͠J1IPOF Ͱ࣮ߦ

  35. Ҡ২ํ๏ w 'SBHNFOU4IBEFSͷΈΛ࣮૷ w 7FSUFYU4IBEFS͸جຊ࠲ඪΛड͚औͬͯɺͦΕΛͦͷ··ฦ͚ͩ͢ͷίʔυ Ͱ͍͍ w ܕ͕ҧ͏ͷͰ߹ΘͤΔ w ΠϯϓοτɾΞ΢τϓοτͷॻ͖ํ͕ҧ͏ͷͰ߹ΘͤΔ

    ฦ͢΂͖΋ͷ͸ಉ͡
  36. None
  37. w ͜ΕͰجຊతʹ͸ಈ͘ w ೉͍͠ܭࢉ෦෼͸ͦͷ··ྲྀ༻Ͱ͖Δ w ͭ·Γ.4-ͷ๛෋ͳαϯϓϧίʔυ͕खʹೖͬͨ w ޙ͸͜ΕΛϕʔεʹखΛՃ͍͑ͯ͘͜ͱͰ.4-ʹ׳ΕΔ

  38. ·ͱΊ ࠳ંͤͣʹ.4-ʹ׳ΕΔͨΊͷखॱ w લఏ w (16ύΠϓϥΠϯͷ֓೦͸಄ʹೖΕ͓ͯ͘ w J04QSPHSBNNJOHCPPLT "QQMFͷTBNQMFΛࣸܦͯ͠࡞๏ΛֶͿ w

    ҎԼΛͻͨ͢Β΍Δ w .4-ͷ࢓༷ॻ΍(-4-ͷࢿྉɾલड़ͷϒϩάΛࢀߟʹ͠ͳ͕Β(-4-ͷ Ҡ২Λߦ͏ w Ҡ২ίʔυΛ͍͡Γ౗͢
  39. ࢀߟࢿྉ w .FUBM"DDFMFSBUJOHHSBQIJDTBOENVDINPSF IUUQTEFWFMPQFSBQQMFDPNNFUBM w %(SBQIJDTXJUI0QFO(-#BTJD5IFPSZ IUUQTXXXOUVFEVTHIPNFFIDIVBQSPHSBNNJOHPQFOHM$(@#BTJDT5IFPSZIUNM w J041SPHSBNNJOH IUUQTQFBLTDDCPPLTJ04

    w 8PSLJOHXJUI.FUBM'VOEBNFOUBMT IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZNFUBM w 8PSLJOHXJUI.FUBM0WFSWJFX IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZNFUBM w <J04>.FUBMγΣʔμ͜ͱ͸͡Ί8FC(-(-4-ͷ๛෋ͳαϯϓϧΛࢀߟʹ͢Δ IUUQTRJJUBDPNTIVJUFNTEEBCDBCFGD w 6*ʹ.FUBM͕࢖͑ͳ͍͔͍Ζ͍Ζࢼͯ͠Έͨ࿩ IUUQTFOHJOFFSJOHMJOFDPSQDPNKBCMPHEFUBJM w *OUSPEVDUJPO5P%1SPHSBNNJOH(SBQIJDT1JQFMJOF IUUQTTQFBLFSEFDLDPNUB@LB@UTVJOUSPEVDUJPOUPEQSPHSBNNJOH HSBQIJDTQJQFMJOF