Skip to content

Commit

Permalink
Remove bundled shaderc
Browse files Browse the repository at this point in the history
  • Loading branch information
Benau committed Jan 3, 2023
1 parent 93613d8 commit 99bd8a3
Show file tree
Hide file tree
Showing 1,340 changed files with 32 additions and 478,502 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@ lib/harfbuzz
lib/sdl2
lib/mbedtls
lib/astc-encoder
lib/shaderc

.DS_Store
37 changes: 15 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,32 +260,23 @@ if(NOT SERVER_ONLY)
endif()

if(NOT SERVER_ONLY)
find_library(SHADERC_LIBRARY NAMES shaderc_shared libshaderc_shared)
if (IOS)
find_library(SHADERC_LIBRARY NAMES shaderc_combined libshaderc_combined)
else()
find_library(SHADERC_LIBRARY NAMES shaderc_shared libshaderc_shared)
endif()
find_path(SHADERC_INCLUDEDIR NAMES shaderc/shaderc.hpp PATHS)
if (NOT SHADERC_LIBRARY OR NOT SHADERC_INCLUDEDIR)
set(SHADERC_SKIP_INSTALL ON CACHE INTERNAL "Skip installation" FORCE)
set(SHADERC_SKIP_TESTS ON CACHE INTERNAL "Skip building tests" FORCE)
set(SHADERC_SKIP_EXAMPLES ON CACHE INTERNAL "Skip building examples" FORCE)
set(SHADERC_SKIP_COPYRIGHT_CHECK ON CACHE INTERNAL "Skip copyright check" FORCE)

set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE INTERNAL "Skip install" FORCE)
set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE INTERNAL "Skip building examples" FORCE)

set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE INTERNAL "Skip installation" FORCE)
set(SPIRV_SKIP_TESTS ON CACHE INTERNAL "Skip tests" FORCE)
set(SPIRV_SKIP_EXECUTABLES ON CACHE INTERNAL "Skip executables" FORCE)

set(ENABLE_GLSLANG_BINARIES OFF CACHE INTERNAL "Builds glslangValidator and spirv-remap" FORCE)
set(ENABLE_CTEST OFF CACHE INTERNAL "Enable ctest" FORCE)

add_subdirectory("${PROJECT_SOURCE_DIR}/lib/shaderc")
include_directories(BEFORE "${PROJECT_SOURCE_DIR}/lib/shaderc/libshaderc/include")
SET(SHADERC_LIBRARY shaderc)
message(STATUS "System shaderc not found, use the bundled one.")
if (NOT NO_SHADERC)
message(FATAL_ERROR "Please install shaderc from your distribution or disable vulkan support with -DNO_SHADERC=on")
endif()
else()
include_directories("${SHADERC_INCLUDEDIR}")
MESSAGE(STATUS "Use system shaderc: ${SHADERC_LIBRARY}")
endif()
if (NO_SHADERC)
add_definitions(-DDISABLE_SHADERC)
endif()

add_subdirectory("${PROJECT_SOURCE_DIR}/lib/graphics_engine")
endif()
Expand Down Expand Up @@ -774,8 +765,10 @@ if(NOT SERVER_ONLY)
graphics_utils
graphics_engine
${SDL2_LIBRARY}
tinygettext
${SHADERC_LIBRARY})
tinygettext)
if (NOT NO_SHADERC)
target_link_libraries(supertuxkart ${SHADERC_LIBRARY})
endif()
endif()

if(UNIX AND NOT APPLE)
Expand Down
2 changes: 2 additions & 0 deletions cmake/Toolchain-ios-xcode.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ set(MOLTENVK_LIBRARY ${PROJECT_SOURCE_DIR}/dependencies\${EFFECTIVE_PLATFORM_NAM
set(VULKAN_INCLUDEDIR ${PROJECT_SOURCE_DIR}/dependencies-iphoneos/include CACHE STRING "")
set(LIBASTCENC_LIBRARY ${PROJECT_SOURCE_DIR}/dependencies\${EFFECTIVE_PLATFORM_NAME}/lib/libastcenc.a CACHE STRING "")
set(LIBASTCENC_INCLUDEDIR ${PROJECT_SOURCE_DIR}/dependencies-iphoneos/include CACHE STRING "")
set(SHADERC_LIBRARY ${PROJECT_SOURCE_DIR}/dependencies\${EFFECTIVE_PLATFORM_NAME}/lib/libshaderc_combined.a CACHE STRING "")
set(SHADERC_INCLUDEDIR ${PROJECT_SOURCE_DIR}/dependencies-iphoneos/include CACHE STRING "")

# For universal iOS and simulator
set(LIBRESOLV_LIBRARY -lresolv CACHE STRING "")
Expand Down
8 changes: 8 additions & 0 deletions lib/graphics_engine/src/ge_vulkan_shader_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ std::map<std::string, std::pair<GESpinLock, VkShaderModule>* > g_shaders;
} // GEVulkanShaderManager

// ============================================================================
#ifndef DISABLE_SHADERC
shaderc_include_result* showError(const char* message)
{
shaderc_include_result* err = new shaderc_include_result;
Expand All @@ -44,6 +45,7 @@ shaderc_include_result* showError(const char* message)
err->user_data = NULL;
return err;
} // showError
#endif

// ============================================================================
void GEVulkanShaderManager::init(GEVulkanDriver* vk)
Expand Down Expand Up @@ -90,6 +92,7 @@ void GEVulkanShaderManager::destroy()
// ----------------------------------------------------------------------------
void GEVulkanShaderManager::loadAllShaders()
{
#ifndef DISABLE_SHADERC
irr::io::IFileList* files = g_file_system->createFileList(
getShaderFolder().c_str());
for (unsigned i = 0; i < files->getFileCount(); i++)
Expand Down Expand Up @@ -122,12 +125,16 @@ void GEVulkanShaderManager::loadAllShaders()
});
}
files->drop();
#endif
} // loadAllShaders

// ----------------------------------------------------------------------------
VkShaderModule GEVulkanShaderManager::loadShader(shaderc_shader_kind kind,
const std::string& name)
{
#ifdef DISABLE_SHADERC
return VK_NULL_HANDLE;
#else
std::string shader_fullpath = getShaderFolder() + name;
irr::io::IReadFile* r = irr::io::createReadFile(shader_fullpath.c_str());
if (!r)
Expand Down Expand Up @@ -238,6 +245,7 @@ VkShaderModule GEVulkanShaderManager::loadShader(shaderc_shader_kind kind,
shaderc_result_release(result);
shaderc_compiler_release(compiler);
return shader_module;
#endif
} // loadShader

// ----------------------------------------------------------------------------
Expand Down
6 changes: 5 additions & 1 deletion lib/graphics_engine/src/ge_vulkan_shader_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

#include "vulkan_wrapper.h"
#include <string>
#include <shaderc/shaderc.h>
#ifdef DISABLE_SHADERC
#define shaderc_shader_kind int
#else
#include <shaderc/shaderc.h>
#endif

namespace GE
{
Expand Down
5 changes: 0 additions & 5 deletions lib/shaderc/.clang-format

This file was deleted.

9 changes: 0 additions & 9 deletions lib/shaderc/AUTHORS

This file was deleted.

76 changes: 0 additions & 76 deletions lib/shaderc/Android.mk

This file was deleted.

101 changes: 0 additions & 101 deletions lib/shaderc/BUILD.gn

This file was deleted.

Loading

0 comments on commit 99bd8a3

Please sign in to comment.