A collection of tools, libraries, and tests for Vulkan shader compilation.

Overview

Shaderc

A collection of tools, libraries and tests for shader compilation. At the moment it includes:

  • glslc, a command line compiler for GLSL/HLSL to SPIR-V, and
  • 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 and 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.

LinuxLinux Build Status MacOSMacOS Build Status WindowsWindows Build Status

More downloads

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 file.

Shaderc has been shipping in the Android NDK 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 file. If interested in contributing to this project, please see 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 file for more information. See also the AUTHORS and 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 for assembling, disassembling, and transforming SPIR-V binaries.

Shaderc depends on the Google Test 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 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:
git clone https://github.com/google/shaderc $SOURCE_DIR
cd $SOURCE_DIR
./utils/git-sync-deps

Note: The known-good branch of the repository contains a 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 script that will read the JSON file and checkout those specific commits for you.

  1. Ensure you have the requisite tools -- see the tools subsection below.

  2. 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:

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:

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)

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 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: for generating compilation targets.
  • Python 3: for utility scripts and running the test suite.

On Linux, the following tools should be installed:

  • gcov: for testing code coverage, provided by the gcc package on Ubuntu.
  • lcov: a graphical frontend for gcov, provided by the lcov package on Ubuntu.
  • 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: 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:

Building and running Shaderc using Docker

Please make sure you have the Docker engine installed 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:

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:

$ 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.

Test coverage

On Linux, you can obtain test coverage as follows:

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.

