Skip to content

Commit 657367a

Browse files
Merge pull request #24 from ARM-software/release
Release 1.1.1
2 parents 27a51bd + 5a0bf31 commit 657367a

File tree

130 files changed

+4787
-6699
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+4787
-6699
lines changed

.copyrightignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.clang-format
2+
doxyfile
3+
.gitignore
4+
.snakeignore
5+
.yml
6+
.gitmodules
7+
.jpg
8+
.png
9+
.ttf
10+
VERSION

.gitlab-ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,23 @@ Doxygen:
1414
- doxygen docs/doxygen/doxyfile
1515
- if [ $(stat -c%s doxygen/warnings.txt) -gt 0 ]; then cat doxygen/warnings.txt; exit 1; fi
1616

17+
CopyrightHeaders:
18+
stage: Check
19+
image: $DOCKER_REGISTRY/docker/copyright-check/linux:latest
20+
tags:
21+
- linux
22+
- docker
23+
script:
24+
- python3 /usr/local/bin/check_copyright_headers.py $TARGET_BRANCH
25+
1726
SnakeCase:
1827
stage: Check
1928
image: $DOCKER_REGISTRY/docker/snake_case_check/linux:latest
2029
tags:
2130
- linux
2231
- docker
2332
script:
24-
- git snake-case origin/develop > snake-report.txt
33+
- git snake-case $TARGET_BRANCH > snake-report.txt
2534
- if [ $(grep -c '@@' snake-report.txt) -gt 0 ]; then cat snake-report.txt; exit 1; fi
2635
allow_failure: true
2736

@@ -32,7 +41,7 @@ ClangFormat:
3241
- linux
3342
- docker
3443
script:
35-
- git clang-format -v --diff origin/develop > clang-format-report.txt
44+
- git clang-format -v --diff $TARGET_BRANCH > clang-format-report.txt
3645
- if [ $(grep -c 'clang-format did not modify any files' clang-format-report.txt) -eq 0 ] && [ $(grep -c 'no modified files to format' clang-format-report.txt) -eq 0 ]; then cat clang-format-report.txt; exit 1; fi
3746

3847
ClangTidy:

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1919
#
2020

21-
cmake_minimum_required(VERSION 3.6)
21+
cmake_minimum_required(VERSION 3.8)
2222

2323
project(vulkan_best_practice)
2424

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ This project uses the following 3D models. Each one has its own licence.
115115

116116
Models downloaded from Morgan McGuire's [Computer Graphics Archive](https://casual-effects.com/data).
117117

