Move generation of API-Samples SPIR-V header files out of fetchDependencies.

Add Demos/LunarG-VulkanSamples/API-Samples/generateSPIRVShaders script.
Update user documentation.
This commit is contained in:
Bill Hollings 2020-04-12 12:53:17 -04:00
parent b582b9284b
commit 2b2bfc3fbd
6 changed files with 63 additions and 31 deletions

View File

@ -90,6 +90,7 @@
A964BC631E4EA6FC00CA9AF1 /* util_init.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = util_init.cpp; sourceTree = "<group>"; };
A964BC641E4EA6FC00CA9AF1 /* util_init.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = util_init.hpp; sourceTree = "<group>"; };
A977BCFE1B66BB010067E5BF /* API-Samples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "API-Samples.app"; sourceTree = BUILT_PRODUCTS_DIR; };
A99B2F0D24436190001117F7 /* generateSPIRVShaders */ = {isa = PBXFileReference; lastKnownFileType = text; path = generateSPIRVShaders; sourceTree = "<group>"; };
A9B67B6B1C3AAE9800373FFD /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
A9B67B6C1C3AAE9800373FFD /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
A9B67B6E1C3AAE9800373FFD /* DemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoViewController.h; sourceTree = "<group>"; };
@ -151,6 +152,7 @@
isa = PBXGroup;
children = (
A92F37071C7E1B2B008F8BC9 /* Samples.h */,
A99B2F0D24436190001117F7 /* generateSPIRVShaders */,
A95C03971C98FBED00CC653D /* API-Samples */,
A9B67B6A1C3AAE9800373FFD /* iOS */,
A9B67B811C3AAEA200373FFD /* macOS */,

View File

@ -30,6 +30,14 @@
*
* If you choose to add a #define statement to this file, be sure to clear the existing macro
* from the Preprocessor Macros (aka GCC_PREPROCESSOR_DEFINITIONS) compiler setting in Xcode.
*
* Each of the `API-Samples` demos loads SPIR-V shader code from a file. Before running
* any of these demos, generate these SPIR-V files from a command line as follows:
*
* cd MoltenVK/Demos/LunarG-VulkanSamples/API-Samples
* ./generateSPIRVShaders
*
* You only need to do this step once. It generates the SPIR-V shader code files for all of these demos.
*/
#include <MoltenVK/mvk_vulkan.h>

View File

@ -0,0 +1,38 @@
#!/bin/bash
#
# Copyright (c) 2016-2020 The Brenwill Workshop Ltd.
#
# generateSPIRVShaders - Convert GLSL shader files to SPIRV header files
#
# macOS usage: ./generateSPIRVShaders
#
set -e
echo
echo ========== Building MoltenVKShaderConverter tool ==========
echo
cd "../../.."
XC_PROJ="MoltenVKPackaging.xcodeproj"
XC_SCHEME="MVKShaderConverterTool Package"
xcodebuild \
-project "MoltenVKPackaging.xcodeproj" \
-scheme "MVKShaderConverterTool Package" \
-quiet \
build
echo
echo ========== Converting API-Samples shader files ==========
echo
"Package/Latest/MoltenVKShaderConverter/Tools/MoltenVKShaderConverter" \
-r -gi -so -oh -xs . -q \
-d "Demos/LunarG-VulkanSamples/VulkanSamples/API-Samples"
cd - > /dev/null
echo ========== Done! ==========

View File

@ -94,7 +94,17 @@ This demo can be found in the `LunarG-VulkanSamples/API-Samples` folder, and in
`LunarG-VulkanSamples/API-Samples` group in the *Xcode Project Navigator* in the
`Demos.xcworkspace` *Xcode* workspace.
To run this demo, run either the `API-Samples-iOS` or `API-Samples-macOS` *Scheme* from within *Xcode*.
Each of the `API-Samples` demos loads *SPIR-V* shader code from a file. Before any of the
`API-Samples` demos are run, these *SPIR-V* files need to be generated as follows:
cd MoltenVK/Demos/LunarG-VulkanSamples/API-Samples
./generateSPIRVShaders
You only need to do this step once. It generates the *SPIR-V* shader code files for
all of the `API-Samples` demos.
To run any of the `API-Samples` demos, run either the `API-Samples-iOS` or `API-Samples-macOS`
*Scheme* from within *Xcode*.
To specify which of the many modular demos to run, open the `Samples.h` in the `API-Samples`
project in the *Xcode Project Navigator* in the `Demos.xcworkspace` *Xcode* workspace, and

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
#
# Copyright (c) 2016-2020 The Brenwill Workshop Ltd.
#
@ -7,10 +7,7 @@
# macOS usage: ./packagePregenSpirvToolsHeaders
#
set -o errexit
# ----------------- Main -------------------
set -e
EXT_DIR=../External
SPV_TLS_BLD_DIR="${EXT_DIR}/glslang/External/spirv-tools/build"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
#
# Copyright (c) 2016-2020 The Brenwill Workshop Ltd.
#
@ -32,7 +32,7 @@
# This repository does not have to be built.
#
set -o errexit
set -e
# ----------------- Functions -------------------
@ -289,28 +289,5 @@ xcodebuild \
${XC_BUILD_VERBOSITY} \
build
# -------------- Convert sample shader files -----------------
echo
echo ========== Building MoltenVKShaderConverter tool ==========
echo
XC_PROJ="MoltenVKPackaging.xcodeproj"
XC_SCHEME="MVKShaderConverterTool Package"
xcodebuild \
-project "${XC_PROJ}" \
-scheme "${XC_SCHEME}" \
${XC_BUILD_VERBOSITY} \
build
echo
echo ========== Converting API-Samples shader files ==========
echo
"Package/Latest/MoltenVKShaderConverter/Tools/MoltenVKShaderConverter" \
-r -gi -so -oh -xs . -q \
-d "Demos/LunarG-VulkanSamples/VulkanSamples/API-Samples"
echo ========== Done! ==========