From 48beb6b1c10d7ca42205000a5bb420a1e3282d92 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 14 Feb 2026 12:40:57 +0100 Subject: Fix: CNN v2 compute shader validation error Replace textureSample() with textureSampleLevel() in compute shader. textureSample() requires derivative calculations only available in fragment shaders. Compute shaders must explicitly specify mip level. Fixes: DemoEffectsTest CNNv2Effect initialization Co-Authored-By: Claude Sonnet 4.5 --- workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl index 63fafa8..309e832 100644 --- a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl +++ b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl @@ -33,17 +33,18 @@ fn main(@builtin(global_invocation_id) id: vec3) { // Parametric features (p0-p3) - bilinear sample from specified mip level // Use UV coordinates for bilinear interpolation + // Note: Use textureSampleLevel (not textureSample) in compute shaders let uv = (vec2(coord) + 0.5) / vec2(dims); var rgba: vec4; if (params.mip_level == 0u) { - rgba = textureSample(input_tex, linear_sampler, uv); + rgba = textureSampleLevel(input_tex, linear_sampler, uv, 0.0); } else if (params.mip_level == 1u) { - rgba = textureSample(input_tex_mip1, linear_sampler, uv); + rgba = textureSampleLevel(input_tex_mip1, linear_sampler, uv, 0.0); } else if (params.mip_level == 2u) { - rgba = textureSample(input_tex_mip2, linear_sampler, uv); + rgba = textureSampleLevel(input_tex_mip2, linear_sampler, uv, 0.0); } else { // Mip 3 or higher: use mip 2 as fallback - rgba = textureSample(input_tex_mip2, linear_sampler, uv); + rgba = textureSampleLevel(input_tex_mip2, linear_sampler, uv, 0.0); } let p0 = rgba.r; -- cgit v1.2.3