118+
Fonts downloaded from [Google Fonts](https://fonts.google.com), under license [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0)
119+
118120
### Trademarks
119121

120122
Vulkan is a registered trademark of the Khronos Group Inc.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.0
1+
1.1.1

assets/fonts/Roboto-Regular.ttf

168 KB
Binary file not shown.
111 KB
Binary file not shown.

assets/shaders/base.frag

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,55 @@
2121

2222
precision highp float;
2323

24-
layout (set=0, binding=0) uniform sampler2D base_color_sampler;
24+
#ifdef HAS_BASE_COLOR_TEXTURE
25+
layout (set=0, binding=0) uniform sampler2D base_color_texture;
26+
#endif
2527

2628
layout (location = 0) in vec4 in_pos;
2729
layout (location = 1) in vec2 in_uv;
2830
layout (location = 2) in vec3 in_normal;
2931

3032
layout (location = 0) out vec4 o_color;
3133

32-
layout(push_constant, std430) uniform PushConstant {
33-
layout(offset = 128) vec4 light_pos;
34+
layout(set = 0, binding = 1) uniform GlobalUniform {
35+
mat4 model;
36+
mat4 view_proj;
37+
vec4 light_pos;
3438
vec4 light_color;
35-
} fs_push_constant;
39+
} global_uniform;
40+
41+
// Push constants are much quicker than uniforms
42+
// but they come with a limitation in the size of data.
43+
// The standard requires at least 128 bytes
44+
layout(push_constant, std430) uniform PBRMaterialUniform {
45+
vec4 base_color_factor;
46+
float metallic_factor;
47+
float roughness_factor;
48+
} pbr_material_uniform;
3649

3750
void main(void)
3851
{
3952
vec3 normal = normalize(in_normal);
4053

41-
vec3 world_to_light = fs_push_constant.light_pos.xyz - in_pos.xyz;
54+
vec3 world_to_light = global_uniform.light_pos.xyz - in_pos.xyz;
4255

4356
float dist = length(world_to_light) * 0.0001;
4457

45-
float atten = 1.0 - smoothstep(0.5 * fs_push_constant.light_pos.w, fs_push_constant.light_pos.w, dist);
58+
float atten = 1.0 - smoothstep(0.5 * global_uniform.light_pos.w, global_uniform.light_pos.w, dist);
4659

4760
world_to_light = normalize(world_to_light);
4861

4962
float ndotl = clamp(dot(normal, world_to_light), 0.0, 1.0);
5063

5164
vec4 base_color = vec4(1.0, 0.0, 0.0, 1.0);
5265

53-
base_color = texture(base_color_sampler, in_uv);
66+
#ifdef HAS_BASE_COLOR_TEXTURE
67+
base_color = texture(base_color_texture, in_uv);
68+
#else
69+
base_color = pbr_material_uniform.base_color_factor;
70+
#endif
5471

5572
vec4 ambient_color = vec4(0.2, 0.2, 0.2, 1.0) * base_color;
5673

57-
o_color = ambient_color + ndotl * atten * fs_push_constant.light_color * base_color;
74+
o_color = ambient_color + ndotl * atten * global_uniform.light_color * base_color;
5875
}

assets/shaders/base.vert

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,24 @@ layout(location = 0) in vec3 position;
2323
layout(location = 1) in vec2 texcoord_0;
2424
layout(location = 2) in vec3 normal;
2525

26-
layout(push_constant, std430) uniform PushConstant {
26+
layout(set = 0, binding = 1) uniform GlobalUniform {
2727
mat4 model;
2828
mat4 view_proj;
29-
} vs_push_constant;
29+
vec4 light_pos;
30+
vec4 light_color;
31+
} global_uniform;
3032

3133
layout (location = 0) out vec4 o_pos;
3234
layout (location = 1) out vec2 o_uv;
3335
layout (location = 2) out vec3 o_normal;
3436

3537
void main(void)
3638
{
37-
o_pos = vs_push_constant.model * vec4(position, 1.0);
39+
o_pos = global_uniform.model * vec4(position, 1.0);
3840

3941
o_uv = texcoord_0;
4042

41-
o_normal = mat3(vs_push_constant.model) * normal;
43+
o_normal = mat3(global_uniform.model) * normal;
4244

43-
gl_Position = vs_push_constant.view_proj * o_pos;
45+
gl_Position = global_uniform.view_proj * o_pos;
4446
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#[[
2+
Copyright (c) 2019, Arm Limited and Contributors
3+
4+
SPDX-License-Identifier: MIT
5+
6+
Permission is hereby granted, free of charge,
7+
to any person obtaining a copy of this software and associated documentation files (the "Software"),
8+
to deal in the Software without restriction, including without limitation the rights to
9+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
10+
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
21+
]]
22+
23+
set(CMAKE_MODULE_PATH
24+
${CMAKE_MODULE_PATH}
25+
${CMAKE_MODULE_PATH}/module)
26+
set(ASSETS_DIR ${ASSETS_DIR})
27+
set(DEVICE_DIR ${DEVICE_DIR})
28+
29+
find_package(Adb 1.0.40 REQUIRED)
30+
31+
set(ADB_COMMAND ${ADB_EXECUTABLE} push --sync ${ASSETS_DIR} ${DEVICE_DIR})
32+
33+
execute_process(
34+
COMMAND
35+
${ADB_COMMAND}
36+
RESULT_VARIABLE
37+
ret_var
38+
OUTPUT_VARIABLE
39+
ret_msg
40+
OUTPUT_STRIP_TRAILING_WHITESPACE)
41+
42+
if(NOT "${ret_var}" STREQUAL "0")
43+
message(WARNING "Could not sync assets to device:\n${ret_msg}")
44+
else()
45+
message(STATUS "Updating assets:\n${ret_msg}")
46+
endif()

0 commit comments

Comments
 (0)