Comments
  • Roll third_party/googletest 176eccfb8f42..d7003576dd13 (2 commits)

    Roll third_party/googletest 176eccfb8f42..d7003576dd13 (2 commits)

    https://github.com/google/googletest.git /compare/176eccfb8f42..d7003576dd13

    git log 176eccfb8f42339b8ea2341e926f6835f7932bc4..d7003576dd133856432e2e07340f45926242cc3a --date=short --no-merges --format=%ad %ae %s 2019-06-17 [email protected] Googletest export 2019-06-17 [email protected] Googletest export

    The AutoRoll server is located here: https://autoroll.skia.org/r/googletest-shaderc-autoroll

    Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (radial-[email protected]), and stop the roller if necessary.

    autoroller: commit 
    opened by google-shaderc-autoroll 456
  • Roll third_party/re2 0c95bcce2f1f..848dfb7e1d7b (2 commits)

    Roll third_party/re2 0c95bcce2f1f..848dfb7e1d7b (2 commits)

    https://github.com/google/re2.git /compare/0c95bcce2f1f..848dfb7e1d7b

    git log 0c95bcce2f1f0f071a786ca2c42384b211b8caba..848dfb7e1d7ba641d598cb66f81590f3999a555a --date=short --no-merges --format=%ad %ae %s 2019-06-13 [email protected] Don't let DFA execution bail when slow for RE2::Set. 2019-06-13 [email protected] Expose FilteredRE2::GetRE2() as public.

    The AutoRoll server is located here: https://autoroll.skia.org/r/re2-shaderc-autoroll

    Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (radial-[email protected]), and stop the roller if necessary.

    autoroller: commit 
    opened by google-shaderc-autoroll 92
  • Use SHADERC_BUILD_SHARED to control static/shared library

    Use SHADERC_BUILD_SHARED to control static/shared library

    Previously we build both static and shared library at the same time. Because of that, we cannot name both the static and shared library as shaderc.

    This commit stops compiling both static and shared library. Instead we let the user choose now.

    kokoro:run 
    opened by antiagainst 23
  • Add pkg-config (.pc) file

    Add pkg-config (.pc) file

    pkg-config is the standard way to find C libraries on Linux and related systems. It's typical of libraries that intend to be used on Linux to package a pkg-config file.

    As far as I can tell, shaderc doesn't seem to include one.

    enhancement 
    opened by haasn 17
  • Fixing duplicate absolute install paths when using Visual Studio generators

    Fixing duplicate absolute install paths when using Visual Studio generators

    A slight bug occurs when running a cmake install on shaderc when using Visual Studio as a generator, where the source install file paths are incorrect. They contain a duplicate absolute path.

    This issue occurred when a pull request was merged in order to fix the Ninja build system back in this PR https://github.com/google/shaderc/pull/570

    The issue is fixed by relying on the shaderc_combine_static_lib() function to properly set an absolute path on the location of the shaderc_combined custom target.

    You can verify that this install behavior now works properly by running this on a Windows machine, generating for VS2017:

    git clone https://github.com/RikoOphorst/shaderc
    cd shaderc
    mkdir build
    cd build
    cmake ../ -G"Visual Studio 15 2017 Win64"
    cmake --build . --target install
    

    Apologies if I'm submitting this pull request incorrectly, this is the first time I've made a pull request in any repo.

    opened by RikoOphorst 14
  • Roll third_party/spirv-cross fce83b7e8b0f..5e9e8918f9a2 (37 commits)

    Roll third_party/spirv-cross fce83b7e8b0f..5e9e8918f9a2 (37 commits)

    https://github.com/KhronosGroup/SPIRV-Cross.git /compare/fce83b7e8b0f..5e9e8918f9a2

    git log fce83b7e8b0f6599efd4481992b2eb30f69f21de..5e9e8918f9a22d488811c575a97ccda2d8a8726d --date=short --no-merges --format=%ad %ae %s 2019-06-10 [email protected] Expand constexpr sampler sanity check. 2019-06-10 [email protected] MSL: Support remapping constexpr samplers by set/binding. 2019-06-10 [email protected] Employ heuristics to figure out how to emit SSBO/UAV reflection names. 2019-06-06 [email protected] Deal with nested loops. 2019-06-06 [email protected] Use the existing loop dominator when doing loop variable preservation. 2019-06-06 [email protected] Rewrite how loop dominators are propagated. 2019-06-06 [email protected] Deal with case where a variable is dominated by inner part of a loop. 2019-06-05 [email protected] Fix storage packing qualifiers missing on "shaderRecordNV" buffers 2019-06-05 [email protected] Add test for callable data 2019-06-05 [email protected] Fix callable data variables 2019-06-03 [email protected] Add support for "shaderRecordNV" qualifier 2019-06-05 [email protected] Deal with case where a block is somehow emitted in a duplicated fashion. 2019-06-02 [email protected] Fix erronous default for emit_line_directives. 2019-05-31 [email protected] MSL: Fix declaration of unused input variables. 2019-05-28 [email protected] Fixup OpLine parsing comments. 2019-05-28 [email protected] Support emitting OpLine directive. 2019-05-28 [email protected] GLSL: Support std430 in UBOs with scalar layout. 2019-05-27 [email protected] Run format_all.sh. 2019-05-27 [email protected] MSL: Use correct address space when passing array-of-buffers. 2019-05-27 [email protected] OpArrayLength must trigger active variables. 2019-05-27 [email protected] MSL: Implement OpArrayLength. 2019-05-24 [email protected] Add Git/timestamp --revision support. 2019-05-23 [email protected] MSL: Add test case for complex type alias. 2019-05-23 [email protected] MSL: Fix struct declaration order with complex type aliases. 2019-05-18 [email protected] Fix formatting, update C ABI version. 2019-05-09 [email protected] MSL: Support argument buffers and image swizzling. 2019-05-08 [email protected] Add get_member_name and active_buffer_ranges to C APIs 2019-05-17 [email protected] Fix spvc_type_get_vector_size C function. 2019-05-16 [email protected] Remove fallback for OpGroupNonUniformElect. 2019-05-15 [email protected] MSL: Add support for subgroup operations. 2019-05-14 [email protected] Only deploy on new tags. 2019-05-14 [email protected] Add setup for Github releases via Travis. 2019-05-14 [email protected] Validate that C ABI in CMakeLists.txt matches code. 2019-05-14 [email protected] Run format_all.sh. 2019-05-11 [email protected] GLSL: Add option to disable buffer blocks regardless of version 2019-05-13 [email protected] Fix nonuniform test for MSL. 2019-05-13 [email protected] HLSL/MSL: Deal correctly with nonuniformEXT qualifier.

    The AutoRoll server is located here: https://autoroll.skia.org/r/spirv-cross-shaderc-autoroll

    Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (radial-[email protected]), and stop the roller if necessary.

    autoroller: commit 
    opened by google-shaderc-autoroll 12
  • CMakeLists: enable CMAKE_MSVC_RUNTIME_LIBRARY property

    CMakeLists: enable CMAKE_MSVC_RUNTIME_LIBRARY property

    Support for different MSVC Runtime Library options. Example (when doing cmake setup): cmake -S ... -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL

    May also need to pass additional params to cmake setup: -DLLVM_USE_CRT_RELEASE=MD etc.

    This is used by glslang (3rd party lib) to configure the MSVC Runtime Library

    opened by jmoguillansky-gpsw 11
  • Roll third_party/re2 90970542fe95..0c95bcce2f1f (47 commits)

    Roll third_party/re2 90970542fe95..0c95bcce2f1f (47 commits)

    https://github.com/google/re2.git /compare/90970542fe95..0c95bcce2f1f

    git log 90970542fe952602f42150c6e71d086f5afebcb3..0c95bcce2f1f0f071a786ca2c42384b211b8caba --date=short --no-merges --format=%ad %ae %s 2019-05-22 [email protected] Add GCC 9.x to the Travis CI matrix. 2019-05-05 [email protected] Fix the bug in Regexp::ToString() that emitted [^]. 2019-04-19 [email protected] Set an ALIAS and a NAMESPACE in the CMake configuration. 2019-04-18 [email protected] Configure CMake to install the re2Config "export". 2019-04-17 [email protected] Address some clang-tidy gripes. 2019-04-11 [email protected] Update Consume's method comment re: empty matches. 2019-04-09 [email protected] Make the fuzzer check for large substrings as soon as possible. 2019-03-18 [email protected] Get rid of using std::string;. (part 7 of 7) 2019-03-18 [email protected] Get rid of using std::string;. (part 6 of N) 2019-03-18 [email protected] Get rid of using std::string;. (part 5 of N) 2019-03-18 [email protected] Get rid of using std::string;. (part 4 of N) 2019-03-18 [email protected] Get rid of using std::string;. (part 3 of N) 2019-03-18 [email protected] Get rid of using std::string;. (part 2 of N) 2019-03-18 [email protected] Get rid of using std::string;. (part 1 of N) 2019-03-14 [email protected] Make the BitState bitmap use list heads. 2019-03-13 [email protected] Make NFA use hints. 2019-03-11 [email protected] Avoid touching the bitmap even more. 2019-03-11 [email protected] Make BitState avoid touching the bitmap unnecessarily. 2019-03-10 [email protected] Give foldcase 1 bit and hint 15 bits. 2019-03-08 [email protected] Remove a bogus comment. 2019-03-08 [email protected] Handle foldcase when computing hints. Mea culpa. 2019-03-08 [email protected] Compute hints for ByteRange instructions. Make BitState use them. 2019-03-06 [email protected] Tidy up a call to fullrune(). 2019-03-05 [email protected] Fix a silly buffer underflow. 2019-03-05 [email protected] Implement run length encoding for BitState. 2019-03-04 [email protected] Simplify AltMatch and Capture handling in BitState. 2019-02-25 [email protected] Make the fuzzer handle \p and \P specially. 2019-02-25 [email protected] Check onepass_nodes_.data(), not .size(). 2019-02-25 [email protected] Use PODArray<> for OnePass nodes. 2019-02-13 [email protected] Update the Erlang wrapper URL. 2019-02-10 [email protected] Tidy up semicolons (mostly macro-related) in re2.h. 2019-01-31 [email protected] Clarify the scope of a comment. 2019-01-31 [email protected] Work around a bug in older versions of bash. :/ 2019-01-31 [email protected] Refactor the CMake scripts. 2019-01-31 [email protected] Use bash on Windows since Kokoro offers it. 2019-01-31 [email protected] Refactor the Bazel scripts. 2019-01-29 [email protected] Try using bash on Windows since Kokoro offers it. 2019-01-25 [email protected] Crudely limit the use of various character classes when fuzzing. 2019-01-21 [email protected] Oops, std::string_view requires C++17. 2019-01-21 [email protected] Support constructing StringPiece from std::string_view. 2019-01-21 [email protected] Add Clang 8 to the Travis CI matrix. 2019-01-11 [email protected] Avoid null PODArray<> issues in SparseSet and SparseArray<>. 2019-01-11 [email protected] Use PODArray<> in SparseArray<>. 2019-01-10 [email protected] Simplify SparseArray<> significantly. 2019-01-10 [email protected] Ensure we succeed at constructing new sparse and dense arrays. 2019-01-09 [email protected] Ensure we succeed at constructing new sparse and dense arrays. 2019-01-09 [email protected] Use PODArray<> in SparseSet.

    The AutoRoll server is located here: https://autoroll.skia.org/r/re2-shaderc-autoroll

    Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (radial-[email protected]), and stop the roller if necessary.

    autoroller: commit 
    opened by google-shaderc-autoroll 11
  • Roll third_party/glslang f88e5824d2cf..9866ad9195ce (33 commits)

    Roll third_party/glslang f88e5824d2cf..9866ad9195ce (33 commits)

    https://github.com/KhronosGroup/glslang.git /compare/f88e5824d2cf..9866ad9195ce

    git log f88e5824d2cfca5edc58c7c2101ec9a4ec36afac..9866ad9195cec8f266f16191fb4ec2ce4896e5c0 --date=short --no-merges --format=%ad %ae %s 2019-06-04 [email protected] Add support for GL_NV_shader_sm_builtins 2019-06-08 [email protected] GLSL: Revert f6873f7 to fix #1764. 2019-06-07 [email protected] Use spvValidatorOptionsSetBeforeHlslLegalization for pre-legalized HLSL 2019-06-06 [email protected] Uppdate spirv-tools known-good 2019-06-05 [email protected] Remove unused parameter 2019-06-04 [email protected] Add missing NV_EXTENSIONS ifdef 2019-06-03 [email protected] Support GL_ARB_fragment_shader_interlock 2019-05-27 [email protected] Fix subgroup support for ray tracing 2019-05-30 [email protected] Add AST tests for ray tracing shaders 2019-05-30 [email protected] Add AST tests for mesh and task shaders 2019-05-30 [email protected] Add more subgroup testing 2019-05-30 [email protected] Allow runtime-sized arrays of acceleration structures 2019-05-28 [email protected] Fix include guard for GL_EXT_multiview 2019-05-28 [email protected] Return consistent names from CapabilityString 2019-05-23 [email protected] Fixed .dll install on MSVC. 2019-05-17 [email protected] Remove non-source sources from binary targets 2019-05-16 [email protected] Build.gn: allow optimization in glslang lib and standalone 2019-05-16 [email protected] Update SPIRV-Tools, SPIRV-Headers 2019-05-10 [email protected] Build: Fix 3 warnings. 2019-05-10 [email protected] Bump version and revision. 2019-05-09 [email protected] SPV 1.4: Move to 1.4 validation, removing all 1.4 validation failures. 2019-03-31 [email protected] SPV 1.4: Emit SignExtend and ZeroExtend for integer image reads/writes. 2019-02-07 [email protected] SPV 1.4: Lookup tables: Use variable initializer and NonWritable... 2019-01-15 [email protected] SPV 1.4: Add support for OpCopyLogical, careful of Boolean differences. 2019-01-12 [email protected] SPV 1.4: Implement the 5 new loop controls. 2019-01-10 [email protected] SPV 1.4: Use OpSelect for trivial typed non-scalar/vector expressions. 2019-01-04 [email protected] SPV 1.4: Add testing infrastructure for SPV 1.4 tests. 2019-01-04 [email protected] SPV 1.4: Generate all globals on OpEntryPoint interface list. 2019-05-09 [email protected] SPV: Move to the SPIR-V 1.4 header. 2019-05-09 [email protected] Latest known-good SPIRV-Tools: WARNING: Needs python 3.x. 2019-05-09 [email protected] Bump revision. 2019-05-08 [email protected] For nonuniformEXT constructor, make a copy of the node to decorate 2019-03-08 [email protected] Add support for GL_EXT_buffer_reference2

    The AutoRoll server is located here: https://autoroll.skia.org/r/glslang-shaderc-autoroll

    Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (radial-[email protected]), and stop the roller if necessary.

    autoroller: commit 
    opened by google-shaderc-autoroll 11
  • Issue with scalers in the mpv project related to shaderc

    Issue with scalers in the mpv project related to shaderc

    I'm not sure how related this is to shaderc or spirv-tools, but users have reported that reverting to this commit of shaderc: https://github.com/google/shaderc/commit/583fb1326b02c9bec31096b93bf5938e0d16346b, fixes the issue, so I posted the initial issue report here.

    See https://github.com/mpv-player/mpv/issues/5695, for more details.

    opened by PapricaJim 11
  • Fix the link order of libglslang and libHLSL

    Fix the link order of libglslang and libHLSL

    libglslang depends on libHLSL, so the latter needs to be specified last. This fixes an issue when trying to build shaderc against system-wide versions of libglslang/libHLSL, rather than the in-tree versions from third_party.

    opened by haasn 10
  • Macro gets expanded twice, leading to unexpected generated code.

    Macro gets expanded twice, leading to unexpected generated code.

    Hi,

    Blender developer here. Currently we are developing our Vulkan back-end. We use intensively macros to be able to cross compile between OpenGL/Vulkan/Metal and also for migrating between internal feature sets.

    When compiling the next vertex shader using glslc fails. For now we are using

    shaderc v2021.3 v2021.3
    spirv-tools v2021.4 v2021.4
    glslang 11.1.0-316-g600c5037
    

    To reproduce you can use glslc -fshader-stage=vertex ./vertex.glsl to validate the error. ./vertex.glsl:68: error: '' : syntax error, unexpected LEFT_PAREN, expecting IDENTIFIER

    I did search for similar issues, but didn't see them. Sorry if I added a new one by mistake or has already been resolved up-stream.

    #version 450
    
    #define drw_view drw_view_[drw_view_id]
    
    /* Single-view case (default). */
    #define drw_view_id 0
    #define DRW_VIEW_LEN 1
    #define DRW_VIEW_SHIFT 0
    
    struct ViewMatrices {
      mat4 viewmat;
      mat4 winmat;
    };
    
    #define ViewMatrix drw_view.viewmat
    #define ProjectionMatrix drw_view.winmat
    
    /** \} */
    
    /* Pass Resources. */
    layout(binding = 0, std140) uniform drw_view_ {
      ViewMatrices _drw_view_[DRW_VIEW_LEN];
    };
    #define drw_view_ (_drw_view_)
    
    /* Push Constants. */
    layout(push_constant) uniform constants {
      vec3 pPosition;
      float pSize;
      vec4 pColor;
    }
    PushConstants;
    #define pPosition (PushConstants.pPosition)
    #define pSize (PushConstants.pSize)
    #define pColor (PushConstants.pColor)
    
    /* Inputs. */
    layout(location = 0) in vec3 pos;
    
    /* Interfaces. */
    layout(location = 0) out flat vec4 finalColor;
    
    /** Transform shortcuts. */
    /* Rule of thumb: Try to reuse world positions and normals because converting
     * through viewspace will always be decomposed in at least 2 matrix operation.
     */
    #define point_world_to_ndc(p) (ProjectionMatrix * (ViewMatrix * vec4(p, 1.0)))
    
    void main() {
    #if 0
      /* Use local variable to workaround macro unrolling issue in Spir-V. */
      vec3 pos = pPosition;
      gl_Position = point_world_to_ndc(pos);
    #else
      /* Unrolling fails when unrolling with
    
      ./vertex.glsl:69: error: '' :  syntax error, unexpected LEFT_PAREN, expecting
    IDENTIFIER.
    
      shaderc v2021.3 v2021.3
      spirv-tools v2021.4 v2021.4
      glslang 11.1.0-316-g600c5037
    
      Target: SPIR-V 1.0
      */
    
      gl_Position = point_world_to_ndc(pPosition);
    #endif
      finalColor = pColor;
      gl_PointSize = pSize;
    }
    
    opened by jeroenbakker-atmind 2
  • Using `#if WIN32` instead of `#ifdef _WIN32` seems to result in unistd.h being included.

    Using `#if WIN32` instead of `#ifdef _WIN32` seems to result in unistd.h being included.

    When building in windows, the file file_finder_test.cc will attempt to include unistd.h. It seems this is due to #if WIN32 being used instead of #ifdef _WIN32. I'm not sure if I have my build incorrectly configured, but changing this (with _CRT_SECURE_NO_WARNINGS due to a strncpy call) works.

    opened by MarcelPiNacy 0
  • Mistake: glslc should not do if-optimize for some subgroup op.

    Mistake: glslc should not do if-optimize for some subgroup op.

    Hi, i found glslc may add some if-optimize for && statement.

    but somtimes it make error case( Some subgroup-op require all lane in active state), eg code like this:

    image

    compiling code is below:

    image

    now subgroup-op was placed in if-statement, and may no active in all quad lane, then will case some compute error.

    if change the code like this:

    image

    now all quad lane can active to compute, and the result is right: image

    opened by ghost 0
  • CMakeLists.txt: drop OSDependent/OGLCompiler from lists of glslang libraries

    CMakeLists.txt: drop OSDependent/OGLCompiler from lists of glslang libraries

    glslang no longer installs them separately, and all needed functionality has been merged into glslang shared library itself.

    This wasn't a problem previously as they were still provided, as static libraries but in latest glslang they no longer are: https://github.com/KhronosGroup/glslang/commit/7cd519511c32d7e86d901c7ed231cb84c652d18d

    opened by kanavin 1
  • Implement GL_EXT_texture_shadow_lod

    Implement GL_EXT_texture_shadow_lod

    GL_EXT_texture_shadow_lod provides various missing overloads for sampling sampler2DArrayShadows. Their absence in GLSL is baffling and an awkward constraint in e.g. cascading shadow map implementations.

    In theory you can work around this with textureGrad, but this seems to have significantly worse performance than technically-UB use of texture on my 970, accounting for more than 1ms of frametime.

    opened by Ralith 1
