fixed SPIR-V compilation error with unmodified variables
Change-Id: I22981a60c21a2e16d41d69c53e099f221a202a58 Reviewed-on: https://skia-review.googlesource.com/11000 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
0df1b04db8
commit
c6f5e10709
@ -498,7 +498,7 @@ std::unique_ptr<ASTVarDeclarations> Parser::varDeclarationEnd(Modifiers mods,
|
||||
|
||||
/* modifiers type IDENTIFIER (LBRACKET INT_LITERAL RBRACKET)? */
|
||||
std::unique_ptr<ASTParameter> Parser::parameter() {
|
||||
Modifiers modifiers = this->modifiersWithDefaults(Modifiers::kIn_Flag);
|
||||
Modifiers modifiers = this->modifiersWithDefaults(0);
|
||||
std::unique_ptr<ASTType> type = this->type();
|
||||
if (!type) {
|
||||
return nullptr;
|
||||
|
@ -1642,8 +1642,13 @@ SpvStorageClass_ get_storage_class(const Modifiers& modifiers) {
|
||||
|
||||
SpvStorageClass_ get_storage_class(const Expression& expr) {
|
||||
switch (expr.fKind) {
|
||||
case Expression::kVariableReference_Kind:
|
||||
return get_storage_class(((VariableReference&) expr).fVariable.fModifiers);
|
||||
case Expression::kVariableReference_Kind: {
|
||||
const Variable& var = ((VariableReference&) expr).fVariable;
|
||||
if (var.fStorage != Variable::kGlobal_Storage) {
|
||||
return SpvStorageClassFunction;
|
||||
}
|
||||
return get_storage_class(var.fModifiers);
|
||||
}
|
||||
case Expression::kFieldAccess_Kind:
|
||||
return get_storage_class(*((FieldAccess&) expr).fBase);
|
||||
case Expression::kIndex_Kind:
|
||||
|
@ -93,7 +93,7 @@ DEF_TEST(SkSLFunctions, r) {
|
||||
*SkSL::ShaderCapsFactory::Default(),
|
||||
"#version 400\n"
|
||||
"out vec4 sk_FragColor;\n"
|
||||
"float foo(in float v[2]) {\n"
|
||||
"float foo(float v[2]) {\n"
|
||||
" return v[0] * v[1];\n"
|
||||
"}\n"
|
||||
"void bar(inout float x) {\n"
|
||||
|
Loading…
Reference in New Issue
Block a user