Skip to content

Commit

Permalink
Actually reverse indices for early Z!
Browse files Browse the repository at this point in the history
2x performance improvement. I feel silly.
  • Loading branch information
pcwalton committed Sep 15, 2017
1 parent 42151cc commit b48b256
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion demo/client/src/3d-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class ThreeDView extends PathfinderDemoView {
return transform;
}

protected clearForResolve(): void {
protected clearForDirectRendering(): void {
this.gl.clearColor(1.0, 1.0, 1.0, 1.0);
this.gl.clearDepth(1.0);
this.gl.depthMask(true);
Expand Down
4 changes: 2 additions & 2 deletions demo/client/src/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export abstract class PathfinderDemoView extends PathfinderView {
antialiasingStrategy.prepare(this);

// Clear.
this.clearForResolve();
this.clearForDirectRendering();

// Draw "scenery" (used in the 3D view).
this.drawSceneryIfNecessary();
Expand Down Expand Up @@ -514,7 +514,7 @@ export abstract class PathfinderDemoView extends PathfinderView {

protected drawSceneryIfNecessary(): void {}

protected clearForResolve(): void {
protected clearForDirectRendering(): void {
this.gl.clearColor(1.0, 1.0, 1.0, 1.0);
this.gl.clearDepth(0.0);
this.gl.depthMask(true);
Expand Down
2 changes: 1 addition & 1 deletion demo/server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ fn partition_paths(partitioner: &mut Partitioner, subpath_indices: &[SubpathRang

// Reverse interior indices for early Z optimizations.
let mut new_cover_interior_indices = Vec::with_capacity(cover_interior_indices.len());
for path_indices in &mut path_indices {
for path_indices in path_indices.iter_mut().rev() {
let old_byte_start = path_indices.cover_interior_indices.start * mem::size_of::<u32>();
let old_byte_end = path_indices.cover_interior_indices.end * mem::size_of::<u32>();
let new_start_index = new_cover_interior_indices.len() / mem::size_of::<u32>();
Expand Down

0 comments on commit b48b256

Please sign in to comment.