Owner
Google
Google ❤️ Open Source
Google
A cross platform shader language with multi-threaded offline compilation or platform shader source code generation

A cross platform shader language with multi-threaded offline compilation or platform shader source code generation. Output json reflection info and c++ header with your shaders structs, fx-like techniques and compile time branch evaluation via (uber-shader) "permutations".

Alex Dixon 286 Dec 14, 2022
Shader cross compiler to translate HLSL (Shader Model 4 and 5) to GLSL

XShaderCompiler ("Cross Shader Compiler") Features Cross compiles HLSL shader code (Shader Model 4 and 5) into GLSL Simple to integrate into other pro

Lukas Hermanns 345 Dec 9, 2022
Shader Playground is a website for exploring shader compilers.

Shader Playground is a website for exploring shader compilers. Visit website Supported backends Compilers ANGLE Clspv DXC FXC Glslan

Tim Jones 445 Dec 30, 2022
GraphicsFuzz provides tools for automatically finding and simplifying bugs in graphics drivers, specifically graphics shader compilers.

GraphicsFuzz GraphicsFuzz is a set of tools for testing shader compilers GraphicsFuzz provides tools for automatically finding and simplifying bugs in

Google 516 Dec 15, 2022
Collection of Vulkan samples

This repository holds many samples, showing various aspect of Vulkan, debugging tips and usage of other Nvidia tools.

