Blame 0001-Use-system-headers-for-Vulkan.patch

Mystro256 fe5abf9
From 0974371aae2bda84862ea4a9a187d4af84b498c8 Mon Sep 17 00:00:00 2001
Mystro256 7c5b312
From: Mystro256 <alexjnewt@hotmail.com>
Mystro256 7c5b312
Date: Thu, 12 Mar 2020 13:41:58 -0400
Mystro256 fe5abf9
Subject: [PATCH 1/5] Use system headers for Vulkan
Mystro256 7c5b312
Mystro256 7c5b312
This can't be upstreamed, as it should be reworked to allow these bundled
Mystro256 7c5b312
libraries if detected. This will work in the meantime for Fedora though.
Mystro256 7c5b312
---
Mystro256 fe5abf9
 CMakeLists.txt                                |   1 -
Mystro256 fe5abf9
 .../Core/VideoBackends/Vulkan/CMakeLists.txt  |  22 ++--
Mystro256 fe5abf9
 .../VideoBackends/Vulkan/ShaderCompiler.cpp   | 109 +++++++++++++++++-
Mystro256 fe5abf9
 3 files changed, 118 insertions(+), 14 deletions(-)
Mystro256 7c5b312
Mystro256 7c5b312
diff --git a/CMakeLists.txt b/CMakeLists.txt
Mystro256 fe5abf9
index 26484938a3..c27b9cd80f 100644
Mystro256 7c5b312
--- a/CMakeLists.txt
Mystro256 7c5b312
+++ b/CMakeLists.txt
Mystro256 fe5abf9
@@ -543,7 +543,6 @@ else()
Mystro256 3a97ac9
   message(STATUS "Using static fmt from Externals")
Mystro256 7c5b312
   add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL)
Mystro256 7c5b312
 endif()
Mystro256 7c5b312
-add_subdirectory(Externals/glslang)
Mystro256 7c5b312
 add_subdirectory(Externals/imgui)
Mystro256 7c5b312
 
Mystro256 7c5b312
 find_package(pugixml)
Mystro256 7c5b312
diff --git a/Source/Core/VideoBackends/Vulkan/CMakeLists.txt b/Source/Core/VideoBackends/Vulkan/CMakeLists.txt
Mystro256 fe5abf9
index 40966f191d..f20c1ee632 100644
Mystro256 7c5b312
--- a/Source/Core/VideoBackends/Vulkan/CMakeLists.txt
Mystro256 7c5b312
+++ b/Source/Core/VideoBackends/Vulkan/CMakeLists.txt
Mystro256 fe5abf9
@@ -43,22 +43,20 @@ PUBLIC
Mystro256 7c5b312
   videocommon
Mystro256 7c5b312
 
Mystro256 7c5b312
 PRIVATE
Mystro256 7c5b312
-  # Link against glslang, the other necessary libraries are referenced by the executable.
Mystro256 7c5b312
   glslang
Mystro256 7c5b312
+  OSDependent
Mystro256 7c5b312
+  OGLCompiler
Mystro256 7c5b312
+  glslang
Mystro256 7c5b312
+  HLSL
Mystro256 7c5b312
+  SPIRV
Mystro256 7c5b312
+  SPIRV-Tools-opt
Mystro256 7c5b312
+  SPIRV-Tools
Mystro256 7c5b312
   xxhash
Mystro256 7c5b312
 )
Mystro256 7c5b312
 
