Remove bundled shaderc

This commit is contained in:
Benau 2023-01-03 10:01:41 +08:00
parent 93613d884e
commit 99bd8a338a
1340 changed files with 32 additions and 478502 deletions

1
.gitignore vendored
View File

@ -90,5 +90,6 @@ lib/harfbuzz
lib/sdl2
lib/mbedtls
lib/astc-encoder
lib/shaderc
.DS_Store

View File

@ -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()
@ -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)

View File

@ -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 "")

View File

@ -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;
@ -44,6 +45,7 @@ shaderc_include_result* showError(const char* message)
err->user_data = NULL;
return err;
} // showError
#endif
// ============================================================================
void GEVulkanShaderManager::init(GEVulkanDriver* vk)
@ -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++)
@ -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)
@ -238,6 +245,7 @@ VkShaderModule GEVulkanShaderManager::loadShader(shaderc_shader_kind kind,
shaderc_result_release(result);
shaderc_compiler_release(compiler);
return shader_module;
#endif
} // loadShader
// ----------------------------------------------------------------------------

View File

@ -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
{

View File

@ -1,5 +0,0 @@
---
# Use Google code formatting rules.
Language: Cpp
BasedOnStyle: Google
...

View File

@ -1,9 +0,0 @@
# This is the official list of shaderc authors for copyright purposes.
# This file is distinct from the CONTRIBUTORS files.
# See the latter for an explanation.
# Names should be added to this file as:
# Name or Organization <email address>
# The email address is not required for organizations.
Google Inc.

View File

@ -1,76 +0,0 @@
# Copyright 2020 The Shaderc Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ROOT_SHADERC_PATH := $(call my-dir)
include $(ROOT_SHADERC_PATH)/third_party/Android.mk
include $(ROOT_SHADERC_PATH)/libshaderc_util/Android.mk
include $(ROOT_SHADERC_PATH)/libshaderc/Android.mk
ALL_LIBS:=libglslang.a \
libOGLCompiler.a \
libOSDependent.a \
libshaderc.a \
libshaderc_util.a \
libSPIRV.a \
libHLSL.a \
libSPIRV-Tools.a \
libSPIRV-Tools-opt.a
SHADERC_HEADERS=shaderc.hpp shaderc.h env.h status.h visibility.h
SHADERC_HEADERS_IN_OUT_DIR=$(foreach H,$(SHADERC_HEADERS),$(NDK_APP_LIBS_OUT)/../include/shaderc/$(H))
define gen_libshaderc_header
$(NDK_APP_LIBS_OUT)/../include/shaderc/$(1) : \
$(ROOT_SHADERC_PATH)/libshaderc/include/shaderc/$(1)
$(call host-mkdir,$(NDK_APP_LIBS_OUT)/../include/shaderc)
$(call host-cp,$(ROOT_SHADERC_PATH)/libshaderc/include/shaderc/$(1) \
,$(NDK_APP_LIBS_OUT)/../include/shaderc/$(1))
endef
define gen_libshaderc
$(1)/combine.ar: $(addprefix $(1)/, $(ALL_LIBS))
@echo "create libshaderc_combined.a" > $(1)/combine.ar
$(foreach lib,$(ALL_LIBS),
@echo "addlib $(lib)" >> $(1)/combine.ar
)
@echo "save" >> $(1)/combine.ar
@echo "end" >> $(1)/combine.ar
$(1)/libshaderc_combined.a: $(addprefix $(1)/, $(ALL_LIBS)) $(1)/combine.ar
@echo "[$(TARGET_ARCH_ABI)] Combine: libshaderc_combined.a <= $(ALL_LIBS)"
@cd $(1) && $(TARGET_AR) -M < combine.ar && cd $(ROOT_SHADERC_PATH)
@$(TARGET_STRIP) --strip-debug $(1)/libshaderc_combined.a
$(NDK_APP_LIBS_OUT)/$(APP_STL)/$(TARGET_ARCH_ABI)/libshaderc.a: \
$(1)/libshaderc_combined.a
$(call host-mkdir,$(NDK_APP_LIBS_OUT)/$(APP_STL)/$(TARGET_ARCH_ABI))
$(call host-cp,$(1)/libshaderc_combined.a \
,$(NDK_APP_LIBS_OUT)/$(APP_STL)/$(TARGET_ARCH_ABI)/libshaderc.a)
ifndef HEADER_TARGET
HEADER_TARGET=1
$(eval $(foreach H,$(SHADERC_HEADERS),$(call gen_libshaderc_header,$(H))))
endif
libshaderc_combined: \
$(NDK_APP_LIBS_OUT)/$(APP_STL)/$(TARGET_ARCH_ABI)/libshaderc.a
endef
libshaderc_combined: $(SHADERC_HEADERS_IN_OUT_DIR)
$(eval $(call gen_libshaderc,$(TARGET_OUT)))

View File

@ -1,101 +0,0 @@
# Copyright 2018 The Shaderc Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/build.gni")
import("//build_overrides/shaderc.gni")
glslang_dir = shaderc_glslang_dir
spirv_tools_dir = shaderc_spirv_tools_dir
config("shaderc_util_public") {
include_dirs = [ "libshaderc_util/include" ]
}
source_set("shaderc_util_sources") {
sources = [
"libshaderc_util/include/libshaderc_util/counting_includer.h",
"libshaderc_util/include/libshaderc_util/exceptions.h",
"libshaderc_util/include/libshaderc_util/file_finder.h",
"libshaderc_util/include/libshaderc_util/format.h",
"libshaderc_util/include/libshaderc_util/io_shaderc.h",
"libshaderc_util/include/libshaderc_util/message.h",
"libshaderc_util/include/libshaderc_util/mutex.h",
"libshaderc_util/include/libshaderc_util/resources.h",
"libshaderc_util/include/libshaderc_util/spirv_tools_wrapper.h",
"libshaderc_util/include/libshaderc_util/string_piece.h",
"libshaderc_util/include/libshaderc_util/universal_unistd.h",
"libshaderc_util/include/libshaderc_util/version_profile.h",
"libshaderc_util/src/compiler.cc",
"libshaderc_util/src/file_finder.cc",
"libshaderc_util/src/io_shaderc.cc",
"libshaderc_util/src/message.cc",
"libshaderc_util/src/resources.cc",
"libshaderc_util/src/shader_stage.cc",
"libshaderc_util/src/spirv_tools_wrapper.cc",
"libshaderc_util/src/version_profile.cc",
]
# Configure Glslang's interface to include HLSL-related entry points.
defines = [ "ENABLE_HLSL=1" ]
public_configs = [ ":shaderc_util_public" ]
deps = [
"${glslang_dir}:glslang_sources",
"${spirv_tools_dir}:spvtools",
]
if (build_with_chromium) {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
}
config("shaderc_public") {
include_dirs = [ "libshaderc/include" ]
if (is_component_build) {
defines = [ "SHADERC_SHAREDLIB" ]
}
}
component("libshaderc") {
public_configs = [
":shaderc_public",
":shaderc_util_public",
]
defines = [ "SHADERC_IMPLEMENTATION" ]
sources = [
"libshaderc/include/shaderc/env.h",
"libshaderc/include/shaderc/shaderc.h",
"libshaderc/include/shaderc/shaderc.hpp",
"libshaderc/include/shaderc/status.h",
"libshaderc/include/shaderc/visibility.h",
"libshaderc/src/shaderc.cc",
"libshaderc/src/shaderc_private.h",
]
deps = [
":shaderc_util_sources",
"${spirv_tools_dir}:spvtools",
"${spirv_tools_dir}:spvtools_val",
"${glslang_dir}:glslang_sources",
]
if (build_with_chromium) {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
}

View File

@ -1,304 +0,0 @@
Revision history for Shaderc
v2022.1 2022-01-27
- Update DEPS to include two fixes on top of SPIRV-Tools v2022.1:
- Validator handles Nontemporal image operand
- Optimizer handles RayQueryKHR type
v2022.0 2022-01-27
- Update to Glslang 11.8.0
v2021.4 2022-01-27
- Support Vulkan 1.3
- Support targeting SPIR-V 1.6, which is the default for Vulkan 1.3
- Updated copyright check: Excludes Glslang generated files when
building in source tree
- Fix Android.mk rules for building libshaderc_combined, to adapt to more
recent NDKs that have removed the GNU binutils.
v2021.3 2021-11-11
- Add build switch to disable copyright check
- Update DEPS:
- SPIRV-Tools v2021.4
- SPIRV-Headers GitHub master 2021-11-11
- Glslang GitHub master 2021-11-11
v2021.2 2021-08-25
- README: Mention Common Lisp bindings (external)
- Update DEPS:
- SPIRV-Tools v2021.3
- SPIRV-Headers master 2021-08-25
- Glslang GitHub master 2021-08-25
v2021.1 2021-06-21
- Disable --target-env=opengl_compat with an explicit error message
- It has been deprecated for a long time.
v2021.0 2021-04-21
- Refresh dependencies (in DEPS):
- SPIRV-Tools v2021.1
- SPIRV-Headers snapshot 2021-04-21
- Glslang 11.2.0, snapshot 2021-04-21
- Fixes:
#1174: Windows Bazel support: rename internal headers io.* to io_shaderc.*
v2020.5 2021-02-19
- Refresh dependencies (in DEPS):
- SPIRV-Tools v2020.7 + 1 patch
- Glslang 11.1.0
- Add option to skip building examples
- Fixes:
#1153: Improve file+line parsing from Glslang messages
v2020.4 2020-12-09
- Removed svpc
- Fixed issues with embedders getting duplicate symbols
- Converted C-style casts to static_cast
- Rolled ahead to fix/pickup Vulkan Raytracing support
v2020.3 2020-09-02
- General:
- Last release with spvc
- Cleaned up issues discovered by Infer
- spvc:
- Added support for Dawn using deprecated Options constructor
- Adding support for the additional fixed sample mask in MSL
v2020.2 2020-07-23
- General:
- Remove VS2013 support
- Support both posix and non-posix MinGW toolchains
- Support optionally building Tint tooling for WGSL
- Add -h option to glslc, spvc; same as --help
- Add source file license checker
- BUILD.gn improvements
- glslc, libshaderc:
- Update to Glslang generator 9
- Add interface to support 16bit types in HLSL
- Add glslc hidden experimental option -mfmt=wgsl; requires Tint
- spvc:
- Add minimum buffer size for Dawn reflection
v2020.1 2020-06-09
This is the last version that officially supports VS2013.
- General:
- Added warning signs about unsupported downloads (#1041)
- Added .NET bindings to README.md (#1060)
- Only add -fPIC if supported by the compiler. (#1061)
- glslc, libshaderc:
- Removed Singleton pattern around access to glslang (#1059)
- spvc:
- Added concept of comparison sampler to API (#1036)
- Added support for options.hlsl.nonwritable_uav_texture_as_srv (#1048)
- Support forcing storage buffers to be always declared as UAV. (#1076)
v2020.0 2020-03-06
- General:
- Getting spirv.hpp from SPIRV-Headers instead of not glslang (#992)
- Added clarification about status of artifacts in downloads.md (#1012)
- glslc, libshaderc:
- Added support for new Glslang profile enum, EProfileCount (#973)
- Updated user documentation for -S in glslc (#978)
- Add documentation for Vulkan 1.2 and SPIR-V 1.5 (#980)
- Removed NV_EXTENSIONS conditionals (#1003)
- Added support for generating WebGPU SPIR-V to libshaderc (#1021)
- Rolled in all DEPS for provisional SPIR-V extensions for raytracing
- spvc:
- Normalized API behaviour (#967)
- Added source_set target for libshaderc_spvc (#976)
- Added in support for spvc logging to the terminal (#981)
- Internal refactoring to reduce boiler plate in API implementations (#984)
- Added newline to logging messages to make them readable (#985)
- Added reflection support for Dawn:
- storage textures (#1001)
- storage texture format (#1005)
- texture dimension for storage textures (#1008)
- is storage texture declared as multisampled texture (#1011)
- Converted compile options to require explicit environments (#1019)
- Added knob to control force_zero_initialized_variables in SPIRV-Cross (#1028)
v2019.1 2020-01-22
- glslc, libshaderc:
- Add -fnan-clamp: Generate code for max and min builtins so that,
given a NaN operand, will return the other operand. Similarly, the
clamp builtin favours non-NaN operands, as if clamp was implemented
as the composition of max and min.
- Add -finvert-y
- Using SetBeforeHlslLegalization for more relaxed validation rules
- Added support for SPIR-V 1.5
- Add --emit-line-directive option
- Added support for Vulkan 1.2
- spvc:
- Add many options:
--flatten-multidimensional-arrays
--es
--no-es
--glsl-emit-push-constant-as-ubo
--msl-swizzle-texture-samples
--msl-platform=ios|macos
--msl-pad-fragment-output
--msl-capture-output
--msl-domain-lower-left
--msl-argument-buffers
--msl-discrete-descriptor-set=<number>
--hlsl-enable-compat
- Reintroduce shaderc_spvc_compile_options_set_shader_model
- Added option to inject robust buffer access code
- Added support for emitting ToVulkan shaders
- Added spirv-opt based IR generation as alternative to built in spirv_cross IR gen
- Added API for specifying source and target execution environments
- Added option & reflection API methods neede by Dawn
- Substantial internal refactoring and code cleanup
- Large number of breaking changes to the API
- Replaced shaderc_spvc_compile_options_set_shader_model with
shaderc_spvc_compile_options_set_hlsl_shader_model
- Compiler initialization and shader generation moved into seperate calls
- Seperated return codes from shaderc ones
- Many small API changes
- Improvements to testing
- Refactoring and clean up of run_spirv_cross_tests.py
- Seperation of expectations into known failures, known invalids, and cases
that need investigation
- Tweaks and fixes to substantially increase passing cases
- Added support for running tests using spvc IR generation
- Infrastructure
- Update DEPS with cross-verified commits from associated repos.
- Add utils/roll-deps
- Infrastructure:
- Removed Appveyor artifacts link
- Improvements and clean up of DEPS rolling scripts
- Enabled warnings about implicit fallthrough
- Enabled improper semicolon warnings
- Restricted -fPIC to platforms that support it
- Converted remaining scripts to use Python 3
- Replaced nosetest with unittest
- Removed assumptions aabout location of spirv-tools, effcee, and RE2
- Migrated BUILD.gn spirv_cross dependency to local repo
- Fixes:
- Fix duplicate install paths when using VisualStudio
- Fixed BUILD.gn for Chromium, Dawn & Fuchsia
- Explicitly enabled HLSL support in glslang
- Added installing necessary headers in Android.mk
- Removed unsupported Unicode characters
- Fixed detection of spirv-headers directory
#666: Update Docker file to use Python3
v2019.0 2019-06-04
- Add optional spvc, libshaderc_spvc as wrapper around SPIRV-Cross:
- Rejects bad modules by running the SPIR-V validator first
- Skips exception-heavy SPIRV-Cross SPIR-V parser
- Support NV extensions for shader stages
- Require SPIRV-Tools and SPIRV-Headers with SPIR-V 1.4 support
Build support:
- Use KhronosGroup/glslang instead of google/glslang
- Stop running tests on VS 2013 (googletest no longer supports VS2013)
- Require Python3 for building
- Support Chromium's GN build system
- Kokoro build fixes
- Cmake build fixes: Only build subdirs if those targets are not yet defined
- Use Android.mk from Glslang
- Dockerfile gets re2 and effcee sources
- Fixes for newer googletest
- Add address sanitizer presubmit bot
- Generate config files for pkg-config
Spvc:
- Add option to specify source environment. Spvc will transform from source
to target environment if they are different. This only works for WebGPU0
and Vulkan 1.1.
Fixes:
#499: In HLSL compilation, relax layout and logical pointer validation rules
prior to running the legalization recipe.
v2018.0 2018-10-01
- Support -fhlsl_functionality1 (also -fhlsl-functionality1)
- Support NVIDIA Turing extensions. Requires updated Glslang and SPIRV-Tools.
- Use SPIR-V optimization and HLSL legalization recipes from SPIRV-Tools.
- Pass target environment into SPIRV-Tools code, e.g. from --target-env vulkan1.1
- Add SONAME=1 property to shared library
- Support GN build for Chromium
Fixes:
#469: Add virtual dtor to classes with virtual functions.
#457: Fix writing SPIR-V binaries to standard output on Windows.
v2017.2 2018-02-27
- Add a shared library version of libshaderc
- Support GLSL 4.6 and ESSL 3.2
- Fail compilation if a resource does not have a binding.
- Add options for automatically setting bindings for (uniform) resources that
don't have bindings set in shader source.
- Add options for automatically setting locations for pipline inputs and outputs.
- Add option for using HLSL IO mappings as expressed in source.
- Add options for setting resource binding base numbers.
- Add option to use HLSL resource register numbers for bindings.
- HLSL compilation now defaults to HLSL packing rules.
(This change is inherited from Glslang commit 7cca140.)
- HLSL compilation runs SPIR-V "legalization" transforms to reduce
manipulation of opaque handles (e.g. images), to satisfy Vulkan rules.
- Adapt to Glslang generator version numbers:
- To 2: a fix for code generation for atomicCounterDecrement.
- To 3: change memory barrier semantics masks
- To 4: generate more access chains for swizzles
- CMake install rules uses GNUInstallDirs. For example, install to lib64
when that is the norm for the target system.
v2017.1 2017-03-10
- Add option to automatically assign bindings to uniform variables
that don't have an explicit 'binding' layout in the shader source.
- Enable NVIDIA extensions by default in GLSL compilation
- README mentions language bindings provided by 3rd parties.
- README describes the known-good branch on GitHub
- Fixed examples in shaderc.h; added C API use to examples/online-compile
- Fixes issues:
#289: Don't output an object file when compilation fails.
#296: Enable use of the CMake in Android Studio.
v2016.2 2016-12-13
- Describe Shaderc's level of stability.
- Support HLSL compilation, exposing functionality in Glslang.
- Supported in C, C++ API
- glslc accepts "-x hlsl", and assumes .hlsl files are HLSL.
- glslc accepts "-fentry-point=<name>" to set entry point name,
overriding default value "main".
- Support setting shader resource limits in C, C++ APIs, and in
glslc
- glslc adds -flimit=<setting>
- glslc adds --show-limits to display defaults and valid resource
limit syntax.
- glslc adds "-flimit-file <file>" support to read Glslang resource
configuration files, i.e. the output of "glslangValidator -c".
- Enable AMD extensions by default in GLSL compilation
- Fixes issues:
#281: Work around Android build issue with abspath on Windows
#283: Increase default maxDrawBuffers to 4, to match Vulkan/GLES3.0
v2016.1 2016-10-12
- C API for assembling now takes an options object
- Support compilation options to optimize for size.
- Maintain compatibility with recent SPIRV-Tools and Glslang versions.
- Update examples.
- Build cleanups.
- Fixes issues:
#238: Fix invocation of python scripts during build
v2016.0 2016-07-07
- Adds v<year>.<index> versioning, with "-dev" suffix to indicate work in
progress. The intent is to summarize and report functionalities more easily
for incorporating into downstream projects.
- Summary of functionalities (See the README.md for more details):
- Provides libraries and command line tools for generating SPIR-V modules
- Supports GLSL source code or SPIR-V assembly as input
- Supports SPIR-V binary or assembly text as output
- Command line options follow GCC/Clang conventions
- Supports various semantics (OpenGL, OpenGL Compatible and Vulkan)
- Supports #include
- Supports user-defined macros
- Supports dependency information dumping

View File

@ -1,165 +0,0 @@
# Copyright 2020 The Shaderc Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 2.8.12)
project(shaderc)
enable_testing()
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
message(STATUS "No build type selected, default to Debug")
set(CMAKE_BUILD_TYPE "Debug")
endif()
message(STATUS "Shaderc: build type is \"${CMAKE_BUILD_TYPE}\".")
option(SHADERC_ENABLE_WGSL_OUTPUT "Enable WGSL output" OFF)
option(SHADERC_SKIP_INSTALL "Skip installation" ${SHADERC_SKIP_INSTALL})
if(NOT ${SHADERC_SKIP_INSTALL})
set(SHADERC_ENABLE_INSTALL ON)
endif()
option(SHADERC_SKIP_TESTS "Skip building tests" ${SHADERC_SKIP_TESTS})
if(NOT ${SHADERC_SKIP_TESTS})
set(SHADERC_ENABLE_TESTS ON)
endif()
if(${SHADERC_ENABLE_TESTS})
message(STATUS "Configuring Shaderc to build tests.")
else()
message(STATUS "Configuring Shaderc to avoid building tests.")
endif()
option(SHADERC_SKIP_EXAMPLES "Skip building examples" ${SHADERC_SKIP_EXAMPLES})
if(NOT ${SHADERC_SKIP_EXAMPLES})
set(SHADERC_ENABLE_EXAMPLES ON)
endif()
if(${SHADERC_ENABLE_EXAMPLES})
message(STATUS "Configuring Shaderc to build examples.")
else()
message(STATUS "Configuring Shaderc to avoid building examples.")
endif()
option(SHADERC_SKIP_COPYRIGHT_CHECK "Skip copyright check" ${SHADERC_SKIP_COPYRIGHT_CHECK})
if(NOT ${SHADERC_SKIP_COPYRIGHT_CHECK})
set(SHADERC_ENABLE_COPYRIGHT_CHECK ON)
endif()
if(${SHADERC_ENABLE_COPYRIGHT_CHECK})
message(STATUS "Configuring Shaderc to check copyrights.")
else()
message(STATUS "Configuring Shaderc to avoid checking copyrights.")
endif()
option(SHADERC_ENABLE_WERROR_COMPILE "Enable passing -Werror to compiler, if available" ON)
set (CMAKE_CXX_STANDARD 11)
include(GNUInstallDirs)
include(cmake/setup_build.cmake)
include(cmake/utils.cmake)
include(CheckCXXCompilerFlag)
set(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS ${DISABLE_EXCEPTIONS} CACHE BOOL "Coupling SPIRV-Cross exception conversion to DISABLE_EXCEPTIONS" FORCE)
if(DISABLE_EXCEPTIONS)
# Need to set additional values here, since some of the wrapped code occurs in
# .h/.hpp files, so maybe included outside of the library.
add_definitions(-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
endif()
# These flags are not supported on Windows and some older version of GCC
# that our bots use.
# Warning about implicit fallthrough in switch blocks
check_cxx_compiler_flag(-Wimplicit-fallthrough COMPILER_SUPPORTS_FALLTHROUGH_WARNING)
if (COMPILER_SUPPORTS_FALLTHROUGH_WARNING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wimplicit-fallthrough")
endif()
# Warning about extra semi-colons
check_cxx_compiler_flag(-Wextra-semi COMPILER_SUPPORTS_EXTRA_SEMI_WARNING)
if (COMPILER_SUPPORTS_EXTRA_SEMI_WARNING)
add_compile_options("-Wextra-semi")
endif()
find_host_package(PythonInterp 3 REQUIRED)
if (SHADERC_ENABLE_COPYRIGHT_CHECK)
add_custom_target(check-copyright ALL
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py
--check
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Check copyright")
endif()
add_custom_target(add-copyright
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Add copyright")
if(MSVC)
option(SHADERC_ENABLE_SHARED_CRT
"Use the shared CRT instead of the static CRT"
${SHADERC_ENABLE_SHARED_CRT})
if (NOT SHADERC_ENABLE_SHARED_CRT)
# Link executables statically by replacing /MD with /MT everywhere.
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
endif(NOT SHADERC_ENABLE_SHARED_CRT)
endif(MSVC)
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
add_subdirectory(third_party)
add_subdirectory(libshaderc_util)
add_subdirectory(libshaderc)
if(${SHADERC_ENABLE_EXAMPLES})
add_subdirectory(examples)
endif()
add_custom_target(build-version
${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py
${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc
COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).")
function(define_pkg_config_file NAME LIBS)
add_custom_target(${NAME}-pkg-config ALL
COMMAND ${CMAKE_COMMAND}
-DCHANGES_FILE=${CMAKE_CURRENT_SOURCE_DIR}/CHANGES
-DTEMPLATE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/${NAME}.pc.in
-DOUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/${NAME}.pc
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DLIBS=${LIBS}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake
DEPENDS "CHANGES" "cmake/${NAME}.pc.in" "cmake/write_pkg_config.cmake")
if (SHADERC_ENABLE_INSTALL)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${NAME}.pc
DESTINATION
${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
endfunction()
define_pkg_config_file(shaderc -lshaderc_shared)
define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util")
define_pkg_config_file(shaderc_combined -lshaderc_combined)

View File

@ -1,25 +0,0 @@
Want to contribute? Great! First, read this page (including the small print at
the end). Then, have a look at [`DEVELOPMENT.howto.md`](DEVELOPMENT.howto.md),
which contains useful info to guide you along the way.
## Before you contribute
Before we can use your code, you must sign the
[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
(CLA), which you can do online. The CLA is necessary mainly because you own the
copyright to your changes, even after your contribution becomes part of our
codebase, so we need your permission to use and distribute your code. We also
need to be sure of various other things -- for instance that you'll tell us if
you know that your code infringes on other people's patents. You don't have to
sign the CLA until after you've submitted your code for review and a member has
approved it, but you must do it before we can put your code into our codebase.
Before you start working on a larger contribution, you should get in touch with
us first through the issue tracker with your idea so that we can help out and
possibly guide you. Coordinating up front makes it much easier to avoid
frustration later on.
## The small print
Contributions made by corporations are covered by a different agreement than
the one above, the Software Grant and Corporate Contributor License Agreement.

View File

@ -1,24 +0,0 @@
# People who have agreed to one of the CLAs and can contribute patches.
# The AUTHORS file lists the copyright holders; this file
# lists people. For example, Google employees are listed here
# but not in AUTHORS, because Google holds the copyright.
#
# https://developers.google.com/open-source/cla/individual
# https://developers.google.com/open-source/cla/corporate
#
# Names should be added to this file as:
# Name <email address>
Lei Zhang <antiagainst@google.com>
David Neto <dneto@google.com>
Andrew Woloszyn <awoloszyn@google.com>
Stefanus Du Toit <sdt@google.com>
Dejan Mircevski <deki@google.com>
Mark Adams <marka@nvidia.com>
Jason Ekstrand <jason.ekstrand@intel.com>
Damien Mabin <dmabin@google.com>
Qining Lu <qining@google.com>
Jakob Vogel <JakobpunktVogel@gmail.com>
David Yen <dyen@google.com>
Adam Chainz <adam@adamj.eu>
Robin Quint <robin.quint@outlook.com>

View File

@ -1,33 +0,0 @@
use_relative_paths = True
vars = {
'google_git': 'https://github.com/google',
'khronos_git': 'https://github.com/KhronosGroup',
'effcee_revision' : '2ec8f8738118cc483b67c04a759fee53496c5659',
'glslang_revision': 'c34bb3b6c55f6ab084124ad964be95a699700d34',
'googletest_revision': '389cb68b87193358358ae87cc56d257fd0d80189',
're2_revision': '7107ebc4fbf7205151d8d2a57b2fc6e7853125d4',
'spirv_headers_revision': 'b42ba6d92faf6b4938e6f22ddd186dbdacc98d78',
'spirv_tools_revision': 'b846f8f1dc2d79f2b5ce27d5ad901f885da1cf82',
}
deps = {
'third_party/effcee': Var('google_git') + '/effcee.git@' +
Var('effcee_revision'),
'third_party/googletest': Var('google_git') + '/googletest.git@' +
Var('googletest_revision'),
'third_party/glslang': Var('khronos_git') + '/glslang.git@' +
Var('glslang_revision'),
'third_party/re2': Var('google_git') + '/re2.git@' +
Var('re2_revision'),
'third_party/spirv-headers': Var('khronos_git') + '/SPIRV-Headers.git@' +
Var('spirv_headers_revision'),
'third_party/spirv-tools': Var('khronos_git') + '/SPIRV-Tools.git@' +
Var('spirv_tools_revision'),
}

View File

@ -1,52 +0,0 @@
Thank you for considering Shaderc development! Please make sure you review
[`CONTRIBUTING.md`](CONTRIBUTING.md) for important preliminary info.
## Building
Instructions for first-time building can be found in [`README.md`](README.md).
Incremental build after a source change can be done using `ninja` (or
`cmake --build`) and `ctest` exactly as in the first-time procedure.
## Code reviews
(Terminology: we consider everyone with write access to our GitHub repo a
project _member_.)
All submissions, including submissions by project members, require review. We
use GitHub pull requests to facilitate the review process. A submission may be
accepted by any project member (other than the submitter), who will then squash
the changes into a single commit and cherry-pick them into the repository.
Before accepting, there may be some review feedback prompting changes in the
submission. You should expect reviewers to strictly insist on the
[commenting](https://google.github.io/styleguide/cppguide.html#Comments)
guidelines -- in particular, every file, class, method, data member, and global
will require a comment. Reviewers will also expect to see test coverage for
every code change. _How much_ coverage will be a judgment call on a
case-by-case basis, balancing the required effort against the incremental
benefit. Coverage will be expected. As a matter of development philosophy,
we will strive to engineer the code to make writing tests easy.
## Coding style
For our C++ files, we use the
[Google C++ style guide](https://google.github.io/styleguide/cppguide.html).
(Conveniently, the formatting rules it specifies can be achieved using
`clang-format -style=google`.)
For our Python files, we use the
[Google Python style guide](https://google.github.io/styleguide/pyguide.html).
## Supported platforms
We expect Shaderc to always build and test successfully on the platforms listed
below. Please keep that in mind when offering contributions. This list will
likely grow over time.
| Platform | Build Status |
|:--------:|:------------:|
| Android (ARMv7) | Not Automated |
| Linux (x86_64) | [![Linux Build Status](https://travis-ci.org/google/shaderc.svg)](https://travis-ci.org/google/shaderc "Linux Build Status") |
| Mac OS X | [![Mac Build Status](https://travis-ci.org/google/shaderc.svg)](https://travis-ci.org/google/shaderc "Mac Build Status") |
| Windows (x86_64) | [![Windows Build status](https://ci.appveyor.com/api/projects/status/g6c372blna7vnk1l?svg=true)](https://ci.appveyor.com/project/dneto0/shaderc "Windows Build Status") |

View File

@ -1,50 +0,0 @@
# Copyright 2016 The Shaderc Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM alpine
MAINTAINER Google Shaderc Team
RUN apk add --update \
build-base \
cmake \
git \
ninja \
python3 \
py-pip \
&& rm -rf /var/cache/apk/*
WORKDIR /root
RUN git clone https://github.com/google/shaderc
WORKDIR shaderc
RUN ./utils/git-sync-deps
WORKDIR build
RUN cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
.. \
&& ninja install
WORKDIR /root
RUN rm -rf shaderc
RUN adduser -s /bin/sh -D shaderc
USER shaderc
VOLUME /code
WORKDIR /code
CMD ["/bin/sh"]

View File

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,262 +0,0 @@
# Shaderc
A collection of tools, libraries and tests for shader compilation.
At the moment it includes:
- [`glslc`](glslc), a command line compiler for GLSL/HLSL to SPIR-V, and
- [`libshaderc`](libshaderc), a library API for accessing `glslc` functionality.
**Note:** The fact that that `libshaderc` is not named `libshaderc_glslc` is a
quirk of history, and a known inconsistency. Changing it would require a
significant amount of renaming and breaking of downstream projects, so it is
being left as is.
`glslc` wraps around core functionality in [glslang][khr-glslang]
and [SPIRV-Tools][spirv-tools]. `glslc` and its library aims to
to provide:
* a command line compiler with GCC- and Clang-like usage, for better
integration with build systems
* an API where functionality can be added without breaking existing clients
* an API supporting standard concurrency patterns across multiple
operating systems
* increased functionality such as file `#include` support
## Downloads
**Note: These binaries are just the artifacts of the builders and have not
undergone any QA, thus they should be considered unsupported.**
<img alt="Linux" src="kokoro/img/linux.png" width="20px" height="20px" hspace="2px"/>[![Linux Build Status](https://storage.googleapis.com/shaderc/badges/build_status_linux_clang_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_linux_clang_release.html)
<img alt="MacOS" src="kokoro/img/macos.png" width="20px" height="20px" hspace="2px"/>[![MacOS Build Status](https://storage.googleapis.com/shaderc/badges/build_status_macos_clang_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_macos_clang_release.html)
<img alt="Windows" src="kokoro/img/windows.png" width="20px" height="20px" hspace="2px"/>[![Windows Build Status](https://storage.googleapis.com/shaderc/badges/build_status_windows_vs2017_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2017_release.html)
[More downloads](downloads.md)
## Status
Shaderc has maintained backward compatibility for quite some time, and we
don't anticipate any breaking changes.
Ongoing enhancements are described in the [CHANGES](CHANGES) file.
Shaderc has been shipping in the
[Android NDK](https://developer.android.com/ndk/index.html) since version r12b.
(The NDK build uses sources from https://android.googlesource.com/platform/external/shaderc/.
Those repos are downstream from GitHub.)
We currently require r18b.
For licensing terms, please see the [`LICENSE`](LICENSE) file. If interested in
contributing to this project, please see [`CONTRIBUTING.md`](CONTRIBUTING.md).
This is not an official Google product (experimental or otherwise), it is just
code that happens to be owned by Google. That may change if Shaderc gains
contributions from others. See the [`CONTRIBUTING.md`](CONTRIBUTING.md) file
for more information. See also the [`AUTHORS`](AUTHORS) and
[`CONTRIBUTORS`](CONTRIBUTORS) files.
## File organization
- `android_test/` : a small Android application to verify compilation
- `cmake/`: CMake utility functions and configuration for Shaderc
- `examples/`: Example programs
- `glslc/`: an executable to compile GLSL to SPIR-V
- `libshaderc/`: a library for compiling shader strings into SPIR-V
- `libshaderc_util/`: a utility library used by multiple shaderc components
- `third_party/`: third party open source packages; see below
- `utils/`: utility scripts for Shaderc
Shaderc depends on glslang, the Khronos reference compiler for GLSL.
Shaderc depends on [SPIRV-Tools][spirv-tools] for assembling, disassembling,
and transforming SPIR-V binaries.
Shaderc depends on the [Google Test](https://github.com/google/googletest)
testing framework.
In the following sections, `$SOURCE_DIR` is the directory you intend to clone
Shaderc into.
## Getting and building Shaderc
**If you only want prebuilt executables or libraries, see the
[Downloads](#downloads) section.**
The rest of this section describes how to build Shaderc from sources.
Note: Shaderc assumes Glslang supports HLSL compilation. The instructions
below assume you're building Glslang from sources, and in a subtree
of `shaderc/third_party`. In that scenario, Glslang's HLSL support
is automatically enabled. Shaderc also can be built using a Glslang
from outside the `shaderc/third_party` tree. In that case you must
ensure that that external Glslang is built with HLSL functionality.
See Glslang's `ENABLE_HLSL` CMake setting.)
1) Check out the source code:
```sh
git clone https://github.com/google/shaderc $SOURCE_DIR
cd $SOURCE_DIR
./utils/git-sync-deps
```
**Note:** The [known-good](https://github.com/google/shaderc/tree/known-good)
branch of the repository contains a
[known_good.json](https://github.com/google/shaderc/blob/known-good/known_good.json)
file describing a set of repo URLs and specific commits that have been
tested together. This information is updated periodically, and typically
matches the latest update of these sources in the development branch
of the Android NDK.
The `known-good` branch also contains a
[update_shaderc.py](https://github.com/google/shaderc/blob/known-good/update_shaderc_sources.py)
script that will read the JSON file and checkout those specific commits for you.
2) Ensure you have the requisite tools -- see the tools subsection below.
3) Decide where to place the build output. In the following steps, we'll call it
`$BUILD_DIR`. Any new directory should work. We recommend building outside
the source tree, but it is also common to build in a (new) subdirectory of
`$SOURCE_DIR`, such as `$SOURCE_DIR/build`.
4a) Build (and test) with Ninja on Linux or Windows:
```sh
cd $BUILD_DIR
cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} $SOURCE_DIR
ninja
ctest # optional
```
4b) Or build (and test) with MSVC on Windows:
```sh
cd $BUILD_DIR
cmake $SOURCE_DIR
cmake --build . --config {Release|Debug|MinSizeRel|RelWithDebInfo}
ctest -C {Release|Debug|MinSizeRel|RelWithDebInfo}
```
4c) Or build with MinGW on Linux for Windows:
(Skip building threaded unit tests due to
[Googletest bug 606](https://github.com/google/googletest/issues/606))
```sh
cd $BUILD_DIR
cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} $SOURCE_DIR \
-DCMAKE_TOOLCHAIN_FILE=$SOURCE_DIR/cmake/linux-mingw-toolchain.cmake \
-Dgtest_disable_pthreads=ON
ninja
```
After a successful build, you should have a `glslc` executable somewhere under
the `$BUILD_DIR/glslc/` directory, as well as a `libshaderc` library somewhere
under the `$BUILD_DIR/libshaderc/` directory.
The default behavior on MSVC is to link with the static CRT. If you would like
to change this behavior `-DSHADERC_ENABLE_SHARED_CRT` may be passed on the
cmake configure line.
See [the libshaderc README](libshaderc/README.md) for more on using the library
API in your project.
### Tools you'll need
For building, testing, and profiling Shaderc, the following tools should be
installed regardless of your OS:
- [CMake](http://www.cmake.org/): for generating compilation targets.
- [Python 3](http://www.python.org/): for utility scripts and running the test suite.
On Linux, the following tools should be installed:
- [`gcov`](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html): for testing code
coverage, provided by the `gcc` package on Ubuntu.
- [`lcov`](http://ltp.sourceforge.net/coverage/lcov.php): a graphical frontend
for `gcov`, provided by the `lcov` package on Ubuntu.
- [`genhtml`](http://linux.die.net/man/1/genhtml): for creating reports in html
format from `lcov` output, provided by the `lcov` package on Ubuntu.
On Linux, if cross compiling to Windows:
- [`mingw`](http://www.mingw.org): A GCC-based cross compiler targeting Windows
so that generated executables use the Microsoft C runtime libraries.
On Windows, the following tools should be installed and available on your path:
- Visual Studio 2015 or later. Previous versions of Visual Studio may work but
are untested and unsupported.
- Git - including the associated tools, Bash, `diff`.
Optionally, the following tools may be installed on any OS:
- [`asciidoctor`](http://asciidoctor.org/): for generating documentation.
- [`pygments.rb`](https://rubygems.org/gems/pygments.rb) required by
`asciidoctor` for syntax highlighting.
### Building and running Shaderc using Docker
Please make sure you have the Docker engine
[installed](https://docs.docker.com/engine/installation/) on your machine.
To create a Docker image containing Shaderc command line tools, issue the
following command in `${SOURCE_DIR}`: `docker build -t <IMAGE-NAME> .`.
The created image will have all the command line tools installed at
`/usr/local` internally, and a data volume mounted at `/code`.
Assume `<IMAGE-NAME>` is `shaderc/shaderc` from now on.
To invoke a tool from the above created image in a Docker container:
```bash
docker run shaderc/shaderc glslc --version
```
Alternatively, you can mount a host directory (e.g., `example`) containing
the shaders you want to manipulate and run different kinds of tools via
an interactive shell in the container:
```bash
$ docker run -i -t -v `pwd`/example:/code shaderc/shaderc
/code $ ls
test.vert
/code $ glslc -c -o - test.vert | spirv-dis
```
## Bug tracking
We track bugs using GitHub -- click on the "Issues" button on
[the project's GitHub page](https://github.com/google/shaderc).
## Test coverage
On Linux, you can obtain test coverage as follows:
```sh
cd $BUILD_DIR
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DENABLE_CODE_COVERAGE=ON $SOURCE_DIR
ninja
ninja report-coverage
```
Then the coverage report can be found under the `$BUILD_DIR/coverage-report`
directory.
## Bindings
Bindings are maintained by third parties, may contain content
offered under a different license, and may reference or contain
older versions of Shaderc and its dependencies.
* **Python:** [pyshaderc][pyshaderc]
* **Rust:** [shaderc-rs][shaderc-rs]
* **Go:** [gshaderc][gshaderc]
* **.NET:** [shaderc.net][shadercdotnet]
* **Common Lisp:** [shadercl][shaderccommonlisp]
[khr-glslang]: https://github.com/KhronosGroup/glslang
[spirv-tools]: https://github.com/KhronosGroup/SPIRV-Tools
[spirv-cross]: https://github.com/KhronosGroup/SPIRV-Cross
[pyshaderc]: https://github.com/realitix/pyshaderc
[shaderc-rs]: https://github.com/google/shaderc-rs
[appveyor]: https://ci.appveyor.com/project/dneto0/shaderc
[dawn]: https://dawn.googlesource.com/dawn
[gshaderc]: https://github.com/celer/gshaderc
[shadercdotnet]: https://github.com/jpbruyere/shaderc.net
[shaderccommonlisp]: https://github.com/JolifantoBambla/shadercl

View File

@ -1,39 +0,0 @@
# Copyright 2020 The Shaderc Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distribute