NVIDIA DesignWorks Samples 52 Dec 31, 2022
POCO C++ Libraries are powerful cross-platform C++ libraries for building network

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.

POCO C++ Libraries 6.7k Jan 1, 2023
Ziggified GLFW bindings with 100% API coverage, zero-fuss installation, cross compilation, and more.

mach/glfw - Ziggified GLFW bindings Ziggified GLFW bindings that Mach engine uses, with 100% API coverage, zero-fuss installation, cross compilation,

Hexops 201 Dec 27, 2022
This is a compilation of the code and images for all Arduino code in the Robotics 11 class.

Robotics 11 - Arduino This is a compilation of the code and images for all Arduino code in the Robotics 11 class. All code can be viewed in each proje

GuhBean 1 Oct 29, 2021
This is the source code for Mirai. The compilation method has been simplified a little and some modifications have been made.

Mirai BotNet to Tashiro(未来砲) Leaked Linux.Mirai Source Code for Research/IoT Development Purposes Uploaded for research purposes and so we can develop

われ 28 Jul 30, 2022
"Zero setup" cross-compilation for a wide variety of architectures.

"Zero setup" cross-compilation for a wide variety of architectures. xcross includes compact docker images and a build utility for minimal setup C/C++ cross-compiling, inspired by rust-embedded/cross

