Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide whitespace changes
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Text styles
Change appearance
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Untitled diff
Created
7 years ago
Diff never expires
Clear
Export
Share
Explain
16 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
88 lines
Copy
16 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
88 lines
Copy
#version 450
#version 450
#define WIDTH 800
#define WIDTH 800
#define HEIGHT 600
#define HEIGHT 600
#define WORKGROUP_SIZE 32
#define WORKGROUP_SIZE 32
layout (local_size_x = WORKGROUP_SIZE, local_size_y = WORKGROUP_SIZE, local_size_z = 1) in;
layout (local_size_x = WORKGROUP_SIZE, local_size_y = WORKGROUP_SIZE, local_size_z = 1) in;
layout(binding = 0) readonly buffer buf1 {
layout(binding = 0) readonly buffer buf1 {
Copy
Copied
Copy
Copied
int data
[WIDTH]
[HEIGHT]
;
int data
[HEIGHT]
[WIDTH]
;
} previousBoard;
} previousBoard;
layout(binding = 1) buffer buf2 {
layout(binding = 1) buffer buf2 {
Copy
Copied
Copy
Copied
int data
[WIDTH]
[HEIGHT]
;
int data
[HEIGHT]
[WIDTH]
;
} nextBoard;
} nextBoard;
void main() {
void main() {
int x = int(gl_GlobalInvocationID.x);
int x = int(gl_GlobalInvocationID.x);
int y = int(gl_GlobalInvocationID.y);
int y = int(gl_GlobalInvocationID.y);
if(x >= WIDTH || y >= HEIGHT)
if(x >= WIDTH || y >= HEIGHT)
return;
return;
uint countNeighboors = 0;
uint countNeighboors = 0;
if (y > 0)
if (y > 0)
{
{
if (x > 0)
if (x > 0)
{
{
// x - 1 ; y - 1
// x - 1 ; y - 1
Copy
Copied
Copy
Copied
countNeighboors += previousBoard.data[
x
- 1][
y
- 1];
countNeighboors += previousBoard.data[
y
- 1][
x
- 1];
}
}
// x ; y - 1
// x ; y - 1
Copy
Copied
Copy
Copied
countNeighboors += previousBoard.data
[x]
[y - 1]
;
countNeighboors += previousBoard.data
[y - 1]
[x]
;
if(x < 799)
if(x < 799)
{
{
// x + 1 ; y - 1
// x + 1 ; y - 1
Copy
Copied
Copy
Copied
countNeighboors += previousBoard.data
[x + 1]
[y - 1]
;
countNeighboors += previousBoard.data
[y - 1]
[x + 1]
;
}
}
}
}
if (x > 0)
if (x > 0)
{
{
// x - 1 ; y
// x - 1 ; y
Copy
Copied
Copy
Copied
countNeighboors += previousBoard.data
[x - 1]
[y]
;
countNeighboors += previousBoard.data
[y]
[x - 1]
;
}
}
if(x < 799)
if(x < 799)
{
{
// x + 1 ; y
// x + 1 ; y
Copy
Copied
Copy
Copied
countNeighboors += previousBoard.data
[x + 1]
[y]
;
countNeighboors += previousBoard.data
[y]
[x + 1]
;
}
}
if (y < 599)
if (y < 599)
{
{
if (x > 0)
if (x > 0)
{
{
// x - 1 ; y + 1
// x - 1 ; y + 1
Copy
Copied
Copy
Copied
countNeighboors += previousBoard.data
[x - 1]
[y + 1]
;
countNeighboors += previousBoard.data
[y + 1]
[x - 1]
;
}
}
// x ; y + 1
// x ; y + 1
Copy
Copied
Copy
Copied
countNeighboors += previousBoard.data
[x]
[y + 1]
;
countNeighboors += previousBoard.data
[y + 1]
[x]
;
if(x < 799)
if(x < 799)
{
{
// x + 1 ; y + 1
// x + 1 ; y + 1
Copy
Copied
Copy
Copied
countNeighboors += previousBoard.data[
x
+ 1][
y
+ 1];
countNeighboors += previousBoard.data[
y
+ 1][
x
+ 1];
}
}
}
}
if(countNeighboors == 3)
if(countNeighboors == 3)
{
{
Copy
Copied
Copy
Copied
nextBoard.data[
x][y
] = 1;
nextBoard.data[
y][x
] = 1;
}
}
else if (countNeighboors == 2)
else if (countNeighboors == 2)
{
{
Copy
Copied
Copy
Copied
nextBoard.data[
x][y
] = previousBoard.data[
x][y
];
nextBoard.data[
y][x
] = previousBoard.data[
y][x
];
}
}
else
else
{
{
Copy
Copied
Copy
Copied
nextBoard.data[
x][y
] = 0;
nextBoard.data[
y][x
] = 0;
}
}
}
}
Saved diffs
Original text
Open file
#version 450 #define WIDTH 800 #define HEIGHT 600 #define WORKGROUP_SIZE 32 layout (local_size_x = WORKGROUP_SIZE, local_size_y = WORKGROUP_SIZE, local_size_z = 1) in; layout(binding = 0) readonly buffer buf1 { int data[WIDTH][HEIGHT]; } previousBoard; layout(binding = 1) buffer buf2 { int data[WIDTH][HEIGHT]; } nextBoard; void main() { int x = int(gl_GlobalInvocationID.x); int y = int(gl_GlobalInvocationID.y); if(x >= WIDTH || y >= HEIGHT) return; uint countNeighboors = 0; if (y > 0) { if (x > 0) { // x - 1 ; y - 1 countNeighboors += previousBoard.data[x - 1][y - 1]; } // x ; y - 1 countNeighboors += previousBoard.data[x][y - 1]; if(x < 799) { // x + 1 ; y - 1 countNeighboors += previousBoard.data[x + 1][y - 1]; } } if (x > 0) { // x - 1 ; y countNeighboors += previousBoard.data[x - 1][y]; } if(x < 799) { // x + 1 ; y countNeighboors += previousBoard.data[x + 1][y]; } if (y < 599) { if (x > 0) { // x - 1 ; y + 1 countNeighboors += previousBoard.data[x - 1][y + 1]; } // x ; y + 1 countNeighboors += previousBoard.data[x][y + 1]; if(x < 799) { // x + 1 ; y + 1 countNeighboors += previousBoard.data[x + 1][y + 1]; } } if(countNeighboors == 3) { nextBoard.data[x][y] = 1; } else if (countNeighboors == 2) { nextBoard.data[x][y] = previousBoard.data[x][y]; } else { nextBoard.data[x][y] = 0; } }
Changed text
Open file
#version 450 #define WIDTH 800 #define HEIGHT 600 #define WORKGROUP_SIZE 32 layout (local_size_x = WORKGROUP_SIZE, local_size_y = WORKGROUP_SIZE, local_size_z = 1) in; layout(binding = 0) readonly buffer buf1 { int data[HEIGHT][WIDTH]; } previousBoard; layout(binding = 1) buffer buf2 { int data[HEIGHT][WIDTH]; } nextBoard; void main() { int x = int(gl_GlobalInvocationID.x); int y = int(gl_GlobalInvocationID.y); if(x >= WIDTH || y >= HEIGHT) return; uint countNeighboors = 0; if (y > 0) { if (x > 0) { // x - 1 ; y - 1 countNeighboors += previousBoard.data[y - 1][x - 1]; } // x ; y - 1 countNeighboors += previousBoard.data[y - 1][x]; if(x < 799) { // x + 1 ; y - 1 countNeighboors += previousBoard.data[y - 1][x + 1]; } } if (x > 0) { // x - 1 ; y countNeighboors += previousBoard.data[y][x - 1]; } if(x < 799) { // x + 1 ; y countNeighboors += previousBoard.data[y][x + 1]; } if (y < 599) { if (x > 0) { // x - 1 ; y + 1 countNeighboors += previousBoard.data[y + 1][x - 1]; } // x ; y + 1 countNeighboors += previousBoard.data[y + 1][x]; if(x < 799) { // x + 1 ; y + 1 countNeighboors += previousBoard.data[y + 1][x + 1]; } } if(countNeighboors == 3) { nextBoard.data[y][x] = 1; } else if (countNeighboors == 2) { nextBoard.data[y][x] = previousBoard.data[y][x]; } else { nextBoard.data[y][x] = 0; } }
Find difference