Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
隱藏空白變更
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
文字樣式
變更外觀
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
7 年前
差異永不過期
清除
匯出
分享
解釋
16 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
88 行
全部複製
16 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
88 行
全部複製
#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 {
複製
已複製
複製
已複製
int data
[WIDTH]
[HEIGHT]
;
int data
[HEIGHT]
[WIDTH]
;
} previousBoard;
} previousBoard;
layout(binding = 1) buffer buf2 {
layout(binding = 1) buffer buf2 {
複製
已複製
複製
已複製
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
複製
已複製
複製
已複製
countNeighboors += previousBoard.data[
x
- 1][
y
- 1];
countNeighboors += previousBoard.data[
y
- 1][
x
- 1];
}
}
// x ; y - 1
// x ; y - 1
複製
已複製
複製
已複製
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
複製
已複製
複製
已複製
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
複製
已複製
複製
已複製
countNeighboors += previousBoard.data
[x - 1]
[y]
;
countNeighboors += previousBoard.data
[y]
[x - 1]
;
}
}
if(x < 799)
if(x < 799)
{
{
// x + 1 ; y
// x + 1 ; y
複製
已複製
複製
已複製
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
複製
已複製
複製
已複製
countNeighboors += previousBoard.data
[x - 1]
[y + 1]
;
countNeighboors += previousBoard.data
[y + 1]
[x - 1]
;
}
}
// x ; y + 1
// x ; y + 1
複製
已複製
複製
已複製
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
複製
已複製
複製
已複製
countNeighboors += previousBoard.data[
x
+ 1][
y
+ 1];
countNeighboors += previousBoard.data[
y
+ 1][
x
+ 1];
}
}
}
}
if(countNeighboors == 3)
if(countNeighboors == 3)
{
{
複製
已複製
複製
已複製
nextBoard.data[
x][y
] = 1;
nextBoard.data[
y][x
] = 1;
}
}
else if (countNeighboors == 2)
else if (countNeighboors == 2)
{
{
複製
已複製
複製
已複製
nextBoard.data[
x][y
] = previousBoard.data[
x][y
];
nextBoard.data[
y][x
] = previousBoard.data[
y][x
];
}
}
else
else
{
{
複製
已複製
複製
已複製
nextBoard.data[
x][y
] = 0;
nextBoard.data[
y][x
] = 0;
}
}
}
}
已保存差異
原始文本
開啟檔案
#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; } }
更改後文本
開啟檔案
#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; } }
尋找差異