diff --git a/gpu/Cargo.toml b/gpu/Cargo.toml index c4eff7bce..876b57153 100644 --- a/gpu/Cargo.toml +++ b/gpu/Cargo.toml @@ -23,7 +23,7 @@ ribir_geom = {path = "../geom", version = "0.0.1-alpha.4" } ribir_painter = {path = "../painter", features = ["tessellation"], version = "0.0.1-alpha.4" } slab = "0.4.8" wgpu = {workspace = true, optional = true} -zerocopy.workspace = true +zerocopy = {workspace=true, features = ["derive"]} [dev-dependencies] paste.workspace = true diff --git a/gpu/src/wgpu_impl/shaders/color_triangles.wgsl b/gpu/src/wgpu_impl/shaders/color_triangles.wgsl index 128b916c2..b78b3f77c 100644 --- a/gpu/src/wgpu_impl/shaders/color_triangles.wgsl +++ b/gpu/src/wgpu_impl/shaders/color_triangles.wgsl @@ -11,7 +11,6 @@ struct FragInput { } - @vertex fn vs_main(v: Vertex) -> FragInput { var input: FragInput; @@ -63,7 +62,7 @@ fn fs_main(input: FragInput) -> @location(0) vec4 { let tex_size = textureDimensions(texture); mask_pos = mask_pos / vec2(f32(tex_size.x), f32(tex_size.y)); - let alpha = textureSample(texture, s_sampler, mask_pos).r; + let alpha = textureSampleLevel(texture, s_sampler, mask_pos, 0.).r; if alpha == 0. { color.a = 0.; break; diff --git a/gpu/src/wgpu_impl/shaders/img_triangles.wgsl b/gpu/src/wgpu_impl/shaders/img_triangles.wgsl index 367e95e44..72f9b7160 100644 --- a/gpu/src/wgpu_impl/shaders/img_triangles.wgsl +++ b/gpu/src/wgpu_impl/shaders/img_triangles.wgsl @@ -88,7 +88,7 @@ fn fs_main(f: VertexOutput) -> @location(0) vec4 { let mask_sampler = samplers[mask_tex_idx]; let mask_tex_size = textureDimensions(mask_tex); mask_pos = mask_pos / vec2(f32(mask_tex_size.x), f32(mask_tex_size.y)); - let alpha = textureSample(mask_tex, mask_sampler, mask_pos).r; + let alpha = textureSampleLevel(mask_tex, mask_sampler, mask_pos, 0.).r; if alpha == 0. { color.a = 0.; break; diff --git a/gpu/src/wgpu_impl/shaders/linear_gradient_triangles.wgsl b/gpu/src/wgpu_impl/shaders/linear_gradient_triangles.wgsl index bcebcb085..08e447863 100644 --- a/gpu/src/wgpu_impl/shaders/linear_gradient_triangles.wgsl +++ b/gpu/src/wgpu_impl/shaders/linear_gradient_triangles.wgsl @@ -80,7 +80,7 @@ fn calc_mask_alpha(pos: vec2, mask_idx: i32) -> f32 { let tex_size = textureDimensions(texture); mask_pos = mask_pos / vec2(f32(tex_size.x), f32(tex_size.y)); - let a = textureSample(texture, s_sampler, mask_pos).r; + let a = textureSampleLevel(texture, s_sampler, mask_pos, 0.).r; alpha = alpha * a; if alpha == 0. { break; diff --git a/gpu/src/wgpu_impl/shaders/radial_gradient_triangles.wgsl b/gpu/src/wgpu_impl/shaders/radial_gradient_triangles.wgsl index 206e0c4c1..9f12ddbb0 100644 --- a/gpu/src/wgpu_impl/shaders/radial_gradient_triangles.wgsl +++ b/gpu/src/wgpu_impl/shaders/radial_gradient_triangles.wgsl @@ -83,7 +83,7 @@ fn calc_mask_alpha(pos: vec2, mask_idx: i32) -> f32 { let tex_size = textureDimensions(texture); mask_pos = mask_pos / vec2(f32(tex_size.x), f32(tex_size.y)); - let a = textureSample(texture, s_sampler, mask_pos).r; + let a = textureSampleLevel(texture, s_sampler, mask_pos, 0.).r; alpha = alpha * a; if alpha == 0. { break;