fix shaders on windows

This commit is contained in:
Skyler Lehmkuhl 2026-02-16 10:48:51 -05:00
parent 2a94ac0f69
commit e9ee0d92e2
2 changed files with 10 additions and 10 deletions

View File

@ -90,7 +90,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
// Clip to view rectangle
if frag_x < params.clip_rect.x || frag_x > params.clip_rect.z ||
frag_y < params.clip_rect.y || frag_y > params.clip_rect.w {
discard;
return vec4(0.0, 0.0, 0.0, 0.0);
}
// Compute the content rect in screen space
@ -110,7 +110,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
corner_radius
);
if dist > 0.0 {
discard;
return vec4(0.0, 0.0, 0.0, 0.0);
}
// Fragment X -> audio time -> global CQT column
@ -118,28 +118,28 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
let audio_time = timeline_time - params.clip_start_time + params.trim_start;
if audio_time < 0.0 || audio_time > params.audio_duration {
discard;
return vec4(0.0, 0.0, 0.0, 0.0);
}
let global_col = audio_time * params.sample_rate / params.hop_size;
// Check if this column is in the cached range
if global_col < params.cache_valid_start || global_col >= params.cache_valid_end {
discard;
return vec4(0.0, 0.0, 0.0, 0.0);
}
// Fragment Y -> MIDI note -> CQT bin (direct mapping!)
let note = params.max_note - ((frag_y - params.clip_rect.y + params.scroll_y) / params.note_height);
if note < params.min_note || note > params.max_note {
discard;
return vec4(0.0, 0.0, 0.0, 0.0);
}
// CQT bin: each octave has bins_per_octave bins, starting from min_note
let bin = (note - params.min_note) * params.bins_per_octave / 12.0;
if bin < 0.0 || bin >= params.freq_bins {
discard;
return vec4(0.0, 0.0, 0.0, 0.0);
}
// Map global column to ring buffer position (accounting for stride)

View File

@ -59,7 +59,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
// Clip to the clip rectangle
if frag_x < params.clip_rect.x || frag_x > params.clip_rect.z ||
frag_y < params.clip_rect.y || frag_y > params.clip_rect.w {
discard;
return vec4(0.0, 0.0, 0.0, 0.0);
}
// Fragment X position audio time
@ -70,7 +70,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
// Audio time frame index
let frame_f = audio_time * params.sample_rate - params.segment_start_frame;
if frame_f < 0.0 || frame_f >= params.total_frames {
discard;
return vec4(0.0, 0.0, 0.0, 0.0);
}
// Determine mip level based on how many audio frames map to one pixel
@ -117,6 +117,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
if frag_y >= y_top_adj && frag_y <= y_bot_adj {
return params.tint_color;
}
return vec4(0.0, 0.0, 0.0, 0.0);
} else {
// Split stereo mode: left channel in top half, right channel in bottom half
let half_height = clip_height * 0.5;
@ -152,7 +153,6 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return params.tint_color;
}
}
return vec4(0.0, 0.0, 0.0, 0.0);
}
discard;
}