יצירת קובצי כותרת Vulkan לכל תוכנת הצללה

המדריך הזה מראה איך ליצור כותרות Vulkan C++ לכל מערכת הפעלה מארחת מקובצי ההצללה.

יצירת כותרות C++ מקובצי ההצללה

  1. מורידים למחשב המקומי את הכליKhronos Group Glslang: מועמד ל-26 ביולי 2020.

  2. מחלצים את הקבצים.

  3. כדאי לבדוק את הגרסה שלה:

    • Windows

      bin\glslangValidator --version

    • macOS

      ./bin/glslangValidator --version

    • Linux

      ./bin/glslangValidator --version

  4. במאגר של Cardboard, מאתרים את התיקייה sdk/rendering/android/shaders ושומרים את הנתיב שלה.

  5. יוצרים את קובצי הכותרת Vulkan ב-C++:

    • Windows

      bin\glslangValidator -V --vn distortion_frag %SHADERS_FOLDER_PATH%\distortion.frag -o distortion_frag.spv.h
      bin\glslangValidator -V --vn distortion_vert %SHADERS_FOLDER_PATH%\distortion.vert -o distortion_vert.spv.h
      

    • macOS

      ./bin/glslangValidator -V --vn distortion_frag $SHADERS_FOLDER_PATH/distortion.frag -o distortion_frag.spv.h
      
      ./bin/glslangValidator -V --vn distortion_vert $SHADERS_FOLDER_PATH/distortion.vert -o distortion_vert.spv.h
      
      

    • Linux

      ./bin/glslangValidator -V --vn distortion_frag $SHADERS_FOLDER_PATH/distortion.frag -o distortion_frag.spv.h
      
      ./bin/glslangValidator -V --vn distortion_vert $SHADERS_FOLDER_PATH/distortion.vert -o distortion_vert.spv.h
      
      

עכשיו ערכי distortion_frag.spv.h ו-distortion_vert.spv.h.