Mystro256 7c5b312
-# Only include the Vulkan headers when building the Vulkan backend
Mystro256 7c5b312
-target_include_directories(videovulkan
Mystro256 7c5b312
-PRIVATE
Mystro256 7c5b312
-  ${CMAKE_SOURCE_DIR}/Externals/Vulkan/Include
Mystro256 7c5b312
-)
Mystro256 7c5b312
-
Mystro256 7c5b312
-# Silence warnings on glslang by flagging it as a system include
Mystro256 7c5b312
 target_include_directories(videovulkan
Mystro256 7c5b312
 SYSTEM PRIVATE
Mystro256 fe5abf9
-  ${CMAKE_SOURCE_DIR}/Externals/glslang/StandAlone
Mystro256 7c5b312
-  ${CMAKE_SOURCE_DIR}/Externals/glslang/glslang/Public
Mystro256 7c5b312
-  ${CMAKE_SOURCE_DIR}/Externals/glslang/SPIRV
Mystro256 fe5abf9
-  ${CMAKE_SOURCE_DIR}/Externals/glslang
Mystro256 7c5b312
+  /usr/include/glslang/Public
Mystro256 7c5b312
+  /usr/include/glslang/SPIRV
Mystro256 fe5abf9
+  /usr/include/glslang/Include
Mystro256 7c5b312
 )
Mystro256 7c5b312
diff --git a/Source/Core/VideoBackends/Vulkan/ShaderCompiler.cpp b/Source/Core/VideoBackends/Vulkan/ShaderCompiler.cpp
Mystro256 fe5abf9
index 8d6a4653e2..3f125a6661 100644
Mystro256 7c5b312
--- a/Source/Core/VideoBackends/Vulkan/ShaderCompiler.cpp
Mystro256 7c5b312
+++ b/Source/Core/VideoBackends/Vulkan/ShaderCompiler.cpp
Mystro256 fe5abf9
@@ -262,7 +262,114 @@ bool InitializeGlslang()
Mystro256 fe5abf9
 
Mystro256 fe5abf9
 const TBuiltInResource* GetCompilerResourceLimits()
