summaryrefslogtreecommitdiff
path: root/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
diff options
context:
space:
mode:
Diffstat (limited to 'workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl')
-rw-r--r--workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl13
1 files changed, 8 insertions, 5 deletions
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
index 7b08132..63fafa8 100644
--- a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
+++ b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
@@ -20,6 +20,7 @@ struct StaticFeatureParams {
@group(0) @binding(3) var depth_tex: texture_2d<f32>;
@group(0) @binding(4) var output_tex: texture_storage_2d<rgba32uint, write>;
@group(0) @binding(5) var<uniform> params: StaticFeatureParams;
+@group(0) @binding(6) var linear_sampler: sampler;
@compute @workgroup_size(8, 8)
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
@@ -30,17 +31,19 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) {
return;
}
- // Parametric features (p0-p3) - sample from specified mip level
+ // Parametric features (p0-p3) - bilinear sample from specified mip level
+ // Use UV coordinates for bilinear interpolation
+ let uv = (vec2<f32>(coord) + 0.5) / vec2<f32>(dims);
var rgba: vec4<f32>;
if (params.mip_level == 0u) {
- rgba = textureLoad(input_tex, coord, 0);
+ rgba = textureSample(input_tex, linear_sampler, uv);
} else if (params.mip_level == 1u) {
- rgba = textureLoad(input_tex_mip1, coord, 0);
+ rgba = textureSample(input_tex_mip1, linear_sampler, uv);
} else if (params.mip_level == 2u) {
- rgba = textureLoad(input_tex_mip2, coord, 0);
+ rgba = textureSample(input_tex_mip2, linear_sampler, uv);
} else {
// Mip 3 or higher: use mip 2 as fallback
- rgba = textureLoad(input_tex_mip2, coord, 0);
+ rgba = textureSample(input_tex_mip2, linear_sampler, uv);
}
let p0 = rgba.r;