Skip to content

Commit c76ba26

Browse files
committed
Add vulkansupport.
1 parent 744965c commit c76ba26

File tree

3 files changed

+50
-11
lines changed

3 files changed

+50
-11
lines changed

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,26 @@ However the following is a list of extra dependency options that require externa
6969
1. Download either the "Intel OpenCL SDK", "AMD OpenCL SDK" or the "NVIDIA CUDA SDK" from their respective suppliers.
7070
2. Install the downloaded SDK wherever desired.
7171
3. ffnvcodec/nvdec/nvenc (requires nv-codec-headers)
72-
1. Download the nv-codec-headers repository from https://github.com/FFmpeg/nv-codec-headers
73-
2. Save the contents of the nv-codec-headers repositories "include" folder into "OutputDir/include/*".
72+
1. Download the nv-codec-headers repository from https://github.com/FFmpeg/nv-codec-headers
73+
2. Save the contents of the nv-codec-headers repositories "include" folder into "OutputDir/include/*".
7474
5. cuda-sdk (requires latest NVIDIA CUDA SDK)
75-
1. Download the NVIDIA CUDA SDK from the NVIDIA website
76-
2. Install the downloaded SDK wherever desired.
75+
1. Download the NVIDIA CUDA SDK from the NVIDIA website
76+
2. Install the downloaded SDK wherever desired.
7777
6. amf (requires Advanced Media Framework (AMF) SDK headers)
78-
1. Download the AMF repository from https://github.com/GPUOpen-LibrariesAndSDKs/AMF
79-
2. Save the contents of the AMF repositories "amf/public/include" into "OutputDir/include/AMF/*".
78+
1. Download the AMF repository from https://github.com/GPUOpen-LibrariesAndSDKs/AMF
79+
2. Save the contents of the AMF repositories "amf/public/include" into "OutputDir/include/AMF/*".
8080
7. decklink (requires Blackmagic DeckLink SDK)
8181
1. Download the "Blackmagic DeckLink SDK" from the Blackmagic website.
8282
2. Extract the downloaded SDK wherever desired.
83-
3. Run the following command from a Visual Studio developer command prompt in the "Win/include" folder:
84-
midl /win32 /h DeckLinkAPI.h DeckLinkAPI.idl
85-
4. Copy the newly created "DeckLinkAPI.h" and "DeckLinkAPI_i.c" files to *OutputDir*/include/*.
83+
3. Run the following command from a Visual Studio developer command prompt in the "Win/include" folder:
84+
midl /win32 /h DeckLinkAPI.h DeckLinkAPI.idl
85+
4. Copy the newly created "DeckLinkAPI.h" and "DeckLinkAPI_i.c" files to *OutputDir*/include/*.
86+
8. vulkan (requires Vulkan headers or Vulkan SDK)
87+
1. Download the Vulkan SDK from https://www.lunarg.com/vulkan-sdk/
88+
2. Install the downloaded SDK wherever desired.
89+
or
90+
1. Download the vulkan-headers repository from https://github.com/KhronosGroup/Vulkan-Headers
91+
2. Save the contents of the vulkan-headers repositories "include" folder into "OutputDir/include/*".
8692

8793
Any dependencies supplied by ShiftMediaProject should be downloaded next to the FFmpeg folder as they will use the same OutputDir location. Projects to build each dependency can be found in the respective repository **./SMP** directories.
8894

source/configGenerator_build.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ bool ConfigGenerator::buildAutoDetectValues()
329329
} else if (i == "crystalhd") {
330330
enable = false;
331331
} else if (i == "cuda" || i == "cuvid") {
332-
enable = findFile(m_rootDirectory + "compat/cuda/dynlink_cuda.h", sFileName);
332+
enable = (findFile(m_rootDirectory + "compat/cuda/dynlink_loader.h", sFileName) &&
333+
findFile(m_rootDirectory + "compat/cuda/dynlink_cuda.h", sFileName));
333334
if (!enable) {
334335
makeFileGeneratorRelative(m_outDirectory + "include/ffnvcodec/dynlink_cuda.h", sFileName);
335336
enable = findFile(sFileName, sFileName);
@@ -414,6 +415,9 @@ bool ConfigGenerator::buildAutoDetectValues()
414415
} else if (i == "videotoolbox_hwaccel") {
415416
enable = false;
416417
} else if (i == "vulkan") {
418+
enable = true;
419+
} else if (i == "libglslang" || i == " libshaderc" ||
420+
i == " spirv_compiler") {
417421
// Not currently supported
418422
enable = false;
419423
} else if (i == "w32threads") {
@@ -825,6 +829,14 @@ void ConfigGenerator::buildReplaceValues(
825829
# define CONFIG_OPENAL 1\n\
826830
#else\n\
827831
# define CONFIG_OPENAL 0\n\
832+
#endif";
833+
}
834+
opt = getConfigOptionPrefixed("CONFIG_VULKAN");
835+
if ((opt != m_configValues.end()) && opt->m_value == "1") {
836+
replaceValues["CONFIG_VULKAN"] = "#if " + winrtDefine + "\n\
837+
# define CONFIG_VULKAN 1\n\
838+
#else\n\
839+
# define CONFIG_VULKAN 0\n\
828840
#endif";
829841
}
830842
}

source/projectGenerator_build.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ void ProjectGenerator::buildDependencies(StaticList& libs, StaticList& addLibs,
205205
}
206206
} else if (i == "wincrypt") {
207207
addLibs.emplace_back("Advapi32"); // Add the additional required libs
208+
} else if (i == "vulkan") {
209+
// Doesn't need any additional libs
208210
} else {
209211
// By default just use the lib name and prefix with lib if not already
210212
if (i.find("lib") == 0) {
@@ -391,6 +393,24 @@ void ProjectGenerator::buildDependencyValues(StaticList& includeDirs, StaticList
391393
lib64Dirs.emplace_back("$(CUDA_PATH)/lib/x64");
392394
}
393395
}
396+
} else if (i.first == "vulkan" && !winrt) {
397+
if (findEnvironmentVariable("VULKAN_SDK")) {
398+
includeDirs.emplace_back("$(VULKAN_SDK)/include/");
399+
} else {
400+
string fileName;
401+
m_configHelper.makeFileGeneratorRelative(
402+
m_configHelper.m_outDirectory + "include/vulkan/vulkan.h", fileName);
403+
if (findFile(fileName, fileName)) {
404+
// Nothing to do as $(OutDir)/include is always added anyway
405+
} else {
406+
outputWarning("Could not find the Vulkan headers.");
407+
outputWarning(
408+
"Either the Vulkan SDK is not installed or the environment variable is missing or the headers are not installed in a known location.", false);
409+
outputWarning(
410+
"Vulkan requires the Vulkan headers to be available in the include path.",
411+
false);
412+
}
413+
}
394414
}
395415
}
396416
}
@@ -526,7 +546,8 @@ void ProjectGenerator::buildProjectDependencies(map<string, bool>& projectDeps)
526546
projectDeps["sdl"] = (m_projectName == "libavdevice") || (m_projectName == "ffplay") || (m_projectName == "avplay");
527547
projectDeps["sdl2"] =
528548
(m_projectName == "libavdevice") || (m_projectName == "ffplay") || (m_projectName == "avplay");
529-
projectDeps["vapoursynth"] = m_projectName.compare("libavformat");
549+
projectDeps["vapoursynth"] = m_projectName == "libavformat";
550+
projectDeps["vulkan"] = (m_projectName == "libavcodec") || (m_projectName == "libavutil");
530551
projectDeps["zlib"] = (m_projectName == "libavformat") || (m_projectName == "libavcodec");
531552
}
532553

0 commit comments

Comments
 (0)