mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-02 08:20:09 +00:00
blade: cull mask support for sprites
This commit is contained in:
parent
7509677003
commit
11964dc731
3 changed files with 12 additions and 4 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -937,7 +937,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "blade-graphics"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/kvark/blade?rev=62eb18d312f720a5aac8f508fe223146a24fc7f0#62eb18d312f720a5aac8f508fe223146a24fc7f0"
|
||||
dependencies = [
|
||||
"ash",
|
||||
"ash-window",
|
||||
|
@ -967,7 +966,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "blade-macros"
|
||||
version = "0.2.1"
|
||||
source = "git+https://github.com/kvark/blade?rev=62eb18d312f720a5aac8f508fe223146a24fc7f0#62eb18d312f720a5aac8f508fe223146a24fc7f0"
|
||||
source = "git+https://github.com/kvark/blade?rev=f35bc605154e210ab6190291235889b6ddad73f1#f35bc605154e210ab6190291235889b6ddad73f1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
@ -99,6 +99,6 @@ flume = "0.11"
|
|||
xcb = { version = "1.3", features = ["as-raw-xcb-connection"] }
|
||||
as-raw-xcb-connection = "1"
|
||||
#TODO: use these on all platforms
|
||||
blade-graphics = { git = "https://github.com/kvark/blade", rev = "62eb18d312f720a5aac8f508fe223146a24fc7f0" }
|
||||
blade-macros = { git = "https://github.com/kvark/blade", rev = "62eb18d312f720a5aac8f508fe223146a24fc7f0" }
|
||||
blade-graphics = { git = "https://github.com/kvark/blade", rev = "f35bc605154e210ab6190291235889b6ddad73f1" }
|
||||
blade-macros = { git = "https://github.com/kvark/blade", rev = "f35bc605154e210ab6190291235889b6ddad73f1" }
|
||||
bytemuck = "1"
|
||||
|
|
|
@ -504,6 +504,10 @@ fn vs_mono_sprite(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index
|
|||
@fragment
|
||||
fn fs_mono_sprite(input: MonoSpriteVarying) -> @location(0) vec4<f32> {
|
||||
let sample = textureSample(t_sprite, s_sprite, input.tile_position).r;
|
||||
// Alpha clip after using the derivatives.
|
||||
if (any(input.clip_distances < vec4<f32>(0.0))) {
|
||||
return vec4<f32>(0.0);
|
||||
}
|
||||
return input.color * vec4<f32>(1.0, 1.0, 1.0, sample);
|
||||
}
|
||||
|
||||
|
@ -545,6 +549,11 @@ fn vs_poly_sprite(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index
|
|||
@fragment
|
||||
fn fs_poly_sprite(input: PolySpriteVarying) -> @location(0) vec4<f32> {
|
||||
let sample = textureSample(t_sprite, s_sprite, input.tile_position);
|
||||
// Alpha clip after using the derivatives.
|
||||
if (any(input.clip_distances < vec4<f32>(0.0))) {
|
||||
return vec4<f32>(0.0);
|
||||
}
|
||||
|
||||
let sprite = b_poly_sprites[input.sprite_id];
|
||||
let distance = quad_sdf(input.position.xy, sprite.bounds, sprite.corner_radii);
|
||||
|
||||
|
|
Loading…
Reference in a new issue