mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[glsl-in] Add support for texture function with LOD bias
This commit is contained in:
committed by
João Capucho
parent
ef1194d69a
commit
fbab3a3ba5
@@ -152,7 +152,7 @@ impl Program<'_> {
|
||||
Ok(Some(args[0].0))
|
||||
}
|
||||
"texture" => {
|
||||
if args.len() != 2 {
|
||||
if !(2..=3).contains(&args.len()) {
|
||||
return Err(ErrorKind::wrong_function_args(name, 2, args.len(), meta));
|
||||
}
|
||||
if let Some(sampler) = ctx.samplers.get(&args[0].0).copied() {
|
||||
@@ -163,7 +163,7 @@ impl Program<'_> {
|
||||
coordinate: args[1].0,
|
||||
array_index: None, //TODO
|
||||
offset: None, //TODO
|
||||
level: SampleLevel::Auto,
|
||||
level: args.get(2).map_or(SampleLevel::Auto, |&(expr, _)| SampleLevel::Bias(expr)),
|
||||
depth_ref: None,
|
||||
},
|
||||
body,
|
||||
|
||||
@@ -271,6 +271,7 @@ fn textures() {
|
||||
layout(set = 1, binding = 2) uniform sampler tex_sampler;
|
||||
void main() {
|
||||
o_color = texture(sampler2D(tex, tex_sampler), v_uv);
|
||||
o_color.a = texture(sampler2D(tex, tex_sampler), v_uv, 2.0).a;
|
||||
}
|
||||
"#,
|
||||
&entry_points,
|
||||
|
||||
Reference in New Issue
Block a user