From b2a7e7b75459344797715502267148a307db670f Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Thu, 3 Nov 2022 12:22:34 -0700 Subject: [PATCH 1/2] [Impeller] validate that SkSL has no user supplied inputs --- impeller/compiler/spirv_sksl.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/impeller/compiler/spirv_sksl.cc b/impeller/compiler/spirv_sksl.cc index 491a829f56819..f569d1555d683 100644 --- a/impeller/compiler/spirv_sksl.cc +++ b/impeller/compiler/spirv_sksl.cc @@ -195,16 +195,24 @@ void CompilerSkSL::detect_unsupported_resources() { } } - // Push constant blocks are not supported. for (auto& id : ir.ids) { if (id.get_type() == TypeVariable) { auto& var = id.get(); auto& type = get(var.basetype); + + // Push constant blocks are not supported. if (!is_hidden_variable(var) && var.storage != StorageClassFunction && type.pointer && type.storage == StorageClassPushConstant) { FLUTTER_CROSS_THROW("SkSL does not support push constant blocks: '" + get_name(var.self) + "'"); } + + // User specified inputs are not supported. + if (!is_hidden_variable(var) && var.storage != StorageClassFunction && + type.pointer && type.storage == StorageClassInput) { + FLUTTER_CROSS_THROW("SkSL does not support inputs: '" + + get_name(var.self) + "'"); + } } } } From cbfb7810f46758fd67746324c9e75fe98af01017 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Thu, 3 Nov 2022 12:23:44 -0700 Subject: [PATCH 2/2] ++ --- impeller/compiler/spirv_sksl.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/impeller/compiler/spirv_sksl.cc b/impeller/compiler/spirv_sksl.cc index f569d1555d683..2535d4ec6e658 100644 --- a/impeller/compiler/spirv_sksl.cc +++ b/impeller/compiler/spirv_sksl.cc @@ -177,12 +177,12 @@ bool CompilerSkSL::emit_struct_resources() { } void CompilerSkSL::detect_unsupported_resources() { - // UBOs and SSBOs are not supported. for (auto& id : ir.ids) { if (id.get_type() == TypeVariable) { auto& var = id.get(); auto& type = get(var.basetype); + // UBOs and SSBOs are not supported. if (var.storage != StorageClassFunction && type.pointer && type.storage == StorageClassUniform && !is_hidden_variable(var) && (ir.meta[type.self].decoration.decoration_flags.get( @@ -192,13 +192,6 @@ void CompilerSkSL::detect_unsupported_resources() { FLUTTER_CROSS_THROW("SkSL does not support UBOs or SSBOs: '" + get_name(var.self) + "'"); } - } - } - - for (auto& id : ir.ids) { - if (id.get_type() == TypeVariable) { - auto& var = id.get(); - auto& type = get(var.basetype); // Push constant blocks are not supported. if (!is_hidden_variable(var) && var.storage != StorageClassFunction &&