Alexander Huszagh 29 Nov 10, 2022
Fluid Visualization - The code compilation is only tested on Arch Linux x86_64

Fluid Visualization The code compilation is only tested on Arch Linux x86_64, Linux kernel 5.15.13-arch1, with gcc 11.1.0, CMake 3.22.1, Xorg X server

krr 2 Jan 30, 2022
Collection of cross-platform single-header C libraries for doing a lot of stuff! (Still WIP)

ice_libs Collection of cross-platform single-header C libraries for doing a lot of stuff! (Still WIP) Brief ice_libs is collection of Single-Header C

Rabia Alhaffar 118 Dec 6, 2022
Cloud Native Data Plane (CNDP) is a collection of user space libraries to accelerate packet processing for cloud applications.

CNDP - Cloud Native Data Plane Overview Cloud Native Data Plane (CNDP) is a collection of userspace libraries for accelerating packet processing for c

Cloud Native Data Plane 35 Dec 28, 2022
sbase is a collection of unix tools that are inherently portable across UNIX and UNIX-like systems.

sbase is a collection of unix tools that are inherently portable across UNIX and UNIX-like systems.

Anton Samokhvalov 1 Nov 1, 2021
An open collection of tools and experiments for rendering wide-gamut scene-linear data into an image for an SDR or HDR display device.

