1
0
mirror of https://github.com/fumiama/gozel.git synced 2026-06-10 03:11:11 +08:00

feat(examples): add image_scale (#7)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
fumiama
2026-03-29 17:11:22 +08:00
committed by GitHub
parent 68ca8b5e2e
commit 6522bde914
123 changed files with 1074 additions and 163 deletions

View File

@@ -0,0 +1,19 @@
kernel void scale(
read_only image2d_t inputImg,
sampler_t smp,
write_only image2d_t outputImg)
{
uint x = get_global_id(0);
uint y = get_global_id(1);
uint outW = get_image_width(outputImg);
uint outH = get_image_height(outputImg);
float2 normCoord = (float2)(
(float)x / (float)outW,
(float)y / (float)outH
);
float4 pixel = read_imagef(inputImg, smp, normCoord);
write_imagef(outputImg, (int2)(x, y), pixel);
}