为每个着色器生成 Vulkan 头文件
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本指南介绍如何从着色器文件为每个主机操作系统生成 Vulkan C++ 头文件。
在本地机器上下载 Khronos Group Glslang Tool: Candidate of 2020。
解压缩。
检查其版本:
Windows
bin\glslangValidator --version
macOS
./bin/glslangValidator --version
Linux
./bin/glslangValidator --version
在 Cardboard 仓库中,找到 sdk/rendering/android/shaders
文件夹并保存其路径。
使用 C++ 生成 Vulkan 头文件:
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。
保留所有权利。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-09-09。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-09-09。"],[[["This guide provides instructions on generating Vulkan C++ header files from shader files for use in your application."],["You will need to download and install the Khronos Group Glslang tool to convert shader files into header files."],["The process involves locating your shader files and using the glslangValidator tool with specific commands to generate the corresponding header files."],["The generated header files, `distortion_frag.spv.h` and `distortion_vert.spv.h`, will contain the Vulkan-compatible code derived from your shaders."]]],[]]