mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
glsl-in: Add support for texelFetchOffset
This commit is contained in:
committed by
Dzmitry Malyshau
parent
62f267a140
commit
d449d2e665
@@ -306,7 +306,8 @@ pub fn inject_builtin(
|
||||
f,
|
||||
)
|
||||
}
|
||||
"texelFetch" => {
|
||||
"texelFetch" | "texelFetchOffset" => {
|
||||
let offset = "texelFetchOffset" == name;
|
||||
let f = |kind, dim, arrayed, multi, _shadow| {
|
||||
// Cube images aren't supported
|
||||
if let Dim::Cube = dim {
|
||||
@@ -322,7 +323,7 @@ pub fn inject_builtin(
|
||||
let dim_value = image_dims_to_coords_size(dim);
|
||||
let coordinates = make_coords_arg(dim_value + arrayed as usize, Sk::Sint);
|
||||
|
||||
let args = vec![
|
||||
let mut args = vec![
|
||||
image,
|
||||
coordinates,
|
||||
TypeInner::Scalar {
|
||||
@@ -331,6 +332,10 @@ pub fn inject_builtin(
|
||||
},
|
||||
];
|
||||
|
||||
if offset {
|
||||
args.push(make_coords_arg(dim_value, Sk::Sint));
|
||||
}
|
||||
|
||||
declaration
|
||||
.overloads
|
||||
.push(module.add_builtin(args, MacroCall::ImageLoad { multi }))
|
||||
|
||||
Reference in New Issue
Block a user