Mystro256 fe5abf9
 {
Mystro256 fe5abf9
-  return &glslang::DefaultTBuiltInResource;
Mystro256 fe5abf9
+  //return &glslang::DefaultTBuiltInResource;
Mystro256 fe5abf9
+  static const TBuiltInResource limits = {
Mystro256 fe5abf9
+    /* .MaxLights = */ 32,
Mystro256 fe5abf9
+    /* .MaxClipPlanes = */ 6,
Mystro256 fe5abf9
+    /* .MaxTextureUnits = */ 32,
Mystro256 fe5abf9
+    /* .MaxTextureCoords = */ 32,
Mystro256 fe5abf9
+    /* .MaxVertexAttribs = */ 64,
Mystro256 fe5abf9
+    /* .MaxVertexUniformComponents = */ 4096,
Mystro256 fe5abf9
+    /* .MaxVaryingFloats = */ 64,
Mystro256 fe5abf9
+    /* .MaxVertexTextureImageUnits = */ 32,
Mystro256 fe5abf9
+    /* .MaxCombinedTextureImageUnits = */ 80,
Mystro256 fe5abf9
+    /* .MaxTextureImageUnits = */ 32,
Mystro256 fe5abf9
+    /* .MaxFragmentUniformComponents = */ 4096,
Mystro256 fe5abf9
+    /* .MaxDrawBuffers = */ 32,
Mystro256 fe5abf9
+    /* .MaxVertexUniformVectors = */ 128,
Mystro256 fe5abf9
+    /* .MaxVaryingVectors = */ 8,
Mystro256 fe5abf9
+    /* .MaxFragmentUniformVectors = */ 16,
Mystro256 fe5abf9
+    /* .MaxVertexOutputVectors = */ 16,
Mystro256 fe5abf9
+    /* .MaxFragmentInputVectors = */ 15,
Mystro256 fe5abf9
+    /* .MinProgramTexelOffset = */ -8,
Mystro256 fe5abf9
+    /* .MaxProgramTexelOffset = */ 7,
Mystro256 fe5abf9
+    /* .MaxClipDistances = */ 8,
Mystro256 fe5abf9
+    /* .MaxComputeWorkGroupCountX = */ 65535,
Mystro256 fe5abf9
+    /* .MaxComputeWorkGroupCountY = */ 65535,
Mystro256 fe5abf9
+    /* .MaxComputeWorkGroupCountZ = */ 65535,
Mystro256 fe5abf9
+    /* .MaxComputeWorkGroupSizeX = */ 1024,
Mystro256 fe5abf9
+    /* .MaxComputeWorkGroupSizeY = */ 1024,
Mystro256 fe5abf9
+    /* .MaxComputeWorkGroupSizeZ = */ 64,
Mystro256 fe5abf9
+    /* .MaxComputeUniformComponents = */ 1024,
Mystro256 fe5abf9
+    /* .MaxComputeTextureImageUnits = */ 16,
Mystro256 fe5abf9
+    /* .MaxComputeImageUniforms = */ 8,
Mystro256 fe5abf9
+    /* .MaxComputeAtomicCounters = */ 8,
Mystro256 fe5abf9
+    /* .MaxComputeAtomicCounterBuffers = */ 1,
Mystro256 fe5abf9
+    /* .MaxVaryingComponents = */ 60,
Mystro256 fe5abf9
+    /* .MaxVertexOutputComponents = */ 64,
Mystro256 fe5abf9
+    /* .MaxGeometryInputComponents = */ 64,
Mystro256 fe5abf9
+    /* .MaxGeometryOutputComponents = */ 128,
Mystro256 fe5abf9
+    /* .MaxFragmentInputComponents = */ 128,
Mystro256 fe5abf9
+    /* .MaxImageUnits = */ 8,
Mystro256 fe5abf9
+    /* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
Mystro256 fe5abf9
+    /* .MaxCombinedShaderOutputResources = */ 8,
Mystro256 fe5abf9
+    /* .MaxImageSamples = */ 0,
Mystro256 fe5abf9
+    /* .MaxVertexImageUniforms = */ 0,
Mystro256 fe5abf9
+    /* .MaxTessControlImageUniforms = */ 0,
Mystro256 fe5abf9
+    /* .MaxTessEvaluationImageUniforms = */ 0,
Mystro256 fe5abf9
+    /* .MaxGeometryImageUniforms = */ 0,
Mystro256 fe5abf9
+    /* .MaxFragmentImageUniforms = */ 8,
Mystro256 fe5abf9
+    /* .MaxCombinedImageUniforms = */ 8,
Mystro256 fe5abf9
+    /* .MaxGeometryTextureImageUnits = */ 16,
Mystro256 fe5abf9
+    /* .MaxGeometryOutputVertices = */ 256,
Mystro256 fe5abf9
+    /* .MaxGeometryTotalOutputComponents = */ 1024,
Mystro256 fe5abf9
+    /* .MaxGeometryUniformComponents = */ 1024,
Mystro256 fe5abf9
+    /* .MaxGeometryVaryingComponents = */ 64,
Mystro256 fe5abf9
+    /* .MaxTessControlInputComponents = */ 128,
Mystro256 fe5abf9
+    /* .MaxTessControlOutputComponents = */ 128,
Mystro256 fe5abf9
+    /* .MaxTessControlTextureImageUnits = */ 16,
Mystro256 fe5abf9
+    /* .MaxTessControlUniformComponents = */ 1024,
Mystro256 fe5abf9
+    /* .MaxTessControlTotalOutputComponents = */ 4096,
Mystro256 fe5abf9
+    /* .MaxTessEvaluationInputComponents = */ 128,
Mystro256 fe5abf9
+    /* .MaxTessEvaluationOutputComponents = */ 128,
Mystro256 fe5abf9
+    /* .MaxTessEvaluationTextureImageUnits = */ 16,
Mystro256 fe5abf9
+    /* .MaxTessEvaluationUniformComponents = */ 1024,
Mystro256 fe5abf9
+    /* .MaxTessPatchComponents = */ 120,
Mystro256 fe5abf9
+    /* .MaxPatchVertices = */ 32,
Mystro256 fe5abf9
+    /* .MaxTessGenLevel = */ 64,
Mystro256 fe5abf9
+    /* .MaxViewports = */ 16,
Mystro256 fe5abf9
+    /* .MaxVertexAtomicCounters = */ 0,
Mystro256 fe5abf9
+    /* .MaxTessControlAtomicCounters = */ 0,
Mystro256 fe5abf9
+    /* .MaxTessEvaluationAtomicCounters = */ 0,
Mystro256 fe5abf9
+    /* .MaxGeometryAtomicCounters = */ 0,
Mystro256 fe5abf9
+    /* .MaxFragmentAtomicCounters = */ 8,
Mystro256 fe5abf9
+    /* .MaxCombinedAtomicCounters = */ 8,
Mystro256 fe5abf9
+    /* .MaxAtomicCounterBindings = */ 1,
Mystro256 fe5abf9
+    /* .MaxVertexAtomicCounterBuffers = */ 0,
Mystro256 fe5abf9
+    /* .MaxTessControlAtomicCounterBuffers = */ 0,
Mystro256 fe5abf9
+    /* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
Mystro256 fe5abf9
+    /* .MaxGeometryAtomicCounterBuffers = */ 0,
Mystro256 fe5abf9
+    /* .MaxFragmentAtomicCounterBuffers = */ 1,
Mystro256 fe5abf9
+    /* .MaxCombinedAtomicCounterBuffers = */ 1,
Mystro256 fe5abf9
+    /* .MaxAtomicCounterBufferSize = */ 16384,
Mystro256 fe5abf9
+    /* .MaxTransformFeedbackBuffers = */ 4,
Mystro256 fe5abf9
+    /* .MaxTransformFeedbackInterleavedComponents = */ 64,
Mystro256 fe5abf9
+    /* .MaxCullDistances = */ 8,
Mystro256 fe5abf9
+    /* .MaxCombinedClipAndCullDistances = */ 8,
Mystro256 fe5abf9
+    /* .MaxSamples = */ 4,
Mystro256 fe5abf9
+    /* .maxMeshOutputVerticesNV = */ 256,
Mystro256 fe5abf9
+    /* .maxMeshOutputPrimitivesNV = */ 512,
Mystro256 fe5abf9
+    /* .maxMeshWorkGroupSizeX_NV = */ 32,
Mystro256 fe5abf9
+    /* .maxMeshWorkGroupSizeY_NV = */ 1,
Mystro256 fe5abf9
+    /* .maxMeshWorkGroupSizeZ_NV = */ 1,
Mystro256 fe5abf9
+    /* .maxTaskWorkGroupSizeX_NV = */ 32,
Mystro256 fe5abf9
+    /* .maxTaskWorkGroupSizeY_NV = */ 1,
Mystro256 fe5abf9
+    /* .maxTaskWorkGroupSizeZ_NV = */ 1,
Mystro256 fe5abf9
+    /* .maxMeshViewCountNV = */ 4,
Mystro256 fe5abf9
+
Mystro256 fe5abf9
+    /* .limits = */ {
Mystro256 fe5abf9
+        /* .nonInductiveForLoops = */ 1,
Mystro256 fe5abf9
+        /* .whileLoops = */ 1,
Mystro256 fe5abf9
+        /* .doWhileLoops = */ 1,
Mystro256 fe5abf9
+        /* .generalUniformIndexing = */ 1,
Mystro256 fe5abf9
+        /* .generalAttributeMatrixVectorIndexing = */ 1,
Mystro256 fe5abf9
+        /* .generalVaryingIndexing = */ 1,
Mystro256 fe5abf9
+        /* .generalSamplerIndexing = */ 1,
Mystro256 fe5abf9
+        /* .generalVariableIndexing = */ 1,
Mystro256 fe5abf9
+        /* .generalConstantMatrixVectorIndexing = */ 1,
Mystro256 fe5abf9
+  }};
Mystro256 fe5abf9
+
Mystro256 fe5abf9
+  return &limits;
Mystro256 fe5abf9
 }
Mystro256 fe5abf9
 
Mystro256 fe5abf9
 std::optional<SPIRVCodeVector> CompileVertexShader(std::string_view source_code)
Mystro256 7c5b312
-- 
Mystro256 fe5abf9
2.26.2
Mystro256 7c5b312