Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 66b244d

Browse files
author
Jonah Williams
authored
[Impeller] validate calls to texture in SkSL (#37289)
* [Impeller] validate calls to texture in SkSL * Update spirv_sksl.cc
1 parent 0b79b5c commit 66b244d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

impeller/compiler/spirv_sksl.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,15 @@ std::string CompilerSkSL::to_function_args(const TextureFunctionArguments& args,
442442
std::string name = to_expression(args.base.img);
443443

444444
std::string glsl_args = CompilerGLSL::to_function_args(args, p_forward);
445+
// SkSL only supports coordinates. All other arguments to texture are
446+
// unsupported and will generate invalid SkSL.
447+
if (args.grad_x || args.grad_y || args.lod || args.coffset || args.offset ||
448+
args.sample || args.min_lod || args.sparse_texel || args.bias ||
449+
args.component) {
450+
FLUTTER_CROSS_THROW(
451+
"Only sampler and position arguments are supported in texture() "
452+
"calls.");
453+
}
445454

446455
// GLSL puts the shader as the first argument, but in SkSL the shader is
447456
// implicitly passed as the reciever of the 'eval' method. Therefore, the

0 commit comments

Comments
 (0)