Skip to content

Commit

Permalink
Merge remote-tracking branch 'aosp/upstream-master' into update-shaderc
Browse files Browse the repository at this point in the history
Including:
ef2b7a6 Avoid C-style cast for constants definitions (google#760)
c1af9a7 SetBeforeHlslLegalization to use more relaxed validation rules (google#676)
72988e4 Explicitly use python3 for git-sync-deps (google#759)
1f2dec1 Remove app_dummy call in Android test (google#756)
e9bb8f2 Add verbose flag to run_spirv_cross_tests.py (google#753)
f396afa Rolling 4 dependencies and update known_failures (google#755)
77d7b65 Rolling 4 dependencies and updating known_failures (google#754)
23bbb32 Add --target-spv option to set target SPIR-V version (google#750)
8de4816 Remove old logging infra from run_spirv_cross_tests.py (google#749)
30d8262 Enable implicit fallthrough warning and fix examples of (google#747)
7781794 Rolling 2 dependencies (google#748)
48e07b5 Rolling 4 dependencies and update known_failures (google#745)
cff2a56 Catch low level exceptions instead of crash (google#744)
11cf0a3 Add jobs flag to spirv cross tests script (google#743)
0ce3725 Extract common test environment bits out into a class (google#738)
c4ba097 Fix BUILD.gn for Chromium build. (google#741)
ab08017 BUILD.gn fixes for Fuchsia. (google#733)
b9a1021 Remove Appveyor artifacts link. (google#739)
16f6e6a Remove SetShaderModel from API (google#734)
b3523d5 Move script fixes from other SPIRV related repos (google#732)
a731ee3 Import improvements to DEPS roll script (google#729)
213a2a8 Update CHANGES (google#730)
2cbf790 Add -fnan-clamp (google#725)
6c4c6ed Add script to generate manual roll patch (google#727)
4714ba1 Rolling 4 dependencies (google#728)
2a888de Roll third_party/glslang def9662348b0..9db72785beb3 (1 commits) (google#721)
daf804a Roll third_party/spirv-cross 4104e363005a..146dc453bcec (2 commits) (google#722)
9164aea Manually roll DEPS to get past test failure (google#717)
8b2600f Roll third_party/googletest fd20d1eccef6..176eccfb8f42 (1 commits) (google#718)
f40bcf8 Roll third_party/googletest e110929a7b49..fd20d1eccef6 (5 commits) (google#715)
8fbd7e0 Roll third_party/re2 0c95bcce2f1f..848dfb7e1d7b (2 commits) (google#712)
a0bfa18 Roll third_party/googletest f7c178ecb33c..e110929a7b49 (2 commits) (google#709)
7b84ab7 Roll third_party/googletest 26afdba792e5..f7c178ecb33c (2 commits) (google#707)
828e3a5 Roll third_party/spirv-cross 00a8539d1ddf..4104e363005a (3 commits) (google#698)
9745f0e Roll third_party/googletest af4c2cb098a3..26afdba792e5 (1 commits) (google#703)
c21dd10 Update glslc tests for -finvert-y option (google#704)
ceff3dd Pass InvertY to glslang (google#695)
b988e6b Roll third_party/googletest 89656ddbe62f..af4c2cb098a3 (2 commits) (google#702)
c6cb20d Roll third_party/spirv-headers 9cf7c3a7d2d2..de99d4d834ae (1 commits) (google#697)
bd60de4 Roll third_party/googletest 076b7f778883..89656ddbe62f (1 commits) (google#694)
dcfa9d0 Roll third_party/spirv-cross fccf1d046204..00a8539d1ddf (1 commits) (google#691)
ef6b960 Roll third_party/spirv-cross 5e9e8918f9a2..fccf1d046204 (1 commits) (google#690)
206a069 Roll third_party/spirv-headers 9242862c84fe..9cf7c3a7d2d2 (1 commits) (google#689)
2f42850 Roll all DEPS to HEAD (google#685)
facd092 Roll third_party/effcee 8f0a61dc95e0..b83b58d177b7 (2 commits) (google#677)
3c76b8a Re-introduce SetShaderModel for backwards compatibility (google#675)
8738101 Refactor dup'd arg handling functions into a single location (google#660)
f21bd30 Update Dockerfile to use Python 3 (google#668)
d0298a3  Add details of spvc to README.md (google#661)
78c188d Change TODO(name) to TODO(bug issue#) for spvc files (google#658)
dc67137 Fixing duplicate absolute install paths when using Visual Studio generators (google#639)
568cf20 Add in missing flags to pass more of the spirv-cross tests (google#664)
acf7d24 Convert vars['foo'] to Var('foo') (google#663)

Testing: checkbuild.py on Linux; unit tests on Windows

Change-Id: Ic91997e8266c6f53239373657fb1f566a0223bf9
  • Loading branch information
dneto0 committed Jul 16, 2019
2 parents afff7dc + ef2b7a6 commit 8bd1f96
Show file tree
Hide file tree
Showing 40 changed files with 1,609 additions and 568 deletions.
18 changes: 14 additions & 4 deletions BUILD.gn
Expand Up @@ -12,6 +12,7 @@
# 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
Expand Down Expand Up @@ -52,6 +53,11 @@ source_set("shaderc_util_sources") {
"${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") {
Expand Down Expand Up @@ -86,8 +92,10 @@ component("libshaderc") {
"${glslang_dir}:glslang_sources",
]

configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
if (build_with_chromium) {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
}

config("shaderc_spvc_public") {
Expand Down Expand Up @@ -125,6 +133,8 @@ component("libshaderc_spvc") {
"${spirv_cross_dir}:spirv_cross_full_for_fuzzers",
]

configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
if (build_with_chromium) {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
}
28 changes: 27 additions & 1 deletion CHANGES
@@ -1,7 +1,33 @@
Revision history for Shaderc

v2019.1-dev 2019-06-04
- Start v2019.1-dev
- 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
- 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
- Infrastructure
- Update DEPS with cross-verified commits from associated repos.
- Add utils/roll-deps
- Fixes:
- Fix duplicate install paths when using VisualStudio
#666: Update Docker file to use Python3

v2019.0 2019-06-04
- Add optional spvc, libshaderc_spvc as wrapper around SPIRV-Cross:
Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Expand Up @@ -33,7 +33,15 @@ option(SHADERC_ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensio
include(GNUInstallDirs)
include(cmake/setup_build.cmake)
include(cmake/utils.cmake)

include(CheckCXXCompilerFlag)

# This flag is not supported on Windows and some older version of GCC
# that our bots use.
unset(COMPILER_SUPPORTS_FALLTHROUGH_WARNING CACHE)
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()

if(SHADERC_ENABLE_NV_EXTENSIONS)
add_definitions(-DNV_EXTENSIONS)
Expand Down
42 changes: 21 additions & 21 deletions DEPS
Expand Up @@ -4,34 +4,34 @@ vars = {
'google_git': 'https://github.com/google',
'khronos_git': 'https://github.com/KhronosGroup',

'effcee_revision' : '8f0a61dc95e0df18c18e0ac56d83b3fa9d2fe90b',
'glslang_revision': 'f88e5824d2cfca5edc58c7c2101ec9a4ec36afac',
'googletest_revision': '0599a7b8410dc5cfdb477900b280475ae775d7f9',
're2_revision': '90970542fe952602f42150c6e71d086f5afebcb3',
'spirv_headers_revision': 'c4f8f65792d4bf2657ca751904c511bbcf2ac77b',
'spirv_tools_revision': '0125b28ed4214d1860696f22d230dbfc965c6c2c',
'spirv_cross_revision': 'fce83b7e8b0f6599efd4481992b2eb30f69f21de',
'effcee_revision' : 'b83b58d177b797edd1f94c5f10837f2cc2863f0a',
'glslang_revision': '4b4b41a63499d34c527ee4f714dde8072f60c900',
'googletest_revision': '437e1008c97b6bf595fec85da42c6925babd96b2',
're2_revision': 'e356bd3f80e0c15c1050323bb5a2d0f8ea4845f4',
'spirv_headers_revision': '29c11140baaf9f7fdaa39a583672c556bf1795a1',
'spirv_tools_revision': 'b8ab80843f67479b1b0c096138e62ec78145f05b',
'spirv_cross_revision': '53ab2144b90abede33be5161aec5dfc94ddc3caf',
}

deps = {
'third_party/effcee': vars['google_git'] + '/effcee.git@' +
vars['effcee_revision'],
'third_party/effcee': Var('google_git') + '/effcee.git@' +
Var('effcee_revision'),

'third_party/googletest': vars['google_git'] + '/googletest.git@' +
vars['googletest_revision'],
'third_party/googletest': Var('google_git') + '/googletest.git@' +
Var('googletest_revision'),

'third_party/glslang': vars['khronos_git'] + '/glslang.git@' +
vars['glslang_revision'],
'third_party/glslang': Var('khronos_git') + '/glslang.git@' +
Var('glslang_revision'),

'third_party/re2': vars['google_git'] + '/re2.git@' +
vars['re2_revision'],
'third_party/re2': Var('google_git') + '/re2.git@' +
Var('re2_revision'),

'third_party/spirv-headers': vars['khronos_git'] + '/SPIRV-Headers.git@' +
vars['spirv_headers_revision'],
'third_party/spirv-headers': Var('khronos_git') + '/SPIRV-Headers.git@' +
Var('spirv_headers_revision'),

'third_party/spirv-tools': vars['khronos_git'] + '/SPIRV-Tools.git@' +
vars['spirv_tools_revision'],
'third_party/spirv-tools': Var('khronos_git') + '/SPIRV-Tools.git@' +
Var('spirv_tools_revision'),

'third_party/spirv-cross': vars['khronos_git'] + '/SPIRV-Cross.git@' +
vars['spirv_cross_revision'],
'third_party/spirv-cross': Var('khronos_git') + '/SPIRV-Cross.git@' +
Var('spirv_cross_revision'),
}
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -21,7 +21,7 @@ RUN apk add --update \
cmake \
git \
ninja \
python \
python3 \
py-pip \
&& rm -rf /var/cache/apk/*

Expand Down
44 changes: 37 additions & 7 deletions README.md
Expand Up @@ -4,10 +4,19 @@ 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 doing the same.

Shaderc wraps around core functionality in [glslang][khr-glslang]
and [SPIRV-Tools][spirv-tools]. Shaderc aims to
- [`libshaderc`](libshaderc), a library API for accessing `glslc` functionality.
- [`spvc`](spvc), a command line wrapper around the SPIR-V to GLSL/HLSL/MSL
compiler [SPIRV-Cross][spirv-cross], and
- [`libshaderc_spvc`](libshaderc_spvc), a library API for accessing `spvc`
functionality.

**Note:** The fact that that `libshaderc` is not named `libshaderc_glslc` is a
quirk of history, and a known inconsistancy. 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
Expand All @@ -16,6 +25,16 @@ to provide:
operating systems
* increased functionality such as file `#include` support

`spvc` wraps around core functionality in [spirv-cross][spirv-cross]
and [SPIRV-Tools][spirv-tools]. `spirv` and its library aims to
provide:

* validation and transformation of inputs before cross-compiling
* an API designed around integration with specific projects like [Dawn][dawn]

**Note:** `spvc` and its library are WIP and optional artifacts that are by
default disabled in the build. How to enabled is detailed below.

## Downloads

<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)
Expand Down Expand Up @@ -69,9 +88,10 @@ Shaderc into.

## Getting and building Shaderc

**Experimental:** On Windows, instead of building from source, you can get the
artifacts built by [Appveyor][appveyor] for the top of the tree of the master
branch under the "Artifacts" tab of a certain job.
**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.

1) Check out the source code:

Expand Down Expand Up @@ -204,6 +224,14 @@ test.vert
/code $ glslc -c -o - test.vert | spirv-dis
```

### Building spvc

The value `SHADERC_ENABLE_SPVC` in `CMakeLists.txt` must be set to `ON` to
enable building `spvc`.

This can be achieved by either editing the file in your checkout, or passing
`-DSHADERC_ENABLE_SPVC=ON` to `cmake` to set the value.

## Bug tracking

We track bugs using GitHub -- click on the "Issues" button on
Expand Down Expand Up @@ -234,6 +262,8 @@ older versions of Shaderc and its dependencies.

[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
1 change: 0 additions & 1 deletion android_test/test.cpp
Expand Up @@ -16,7 +16,6 @@
#include <android_native_app_glue.h>

void android_main(struct android_app* state) {
app_dummy();
shaderc::Compiler compiler;
const char* test_program = "void main() {}";
compiler.CompileGlslToSpv(test_program, strlen(test_program),
Expand Down
18 changes: 18 additions & 0 deletions build_overrides/build.gni
@@ -0,0 +1,18 @@
# Copyright 2019 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.

# These are variables that are overridable by projects that include shaderc.

# Set to true when building shaderc as part of Chromium.
build_with_chromium = false
22 changes: 22 additions & 0 deletions glslc/README.asciidoc
Expand Up @@ -23,10 +23,12 @@ glslc [-c|-S|-E]
[-fhlsl-functionality1]
[-fentry-point=<name>]
[-fauto-map-locations]
[-finvert-y]
[-flimit=...]
[-flimit-file <resource-limits-file>]
[-fshader-stage=...]
[--target-env=...]
[--target-spv=...]
[-g]
[-O0|-Os]
[-Idirectory...]
Expand Down Expand Up @@ -134,6 +136,11 @@ multiple files generated. A filename of `-` represents standard output.

=== Language and Mode Selection Options

[[option-finverty]]
==== `-finverty`

Inverts position.Y output in a vertex shader.

[[option-flimit]]
==== `-flimit=`

Expand Down Expand Up @@ -233,6 +240,21 @@ Generated code uses SPIR-V 1.0, except that code compiled for Vulkan 1.1 uses SP

If this option is not specified, a default of `vulkan1.0` is used.

==== `--target-spv=`

`--target-spv=<value>` lets you specify the SPIR-V version to be used by the generated
module. The default is to use the highest version of SPIR-V required to be supported
by the target environment. For example, the default is SPIR-V 1.0 for Vulkan 1.0, and
and SPIR-V 1.3 for Vulkan 1.1.

The ``<value>`` can be one of the following:

* `spv1.0`
* `spv1.1`
* `spv1.2`
* `spv1.3`
* `spv1.4`

==== `-x`

`-x` lets you specify the language of the input shader files. Valid languages
Expand Down

0 comments on commit 8bd1f96

Please sign in to comment.