From 1cc5c7ac0d7c2c4c267a77bbdce02514031fc96a Mon Sep 17 00:00:00 2001 From: msiglreith Date: Sun, 28 Jun 2020 15:37:27 +0200 Subject: [PATCH] Shader documentation and a slight cleanup --- piet-gpu/shader/backdrop.comp | 17 +++++++++++++++-- piet-gpu/shader/backdrop.spv | Bin 7224 -> 7272 bytes piet-gpu/shader/binning.comp | 29 ++++++++++++++++++----------- piet-gpu/shader/binning.spv | Bin 15876 -> 10484 bytes piet-gpu/shader/coarse.comp | 9 ++++++++- piet-gpu/shader/coarse.spv | Bin 31312 -> 31188 bytes piet-gpu/shader/kernel4.comp | 2 ++ piet-gpu/src/lib.rs | 2 +- 8 files changed, 44 insertions(+), 15 deletions(-) diff --git a/piet-gpu/shader/backdrop.comp b/piet-gpu/shader/backdrop.comp index 090db1d..afe4d62 100644 --- a/piet-gpu/shader/backdrop.comp +++ b/piet-gpu/shader/backdrop.comp @@ -1,4 +1,14 @@ // Propagation of tile backdrop for filling. +// +// Each thread reads one path element and calculates the number of spanned tiles +// based on the bounding box. +// In a further compaction step, the workgroup loops over the corresponding tile rows per element in parallel. +// For each row the per tile backdrop will be read, as calculated in the previous coarse path segment kernel, +// and propagated from the left to the right (prefix summed). +// +// Output state: +// - Each path element has an array of tiles covering the whole path based on boundig box +// - Each tile per path element contains the 'backdrop' and a list of subdivided path segments #version 450 #extension GL_GOOGLE_include_directive : enable @@ -17,8 +27,8 @@ layout(set = 0, binding = 0) buffer AnnotatedBuf { // This is really only used for n_elements; maybe we can handle that // a different way, but it's convenient to have the same signature as // tile allocation. -layout(set = 0, binding = 1) buffer AllocBuf { - uint n_elements; +layout(set = 0, binding = 1) readonly buffer AllocBuf { + uint n_elements; // paths uint n_pathseg; uint alloc; }; @@ -39,6 +49,7 @@ void main() { uint element_ix = gl_GlobalInvocationID.x; AnnotatedRef ref = AnnotatedRef(element_ix * Annotated_size); + // Work assignment: 1 thread : 1 path element uint row_count = 0; if (element_ix < n_elements) { uint tag = Annotated_tag(ref); @@ -67,6 +78,7 @@ void main() { sh_row_count[th_ix] = row_count; } barrier(); + // Work assignment: 1 thread : 1 path element row uint total_rows = sh_row_count[BACKDROP_WG - 1]; for (uint row = th_ix; row < total_rows; row += BACKDROP_WG) { // Binary search to find element @@ -80,6 +92,7 @@ void main() { uint seq_ix = row - (el_ix > 0 ? sh_row_count[el_ix - 1] : 0); uint width = sh_row_width[el_ix]; // Process one row sequentially + // Read backdrop value per tile and prefix sum it uint tile_el_ix = sh_row_base[el_ix] + seq_ix * 2 * width; uint sum = tile[tile_el_ix]; for (uint x = 1; x < width; x++) { diff --git a/piet-gpu/shader/backdrop.spv b/piet-gpu/shader/backdrop.spv index a633c16fcb1b4053d4b2425edb6bebca5fae7d13..67d05dfb6314282d14da2f770eeaf1950d5a02f2 100644 GIT binary patch delta 96 zcmdmC@xo$57i%yJLnZ?RNB}7h239y<87l6<08zsTfEcER38ZH8TGnnc E0246@f&c&j delta 48 mcmaE1vBP3R7ppQWLnZ?RC_`xv28b9VkPi}L*?gC^TMPim+Xol` diff --git a/piet-gpu/shader/binning.comp b/piet-gpu/shader/binning.comp index d35c2d9..0ddeb7e 100644 --- a/piet-gpu/shader/binning.comp +++ b/piet-gpu/shader/binning.comp @@ -1,4 +1,8 @@ // The binning stage of the pipeline. +// +// Each workgroup processes N_TILE paths. +// Each thread processes one path and calculates a N_TILE_X x N_TILE_Y coverage mask +// based on the path bounding box to bin the paths. #version 450 #extension GL_GOOGLE_include_directive : enable @@ -17,7 +21,7 @@ layout(set = 0, binding = 1) buffer StateBuf { }; layout(set = 0, binding = 2) buffer AllocBuf { - uint n_elements; + uint n_elements; // paths // Will be incremented atomically to claim tiles uint tile_ix; uint alloc; @@ -41,6 +45,7 @@ layout(set = 0, binding = 3) buffer BinsBuf { #define INFINITY (1.0 / 0.0) // Note: cudaraster has N_TILE + 1 to cut down on bank conflicts. +// Bitmaps are sliced (256bit into 8 (N_SLICE) 32bit submaps) shared uint bitmaps[N_SLICE][N_TILE]; shared uint count[N_SLICE][N_TILE]; shared uint sh_chunk_start[N_TILE]; @@ -72,17 +77,17 @@ void main() { } int x0 = 0, y0 = 0, x1 = 0, y1 = 0; float my_right_edge = INFINITY; - bool crosses_edge = false; + // bool crosses_edge = false; switch (tag) { - case Annotated_FillLine: - case Annotated_StrokeLine: - AnnoStrokeLineSeg line = Annotated_StrokeLine_read(ref); - x0 = int(floor((min(line.p0.x, line.p1.x) - line.stroke.x) * SX)); - y0 = int(floor((min(line.p0.y, line.p1.y) - line.stroke.y) * SY)); - x1 = int(ceil((max(line.p0.x, line.p1.x) + line.stroke.x) * SX)); - y1 = int(ceil((max(line.p0.y, line.p1.y) + line.stroke.y) * SY)); - crosses_edge = tag == Annotated_FillLine && ceil(line.p0.y * TSY) != ceil(line.p1.y * TSY); - break; + // case Annotated_FillLine: + // case Annotated_StrokeLine: + // AnnoStrokeLineSeg line = Annotated_StrokeLine_read(ref); + // x0 = int(floor((min(line.p0.x, line.p1.x) - line.stroke.x) * SX)); + // y0 = int(floor((min(line.p0.y, line.p1.y) - line.stroke.y) * SY)); + // x1 = int(ceil((max(line.p0.x, line.p1.x) + line.stroke.x) * SX)); + // y1 = int(ceil((max(line.p0.y, line.p1.y) + line.stroke.y) * SY)); + // crosses_edge = tag == Annotated_FillLine && ceil(line.p0.y * TSY) != ceil(line.p1.y * TSY); + // break; case Annotated_Fill: case Annotated_Stroke: // Note: we take advantage of the fact that fills and strokes @@ -98,6 +103,7 @@ void main() { break; } + /* // If the last element in this partition is a fill edge, then we need to do a // look-forward to find the right edge of its corresponding fill. That data is // recorded in aggregates computed in the element processing pass. @@ -126,6 +132,7 @@ void main() { if (crosses_edge) { x1 = int(ceil(my_right_edge * SX)); } + */ // At this point, we run an iterator over the coverage area, // trying to keep divergence low. diff --git a/piet-gpu/shader/binning.spv b/piet-gpu/shader/binning.spv index 524f9e44971fd90bfed307ae7e5a9a3ed88671a1..0d30dfc18cb022403c89ba1238e2fbad0e8be950 100644 GIT binary patch literal 10484 zcmZX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Yv+Lyc>?AsDFYw^5a|0?*aFVV^B-|Q^0E3%cp|X`s&iWn@$IxOtByR zX?q4(pK+ZFd3;O2W!$sjYTg5Rmp&GpxcbxfabSJMbx!5+odYi8o(EU+{g}ARz=^9r zZO;emGp=hRk8e4+jC&DW?Ltc8J|3L7`qTDeus-9u#`5@{050QR23Nb3lDJOW_E01pk>>lx5v^91eMJ@hOuxlOv7+B3aa2xD;ifz>0|5swiDV_=UrG3h+mza}a z*EumafYsu^3ha8te>GSweQpHXMm>FQ0^4WqAi4Dt^C@80DrfYmVCyfYn4{b}ssA*v zYmgkC4pxi*TCj5&|8-!s<)fg2fw|8zr2ILrr>V?-`Voa<1^sq;aX>Io(WdZ zUH2@oTISju)l&aCV71(J&jqXX)up-XZUtv=>rdO~f%Q3`j#VDt^TB1@7r@odqU6lH z5S+OB)AmJRea3apXuTgHjl0sAhB zeHz!c`px}r?7J!Ep8G>?ePet6-b2yv*%aq&_Ja4M`0P&cZ0?5LgW}oT3!C|QU#pjA z<^5>tIV&Fkt9e$kHXj6MZS-fn9|G$$CvkF`4xUT#nL|lVdxOns9@hI}8ulK_R7!IE zFxYx!jvs-m=X`z?tmgjl+u8OXqo}*?_q06!#_8km?I`NzDo?J??E;F=d`fcN2W+nU zV$F3H_Op~S*H6N&SLXUDxO#H^G*~UU&IEskqHeCnl;__Od=9)bMcrKG$#n{N5yj^~ zin;EOJ*dS8U=OC4_aWHa$)5+8d4B@&3ftU+u*XV@4(g0qPTCqi~SzOzC1s++Zy|Q zin`~q7yE-&OW!|)r*C80x0?0J-vw-Y1jXktit~Ob_Hc@GeIz!y-q-5+z3|6ywI5M3 QS3d!tOVQ^V%U$FD1E8;lumAu6 diff --git a/piet-gpu/shader/coarse.comp b/piet-gpu/shader/coarse.comp index eec0bfe..3dcd856 100644 --- a/piet-gpu/shader/coarse.comp +++ b/piet-gpu/shader/coarse.comp @@ -1,4 +1,12 @@ // The coarse rasterizer stage of the pipeline. +// +// As input we have the ordered partitions of paths from the binning phase and +// the annotated tile list of segments and backdrop per path. +// +// Each workgroup operating on one bin by stream compacting +// the elements corresponding to the bin. +// +// As output we have an ordered command stream per tile. Every tile from a path (backdrop + segment list) will be encoded. #version 450 #extension GL_GOOGLE_include_directive : enable @@ -369,7 +377,6 @@ void main() { cmd_fill.rgba_color = fill.rgba_color; Cmd_Fill_write(cmd_ref, cmd_fill); } else { - AnnoFill fill = Annotated_Fill_read(ref); Cmd_Solid_write(cmd_ref, CmdSolid(fill.rgba_color)); } cmd_ref.offset += Cmd_size; diff --git a/piet-gpu/shader/coarse.spv b/piet-gpu/shader/coarse.spv index ad24e6bd5fc181294585fac7eff1dd9e9bbc850e..692b6c1422345a74fcec5a565eb7e594ead27a19 100644 GIT binary patch delta 1697 zcmZ9M*-MpC6vfY-EFUaLL&HWwBMf>963e&`3Kc~p-b5clDhx~vtCwEB9*m;bOMgRe zmE0H0Y*3mfGaGCkwAo6n92)GmzI!)bRphL-_S*aGeZF(-`Vr_E4rGObOJ_J2a5MSM zXvu2K@!G=9?X7L9ZE(&-T-dcw@rZj2-_fvhd%CA@iYM&e zP4Ys2)6bKF&j+UQU?MuVGZ2U*BDtZ=B^QY1&~6d!X0kqm^RsS+%W$)Tw3S%Ccp~iW zM$>c*>`Jg!v1&TwC2&n=ydSRVjOW2Mo$+$GrZcYkn#}kzxF$>SLMMYJGlL3fGUJK| z69WaOR%S*STluZ=KxKC28BDGGZK3OJsAs{_*23%H=fE2nwA6+C3B`pqoxH^y1Yvg` ze2`VA&>mkO%inYnq|76zs+Pfe2~GMTdJyjbOVcr1U!7pf(@x?Y@s?P=cNx@}a_*t> z74YehbJA^xt6=HIuYuEZuET4|k#3$FVClwhg4a;LIo0JYI3CX_V5ZyP)tGFQJ8&7L zTjE`?^qjz?uM4gw71N=w;u!9MrE6SW6Y*j;FC} A)heS0oKb5hSXSTmlclp2O3;jfU4pyaO zV0EE~@d7UWFdp%jU_BP;miG#*x(VW{D~`|e4Ql5#f(oZ!nKy9hc0JyLR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p b/piet-gpu/shader/kernel4.comp index a88bc3d..7727b2c 100644 --- a/piet-gpu/shader/kernel4.comp +++ b/piet-gpu/shader/kernel4.comp @@ -59,6 +59,7 @@ void main() { } break; case Cmd_Stroke: + // Calculate distance field from all the line segments in this tile. CmdStroke stroke = Cmd_Stroke_read(cmd_ref); float df[CHUNK]; for (uint k = 0; k < CHUNK; k++) df[k] = 1e9; @@ -81,6 +82,7 @@ void main() { } break; case Cmd_Fill: + // Calculate coverage based on backdrop + coverage of each line segment CmdFill fill = Cmd_Fill_read(cmd_ref); // Probably better to store as float, but conversion is no doubt cheap. float area[CHUNK]; diff --git a/piet-gpu/src/lib.rs b/piet-gpu/src/lib.rs index 8c720a2..7c0a1fc 100644 --- a/piet-gpu/src/lib.rs +++ b/piet-gpu/src/lib.rs @@ -167,7 +167,7 @@ impl Renderer { let dev = MemFlags::device_local(); let n_elements = scene.len() / piet_gpu_types::scene::Element::fixed_size(); - println!("scene: {} elements", n_elements); + println!("scene: {} elements, {} paths, {} path_segments", n_elements, n_paths, n_pathseg); let scene_buf = device .create_buffer(std::mem::size_of_val(&scene[..]) as u64, host)