From e597e8ef1b578569333fd932bae1b8a1e3b86704 Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Tue, 2 Jul 2019 18:07:52 -0700 Subject: [PATCH] stupid stupid stupid. buffer write bug --- resources/shaders/add.compute | 14 ++++++-------- src/main.rs | 5 +++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/resources/shaders/add.compute b/resources/shaders/add.compute index 8f4dca39..53d275f0 100644 --- a/resources/shaders/add.compute +++ b/resources/shaders/add.compute @@ -61,15 +61,13 @@ void main() { p.y = 0; p.z = 255; } - p.x = 125; - p.y = 255; - p.z = 255; - // p.z = max(p.z - (d0.x + d0.y + d0.z + d1.x + d1.y + d1.z)/5, 0); - write_buffer.buf[0] = (read_buffer.buf[idx] & (~0x000000FF) ) | (p.x); - //write_buffer.buf[idx] = (read_buffer.buf[idx] & (~0x0000FF00) ) | (p.y << 8); - //write_buffer.buf[idx] = (read_buffer.buf[idx] & (~0x00FF0000) ) | (p.z << 16); - //write_buffer.buf[idx] = (read_buffer.buf[idx] & (~0xFF000000) ) | (p.w << 24); + //p.z = max(p.z - (d0.x + d0.y + d0.z + d1.x + d1.y + d1.z)/5, 0); + + write_buffer.buf[idx] = (write_buffer.buf[idx] & (~0x000000FF) ) | (p.x); + write_buffer.buf[idx] = (write_buffer.buf[idx] & (~0x0000FF00) ) | (p.y << 8); + write_buffer.buf[idx] = (write_buffer.buf[idx] & (~0x00FF0000) ) | (p.z << 16); + write_buffer.buf[idx] = (write_buffer.buf[idx] & (~0xFF000000) ) | (p.w << 24); // read_buffer.buf[idx] = (read_buffer.buf[idx] & (~0x000000FF) ) | (p.x); // read_buffer.buf[idx] = (read_buffer.buf[idx] & (~0x0000FF00) ) | (p.y << 8); diff --git a/src/main.rs b/src/main.rs index 87a438a5..82d36a5f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -48,6 +48,7 @@ mod input; mod util; fn main() { + // Load up the input image, determine some details let mut img = image::open("resources/images/test2.png").unwrap(); let xy = img.dimensions(); @@ -175,9 +176,9 @@ fn main() { img.put_pixel(x, y, image::Rgba([r, g, b, a])) } } - }// Currently bringing all this start shit outta scope to see if it stops my gpu from screaming - + } + // Currently bringing all this start shit outta scope to see if it stops my gpu from screaming println!("Saving output"); img.save(format!("output/{}.png", SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs())); }