Skip to content

Commit

Permalink
[Impeller] validate that SkSL has no user supplied inputs (flutter#37293
Browse files Browse the repository at this point in the history
)

* [Impeller] validate that SkSL has no user supplied inputs

* ++
  • Loading branch information
jonahwilliams authored Nov 3, 2022
1 parent e3c5163 commit 2c9a6d6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions impeller/compiler/spirv_sksl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<SPIRVariable>();
auto& type = get<SPIRType>(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(
Expand All @@ -192,19 +192,20 @@ void CompilerSkSL::detect_unsupported_resources() {
FLUTTER_CROSS_THROW("SkSL does not support UBOs or SSBOs: '" +
get_name(var.self) + "'");
}
}
}

// Push constant blocks are not supported.
for (auto& id : ir.ids) {
if (id.get_type() == TypeVariable) {
auto& var = id.get<SPIRVariable>();
auto& type = get<SPIRType>(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) + "'");
}
}
}
}
Expand Down

0 comments on commit 2c9a6d6

Please sign in to comment.