Skip to content

Commit 8c1bfc3

Browse files
nicoburnsmrobinson
authored andcommitted
Prepare WebRender for crates.io release
Changes made: - Update webrender and in-repo crates that are dependencies of webrender to version 0.68 - Update these crates to use workspace depency versions similar to stylo#249 (seeing as the feedback on that change was positive). I have not bothered updating the versions of the other in-repo crates that are not dependencies of webrender (e.g. wrench and crates that are used by wrench like swgl) as we don't need to publish those and thus their version numbers don't matter, and I figured it would keep the diff a little smaller. But it would be easy to update those too if we wanted to. Signed-off-by: Nico Burns <[email protected]>
1 parent 6cafc60 commit 8c1bfc3

Some content is hidden

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

67 files changed

+9197
-30
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install Rust
1818
uses: dtolnay/rust-toolchain@stable
1919
- name: Install freetype
20-
run: sudo apt install libfreetype-dev
20+
run: sudo apt update && sudo apt install -y libfreetype-dev
2121
- name: Build wrench
2222
run: |
2323
cd wrench

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,19 @@ members = [
88
]
99
resolver = "2"
1010

11+
[workspace.package]
12+
version = "0.68.0"
13+
1114
[workspace.dependencies]
15+
api = { version = "0.68", path = "./webrender_api", package = "webrender_api" }
16+
glsl-to-cxx = { version = "0.68", path = "./glsl-to-cxx", package = "glsl-to-cxx" }
17+
glyph_rasterizer = { version = "0.68", path = "./wr_glyph_rasterizer", package = "wr_glyph_rasterizer" }
18+
malloc_size_of = { version = "0.2.2", path = "./wr_malloc_size_of", package = "wr_malloc_size_of" }
19+
peek-poke = { version = "0.3", path = "./peek-poke", package = "peek-poke" }
20+
swgl = { version = "0.68", path = "./swgl", package = "swgl" }
21+
webrender = { version = "0.68", path = "./webrender", package = "webrender" }
22+
webrender_build = { version = "0.68", path = "./webrender_build", package = "webrender_build" }
23+
1224
gleam = "0.15.1"
1325
glean = "=65.2.1"
1426

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
WebRender is a GPU-based 2D rendering engine written in [Rust](https://www.rust-lang.org/). [Firefox](https://www.mozilla.org/firefox), the research web browser [Servo](https://github.com/servo/servo), and other GUI frameworks draw with it. It currently uses the OpenGL API internally.
66

7-
Note that the canonical home for this code is in gfx/wr folder of the
8-
mozilla-central repository at https://hg.mozilla.org/mozilla-central. The
7+
Note that the canonical home for this code is in [gfx/wr folder[(https://github.com/mozilla-firefox/firefox/tree/main/gfx/wr)] of the
8+
mozilla-central repository at https://github.com/mozilla-firefox/firefox. The
99
Github repository at https://github.com/servo/webrender should be considered
1010
a downstream mirror, although it contains additional metadata (such as Github
1111
wiki pages) that do not exist in mozilla-central. Pull requests against the
@@ -51,3 +51,17 @@ example.
5151

5252
See [this gist](https://gist.github.com/finalfantasia/129cae811e02bf4551ac) for
5353
how to make the text tests useful in Fedora, for example.
54+
55+
# Publishing
56+
57+
When publishing these crates to crates.io, the must be published in order.
58+
59+
- `wr_malloc_size_of`: **DO NOT PUBLISH THIS CRATE**. It is released from the upstream repository.
60+
- `webrender_build`
61+
- `glsl-to-cxx`
62+
- `swgl`
63+
- `peek-poke-derive` (`peek-poke/peek-poke-derive`)
64+
- `peek-poke` (`peek-poke/peek-poke-derive`)
65+
- `webrender-api`
66+
- `wr_glyph_rasterizer`
67+
- `webrender`

glsl-to-cxx/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "glsl-to-cxx"
3-
version = "0.1.0"
3+
version.workspace = true
4+
description = "A translator from GLSL to vectorized C++."
45
license = "MPL-2.0"
56
authors = ["The Mozilla Project Developers", "Dimitri Sabadie"]
67
edition = "2018"

swgl/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[package]
22
name = "swgl"
3-
version = "0.1.0"
3+
version.workspace = true
44
license = "MPL-2.0"
55
authors = ["The Mozilla Project Developers"]
66
build = "build.rs"
77
description = "Software OpenGL implementation for WebRender."
88

99
[build-dependencies]
1010
cc = "1.0.46"
11-
glsl-to-cxx = { path = "../glsl-to-cxx" }
12-
webrender_build = { path = "../webrender_build" }
11+
glsl-to-cxx = { workspace = true }
12+
webrender_build = { workspace = true }
1313

1414
[dependencies]
1515
gleam = { workspace = true }

swgl/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fn translate_shader(
137137
}
138138

139139
fn main() {
140-
let shader_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap() + "/../webrender/res";
140+
let shader_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap() + "/res";
141141

142142
let shader_flags = ShaderFeatureFlags::GL
143143
| ShaderFeatureFlags::DUAL_SOURCE_BLENDING

swgl/res/Proggy.ttf

5.16 KB
Binary file not shown.

swgl/res/area-lut.tga

64 KB
Binary file not shown.

swgl/res/base.glsl

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
#if defined(GL_ES)
6+
#if GL_ES == 1
7+
// Sampler default precision is lowp on mobile GPUs.
8+
// This causes RGBA32F texture data to be clamped to 16 bit floats on some GPUs (e.g. Mali-T880).
9+
// Define highp precision macro to allow lossless FLOAT texture sampling.
10+
#define HIGHP_SAMPLER_FLOAT highp
11+
12+
// Default int precision in GLES 3 is highp (32 bits) in vertex shaders
13+
// and mediump (16 bits) in fragment shaders. If an int is being used as
14+
// a texel address in a fragment shader it, and therefore requires > 16
15+
// bits, it must be qualified with this.
16+
#define HIGHP_FS_ADDRESS highp
17+
18+
// texelFetchOffset is buggy on some Android GPUs (see issue #1694).
19+
// Fallback to texelFetch on mobile GPUs.
20+
#define TEXEL_FETCH(sampler, position, lod, offset) texelFetch(sampler, position + offset, lod)
21+
#else
22+
#define HIGHP_SAMPLER_FLOAT
23+
#define HIGHP_FS_ADDRESS
24+
#define TEXEL_FETCH(sampler, position, lod, offset) texelFetchOffset(sampler, position, lod, offset)
25+
#endif
26+
#else
27+
#define HIGHP_SAMPLER_FLOAT
28+
#define HIGHP_FS_ADDRESS
29+
#if defined(PLATFORM_MACOS) && !defined(SWGL)
30+
// texelFetchOffset introduces a variety of shader compilation bugs on macOS Intel so avoid it.
31+
#define TEXEL_FETCH(sampler, position, lod, offset) texelFetch(sampler, position + offset, lod)
32+
#else
33+
#define TEXEL_FETCH(sampler, position, lod, offset) texelFetchOffset(sampler, position, lod, offset)
34+
#endif
35+
#endif
36+
37+
#ifdef SWGL
38+
#define SWGL_DRAW_SPAN
39+
#define SWGL_CLIP_MASK
40+
#define SWGL_ANTIALIAS
41+
#define SWGL_BLEND
42+
#define SWGL_CLIP_DIST
43+
#endif
44+
45+
#ifdef WR_VERTEX_SHADER
46+
#ifdef SWGL
47+
// Annotate a vertex attribute as being flat per each drawn primitive instance.
48+
// SWGL can use this information to avoid redundantly loading the attribute in all SIMD lanes.
49+
#define PER_INSTANCE flat
50+
#else
51+
#define PER_INSTANCE
52+
#endif
53+
54+
#if __VERSION__ != 100
55+
#define varying out
56+
#define attribute in
57+
#endif
58+
#endif
59+
60+
#ifdef WR_FRAGMENT_SHADER
61+
precision highp float;
62+
#if __VERSION__ != 100
63+
#define varying in
64+
#endif
65+
#endif
66+
67+
// Flat interpolation is not supported on ESSL 1
68+
#if __VERSION__ == 100
69+
#define flat
70+
#endif

0 commit comments

Comments
 (0)