mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[glsl-in] Add support for a large number of texture sample overrides
This commit is contained in:
committed by
João Capucho
parent
60bd9ec884
commit
a9d20d8ef4
@@ -39,6 +39,26 @@ impl Module {
|
||||
}
|
||||
}
|
||||
|
||||
fn make_coords_arg(number_of_components: usize, kind: Sk) -> TypeInner {
|
||||
let width = 4;
|
||||
|
||||
match number_of_components {
|
||||
1 => TypeInner::Scalar {
|
||||
kind,
|
||||
width,
|
||||
},
|
||||
_ => TypeInner::Vector {
|
||||
size: match number_of_components {
|
||||
2 => VectorSize::Bi,
|
||||
3 => VectorSize::Tri,
|
||||
_ => VectorSize::Quad,
|
||||
},
|
||||
kind,
|
||||
width,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Inject builtins into
|
||||
///
|
||||
/// This is done to not add a large startup cost and not increase memory
|
||||
@@ -118,31 +138,79 @@ pub fn inject_builtin(declaration: &mut FunctionDeclaration, module: &mut Module
|
||||
))
|
||||
}
|
||||
}
|
||||
"texture" | "textureLod" => {
|
||||
"texture" | "textureGrad" | "textureGradOffset" | "textureLod" | "textureLodOffset" | "textureOffset"
|
||||
| "textureProj" | "textureProjGrad" | "textureProjGradOffset" | "textureProjLod"
|
||||
| "textureProjLodOffset" | "textureProjOffset" => {
|
||||
// bits layout
|
||||
// bits 0 trough 1 - dims
|
||||
// bits 0 through 1 - dims
|
||||
// bit 2 - shadow
|
||||
// bit 3 - array
|
||||
// bit 4 - !bias
|
||||
//
|
||||
// 0b11111 is the latest since there are not 3D arrayed shadowed
|
||||
// textures and cube arrayed shadows textures always have a
|
||||
// compare argument
|
||||
for bits in 0..(0b100000) {
|
||||
// bit 4 - extra variant
|
||||
// bit 5 - bias
|
||||
|
||||
for bits in 0..(0b1000000) {
|
||||
let dim = bits & 0b11;
|
||||
let shadow = bits & 0b100 == 0b100;
|
||||
let arrayed = bits & 0b1000 == 0b1000;
|
||||
let bias = bits & 0b10000 == 0b00000;
|
||||
let variant = bits & 0b10000 == 0b10000;
|
||||
let bias = bits & 0b100000 == 0b100000;
|
||||
|
||||
let builtin = match name {
|
||||
"texture" => MacroCall::Texture,
|
||||
_ => MacroCall::TextureLod,
|
||||
// texture(gsampler, gvec P, [float bias]);
|
||||
"texture" => MacroCall::Texture { proj: false, offset: false, shadow, level_type: TextureLevelType::None, },
|
||||
// textureGrad(gsampler, gvec P, gvec dPdx, gvec dPdy);
|
||||
"textureGrad" => MacroCall::Texture { proj: false, offset: false, shadow, level_type: TextureLevelType::Grad, },
|
||||
// textureGradOffset(gsampler, gvec P, gvec dPdx, gvec dPdy, ivec offset);
|
||||
"textureGradOffset" => MacroCall::Texture { proj: false, offset: true, shadow, level_type: TextureLevelType::Grad, },
|
||||
// textureLod(gsampler, gvec P, float lod);
|
||||
"textureLod" => MacroCall::Texture { proj: false, offset: false, shadow, level_type: TextureLevelType::Lod, },
|
||||
// textureLodOffset(gsampler, gvec P, float lod, ivec offset);
|
||||
"textureLodOffset" => MacroCall::Texture { proj: false, offset: true, shadow, level_type: TextureLevelType::Lod, },
|
||||
// textureOffset(gsampler, gvec+1 P, ivec offset, [float bias]);
|
||||
"textureOffset" => MacroCall::Texture { proj: false, offset: true, shadow, level_type: TextureLevelType::None, },
|
||||
// textureProj(gsampler, gvec+1 P, [float bias]);
|
||||
"textureProj" => MacroCall::Texture { proj: true, offset: false, shadow, level_type: TextureLevelType::None, },
|
||||
// textureProjGrad(gsampler, gvec+1 P, gvec dPdx, gvec dPdy);
|
||||
"textureProjGrad" => MacroCall::Texture { proj: true, offset: false, shadow, level_type: TextureLevelType::Grad, },
|
||||
// textureProjGradOffset(gsampler, gvec+1 P, gvec dPdx, gvec dPdy, ivec offset);
|
||||
"textureProjGradOffset" => MacroCall::Texture { proj: true, offset: true, shadow, level_type: TextureLevelType::Grad, },
|
||||
// textureProjLod(gsampler, gvec+1 P, float lod);
|
||||
"textureProjLod" => MacroCall::Texture { proj: true, offset: false, shadow, level_type: TextureLevelType::Lod, },
|
||||
// textureProjLodOffset(gsampler, gvec+1 P, gvec dPdx, gvec dPdy, ivec offset);
|
||||
"textureProjLodOffset" => MacroCall::Texture { proj: true, offset: true, shadow, level_type: TextureLevelType::Lod, },
|
||||
// textureProjOffset(gsampler, gvec+1 P, ivec offset, [float bias]);
|
||||
"textureProjOffset" => MacroCall::Texture { proj: true, offset: true, shadow, level_type: TextureLevelType::None, },
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
// Shadow, arrayed or both 3D images are not allowed
|
||||
if (shadow || arrayed) && dim == 0b11
|
||||
|| (builtin == MacroCall::TextureLod
|
||||
&& (dim != 0b00 && shadow && arrayed || dim == 0b10 && shadow || !bias))
|
||||
{
|
||||
// Parse out the variant settings.
|
||||
let proj = matches!(builtin, MacroCall::Texture { proj: true, .. });
|
||||
let grad = matches!(builtin, MacroCall::Texture { level_type: TextureLevelType::Grad, .. });
|
||||
let lod = matches!(builtin, MacroCall::Texture { level_type: TextureLevelType::Lod, .. });
|
||||
let offset = matches!(builtin, MacroCall::Texture { offset: true, .. });
|
||||
|
||||
let supports_variant = proj && !shadow;
|
||||
if variant && !supports_variant {
|
||||
continue;
|
||||
}
|
||||
|
||||
let supports_bias = matches!(builtin, MacroCall::Texture { level_type: TextureLevelType::None, .. }) && !shadow;
|
||||
if bias && !supports_bias {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Proj doesn't work with arrayed, Cube or 3D samplers
|
||||
if proj && (arrayed || dim == 0b10 || dim == 0b11) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 3DArray and 3DShadow are not valid texture types
|
||||
if dim == 0b11 && (arrayed || shadow) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// It seems that textureGradOffset(samplerCube) is not defined by GLSL for some reason...
|
||||
if dim == 0b10 && grad && offset {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -165,184 +233,75 @@ pub fn inject_builtin(declaration: &mut FunctionDeclaration, module: &mut Module
|
||||
class,
|
||||
};
|
||||
|
||||
let vector = match (dim, shadow) {
|
||||
(0b00, false) => TypeInner::Scalar {
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
},
|
||||
(0b00, true) | (0b11, _) => TypeInner::Vector {
|
||||
size: VectorSize::Tri,
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
},
|
||||
(_, _) => {
|
||||
let size = match dim + arrayed as u32 + shadow as u32 {
|
||||
1 => VectorSize::Bi,
|
||||
2 => VectorSize::Tri,
|
||||
_ => VectorSize::Quad,
|
||||
};
|
||||
let num_coords_from_dim = (dim + 1).min(3);
|
||||
let mut num_coords = num_coords_from_dim;
|
||||
|
||||
TypeInner::Vector {
|
||||
size,
|
||||
if shadow && proj {
|
||||
num_coords = 4;
|
||||
} else if shadow {
|
||||
num_coords += 1;
|
||||
} else if proj {
|
||||
if variant && num_coords == 4 {
|
||||
// Normal form already has 4 components, no need to have a variant form.
|
||||
continue;
|
||||
} else if variant {
|
||||
num_coords = 4;
|
||||
} else {
|
||||
num_coords += 1;
|
||||
}
|
||||
}
|
||||
|
||||
num_coords += arrayed as usize;
|
||||
|
||||
// Special case: texture(gsamplerCubeArrayShadow) kicks the shadow compare ref to a separate argument,
|
||||
// since it would otherwise take five arguments. It also can't take a bias, nor can it be proj/grad/lod/offset
|
||||
// (presumably because nobody asked for it, and implementation complexity?)
|
||||
if num_coords >= 5 {
|
||||
if lod || grad || offset || proj || bias {
|
||||
continue;
|
||||
}
|
||||
debug_assert!(dim == 0b10 && shadow && arrayed);
|
||||
}
|
||||
debug_assert!(num_coords <= 5);
|
||||
|
||||
let vector = make_coords_arg(num_coords, Sk::Float);
|
||||
let mut args = vec![image, vector];
|
||||
|
||||
if num_coords == 5 {
|
||||
args.push(TypeInner::Scalar {
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
});
|
||||
}
|
||||
|
||||
match builtin {
|
||||
MacroCall::Texture { level_type: TextureLevelType::Lod, .. } => {
|
||||
args.push(TypeInner::Scalar {
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
MacroCall::Texture { level_type: TextureLevelType::Grad, .. } => {
|
||||
args.push(make_coords_arg(num_coords_from_dim, Sk::Float));
|
||||
args.push(make_coords_arg(num_coords_from_dim, Sk::Float));
|
||||
},
|
||||
_ => {},
|
||||
};
|
||||
|
||||
let mut args = vec![image, vector];
|
||||
if offset {
|
||||
args.push(make_coords_arg(num_coords_from_dim, Sk::Sint));
|
||||
}
|
||||
|
||||
if bias {
|
||||
args.push(TypeInner::Scalar {
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
declaration
|
||||
.overloads
|
||||
.push(module.add_builtin(args, builtin))
|
||||
}
|
||||
}
|
||||
"textureProj" => {
|
||||
// bits layout
|
||||
// bit 0 - shadow
|
||||
// bit 1 - bias
|
||||
// bits 2 trough 3 - dims
|
||||
//
|
||||
// 0b0111 is the latest since there are only 1D and 2D shadow
|
||||
// variants
|
||||
for bits in 0..(0b1000) {
|
||||
let dim = bits >> 2;
|
||||
let shadow = bits & 0b1 == 0b1;
|
||||
let bias = bits & 0b10 == 0b10;
|
||||
|
||||
let class = match shadow {
|
||||
true => ImageClass::Depth { multi: false },
|
||||
false => ImageClass::Sampled {
|
||||
kind: Sk::Float,
|
||||
multi: false,
|
||||
},
|
||||
};
|
||||
|
||||
let image = TypeInner::Image {
|
||||
dim: match dim {
|
||||
0b00 => Dim::D1,
|
||||
0b01 => Dim::D2,
|
||||
_ => Dim::Cube,
|
||||
},
|
||||
arrayed: false,
|
||||
class,
|
||||
};
|
||||
|
||||
let vector = TypeInner::Vector {
|
||||
size: VectorSize::Quad,
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
};
|
||||
|
||||
let mut args = vec![image, vector];
|
||||
|
||||
if bias {
|
||||
args.push(TypeInner::Scalar {
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
})
|
||||
}
|
||||
|
||||
declaration
|
||||
.overloads
|
||||
.push(module.add_builtin(args, MacroCall::TextureProj))
|
||||
}
|
||||
}
|
||||
"textureGrad" => {
|
||||
// bits layout
|
||||
// bits 0 trough 1 - dims
|
||||
// bit 2 - shadow
|
||||
// bit 3 - array
|
||||
//
|
||||
// 0b1010 is the latest since there are no 3D arrayed shadowed
|
||||
// textures and cube arrayed shadows textures are not allowed
|
||||
for bits in 0..(0b1011) {
|
||||
let dim = bits & 0b11;
|
||||
let shadow = bits & 0b100 == 0b100;
|
||||
let arrayed = bits & 0b1000 == 0b1000;
|
||||
|
||||
// Shadow, arrayed or both 3D images are not allowed
|
||||
if shadow && dim == 0b11
|
||||
// samplerCubeArrayShadow is not allowed
|
||||
|| shadow && arrayed && dim == 0b10
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
let class = match shadow {
|
||||
true => ImageClass::Depth { multi: false },
|
||||
false => ImageClass::Sampled {
|
||||
kind: Sk::Float,
|
||||
multi: false,
|
||||
},
|
||||
};
|
||||
|
||||
let image = TypeInner::Image {
|
||||
dim: match dim {
|
||||
0b00 => Dim::D1,
|
||||
0b01 => Dim::D2,
|
||||
0b10 => Dim::Cube,
|
||||
_ => Dim::D3,
|
||||
},
|
||||
arrayed,
|
||||
class,
|
||||
};
|
||||
|
||||
let vector = match (dim, shadow) {
|
||||
(0b00, false) => TypeInner::Scalar {
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
},
|
||||
(0b00, true) | (0b11, _) => TypeInner::Vector {
|
||||
size: VectorSize::Tri,
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
},
|
||||
(_, _) => {
|
||||
let size = match dim + arrayed as u32 + shadow as u32 {
|
||||
1 => VectorSize::Bi,
|
||||
2 => VectorSize::Tri,
|
||||
_ => VectorSize::Quad,
|
||||
};
|
||||
|
||||
TypeInner::Vector {
|
||||
size,
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let size = match dim {
|
||||
0b00 => None,
|
||||
0b01 => Some(VectorSize::Bi),
|
||||
_ => Some(VectorSize::Tri),
|
||||
};
|
||||
|
||||
let ty = || match size {
|
||||
None => TypeInner::Scalar {
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
},
|
||||
Some(size) => TypeInner::Vector {
|
||||
size,
|
||||
kind: Sk::Float,
|
||||
width,
|
||||
},
|
||||
};
|
||||
|
||||
let args = vec![image, vector, ty(), ty()];
|
||||
|
||||
declaration
|
||||
.overloads
|
||||
.push(module.add_builtin(args, MacroCall::TextureGrad(shadow)))
|
||||
.push(module.add_builtin(args, builtin));
|
||||
}
|
||||
}
|
||||
"textureSize" => {
|
||||
@@ -1384,15 +1343,20 @@ fn inject_common_builtin(
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||
pub enum TextureLevelType { None, Lod, Grad }
|
||||
|
||||
/// A compiler defined builtin function
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||
pub enum MacroCall {
|
||||
Sampler,
|
||||
SamplerShadow,
|
||||
Texture,
|
||||
TextureLod,
|
||||
TextureProj,
|
||||
TextureGrad(bool),
|
||||
Texture {
|
||||
proj: bool,
|
||||
offset: bool,
|
||||
shadow: bool,
|
||||
level_type: TextureLevelType,
|
||||
},
|
||||
TextureSize,
|
||||
TexelFetch,
|
||||
MathFunction(MathFunction),
|
||||
@@ -1429,88 +1393,122 @@ impl MacroCall {
|
||||
ctx.samplers.insert(args[0], args[1]);
|
||||
Ok(args[0])
|
||||
}
|
||||
MacroCall::Texture | MacroCall::TextureLod => {
|
||||
let comps = parser.coordinate_components(ctx, args[0], args[1], meta, body)?;
|
||||
let level = match *self {
|
||||
MacroCall::Texture => args
|
||||
.get(2)
|
||||
.copied()
|
||||
.map_or(SampleLevel::Auto, SampleLevel::Bias),
|
||||
MacroCall::TextureLod => SampleLevel::Exact(args[2]),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
texture_call(ctx, args[0], level, comps, body, meta)
|
||||
}
|
||||
MacroCall::TextureGrad(shadow) => {
|
||||
let comps = parser.coordinate_components(ctx, args[0], args[1], meta, body)?;
|
||||
let level = match shadow {
|
||||
true => {
|
||||
log::debug!(
|
||||
"Assuming gradients {:?} and {:?} are not greater than 1",
|
||||
args[2],
|
||||
args[3]
|
||||
);
|
||||
SampleLevel::Zero
|
||||
}
|
||||
false => SampleLevel::Gradient {
|
||||
x: args[2],
|
||||
y: args[3],
|
||||
},
|
||||
};
|
||||
texture_call(ctx, args[0], level, comps, body, meta)
|
||||
}
|
||||
MacroCall::TextureProj => {
|
||||
let level = args
|
||||
.get(2)
|
||||
.copied()
|
||||
.map_or(SampleLevel::Auto, SampleLevel::Bias);
|
||||
let size = match *parser.resolve_type(ctx, args[1], meta)? {
|
||||
TypeInner::Vector { size, .. } => size,
|
||||
_ => {
|
||||
return Err(Error {
|
||||
kind: ErrorKind::SemanticError("Bad call to textureProj".into()),
|
||||
meta,
|
||||
})
|
||||
}
|
||||
};
|
||||
let base = args[1];
|
||||
let mut right = ctx.add_expression(
|
||||
Expression::AccessIndex {
|
||||
base,
|
||||
index: size as u32 - 1,
|
||||
},
|
||||
SourceMetadata::none(),
|
||||
body,
|
||||
);
|
||||
let left = if let VectorSize::Bi = size {
|
||||
ctx.add_expression(
|
||||
Expression::AccessIndex { base, index: 0 },
|
||||
SourceMetadata::none(),
|
||||
body,
|
||||
)
|
||||
} else {
|
||||
let size = match size {
|
||||
VectorSize::Tri => VectorSize::Bi,
|
||||
_ => VectorSize::Tri,
|
||||
MacroCall::Texture { proj, offset, shadow, level_type } => {
|
||||
let mut coords = args[1];
|
||||
|
||||
if proj {
|
||||
let size = match *parser.resolve_type(ctx, coords, meta)? {
|
||||
TypeInner::Vector { size, .. } => size,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
right = ctx.add_expression(
|
||||
Expression::Splat { size, value: right },
|
||||
let mut right = ctx.add_expression(
|
||||
Expression::AccessIndex {
|
||||
base: coords,
|
||||
index: size as u32 - 1,
|
||||
},
|
||||
SourceMetadata::none(),
|
||||
body,
|
||||
);
|
||||
ctx.vector_resize(size, base, SourceMetadata::none(), body)
|
||||
let left = if let VectorSize::Bi = size {
|
||||
ctx.add_expression(
|
||||
Expression::AccessIndex { base: coords, index: 0 },
|
||||
SourceMetadata::none(),
|
||||
body,
|
||||
)
|
||||
} else {
|
||||
let size = match size {
|
||||
VectorSize::Tri => VectorSize::Bi,
|
||||
_ => VectorSize::Tri,
|
||||
};
|
||||
right = ctx.add_expression(
|
||||
Expression::Splat { size, value: right },
|
||||
SourceMetadata::none(),
|
||||
body,
|
||||
);
|
||||
ctx.vector_resize(size, coords, SourceMetadata::none(), body)
|
||||
};
|
||||
coords = ctx.add_expression(
|
||||
Expression::Binary {
|
||||
op: BinaryOperator::Divide,
|
||||
left,
|
||||
right,
|
||||
},
|
||||
SourceMetadata::none(),
|
||||
body,
|
||||
);
|
||||
}
|
||||
|
||||
let extra = args.get(2).copied();
|
||||
let comps = parser.coordinate_components(ctx, args[0], coords, extra, meta, body)?;
|
||||
|
||||
let mut num_args = 2;
|
||||
|
||||
if comps.used_extra {
|
||||
num_args += 1;
|
||||
};
|
||||
let coords = ctx.add_expression(
|
||||
Expression::Binary {
|
||||
op: BinaryOperator::Divide,
|
||||
left,
|
||||
right,
|
||||
},
|
||||
SourceMetadata::none(),
|
||||
body,
|
||||
);
|
||||
let comps = parser.coordinate_components(ctx, args[0], coords, meta, body)?;
|
||||
texture_call(ctx, args[0], level, comps, body, meta)
|
||||
|
||||
// Parse out explicit texture level.
|
||||
let mut level = match level_type {
|
||||
TextureLevelType::None => SampleLevel::Auto,
|
||||
|
||||
TextureLevelType::Lod => {
|
||||
num_args += 1;
|
||||
|
||||
if shadow {
|
||||
log::warn!(
|
||||
"Assuming LOD {:?} is zero",
|
||||
args[2],
|
||||
);
|
||||
|
||||
SampleLevel::Zero
|
||||
} else {
|
||||
SampleLevel::Exact(args[2])
|
||||
}
|
||||
}
|
||||
|
||||
TextureLevelType::Grad => {
|
||||
num_args += 2;
|
||||
|
||||
if shadow {
|
||||
log::warn!(
|
||||
"Assuming gradients {:?} and {:?} are not greater than 1",
|
||||
args[2],
|
||||
args[3],
|
||||
);
|
||||
SampleLevel::Zero
|
||||
} else {
|
||||
SampleLevel::Gradient {
|
||||
x: args[2],
|
||||
y: args[3],
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let texture_offset = match offset {
|
||||
true => {
|
||||
let offset_arg = args[num_args];
|
||||
num_args += 1;
|
||||
match parser.solve_constant(ctx, offset_arg, meta) {
|
||||
Ok(v) => Some(v),
|
||||
Err(e) => {
|
||||
parser.errors.push(e);
|
||||
None
|
||||
},
|
||||
}
|
||||
}
|
||||
false => None
|
||||
};
|
||||
|
||||
// Now go back and look for optional bias arg (if available)
|
||||
if let TextureLevelType::None = level_type {
|
||||
level = args
|
||||
.get(num_args)
|
||||
.copied()
|
||||
.map_or(SampleLevel::Auto, SampleLevel::Bias);
|
||||
}
|
||||
|
||||
texture_call(ctx, args[0], level, comps, texture_offset, body, meta)
|
||||
}
|
||||
MacroCall::TextureSize => Ok(ctx.add_expression(
|
||||
Expression::ImageQuery {
|
||||
@@ -1523,7 +1521,7 @@ impl MacroCall {
|
||||
body,
|
||||
)),
|
||||
MacroCall::TexelFetch => {
|
||||
let comps = parser.coordinate_components(ctx, args[0], args[1], meta, body)?;
|
||||
let comps = parser.coordinate_components(ctx, args[0], args[1], None, meta, body)?;
|
||||
Ok(ctx.add_expression(
|
||||
Expression::ImageLoad {
|
||||
image: args[0],
|
||||
@@ -1666,6 +1664,7 @@ fn texture_call(
|
||||
image: Handle<Expression>,
|
||||
level: SampleLevel,
|
||||
comps: CoordComponents,
|
||||
offset: Option<Handle<Constant>>,
|
||||
body: &mut Block,
|
||||
meta: SourceMetadata,
|
||||
) -> Result<Handle<Expression>> {
|
||||
@@ -1682,7 +1681,7 @@ fn texture_call(
|
||||
sampler,
|
||||
coordinate: comps.coordinate,
|
||||
array_index,
|
||||
offset: None,
|
||||
offset,
|
||||
level,
|
||||
depth_ref: comps.depth_ref,
|
||||
},
|
||||
@@ -1700,10 +1699,12 @@ fn texture_call(
|
||||
/// Helper struct for texture calls with the separate components from the vector argument
|
||||
///
|
||||
/// Obtained by calling [`coordinate_components`](Parser::coordinate_components)
|
||||
#[derive(Debug)]
|
||||
struct CoordComponents {
|
||||
coordinate: Handle<Expression>,
|
||||
depth_ref: Option<Handle<Expression>>,
|
||||
array_index: Option<Handle<Expression>>,
|
||||
used_extra: bool,
|
||||
}
|
||||
|
||||
impl Parser {
|
||||
@@ -1713,6 +1714,7 @@ impl Parser {
|
||||
ctx: &mut Context,
|
||||
image: Handle<Expression>,
|
||||
coord: Handle<Expression>,
|
||||
extra: Option<Handle<Expression>>,
|
||||
meta: SourceMetadata,
|
||||
body: &mut Block,
|
||||
) -> Result<CoordComponents> {
|
||||
@@ -1751,12 +1753,13 @@ impl Parser {
|
||||
),
|
||||
_ => coord,
|
||||
};
|
||||
|
||||
let mut coord_index = image_size.map_or(0, |s| s as u32);
|
||||
|
||||
let array_index = match arrayed {
|
||||
true => {
|
||||
let index = match shadow {
|
||||
true => image_size.map_or(0, |s| s as u32 - 1),
|
||||
false => image_size.map_or(0, |s| s as u32),
|
||||
};
|
||||
let index = coord_index;
|
||||
coord_index += 1;
|
||||
|
||||
Some(ctx.add_expression(
|
||||
Expression::AccessIndex { base: coord, index },
|
||||
@@ -1766,15 +1769,21 @@ impl Parser {
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
let mut used_extra = false;
|
||||
let depth_ref = match shadow {
|
||||
true => {
|
||||
let index = image_size.map_or(0, |s| s as u32);
|
||||
let index = coord_index;
|
||||
|
||||
Some(ctx.add_expression(
|
||||
Expression::AccessIndex { base: coord, index },
|
||||
SourceMetadata::none(),
|
||||
body,
|
||||
))
|
||||
if index == 4 {
|
||||
used_extra = true;
|
||||
extra
|
||||
} else {
|
||||
Some(ctx.add_expression(
|
||||
Expression::AccessIndex { base: coord, index },
|
||||
SourceMetadata::none(),
|
||||
body,
|
||||
))
|
||||
}
|
||||
}
|
||||
false => None,
|
||||
};
|
||||
@@ -1783,6 +1792,7 @@ impl Parser {
|
||||
coordinate,
|
||||
depth_ref,
|
||||
array_index,
|
||||
used_extra,
|
||||
})
|
||||
} else {
|
||||
self.errors.push(Error {
|
||||
@@ -1794,6 +1804,7 @@ impl Parser {
|
||||
coordinate: coord,
|
||||
depth_ref: None,
|
||||
array_index: None,
|
||||
used_extra: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ pub fn parse_type(type_name: &str) -> Option<Type> {
|
||||
"2DMSArray" => (ImageDimension::D2, true, sampled(true)),
|
||||
"3D" => (ImageDimension::D3, false, sampled(false)),
|
||||
"Cube" => (ImageDimension::Cube, false, sampled(false)),
|
||||
"CubeArray" => (ImageDimension::D2, true, sampled(false)),
|
||||
"CubeArray" => (ImageDimension::Cube, true, sampled(false)),
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,12 +1,224 @@
|
||||
#version 440 core
|
||||
precision mediump float;
|
||||
|
||||
layout(set = 1, binding = 0) uniform texture2DArray tex;
|
||||
layout(set = 1, binding = 1) uniform sampler samp;
|
||||
layout(set = 1, binding = 0) uniform texture1D tex1D;
|
||||
layout(set = 1, binding = 1) uniform texture1DArray tex1DArray;
|
||||
layout(set = 1, binding = 2) uniform texture2D tex2D;
|
||||
layout(set = 1, binding = 3) uniform texture2DArray tex2DArray;
|
||||
layout(set = 1, binding = 4) uniform textureCube texCube;
|
||||
layout(set = 1, binding = 5) uniform textureCubeArray texCubeArray;
|
||||
layout(set = 1, binding = 6) uniform texture3D tex3D;
|
||||
layout(set = 1, binding = 7) uniform sampler samp;
|
||||
|
||||
layout(location = 0) in vec2 v_TexCoord;
|
||||
layout(location = 0) out vec4 o_color;
|
||||
// WGSL doesn't have 1D depth samplers.
|
||||
#define HAS_1D_DEPTH_TEXTURES 0
|
||||
|
||||
#if HAS_1D_DEPTH_TEXTURES
|
||||
layout(set = 1, binding = 10) uniform texture1D tex1DShadow;
|
||||
layout(set = 1, binding = 11) uniform texture1DArray tex1DArrayShadow;
|
||||
#endif
|
||||
|
||||
layout(set = 1, binding = 12) uniform texture2D tex2DShadow;
|
||||
layout(set = 1, binding = 13) uniform texture2DArray tex2DArrayShadow;
|
||||
layout(set = 1, binding = 14) uniform textureCube texCubeShadow;
|
||||
layout(set = 1, binding = 15) uniform textureCubeArray texCubeArrayShadow;
|
||||
layout(set = 1, binding = 16) uniform texture3D tex3DShadow;
|
||||
layout(set = 1, binding = 17) uniform samplerShadow sampShadow;
|
||||
|
||||
// Conventions for readability:
|
||||
// 1.0 = Shadow Ref
|
||||
// 2.0 = LOD Bias
|
||||
// 3.0 = Explicit LOD
|
||||
// 4.0 = Grad Derivatives
|
||||
// 5 = Offset
|
||||
// 6.0 = Proj W
|
||||
|
||||
void testTex1D(in float coord) {
|
||||
vec4 c;
|
||||
c = texture(sampler1D(tex1D, samp), coord);
|
||||
c = texture(sampler1D(tex1D, samp), coord, 2.0);
|
||||
c = textureGrad(sampler1D(tex1D, samp), coord, 4.0, 4.0);
|
||||
c = textureGradOffset(sampler1D(tex1D, samp), coord, 4.0, 4.0, 5);
|
||||
c = textureLod(sampler1D(tex1D, samp), coord, 3.0);
|
||||
c = textureLodOffset(sampler1D(tex1D, samp), coord, 3.0, 5);
|
||||
c = textureOffset(sampler1D(tex1D, samp), coord, 5);
|
||||
c = textureOffset(sampler1D(tex1D, samp), coord, 5, 2.0);
|
||||
c = textureProj(sampler1D(tex1D, samp), vec2(coord, 6.0));
|
||||
c = textureProj(sampler1D(tex1D, samp), vec4(coord, 0.0, 0.0, 6.0));
|
||||
c = textureProj(sampler1D(tex1D, samp), vec2(coord, 6.0), 2.0);
|
||||
c = textureProj(sampler1D(tex1D, samp), vec4(coord, 0.0, 0.0, 6.0), 2.0);
|
||||
c = textureProjGrad(sampler1D(tex1D, samp), vec2(coord, 6.0), 4.0, 4.0);
|
||||
c = textureProjGrad(sampler1D(tex1D, samp), vec4(coord, 0.0, 0.0, 6.0), 4.0, 4.0);
|
||||
c = textureProjGradOffset(sampler1D(tex1D, samp), vec2(coord, 6.0), 4.0, 4.0, 5);
|
||||
c = textureProjGradOffset(sampler1D(tex1D, samp), vec4(coord, 0.0, 0.0, 6.0), 4.0, 4.0, 5);
|
||||
c = textureProjLod(sampler1D(tex1D, samp), vec2(coord, 6.0), 3.0);
|
||||
c = textureProjLod(sampler1D(tex1D, samp), vec4(coord, 0.0, 0.0, 6.0), 3.0);
|
||||
c = textureProjLodOffset(sampler1D(tex1D, samp), vec2(coord, 6.0), 3.0, 5);
|
||||
c = textureProjLodOffset(sampler1D(tex1D, samp), vec4(coord, 0.0, 0.0, 6.0), 3.0, 5);
|
||||
c = textureProjOffset(sampler1D(tex1D, samp), vec2(coord, 6.0), 5);
|
||||
c = textureProjOffset(sampler1D(tex1D, samp), vec4(coord, 0.0, 0.0, 6.0), 5);
|
||||
c = textureProjOffset(sampler1D(tex1D, samp), vec2(coord, 6.0), 5, 2.0);
|
||||
c = textureProjOffset(sampler1D(tex1D, samp), vec4(coord, 0.0, 0.0, 6.0), 5, 2.0);
|
||||
}
|
||||
|
||||
#if HAS_1D_DEPTH_TEXTURES
|
||||
void testTex1DShadow(float coord) {
|
||||
float d;
|
||||
d = texture(sampler1DShadow(tex1DShadow, sampShadow), vec2(coord, 1.0));
|
||||
d = textureGrad(sampler1DShadow(tex1DShadow, sampShadow), vec2(coord, 1.0), 4.0, 4.0);
|
||||
d = textureGradOffset(sampler1DShadow(tex1DShadow, sampShadow), vec2(coord, 1.0), 4.0, 4.0, 5);
|
||||
d = textureLod(sampler1DShadow(tex1DShadow, sampShadow), vec2(coord, 1.0), 3.0);
|
||||
d = textureLodOffset(sampler1DShadow(tex1DShadow, sampShadow), vec2(coord, 1.0), 3.0, 5);
|
||||
d = textureOffset(sampler1DShadow(tex1DShadow, sampShadow), vec2(coord, 1.0), 5);
|
||||
d = textureProj(sampler1DShadow(tex1DShadow, sampShadow), vec4(coord, 0.0, 1.0, 6.0));
|
||||
d = textureProjGrad(sampler1DShadow(tex1DShadow, sampShadow), vec4(coord, 0.0, 1.0, 6.0), 4.0, 4.0);
|
||||
d = textureProjGradOffset(sampler1DShadow(tex1DShadow, sampShadow), vec4(coord, 0.0, 1.0, 6.0), 4.0, 4.0, 5);
|
||||
d = textureProjLod(sampler1DShadow(tex1DShadow, sampShadow), vec4(coord, 0.0, 1.0, 6.0), 3.0);
|
||||
d = textureProjLodOffset(sampler1DShadow(tex1DShadow, sampShadow), vec4(coord, 0.0, 1.0, 6.0), 3.0, 5);
|
||||
d = textureProjOffset(sampler1DShadow(tex1DShadow, sampShadow), vec4(coord, 0.0, 1.0, 6.0), 5);
|
||||
}
|
||||
#endif
|
||||
|
||||
void testTex1DArray(in vec2 coord) {
|
||||
vec4 c;
|
||||
c = texture(sampler1DArray(tex1DArray, samp), coord);
|
||||
c = texture(sampler1DArray(tex1DArray, samp), coord, 2.0);
|
||||
c = textureGrad(sampler1DArray(tex1DArray, samp), coord, 4.0, 4.0);
|
||||
c = textureGradOffset(sampler1DArray(tex1DArray, samp), coord, 4.0, 4.0, 5);
|
||||
c = textureLod(sampler1DArray(tex1DArray, samp), coord, 3.0);
|
||||
c = textureLodOffset(sampler1DArray(tex1DArray, samp), coord, 3.0, 5);
|
||||
c = textureOffset(sampler1DArray(tex1DArray, samp), coord, 5);
|
||||
c = textureOffset(sampler1DArray(tex1DArray, samp), coord, 5, 2.0);
|
||||
}
|
||||
|
||||
#if HAS_1D_DEPTH_TEXTURES
|
||||
void testTex1DArrayShadow(in vec2 coord) {
|
||||
float d;
|
||||
d = texture(sampler1DArrayShadow(tex1DArrayShadow, sampShadow), vec3(coord, 1.0));
|
||||
d = textureGrad(sampler1DArrayShadow(tex1DArrayShadow, sampShadow), vec3(coord, 1.0), 4.0, 4.0);
|
||||
d = textureGradOffset(sampler1DArrayShadow(tex1DArrayShadow, sampShadow), vec3(coord, 1.0), 4.0, 4.0, 5);
|
||||
d = textureLod(sampler1DArrayShadow(tex1DArrayShadow, sampShadow), vec3(coord, 1.0), 3.0);
|
||||
d = textureLodOffset(sampler1DArrayShadow(tex1DArrayShadow, sampShadow), vec3(coord, 1.0), 3.0, 5);
|
||||
d = textureOffset(sampler1DArrayShadow(tex1DArrayShadow, sampShadow), vec3(coord, 1.0), 5);
|
||||
}
|
||||
#endif
|
||||
|
||||
void testTex2D(in vec2 coord) {
|
||||
vec4 c;
|
||||
c = texture(sampler2D(tex2D, samp), coord);
|
||||
c = texture(sampler2D(tex2D, samp), coord, 2.0);
|
||||
c = textureGrad(sampler2D(tex2D, samp), coord, vec2(4.0), vec2(4.0));
|
||||
c = textureGradOffset(sampler2D(tex2D, samp), coord, vec2(4.0), vec2(4.0), ivec2(5));
|
||||
c = textureLod(sampler2D(tex2D, samp), coord, 3.0);
|
||||
c = textureLodOffset(sampler2D(tex2D, samp), coord, 3.0, ivec2(5));
|
||||
c = textureOffset(sampler2D(tex2D, samp), coord, ivec2(5));
|
||||
c = textureOffset(sampler2D(tex2D, samp), coord, ivec2(5), 2.0);
|
||||
c = textureProj(sampler2D(tex2D, samp), vec3(coord, 6.0));
|
||||
c = textureProj(sampler2D(tex2D, samp), vec4(coord, 0.0, 6.0));
|
||||
c = textureProj(sampler2D(tex2D, samp), vec3(coord, 6.0), 2.0);
|
||||
c = textureProj(sampler2D(tex2D, samp), vec4(coord, 0.0, 6.0), 2.0);
|
||||
c = textureProjGrad(sampler2D(tex2D, samp), vec3(coord, 6.0), vec2(4.0), vec2(4.0));
|
||||
c = textureProjGrad(sampler2D(tex2D, samp), vec4(coord, 0.0, 6.0), vec2(4.0), vec2(4.0));
|
||||
c = textureProjGradOffset(sampler2D(tex2D, samp), vec3(coord, 6.0), vec2(4.0), vec2(4.0), ivec2(5));
|
||||
c = textureProjGradOffset(sampler2D(tex2D, samp), vec4(coord, 0.0, 6.0), vec2(4.0), vec2(4.0), ivec2(5));
|
||||
c = textureProjLod(sampler2D(tex2D, samp), vec3(coord, 6.0), 3.0);
|
||||
c = textureProjLod(sampler2D(tex2D, samp), vec4(coord, 0.0, 6.0), 3.0);
|
||||
c = textureProjLodOffset(sampler2D(tex2D, samp), vec3(coord, 6.0), 3.0, ivec2(5));
|
||||
c = textureProjLodOffset(sampler2D(tex2D, samp), vec4(coord, 0.0, 6.0), 3.0, ivec2(5));
|
||||
c = textureProjOffset(sampler2D(tex2D, samp), vec3(coord, 6.0), ivec2(5));
|
||||
c = textureProjOffset(sampler2D(tex2D, samp), vec4(coord, 0.0, 6.0), ivec2(5));
|
||||
c = textureProjOffset(sampler2D(tex2D, samp), vec3(coord, 6.0), ivec2(5), 2.0);
|
||||
c = textureProjOffset(sampler2D(tex2D, samp), vec4(coord, 0.0, 6.0), ivec2(5), 2.0);
|
||||
}
|
||||
|
||||
void testTex2DShadow(vec2 coord) {
|
||||
float d;
|
||||
d = texture(sampler2DShadow(tex2DShadow, sampShadow), vec3(coord, 1.0));
|
||||
d = textureGrad(sampler2DShadow(tex2DShadow, sampShadow), vec3(coord, 1.0), vec2(4.0), vec2(4.0));
|
||||
d = textureGradOffset(sampler2DShadow(tex2DShadow, sampShadow), vec3(coord, 1.0), vec2(4.0), vec2(4.0), ivec2(5));
|
||||
d = textureLod(sampler2DShadow(tex2DShadow, sampShadow), vec3(coord, 1.0), 3.0);
|
||||
d = textureLodOffset(sampler2DShadow(tex2DShadow, sampShadow), vec3(coord, 1.0), 3.0, ivec2(5));
|
||||
d = textureOffset(sampler2DShadow(tex2DShadow, sampShadow), vec3(coord, 1.0), ivec2(5));
|
||||
d = textureProj(sampler2DShadow(tex2DShadow, sampShadow), vec4(coord, 1.0, 6.0));
|
||||
d = textureProjGrad(sampler2DShadow(tex2DShadow, sampShadow), vec4(coord, 1.0, 6.0), vec2(4.0), vec2(4.0));
|
||||
d = textureProjGradOffset(sampler2DShadow(tex2DShadow, sampShadow), vec4(coord, 1.0, 6.0), vec2(4.0), vec2(4.0), ivec2(5));
|
||||
d = textureProjLod(sampler2DShadow(tex2DShadow, sampShadow), vec4(coord, 1.0, 6.0), 3.0);
|
||||
d = textureProjLodOffset(sampler2DShadow(tex2DShadow, sampShadow), vec4(coord, 1.0, 6.0), 3.0, ivec2(5));
|
||||
d = textureProjOffset(sampler2DShadow(tex2DShadow, sampShadow), vec4(coord, 1.0, 6.0), ivec2(5));
|
||||
}
|
||||
|
||||
void testTex2DArray(in vec3 coord) {
|
||||
vec4 c;
|
||||
c = texture(sampler2DArray(tex2DArray, samp), coord);
|
||||
c = texture(sampler2DArray(tex2DArray, samp), coord, 2.0);
|
||||
c = textureGrad(sampler2DArray(tex2DArray, samp), coord, vec2(4.0), vec2(4.0));
|
||||
c = textureGradOffset(sampler2DArray(tex2DArray, samp), coord, vec2(4.0), vec2(4.0), ivec2(5));
|
||||
c = textureLod(sampler2DArray(tex2DArray, samp), coord, 3.0);
|
||||
c = textureLodOffset(sampler2DArray(tex2DArray, samp), coord, 3.0, ivec2(5));
|
||||
c = textureOffset(sampler2DArray(tex2DArray, samp), coord, ivec2(5));
|
||||
c = textureOffset(sampler2DArray(tex2DArray, samp), coord, ivec2(5), 2.0);
|
||||
}
|
||||
|
||||
void testTex2DArrayShadow(in vec3 coord) {
|
||||
float d;
|
||||
d = texture(sampler2DArrayShadow(tex2DArrayShadow, sampShadow), vec4(coord, 1.0));
|
||||
d = textureGrad(sampler2DArrayShadow(tex2DArrayShadow, sampShadow), vec4(coord, 1.0), vec2(4.0), vec2(4.0));
|
||||
d = textureGradOffset(sampler2DArrayShadow(tex2DArrayShadow, sampShadow), vec4(coord, 1.0), vec2(4.0), vec2(4.0), ivec2(5));
|
||||
d = textureLod(sampler2DArrayShadow(tex2DArrayShadow, sampShadow), vec4(coord, 1.0), 3.0);
|
||||
d = textureLodOffset(sampler2DArrayShadow(tex2DArrayShadow, sampShadow), vec4(coord, 1.0), 3.0, ivec2(5));
|
||||
d = textureOffset(sampler2DArrayShadow(tex2DArrayShadow, sampShadow), vec4(coord, 1.0), ivec2(5));
|
||||
}
|
||||
|
||||
void testTexCube(in vec3 coord) {
|
||||
vec4 c;
|
||||
c = texture(samplerCube(texCube, samp), coord);
|
||||
c = texture(samplerCube(texCube, samp), coord, 2.0);
|
||||
c = textureGrad(samplerCube(texCube, samp), coord, vec3(4.0), vec3(4.0));
|
||||
c = textureLod(samplerCube(texCube, samp), coord, 3.0);
|
||||
c = textureLodOffset(samplerCube(texCube, samp), coord, 3.0, ivec3(5));
|
||||
c = textureOffset(samplerCube(texCube, samp), coord, ivec3(5));
|
||||
c = textureOffset(samplerCube(texCube, samp), coord, ivec3(5), 2.0);
|
||||
}
|
||||
|
||||
void testTexCubeShadow(in vec3 coord) {
|
||||
float d;
|
||||
d = texture(samplerCubeShadow(texCubeShadow, sampShadow), vec4(coord, 1.0));
|
||||
d = textureGrad(samplerCubeShadow(texCubeShadow, sampShadow), vec4(coord, 1.0), vec3(4.0), vec3(4.0));
|
||||
d = textureLod(samplerCubeShadow(texCubeShadow, sampShadow), vec4(coord, 1.0), 3.0);
|
||||
d = textureLodOffset(samplerCubeShadow(texCubeShadow, sampShadow), vec4(coord, 1.0), 3.0, ivec3(5));
|
||||
d = textureOffset(samplerCubeShadow(texCubeShadow, sampShadow), vec4(coord, 1.0), ivec3(5));
|
||||
}
|
||||
|
||||
void testTexCubeArray(in vec4 coord) {
|
||||
vec4 c;
|
||||
c = texture(samplerCubeArray(texCubeArray, samp), coord);
|
||||
c = texture(samplerCubeArray(texCubeArray, samp), coord, 2.0);
|
||||
c = textureGrad(samplerCubeArray(texCubeArray, samp), coord, vec3(4.0), vec3(4.0));
|
||||
c = textureLod(samplerCubeArray(texCubeArray, samp), coord, 3.0);
|
||||
c = textureLodOffset(samplerCubeArray(texCubeArray, samp), coord, 3.0, ivec3(5));
|
||||
c = textureOffset(samplerCubeArray(texCubeArray, samp), coord, ivec3(5));
|
||||
c = textureOffset(samplerCubeArray(texCubeArray, samp), coord, ivec3(5), 2.0);
|
||||
}
|
||||
|
||||
void testTexCubeArrayShadow(in vec4 coord) {
|
||||
float d;
|
||||
d = texture(samplerCubeArrayShadow(texCubeArrayShadow, sampShadow), coord, 1.0);
|
||||
// The rest of the variants aren't defined by GLSL.
|
||||
}
|
||||
|
||||
void testTex3D(in vec3 coord) {
|
||||
vec4 c;
|
||||
c = texture(sampler3D(tex3D, samp), coord);
|
||||
c = texture(sampler3D(tex3D, samp), coord, 2.0);
|
||||
c = textureGrad(sampler3D(tex3D, samp), coord, vec3(4.0), vec3(4.0));
|
||||
c = textureGradOffset(sampler3D(tex3D, samp), coord, vec3(4.0), vec3(4.0), ivec3(5));
|
||||
c = textureLod(sampler3D(tex3D, samp), coord, 3.0);
|
||||
c = textureLodOffset(sampler3D(tex3D, samp), coord, 3.0, ivec3(5));
|
||||
c = textureOffset(sampler3D(tex3D, samp), coord, ivec3(5));
|
||||
c = textureOffset(sampler3D(tex3D, samp), coord, ivec3(5), 2.0);
|
||||
}
|
||||
|
||||
layout(location = 0) in vec4 texcoord;
|
||||
|
||||
void main() {
|
||||
o_color.rgba = texture(sampler2DArray(tex, samp), vec3(v_TexCoord, 0.0));
|
||||
}
|
||||
|
||||
@@ -1,31 +1,574 @@
|
||||
struct FragmentOutput {
|
||||
[[location(0)]] o_color: vec4<f32>;
|
||||
};
|
||||
|
||||
[[group(1), binding(0)]]
|
||||
var tex: texture_2d_array<f32>;
|
||||
var tex1D: texture_1d<f32>;
|
||||
[[group(1), binding(1)]]
|
||||
var tex1DArray: texture_1d_array<f32>;
|
||||
[[group(1), binding(2)]]
|
||||
var tex2D: texture_2d<f32>;
|
||||
[[group(1), binding(3)]]
|
||||
var tex2DArray: texture_2d_array<f32>;
|
||||
[[group(1), binding(4)]]
|
||||
var texCube: texture_cube<f32>;
|
||||
[[group(1), binding(5)]]
|
||||
var texCubeArray: texture_cube_array<f32>;
|
||||
[[group(1), binding(6)]]
|
||||
var tex3D: texture_3d<f32>;
|
||||
[[group(1), binding(7)]]
|
||||
var samp: sampler;
|
||||
var<private> v_TexCoord1: vec2<f32>;
|
||||
var<private> o_color: vec4<f32>;
|
||||
[[group(1), binding(12)]]
|
||||
var tex2DShadow: texture_depth_2d;
|
||||
[[group(1), binding(13)]]
|
||||
var tex2DArrayShadow: texture_depth_2d_array;
|
||||
[[group(1), binding(14)]]
|
||||
var texCubeShadow: texture_depth_cube;
|
||||
[[group(1), binding(15)]]
|
||||
var texCubeArrayShadow: texture_depth_cube_array;
|
||||
[[group(1), binding(16)]]
|
||||
var tex3DShadow: texture_3d<f32>;
|
||||
[[group(1), binding(17)]]
|
||||
var sampShadow: sampler_comparison;
|
||||
var<private> texcoord1: vec4<f32>;
|
||||
|
||||
fn testTex1D(coord: f32) {
|
||||
var coord1: f32;
|
||||
var c: vec4<f32>;
|
||||
|
||||
coord1 = coord;
|
||||
let _e18: f32 = coord1;
|
||||
let _e19: vec4<f32> = textureSample(tex1D, samp, _e18);
|
||||
c = _e19;
|
||||
let _e22: f32 = coord1;
|
||||
let _e24: vec4<f32> = textureSampleBias(tex1D, samp, _e22, 2.0);
|
||||
c = _e24;
|
||||
let _e28: f32 = coord1;
|
||||
let _e31: vec4<f32> = textureSampleGrad(tex1D, samp, _e28, 4.0, 4.0);
|
||||
c = _e31;
|
||||
let _e36: f32 = coord1;
|
||||
let _e40: vec4<f32> = textureSampleGrad(tex1D, samp, _e36, 4.0, 4.0, 5);
|
||||
c = _e40;
|
||||
let _e43: f32 = coord1;
|
||||
let _e45: vec4<f32> = textureSampleLevel(tex1D, samp, _e43, 3.0);
|
||||
c = _e45;
|
||||
let _e49: f32 = coord1;
|
||||
let _e52: vec4<f32> = textureSampleLevel(tex1D, samp, _e49, 3.0, 5);
|
||||
c = _e52;
|
||||
let _e55: f32 = coord1;
|
||||
let _e57: vec4<f32> = textureSample(tex1D, samp, _e55, 5);
|
||||
c = _e57;
|
||||
let _e61: f32 = coord1;
|
||||
let _e64: vec4<f32> = textureSampleBias(tex1D, samp, _e61, 2.0, 5);
|
||||
c = _e64;
|
||||
let _e65: f32 = coord1;
|
||||
let _e68: f32 = coord1;
|
||||
let _e70: vec2<f32> = vec2<f32>(_e68, 6.0);
|
||||
let _e74: vec4<f32> = textureSample(tex1D, samp, (_e70.x / _e70.y));
|
||||
c = _e74;
|
||||
let _e75: f32 = coord1;
|
||||
let _e80: f32 = coord1;
|
||||
let _e84: vec4<f32> = vec4<f32>(_e80, 0.0, 0.0, 6.0);
|
||||
let _e90: vec4<f32> = textureSample(tex1D, samp, (_e84.xyz / vec3<f32>(_e84.w)).x);
|
||||
c = _e90;
|
||||
let _e91: f32 = coord1;
|
||||
let _e95: f32 = coord1;
|
||||
let _e97: vec2<f32> = vec2<f32>(_e95, 6.0);
|
||||
let _e102: vec4<f32> = textureSampleBias(tex1D, samp, (_e97.x / _e97.y), 2.0);
|
||||
c = _e102;
|
||||
let _e103: f32 = coord1;
|
||||
let _e109: f32 = coord1;
|
||||
let _e113: vec4<f32> = vec4<f32>(_e109, 0.0, 0.0, 6.0);
|
||||
let _e120: vec4<f32> = textureSampleBias(tex1D, samp, (_e113.xyz / vec3<f32>(_e113.w)).x, 2.0);
|
||||
c = _e120;
|
||||
let _e121: f32 = coord1;
|
||||
let _e126: f32 = coord1;
|
||||
let _e128: vec2<f32> = vec2<f32>(_e126, 6.0);
|
||||
let _e134: vec4<f32> = textureSampleGrad(tex1D, samp, (_e128.x / _e128.y), 4.0, 4.0);
|
||||
c = _e134;
|
||||
let _e135: f32 = coord1;
|
||||
let _e142: f32 = coord1;
|
||||
let _e146: vec4<f32> = vec4<f32>(_e142, 0.0, 0.0, 6.0);
|
||||
let _e154: vec4<f32> = textureSampleGrad(tex1D, samp, (_e146.xyz / vec3<f32>(_e146.w)).x, 4.0, 4.0);
|
||||
c = _e154;
|
||||
let _e155: f32 = coord1;
|
||||
let _e161: f32 = coord1;
|
||||
let _e163: vec2<f32> = vec2<f32>(_e161, 6.0);
|
||||
let _e170: vec4<f32> = textureSampleGrad(tex1D, samp, (_e163.x / _e163.y), 4.0, 4.0, 5);
|
||||
c = _e170;
|
||||
let _e171: f32 = coord1;
|
||||
let _e179: f32 = coord1;
|
||||
let _e183: vec4<f32> = vec4<f32>(_e179, 0.0, 0.0, 6.0);
|
||||
let _e192: vec4<f32> = textureSampleGrad(tex1D, samp, (_e183.xyz / vec3<f32>(_e183.w)).x, 4.0, 4.0, 5);
|
||||
c = _e192;
|
||||
let _e193: f32 = coord1;
|
||||
let _e197: f32 = coord1;
|
||||
let _e199: vec2<f32> = vec2<f32>(_e197, 6.0);
|
||||
let _e204: vec4<f32> = textureSampleLevel(tex1D, samp, (_e199.x / _e199.y), 3.0);
|
||||
c = _e204;
|
||||
let _e205: f32 = coord1;
|
||||
let _e211: f32 = coord1;
|
||||
let _e215: vec4<f32> = vec4<f32>(_e211, 0.0, 0.0, 6.0);
|
||||
let _e222: vec4<f32> = textureSampleLevel(tex1D, samp, (_e215.xyz / vec3<f32>(_e215.w)).x, 3.0);
|
||||
c = _e222;
|
||||
let _e223: f32 = coord1;
|
||||
let _e228: f32 = coord1;
|
||||
let _e230: vec2<f32> = vec2<f32>(_e228, 6.0);
|
||||
let _e236: vec4<f32> = textureSampleLevel(tex1D, samp, (_e230.x / _e230.y), 3.0, 5);
|
||||
c = _e236;
|
||||
let _e237: f32 = coord1;
|
||||
let _e244: f32 = coord1;
|
||||
let _e248: vec4<f32> = vec4<f32>(_e244, 0.0, 0.0, 6.0);
|
||||
let _e256: vec4<f32> = textureSampleLevel(tex1D, samp, (_e248.xyz / vec3<f32>(_e248.w)).x, 3.0, 5);
|
||||
c = _e256;
|
||||
let _e257: f32 = coord1;
|
||||
let _e261: f32 = coord1;
|
||||
let _e263: vec2<f32> = vec2<f32>(_e261, 6.0);
|
||||
let _e268: vec4<f32> = textureSample(tex1D, samp, (_e263.x / _e263.y), 5);
|
||||
c = _e268;
|
||||
let _e269: f32 = coord1;
|
||||
let _e275: f32 = coord1;
|
||||
let _e279: vec4<f32> = vec4<f32>(_e275, 0.0, 0.0, 6.0);
|
||||
let _e286: vec4<f32> = textureSample(tex1D, samp, (_e279.xyz / vec3<f32>(_e279.w)).x, 5);
|
||||
c = _e286;
|
||||
let _e287: f32 = coord1;
|
||||
let _e292: f32 = coord1;
|
||||
let _e294: vec2<f32> = vec2<f32>(_e292, 6.0);
|
||||
let _e300: vec4<f32> = textureSampleBias(tex1D, samp, (_e294.x / _e294.y), 2.0, 5);
|
||||
c = _e300;
|
||||
let _e301: f32 = coord1;
|
||||
let _e308: f32 = coord1;
|
||||
let _e312: vec4<f32> = vec4<f32>(_e308, 0.0, 0.0, 6.0);
|
||||
let _e320: vec4<f32> = textureSampleBias(tex1D, samp, (_e312.xyz / vec3<f32>(_e312.w)).x, 2.0, 5);
|
||||
c = _e320;
|
||||
return;
|
||||
}
|
||||
|
||||
fn testTex1DArray(coord2: vec2<f32>) {
|
||||
var coord3: vec2<f32>;
|
||||
var c1: vec4<f32>;
|
||||
|
||||
coord3 = coord2;
|
||||
let _e18: vec2<f32> = coord3;
|
||||
let _e22: vec4<f32> = textureSample(tex1DArray, samp, _e18.x, i32(_e18.x));
|
||||
c1 = _e22;
|
||||
let _e25: vec2<f32> = coord3;
|
||||
let _e30: vec4<f32> = textureSampleBias(tex1DArray, samp, _e25.x, i32(_e25.x), 2.0);
|
||||
c1 = _e30;
|
||||
let _e34: vec2<f32> = coord3;
|
||||
let _e40: vec4<f32> = textureSampleGrad(tex1DArray, samp, _e34.x, i32(_e34.x), 4.0, 4.0);
|
||||
c1 = _e40;
|
||||
let _e45: vec2<f32> = coord3;
|
||||
let _e52: vec4<f32> = textureSampleGrad(tex1DArray, samp, _e45.x, i32(_e45.x), 4.0, 4.0, 5);
|
||||
c1 = _e52;
|
||||
let _e55: vec2<f32> = coord3;
|
||||
let _e60: vec4<f32> = textureSampleLevel(tex1DArray, samp, _e55.x, i32(_e55.x), 3.0);
|
||||
c1 = _e60;
|
||||
let _e64: vec2<f32> = coord3;
|
||||
let _e70: vec4<f32> = textureSampleLevel(tex1DArray, samp, _e64.x, i32(_e64.x), 3.0, 5);
|
||||
c1 = _e70;
|
||||
let _e73: vec2<f32> = coord3;
|
||||
let _e78: vec4<f32> = textureSample(tex1DArray, samp, _e73.x, i32(_e73.x), 5);
|
||||
c1 = _e78;
|
||||
let _e82: vec2<f32> = coord3;
|
||||
let _e88: vec4<f32> = textureSampleBias(tex1DArray, samp, _e82.x, i32(_e82.x), 2.0, 5);
|
||||
c1 = _e88;
|
||||
return;
|
||||
}
|
||||
|
||||
fn testTex2D(coord4: vec2<f32>) {
|
||||
var coord5: vec2<f32>;
|
||||
var c2: vec4<f32>;
|
||||
|
||||
coord5 = coord4;
|
||||
let _e18: vec2<f32> = coord5;
|
||||
let _e19: vec4<f32> = textureSample(tex2D, samp, _e18);
|
||||
c2 = _e19;
|
||||
let _e22: vec2<f32> = coord5;
|
||||
let _e24: vec4<f32> = textureSampleBias(tex2D, samp, _e22, 2.0);
|
||||
c2 = _e24;
|
||||
let _e30: vec2<f32> = coord5;
|
||||
let _e35: vec4<f32> = textureSampleGrad(tex2D, samp, _e30, vec2<f32>(4.0), vec2<f32>(4.0));
|
||||
c2 = _e35;
|
||||
let _e43: vec2<f32> = coord5;
|
||||
let _e50: vec4<f32> = textureSampleGrad(tex2D, samp, _e43, vec2<f32>(4.0), vec2<f32>(4.0), vec2<i32>(5, 5));
|
||||
c2 = _e50;
|
||||
let _e53: vec2<f32> = coord5;
|
||||
let _e55: vec4<f32> = textureSampleLevel(tex2D, samp, _e53, 3.0);
|
||||
c2 = _e55;
|
||||
let _e60: vec2<f32> = coord5;
|
||||
let _e64: vec4<f32> = textureSampleLevel(tex2D, samp, _e60, 3.0, vec2<i32>(5, 5));
|
||||
c2 = _e64;
|
||||
let _e68: vec2<f32> = coord5;
|
||||
let _e71: vec4<f32> = textureSample(tex2D, samp, _e68, vec2<i32>(5, 5));
|
||||
c2 = _e71;
|
||||
let _e76: vec2<f32> = coord5;
|
||||
let _e80: vec4<f32> = textureSampleBias(tex2D, samp, _e76, 2.0, vec2<i32>(5, 5));
|
||||
c2 = _e80;
|
||||
let _e81: vec2<f32> = coord5;
|
||||
let _e84: vec2<f32> = coord5;
|
||||
let _e86: vec3<f32> = vec3<f32>(_e84, 6.0);
|
||||
let _e91: vec4<f32> = textureSample(tex2D, samp, (_e86.xy / vec2<f32>(_e86.z)));
|
||||
c2 = _e91;
|
||||
let _e92: vec2<f32> = coord5;
|
||||
let _e96: vec2<f32> = coord5;
|
||||
let _e99: vec4<f32> = vec4<f32>(_e96, 0.0, 6.0);
|
||||
let _e105: vec4<f32> = textureSample(tex2D, samp, (_e99.xyz / vec3<f32>(_e99.w)).xy);
|
||||
c2 = _e105;
|
||||
let _e106: vec2<f32> = coord5;
|
||||
let _e110: vec2<f32> = coord5;
|
||||
let _e112: vec3<f32> = vec3<f32>(_e110, 6.0);
|
||||
let _e118: vec4<f32> = textureSampleBias(tex2D, samp, (_e112.xy / vec2<f32>(_e112.z)), 2.0);
|
||||
c2 = _e118;
|
||||
let _e119: vec2<f32> = coord5;
|
||||
let _e124: vec2<f32> = coord5;
|
||||
let _e127: vec4<f32> = vec4<f32>(_e124, 0.0, 6.0);
|
||||
let _e134: vec4<f32> = textureSampleBias(tex2D, samp, (_e127.xyz / vec3<f32>(_e127.w)).xy, 2.0);
|
||||
c2 = _e134;
|
||||
let _e135: vec2<f32> = coord5;
|
||||
let _e142: vec2<f32> = coord5;
|
||||
let _e144: vec3<f32> = vec3<f32>(_e142, 6.0);
|
||||
let _e153: vec4<f32> = textureSampleGrad(tex2D, samp, (_e144.xy / vec2<f32>(_e144.z)), vec2<f32>(4.0), vec2<f32>(4.0));
|
||||
c2 = _e153;
|
||||
let _e154: vec2<f32> = coord5;
|
||||
let _e162: vec2<f32> = coord5;
|
||||
let _e165: vec4<f32> = vec4<f32>(_e162, 0.0, 6.0);
|
||||
let _e175: vec4<f32> = textureSampleGrad(tex2D, samp, (_e165.xyz / vec3<f32>(_e165.w)).xy, vec2<f32>(4.0), vec2<f32>(4.0));
|
||||
c2 = _e175;
|
||||
let _e176: vec2<f32> = coord5;
|
||||
let _e185: vec2<f32> = coord5;
|
||||
let _e187: vec3<f32> = vec3<f32>(_e185, 6.0);
|
||||
let _e198: vec4<f32> = textureSampleGrad(tex2D, samp, (_e187.xy / vec2<f32>(_e187.z)), vec2<f32>(4.0), vec2<f32>(4.0), vec2<i32>(5, 5));
|
||||
c2 = _e198;
|
||||
let _e199: vec2<f32> = coord5;
|
||||
let _e209: vec2<f32> = coord5;
|
||||
let _e212: vec4<f32> = vec4<f32>(_e209, 0.0, 6.0);
|
||||
let _e224: vec4<f32> = textureSampleGrad(tex2D, samp, (_e212.xyz / vec3<f32>(_e212.w)).xy, vec2<f32>(4.0), vec2<f32>(4.0), vec2<i32>(5, 5));
|
||||
c2 = _e224;
|
||||
let _e225: vec2<f32> = coord5;
|
||||
let _e229: vec2<f32> = coord5;
|
||||
let _e231: vec3<f32> = vec3<f32>(_e229, 6.0);
|
||||
let _e237: vec4<f32> = textureSampleLevel(tex2D, samp, (_e231.xy / vec2<f32>(_e231.z)), 3.0);
|
||||
c2 = _e237;
|
||||
let _e238: vec2<f32> = coord5;
|
||||
let _e243: vec2<f32> = coord5;
|
||||
let _e246: vec4<f32> = vec4<f32>(_e243, 0.0, 6.0);
|
||||
let _e253: vec4<f32> = textureSampleLevel(tex2D, samp, (_e246.xyz / vec3<f32>(_e246.w)).xy, 3.0);
|
||||
c2 = _e253;
|
||||
let _e254: vec2<f32> = coord5;
|
||||
let _e260: vec2<f32> = coord5;
|
||||
let _e262: vec3<f32> = vec3<f32>(_e260, 6.0);
|
||||
let _e270: vec4<f32> = textureSampleLevel(tex2D, samp, (_e262.xy / vec2<f32>(_e262.z)), 3.0, vec2<i32>(5, 5));
|
||||
c2 = _e270;
|
||||
let _e271: vec2<f32> = coord5;
|
||||
let _e278: vec2<f32> = coord5;
|
||||
let _e281: vec4<f32> = vec4<f32>(_e278, 0.0, 6.0);
|
||||
let _e290: vec4<f32> = textureSampleLevel(tex2D, samp, (_e281.xyz / vec3<f32>(_e281.w)).xy, 3.0, vec2<i32>(5, 5));
|
||||
c2 = _e290;
|
||||
let _e291: vec2<f32> = coord5;
|
||||
let _e296: vec2<f32> = coord5;
|
||||
let _e298: vec3<f32> = vec3<f32>(_e296, 6.0);
|
||||
let _e305: vec4<f32> = textureSample(tex2D, samp, (_e298.xy / vec2<f32>(_e298.z)), vec2<i32>(5, 5));
|
||||
c2 = _e305;
|
||||
let _e306: vec2<f32> = coord5;
|
||||
let _e312: vec2<f32> = coord5;
|
||||
let _e315: vec4<f32> = vec4<f32>(_e312, 0.0, 6.0);
|
||||
let _e323: vec4<f32> = textureSample(tex2D, samp, (_e315.xyz / vec3<f32>(_e315.w)).xy, vec2<i32>(5, 5));
|
||||
c2 = _e323;
|
||||
let _e324: vec2<f32> = coord5;
|
||||
let _e330: vec2<f32> = coord5;
|
||||
let _e332: vec3<f32> = vec3<f32>(_e330, 6.0);
|
||||
let _e340: vec4<f32> = textureSampleBias(tex2D, samp, (_e332.xy / vec2<f32>(_e332.z)), 2.0, vec2<i32>(5, 5));
|
||||
c2 = _e340;
|
||||
let _e341: vec2<f32> = coord5;
|
||||
let _e348: vec2<f32> = coord5;
|
||||
let _e351: vec4<f32> = vec4<f32>(_e348, 0.0, 6.0);
|
||||
let _e360: vec4<f32> = textureSampleBias(tex2D, samp, (_e351.xyz / vec3<f32>(_e351.w)).xy, 2.0, vec2<i32>(5, 5));
|
||||
c2 = _e360;
|
||||
return;
|
||||
}
|
||||
|
||||
fn testTex2DShadow(coord6: vec2<f32>) {
|
||||
var coord7: vec2<f32>;
|
||||
var d: f32;
|
||||
|
||||
coord7 = coord6;
|
||||
let _e17: vec2<f32> = coord7;
|
||||
let _e20: vec2<f32> = coord7;
|
||||
let _e22: vec3<f32> = vec3<f32>(_e20, 1.0);
|
||||
let _e25: f32 = textureSampleCompare(tex2DShadow, sampShadow, _e22.xy, _e22.z);
|
||||
d = _e25;
|
||||
let _e26: vec2<f32> = coord7;
|
||||
let _e33: vec2<f32> = coord7;
|
||||
let _e35: vec3<f32> = vec3<f32>(_e33, 1.0);
|
||||
let _e42: f32 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e35.xy, _e35.z);
|
||||
d = _e42;
|
||||
let _e43: vec2<f32> = coord7;
|
||||
let _e52: vec2<f32> = coord7;
|
||||
let _e54: vec3<f32> = vec3<f32>(_e52, 1.0);
|
||||
let _e63: f32 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e54.xy, _e54.z, vec2<i32>(5, 5));
|
||||
d = _e63;
|
||||
let _e64: vec2<f32> = coord7;
|
||||
let _e68: vec2<f32> = coord7;
|
||||
let _e70: vec3<f32> = vec3<f32>(_e68, 1.0);
|
||||
let _e74: f32 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e70.xy, _e70.z);
|
||||
d = _e74;
|
||||
let _e75: vec2<f32> = coord7;
|
||||
let _e81: vec2<f32> = coord7;
|
||||
let _e83: vec3<f32> = vec3<f32>(_e81, 1.0);
|
||||
let _e89: f32 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e83.xy, _e83.z, vec2<i32>(5, 5));
|
||||
d = _e89;
|
||||
let _e90: vec2<f32> = coord7;
|
||||
let _e95: vec2<f32> = coord7;
|
||||
let _e97: vec3<f32> = vec3<f32>(_e95, 1.0);
|
||||
let _e102: f32 = textureSampleCompare(tex2DShadow, sampShadow, _e97.xy, _e97.z, vec2<i32>(5, 5));
|
||||
d = _e102;
|
||||
let _e103: vec2<f32> = coord7;
|
||||
let _e107: vec2<f32> = coord7;
|
||||
let _e110: vec4<f32> = vec4<f32>(_e107, 1.0, 6.0);
|
||||
let _e114: vec3<f32> = (_e110.xyz / vec3<f32>(_e110.w));
|
||||
let _e117: f32 = textureSampleCompare(tex2DShadow, sampShadow, _e114.xy, _e114.z);
|
||||
d = _e117;
|
||||
let _e118: vec2<f32> = coord7;
|
||||
let _e126: vec2<f32> = coord7;
|
||||
let _e129: vec4<f32> = vec4<f32>(_e126, 1.0, 6.0);
|
||||
let _e137: vec3<f32> = (_e129.xyz / vec3<f32>(_e129.w));
|
||||
let _e140: f32 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e137.xy, _e137.z);
|
||||
d = _e140;
|
||||
let _e141: vec2<f32> = coord7;
|
||||
let _e151: vec2<f32> = coord7;
|
||||
let _e154: vec4<f32> = vec4<f32>(_e151, 1.0, 6.0);
|
||||
let _e164: vec3<f32> = (_e154.xyz / vec3<f32>(_e154.w));
|
||||
let _e167: f32 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e164.xy, _e164.z, vec2<i32>(5, 5));
|
||||
d = _e167;
|
||||
let _e168: vec2<f32> = coord7;
|
||||
let _e173: vec2<f32> = coord7;
|
||||
let _e176: vec4<f32> = vec4<f32>(_e173, 1.0, 6.0);
|
||||
let _e181: vec3<f32> = (_e176.xyz / vec3<f32>(_e176.w));
|
||||
let _e184: f32 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e181.xy, _e181.z);
|
||||
d = _e184;
|
||||
let _e185: vec2<f32> = coord7;
|
||||
let _e192: vec2<f32> = coord7;
|
||||
let _e195: vec4<f32> = vec4<f32>(_e192, 1.0, 6.0);
|
||||
let _e202: vec3<f32> = (_e195.xyz / vec3<f32>(_e195.w));
|
||||
let _e205: f32 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e202.xy, _e202.z, vec2<i32>(5, 5));
|
||||
d = _e205;
|
||||
let _e206: vec2<f32> = coord7;
|
||||
let _e212: vec2<f32> = coord7;
|
||||
let _e215: vec4<f32> = vec4<f32>(_e212, 1.0, 6.0);
|
||||
let _e221: vec3<f32> = (_e215.xyz / vec3<f32>(_e215.w));
|
||||
let _e224: f32 = textureSampleCompare(tex2DShadow, sampShadow, _e221.xy, _e221.z, vec2<i32>(5, 5));
|
||||
d = _e224;
|
||||
return;
|
||||
}
|
||||
|
||||
fn testTex2DArray(coord8: vec3<f32>) {
|
||||
var coord9: vec3<f32>;
|
||||
var c3: vec4<f32>;
|
||||
|
||||
coord9 = coord8;
|
||||
let _e18: vec3<f32> = coord9;
|
||||
let _e22: vec4<f32> = textureSample(tex2DArray, samp, _e18.xy, i32(_e18.z));
|
||||
c3 = _e22;
|
||||
let _e25: vec3<f32> = coord9;
|
||||
let _e30: vec4<f32> = textureSampleBias(tex2DArray, samp, _e25.xy, i32(_e25.z), 2.0);
|
||||
c3 = _e30;
|
||||
let _e36: vec3<f32> = coord9;
|
||||
let _e44: vec4<f32> = textureSampleGrad(tex2DArray, samp, _e36.xy, i32(_e36.z), vec2<f32>(4.0), vec2<f32>(4.0));
|
||||
c3 = _e44;
|
||||
let _e52: vec3<f32> = coord9;
|
||||
let _e62: vec4<f32> = textureSampleGrad(tex2DArray, samp, _e52.xy, i32(_e52.z), vec2<f32>(4.0), vec2<f32>(4.0), vec2<i32>(5, 5));
|
||||
c3 = _e62;
|
||||
let _e65: vec3<f32> = coord9;
|
||||
let _e70: vec4<f32> = textureSampleLevel(tex2DArray, samp, _e65.xy, i32(_e65.z), 3.0);
|
||||
c3 = _e70;
|
||||
let _e75: vec3<f32> = coord9;
|
||||
let _e82: vec4<f32> = textureSampleLevel(tex2DArray, samp, _e75.xy, i32(_e75.z), 3.0, vec2<i32>(5, 5));
|
||||
c3 = _e82;
|
||||
let _e86: vec3<f32> = coord9;
|
||||
let _e92: vec4<f32> = textureSample(tex2DArray, samp, _e86.xy, i32(_e86.z), vec2<i32>(5, 5));
|
||||
c3 = _e92;
|
||||
let _e97: vec3<f32> = coord9;
|
||||
let _e104: vec4<f32> = textureSampleBias(tex2DArray, samp, _e97.xy, i32(_e97.z), 2.0, vec2<i32>(5, 5));
|
||||
c3 = _e104;
|
||||
return;
|
||||
}
|
||||
|
||||
fn testTex2DArrayShadow(coord10: vec3<f32>) {
|
||||
var coord11: vec3<f32>;
|
||||
var d1: f32;
|
||||
|
||||
coord11 = coord10;
|
||||
let _e17: vec3<f32> = coord11;
|
||||
let _e20: vec3<f32> = coord11;
|
||||
let _e22: vec4<f32> = vec4<f32>(_e20, 1.0);
|
||||
let _e27: f32 = textureSampleCompare(tex2DArrayShadow, sampShadow, _e22.xy, i32(_e22.z), _e22.w);
|
||||
d1 = _e27;
|
||||
let _e28: vec3<f32> = coord11;
|
||||
let _e35: vec3<f32> = coord11;
|
||||
let _e37: vec4<f32> = vec4<f32>(_e35, 1.0);
|
||||
let _e46: f32 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e37.xy, i32(_e37.z), _e37.w);
|
||||
d1 = _e46;
|
||||
let _e47: vec3<f32> = coord11;
|
||||
let _e56: vec3<f32> = coord11;
|
||||
let _e58: vec4<f32> = vec4<f32>(_e56, 1.0);
|
||||
let _e69: f32 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e58.xy, i32(_e58.z), _e58.w, vec2<i32>(5, 5));
|
||||
d1 = _e69;
|
||||
let _e70: vec3<f32> = coord11;
|
||||
let _e74: vec3<f32> = coord11;
|
||||
let _e76: vec4<f32> = vec4<f32>(_e74, 1.0);
|
||||
let _e82: f32 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e76.xy, i32(_e76.z), _e76.w);
|
||||
d1 = _e82;
|
||||
let _e83: vec3<f32> = coord11;
|
||||
let _e89: vec3<f32> = coord11;
|
||||
let _e91: vec4<f32> = vec4<f32>(_e89, 1.0);
|
||||
let _e99: f32 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e91.xy, i32(_e91.z), _e91.w, vec2<i32>(5, 5));
|
||||
d1 = _e99;
|
||||
let _e100: vec3<f32> = coord11;
|
||||
let _e105: vec3<f32> = coord11;
|
||||
let _e107: vec4<f32> = vec4<f32>(_e105, 1.0);
|
||||
let _e114: f32 = textureSampleCompare(tex2DArrayShadow, sampShadow, _e107.xy, i32(_e107.z), _e107.w, vec2<i32>(5, 5));
|
||||
d1 = _e114;
|
||||
return;
|
||||
}
|
||||
|
||||
fn testTexCube(coord12: vec3<f32>) {
|
||||
var coord13: vec3<f32>;
|
||||
var c4: vec4<f32>;
|
||||
|
||||
coord13 = coord12;
|
||||
let _e18: vec3<f32> = coord13;
|
||||
let _e19: vec4<f32> = textureSample(texCube, samp, _e18);
|
||||
c4 = _e19;
|
||||
let _e22: vec3<f32> = coord13;
|
||||
let _e24: vec4<f32> = textureSampleBias(texCube, samp, _e22, 2.0);
|
||||
c4 = _e24;
|
||||
let _e30: vec3<f32> = coord13;
|
||||
let _e35: vec4<f32> = textureSampleGrad(texCube, samp, _e30, vec3<f32>(4.0), vec3<f32>(4.0));
|
||||
c4 = _e35;
|
||||
let _e38: vec3<f32> = coord13;
|
||||
let _e40: vec4<f32> = textureSampleLevel(texCube, samp, _e38, 3.0);
|
||||
c4 = _e40;
|
||||
let _e45: vec3<f32> = coord13;
|
||||
let _e49: vec4<f32> = textureSampleLevel(texCube, samp, _e45, 3.0, vec3<i32>(5, 5, 5));
|
||||
c4 = _e49;
|
||||
let _e53: vec3<f32> = coord13;
|
||||
let _e56: vec4<f32> = textureSample(texCube, samp, _e53, vec3<i32>(5, 5, 5));
|
||||
c4 = _e56;
|
||||
let _e61: vec3<f32> = coord13;
|
||||
let _e65: vec4<f32> = textureSampleBias(texCube, samp, _e61, 2.0, vec3<i32>(5, 5, 5));
|
||||
c4 = _e65;
|
||||
return;
|
||||
}
|
||||
|
||||
fn testTexCubeShadow(coord14: vec3<f32>) {
|
||||
var coord15: vec3<f32>;
|
||||
var d2: f32;
|
||||
|
||||
coord15 = coord14;
|
||||
let _e17: vec3<f32> = coord15;
|
||||
let _e20: vec3<f32> = coord15;
|
||||
let _e22: vec4<f32> = vec4<f32>(_e20, 1.0);
|
||||
let _e25: f32 = textureSampleCompare(texCubeShadow, sampShadow, _e22.xyz, _e22.w);
|
||||
d2 = _e25;
|
||||
let _e26: vec3<f32> = coord15;
|
||||
let _e33: vec3<f32> = coord15;
|
||||
let _e35: vec4<f32> = vec4<f32>(_e33, 1.0);
|
||||
let _e42: f32 = textureSampleCompareLevel(texCubeShadow, sampShadow, _e35.xyz, _e35.w);
|
||||
d2 = _e42;
|
||||
let _e43: vec3<f32> = coord15;
|
||||
let _e47: vec3<f32> = coord15;
|
||||
let _e49: vec4<f32> = vec4<f32>(_e47, 1.0);
|
||||
let _e53: f32 = textureSampleCompareLevel(texCubeShadow, sampShadow, _e49.xyz, _e49.w);
|
||||
d2 = _e53;
|
||||
let _e54: vec3<f32> = coord15;
|
||||
let _e60: vec3<f32> = coord15;
|
||||
let _e62: vec4<f32> = vec4<f32>(_e60, 1.0);
|
||||
let _e68: f32 = textureSampleCompareLevel(texCubeShadow, sampShadow, _e62.xyz, _e62.w, vec3<i32>(5, 5, 5));
|
||||
d2 = _e68;
|
||||
let _e69: vec3<f32> = coord15;
|
||||
let _e74: vec3<f32> = coord15;
|
||||
let _e76: vec4<f32> = vec4<f32>(_e74, 1.0);
|
||||
let _e81: f32 = textureSampleCompare(texCubeShadow, sampShadow, _e76.xyz, _e76.w, vec3<i32>(5, 5, 5));
|
||||
d2 = _e81;
|
||||
return;
|
||||
}
|
||||
|
||||
fn testTexCubeArray(coord16: vec4<f32>) {
|
||||
var coord17: vec4<f32>;
|
||||
var c5: vec4<f32>;
|
||||
|
||||
coord17 = coord16;
|
||||
let _e18: vec4<f32> = coord17;
|
||||
let _e22: vec4<f32> = textureSample(texCubeArray, samp, _e18.xyz, i32(_e18.w));
|
||||
c5 = _e22;
|
||||
let _e25: vec4<f32> = coord17;
|
||||
let _e30: vec4<f32> = textureSampleBias(texCubeArray, samp, _e25.xyz, i32(_e25.w), 2.0);
|
||||
c5 = _e30;
|
||||
let _e36: vec4<f32> = coord17;
|
||||
let _e44: vec4<f32> = textureSampleGrad(texCubeArray, samp, _e36.xyz, i32(_e36.w), vec3<f32>(4.0), vec3<f32>(4.0));
|
||||
c5 = _e44;
|
||||
let _e47: vec4<f32> = coord17;
|
||||
let _e52: vec4<f32> = textureSampleLevel(texCubeArray, samp, _e47.xyz, i32(_e47.w), 3.0);
|
||||
c5 = _e52;
|
||||
let _e57: vec4<f32> = coord17;
|
||||
let _e64: vec4<f32> = textureSampleLevel(texCubeArray, samp, _e57.xyz, i32(_e57.w), 3.0, vec3<i32>(5, 5, 5));
|
||||
c5 = _e64;
|
||||
let _e68: vec4<f32> = coord17;
|
||||
let _e74: vec4<f32> = textureSample(texCubeArray, samp, _e68.xyz, i32(_e68.w), vec3<i32>(5, 5, 5));
|
||||
c5 = _e74;
|
||||
let _e79: vec4<f32> = coord17;
|
||||
let _e86: vec4<f32> = textureSampleBias(texCubeArray, samp, _e79.xyz, i32(_e79.w), 2.0, vec3<i32>(5, 5, 5));
|
||||
c5 = _e86;
|
||||
return;
|
||||
}
|
||||
|
||||
fn testTexCubeArrayShadow(coord18: vec4<f32>) {
|
||||
var coord19: vec4<f32>;
|
||||
var d3: f32;
|
||||
|
||||
coord19 = coord18;
|
||||
let _e19: vec4<f32> = coord19;
|
||||
let _e24: f32 = textureSampleCompare(texCubeArrayShadow, sampShadow, _e19.xyz, i32(_e19.w), 1.0);
|
||||
d3 = _e24;
|
||||
return;
|
||||
}
|
||||
|
||||
fn testTex3D(coord20: vec3<f32>) {
|
||||
var coord21: vec3<f32>;
|
||||
var c6: vec4<f32>;
|
||||
|
||||
coord21 = coord20;
|
||||
let _e18: vec3<f32> = coord21;
|
||||
let _e19: vec4<f32> = textureSample(tex3D, samp, _e18);
|
||||
c6 = _e19;
|
||||
let _e22: vec3<f32> = coord21;
|
||||
let _e24: vec4<f32> = textureSampleBias(tex3D, samp, _e22, 2.0);
|
||||
c6 = _e24;
|
||||
let _e30: vec3<f32> = coord21;
|
||||
let _e35: vec4<f32> = textureSampleGrad(tex3D, samp, _e30, vec3<f32>(4.0), vec3<f32>(4.0));
|
||||
c6 = _e35;
|
||||
let _e43: vec3<f32> = coord21;
|
||||
let _e50: vec4<f32> = textureSampleGrad(tex3D, samp, _e43, vec3<f32>(4.0), vec3<f32>(4.0), vec3<i32>(5, 5, 5));
|
||||
c6 = _e50;
|
||||
let _e53: vec3<f32> = coord21;
|
||||
let _e55: vec4<f32> = textureSampleLevel(tex3D, samp, _e53, 3.0);
|
||||
c6 = _e55;
|
||||
let _e60: vec3<f32> = coord21;
|
||||
let _e64: vec4<f32> = textureSampleLevel(tex3D, samp, _e60, 3.0, vec3<i32>(5, 5, 5));
|
||||
c6 = _e64;
|
||||
let _e68: vec3<f32> = coord21;
|
||||
let _e71: vec4<f32> = textureSample(tex3D, samp, _e68, vec3<i32>(5, 5, 5));
|
||||
c6 = _e71;
|
||||
let _e76: vec3<f32> = coord21;
|
||||
let _e80: vec4<f32> = textureSampleBias(tex3D, samp, _e76, 2.0, vec3<i32>(5, 5, 5));
|
||||
c6 = _e80;
|
||||
return;
|
||||
}
|
||||
|
||||
fn main1() {
|
||||
let _e4: vec4<f32> = o_color;
|
||||
let _e6: vec2<f32> = v_TexCoord1;
|
||||
let _e9: vec2<f32> = v_TexCoord1;
|
||||
let _e11: vec3<f32> = vec3<f32>(_e9, 0.0);
|
||||
let _e15: vec4<f32> = textureSample(tex, samp, _e11.xy, i32(_e11.z));
|
||||
o_color.x = _e15.x;
|
||||
o_color.y = _e15.y;
|
||||
o_color.z = _e15.z;
|
||||
o_color.w = _e15.w;
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main([[location(0)]] v_TexCoord: vec2<f32>) -> FragmentOutput {
|
||||
v_TexCoord1 = v_TexCoord;
|
||||
fn main([[location(0)]] texcoord: vec4<f32>) {
|
||||
texcoord1 = texcoord;
|
||||
main1();
|
||||
let _e11: vec4<f32> = o_color;
|
||||
return FragmentOutput(_e11);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user