Open Display Transform An open collection of tools and experiments for rendering wide-gamut scene-linear data into an image for an SDR or HDR display

Jed Smith 127 Dec 29, 2022
Suckless-tools - My fork of suckless tools.

suckless-tools Here is my fork of suckless tools. I didn't include tabbed, i was using but not actively. I am using xfce4-terminal instead of st. Beca

null 2 Jan 7, 2022
CSE-7th-Semester-IIT-KGP - Tests, programming assignments and their solution for some courses offered by Department of Computer Science and Engineering, IIT Kharagpur

CSE-7th-Semester-IIT-KGP Disclaimer: Do not copy codes though. Heavy penalization for plagiarism. Programming assignments and their solution for some

Siba Smarak Panigrahi 2 Dec 30, 2021
A collection of tools made by the nerds @ axial

Tools created by Nerds @ AXIAL Tool Name: Vichiti Author: 0x9747 Domain: Open-source Intelligence Tool Name: FLAMES Author: Devisha Rochlani Domain: M

AXIAL 16 Oct 31, 2021
A collection of individual tools to randomize bdsp sheets

BDSP_Randomisers A collection of tools to randomize BDSP assets Setup (Windows 10 only) Install Ubuntu 18.04 via WSL1 (plenty of tutorials on that) In

null 6 Mar 1, 2022