From 5c04e4882bd295e2761db90fb38a568432b165e7 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 11 Dec 2020 14:59:56 +0100 Subject: [PATCH 1/2] remove unused tilegroup.h and extra spaces from kernel4.comp Signed-off-by: Elias Naur --- piet-gpu/shader/kernel4.comp | 2 +- piet-gpu/shader/tilegroup.h | 132 ----------------------------------- 2 files changed, 1 insertion(+), 133 deletions(-) delete mode 100644 piet-gpu/shader/tilegroup.h diff --git a/piet-gpu/shader/kernel4.comp b/piet-gpu/shader/kernel4.comp index a95183c..1f2e27a 100644 --- a/piet-gpu/shader/kernel4.comp +++ b/piet-gpu/shader/kernel4.comp @@ -184,7 +184,7 @@ void main() { float solid_alpha = begin_solid_clip.alpha; for (uint k = 0; k < CHUNK; k++) { blend_stack[blend_slot][k] = packUnorm4x8(vec4(rgb[k], solid_alpha)); - } + } } blend_sp++; break; diff --git a/piet-gpu/shader/tilegroup.h b/piet-gpu/shader/tilegroup.h deleted file mode 100644 index 213ddc3..0000000 --- a/piet-gpu/shader/tilegroup.h +++ /dev/null @@ -1,132 +0,0 @@ -// Code auto-generated by piet-gpu-derive - -struct InstanceRef { - uint offset; -}; - -struct JumpRef { - uint offset; -}; - -struct ChunkRef { - uint offset; -}; - -struct TileGroupRef { - uint offset; -}; - -struct Instance { - uint item_ref; - vec2 offset; -}; - -#define Instance_size 12 - -InstanceRef Instance_index(InstanceRef ref, uint index) { - return InstanceRef(ref.offset + index * Instance_size); -} - -struct Jump { - TileGroupRef new_ref; -}; - -#define Jump_size 4 - -JumpRef Jump_index(JumpRef ref, uint index) { - return JumpRef(ref.offset + index * Jump_size); -} - -struct Chunk { - uint chunk_n; - ChunkRef next; -}; - -#define Chunk_size 8 - -ChunkRef Chunk_index(ChunkRef ref, uint index) { - return ChunkRef(ref.offset + index * Chunk_size); -} - -#define TileGroup_Instance 0 -#define TileGroup_Jump 1 -#define TileGroup_End 2 -#define TileGroup_size 16 - -TileGroupRef TileGroup_index(TileGroupRef ref, uint index) { - return TileGroupRef(ref.offset + index * TileGroup_size); -} - -Instance Instance_read(InstanceRef ref) { - uint ix = ref.offset >> 2; - uint raw0 = tilegroup[ix + 0]; - uint raw1 = tilegroup[ix + 1]; - uint raw2 = tilegroup[ix + 2]; - Instance s; - s.item_ref = raw0; - s.offset = vec2(uintBitsToFloat(raw1), uintBitsToFloat(raw2)); - return s; -} - -void Instance_write(InstanceRef ref, Instance s) { - uint ix = ref.offset >> 2; - tilegroup[ix + 0] = s.item_ref; - tilegroup[ix + 1] = floatBitsToUint(s.offset.x); - tilegroup[ix + 2] = floatBitsToUint(s.offset.y); -} - -Jump Jump_read(JumpRef ref) { - uint ix = ref.offset >> 2; - uint raw0 = tilegroup[ix + 0]; - Jump s; - s.new_ref = TileGroupRef(raw0); - return s; -} - -void Jump_write(JumpRef ref, Jump s) { - uint ix = ref.offset >> 2; - tilegroup[ix + 0] = s.new_ref.offset; -} - -Chunk Chunk_read(ChunkRef ref) { - uint ix = ref.offset >> 2; - uint raw0 = tilegroup[ix + 0]; - uint raw1 = tilegroup[ix + 1]; - Chunk s; - s.chunk_n = raw0; - s.next = ChunkRef(raw1); - return s; -} - -void Chunk_write(ChunkRef ref, Chunk s) { - uint ix = ref.offset >> 2; - tilegroup[ix + 0] = s.chunk_n; - tilegroup[ix + 1] = s.next.offset; -} - -uint TileGroup_tag(TileGroupRef ref) { - return tilegroup[ref.offset >> 2]; -} - -Instance TileGroup_Instance_read(TileGroupRef ref) { - return Instance_read(InstanceRef(ref.offset + 4)); -} - -Jump TileGroup_Jump_read(TileGroupRef ref) { - return Jump_read(JumpRef(ref.offset + 4)); -} - -void TileGroup_Instance_write(TileGroupRef ref, Instance s) { - tilegroup[ref.offset >> 2] = TileGroup_Instance; - Instance_write(InstanceRef(ref.offset + 4), s); -} - -void TileGroup_Jump_write(TileGroupRef ref, Jump s) { - tilegroup[ref.offset >> 2] = TileGroup_Jump; - Jump_write(JumpRef(ref.offset + 4), s); -} - -void TileGroup_End_write(TileGroupRef ref) { - tilegroup[ref.offset >> 2] = TileGroup_End; -} - From d21f2b68dead09b5bbe47b65a73ee7cbc08fe2c4 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 11 Dec 2020 15:01:48 +0100 Subject: [PATCH 2/2] all: add SPDX license headers Fixes #53 Signed-off-by: Elias Naur --- piet-gpu-derive/src/glsl.rs | 1 + piet-gpu/shader/annotated.h | 2 ++ piet-gpu/shader/backdrop.comp | 2 ++ piet-gpu/shader/binning.comp | 2 ++ piet-gpu/shader/bins.h | 2 ++ piet-gpu/shader/coarse.comp | 2 ++ piet-gpu/shader/elements.comp | 2 ++ piet-gpu/shader/kernel4.comp | 2 ++ piet-gpu/shader/path_coarse.comp | 2 ++ piet-gpu/shader/pathseg.h | 2 ++ piet-gpu/shader/ptcl.h | 2 ++ piet-gpu/shader/scene.h | 2 ++ piet-gpu/shader/setup.h | 2 ++ piet-gpu/shader/state.h | 2 ++ piet-gpu/shader/tile.h | 2 ++ piet-gpu/shader/tile_alloc.comp | 2 ++ 16 files changed, 31 insertions(+) diff --git a/piet-gpu-derive/src/glsl.rs b/piet-gpu-derive/src/glsl.rs index ec87640..b55dda4 100644 --- a/piet-gpu-derive/src/glsl.rs +++ b/piet-gpu-derive/src/glsl.rs @@ -8,6 +8,7 @@ use crate::parse::{GpuScalar, GpuType}; pub fn gen_glsl(module: &LayoutModule) -> String { let mut r = String::new(); + writeln!(&mut r, "// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense\n").unwrap(); writeln!(&mut r, "// Code auto-generated by piet-gpu-derive\n").unwrap(); // Note: GLSL needs definitions before uses. We could do a topological sort here, // but easiest for now to just require that in spec. diff --git a/piet-gpu/shader/annotated.h b/piet-gpu/shader/annotated.h index 2adacb1..1e1ebe6 100644 --- a/piet-gpu/shader/annotated.h +++ b/piet-gpu/shader/annotated.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // Code auto-generated by piet-gpu-derive struct AnnoFillRef { diff --git a/piet-gpu/shader/backdrop.comp b/piet-gpu/shader/backdrop.comp index 9e235c9..42eec9c 100644 --- a/piet-gpu/shader/backdrop.comp +++ b/piet-gpu/shader/backdrop.comp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // Propagation of tile backdrop for filling. // // Each thread reads one path element and calculates the number of spanned tiles diff --git a/piet-gpu/shader/binning.comp b/piet-gpu/shader/binning.comp index 53edadf..fc1d355 100644 --- a/piet-gpu/shader/binning.comp +++ b/piet-gpu/shader/binning.comp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // The binning stage of the pipeline. // // Each workgroup processes N_TILE paths. diff --git a/piet-gpu/shader/bins.h b/piet-gpu/shader/bins.h index 5d2b2c7..bc32dda 100644 --- a/piet-gpu/shader/bins.h +++ b/piet-gpu/shader/bins.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // Code auto-generated by piet-gpu-derive struct BinInstanceRef { diff --git a/piet-gpu/shader/coarse.comp b/piet-gpu/shader/coarse.comp index c319cbe..a173608 100644 --- a/piet-gpu/shader/coarse.comp +++ b/piet-gpu/shader/coarse.comp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // The coarse rasterizer stage of the pipeline. // // As input we have the ordered partitions of paths from the binning phase and diff --git a/piet-gpu/shader/elements.comp b/piet-gpu/shader/elements.comp index 532ee8c..5e8957f 100644 --- a/piet-gpu/shader/elements.comp +++ b/piet-gpu/shader/elements.comp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // The element processing stage, first in the pipeline. // // This stage is primarily about applying transforms and computing bounding diff --git a/piet-gpu/shader/kernel4.comp b/piet-gpu/shader/kernel4.comp index 1f2e27a..d01627c 100644 --- a/piet-gpu/shader/kernel4.comp +++ b/piet-gpu/shader/kernel4.comp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // This is "kernel 4" in a 4-kernel pipeline. It renders the commands // in the per-tile command list to an image. diff --git a/piet-gpu/shader/path_coarse.comp b/piet-gpu/shader/path_coarse.comp index eb3509b..0cfb882 100644 --- a/piet-gpu/shader/path_coarse.comp +++ b/piet-gpu/shader/path_coarse.comp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // Coarse rasterization of path segments. // Allocation and initialization of tiles for paths. diff --git a/piet-gpu/shader/pathseg.h b/piet-gpu/shader/pathseg.h index de4ed28..4ce6c46 100644 --- a/piet-gpu/shader/pathseg.h +++ b/piet-gpu/shader/pathseg.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // Code auto-generated by piet-gpu-derive struct PathFillLineRef { diff --git a/piet-gpu/shader/ptcl.h b/piet-gpu/shader/ptcl.h index 0236183..20b362e 100644 --- a/piet-gpu/shader/ptcl.h +++ b/piet-gpu/shader/ptcl.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // Code auto-generated by piet-gpu-derive struct CmdCircleRef { diff --git a/piet-gpu/shader/scene.h b/piet-gpu/shader/scene.h index 03a4884..d0bba6f 100644 --- a/piet-gpu/shader/scene.h +++ b/piet-gpu/shader/scene.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // Code auto-generated by piet-gpu-derive struct LineSegRef { diff --git a/piet-gpu/shader/setup.h b/piet-gpu/shader/setup.h index 6bdde03..6998a16 100644 --- a/piet-gpu/shader/setup.h +++ b/piet-gpu/shader/setup.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // Various constants for the sizes of groups and tiles. // Much of this will be made dynamic in various ways, but for now it's easiest diff --git a/piet-gpu/shader/state.h b/piet-gpu/shader/state.h index eacab52..8479dcf 100644 --- a/piet-gpu/shader/state.h +++ b/piet-gpu/shader/state.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // Code auto-generated by piet-gpu-derive struct StateRef { diff --git a/piet-gpu/shader/tile.h b/piet-gpu/shader/tile.h index b6c5e14..a33cb5a 100644 --- a/piet-gpu/shader/tile.h +++ b/piet-gpu/shader/tile.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // Code auto-generated by piet-gpu-derive struct PathRef { diff --git a/piet-gpu/shader/tile_alloc.comp b/piet-gpu/shader/tile_alloc.comp index f8bbc0d..64529d1 100644 --- a/piet-gpu/shader/tile_alloc.comp +++ b/piet-gpu/shader/tile_alloc.comp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense + // Allocation and initialization of tiles for paths. #version 450