Address review feedback

Cleans up some of the immediate issue, but still hacky and has a bunch
of stuff hard-coded.
This commit is contained in:
Raph Levien 2022-10-25 09:03:13 -07:00
parent a50d76cb1c
commit 911dee23cd
9 changed files with 11 additions and 13 deletions

2
.gitattributes vendored
View file

@ -1,3 +1,3 @@
**/shader/* linguist-language=glsl
**/shader/gen/* linguist-generated
piet-wgpu/shader/* linguist-language=wgsl

3
Cargo.lock generated
View file

@ -906,6 +906,7 @@ dependencies = [
[[package]]
name = "naga"
version = "0.10.0"
source = "git+https://github.com/gfx-rs/naga?rev=ddcd5d3121150b2b1beee6e54e9125ff31aaa9a2#ddcd5d3121150b2b1beee6e54e9125ff31aaa9a2"
dependencies = [
"bit-set",
"bitflags",
@ -1274,7 +1275,7 @@ dependencies = [
]
[[package]]
name = "piet-twgsl"
name = "piet-wgsl"
version = "0.1.0"
dependencies = [
"bytemuck",

View file

@ -13,4 +13,6 @@ members = [
]
[patch.crates-io]
naga = { path = "../../dl/naga" }
# Required for metal support to work on wgpu
# TODO: remove when wgpu is upgraded to 0.15
naga = { git = "https://github.com/gfx-rs/naga", rev="ddcd5d3121150b2b1beee6e54e9125ff31aaa9a2" }

View file

@ -1,3 +0,0 @@
target
.ninja_deps
.ninja_log

View file

@ -1,5 +1,5 @@
[package]
name = "piet-twgsl"
name = "piet-wgsl"
version = "0.1.0"
authors = ["Raph Levien <raph@google.com>"]
license = "MIT/Apache-2.0"

View file

@ -20,10 +20,7 @@ struct Tile {
segments: u32,
}
struct Config {
width_in_tiles: u32,
height_in_tiles: u32,
}
{{> config}}
@group(0) @binding(0)
var<storage> config: Config;
@ -49,6 +46,7 @@ fn main(
backdrop = tiles[ix].backdrop;
}
sh_backdrop[local_id.x] = backdrop;
// iterate log2(WG_SIZE) times
for (var i = 0u; i < firstTrailingBit(WG_SIZE); i += 1u) {
workgroupBarrier();
if local_id.x >= (1u << i) {

View file

@ -20,7 +20,6 @@ use std::{fs::File, io::BufWriter};
use engine::Engine;
use bytemuck;
use render::render;
use test_scene::dump_scene_info;
use wgpu::{Device, Queue};

View file

@ -65,6 +65,7 @@ pub fn render(scene: &Scene, shaders: &Shaders) -> (Recording, BufProxy) {
// TODO: more principled size calc
let tiles_buf = BufProxy::new(4097 * 8);
let segments_buf = BufProxy::new(256 * 24);
recording.clear_all(tiles_buf);
recording.dispatch(
shaders.path_coarse,
(path_coarse_wgs, 1, 1),

View file

@ -25,7 +25,7 @@ impl ShaderTemplate {
pub fn new() -> ShaderTemplate {
let mut handlebars = Handlebars::new();
handlebars
.register_templates_directory("twgsl", "shader")
.register_templates_directory("twgsl", concat!(env!("CARGO_MANIFEST_DIR"), "/shader"))
.unwrap();
handlebars.register_escape_fn(handlebars::no_escape);
ShaderTemplate { handlebars }