Remove GLSL memory qualifiers from SkSL
These were all unused, and only implemented on one backend. Change-Id: Ibd2fcef1a971e6c1bd9da0784c5d852a60708484 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372117 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
parent
42582fc97b
commit
9ca38ff4b4
@ -1,9 +1,6 @@
|
||||
const in out uniform flat noperspective readonly writeonly coherent volatile restrict buffer
|
||||
sk_has_side_effects varying inline
|
||||
void func1() {}
|
||||
const in out uniform flat noperspective buffer sk_has_side_effects varying inline void func1() {}
|
||||
|
||||
void func2(const in out uniform flat noperspective readonly writeonly coherent volatile restrict
|
||||
buffer sk_has_side_effects varying inline float test) {}
|
||||
void func2(const in out uniform flat noperspective buffer sk_has_side_effects varying inline
|
||||
float test) {}
|
||||
|
||||
const in out uniform flat noperspective readonly writeonly coherent volatile restrict buffer
|
||||
sk_has_side_effects varying inline float var;
|
||||
const in out uniform flat noperspective buffer sk_has_side_effects varying inline float var;
|
||||
|
@ -3,5 +3,5 @@ struct S {
|
||||
uniform int b;
|
||||
flat half4 c;
|
||||
noperspective float4 d;
|
||||
inout volatile restrict varying buffer coherent bool e;
|
||||
inout varying buffer bool e;
|
||||
};
|
||||
|
@ -1061,21 +1061,6 @@ void GLSLCodeGenerator::writeModifiers(const Modifiers& modifiers,
|
||||
if (layout.size()) {
|
||||
this->write(layout + " ");
|
||||
}
|
||||
if (modifiers.fFlags & Modifiers::kReadOnly_Flag) {
|
||||
this->write("readonly ");
|
||||
}
|
||||
if (modifiers.fFlags & Modifiers::kWriteOnly_Flag) {
|
||||
this->write("writeonly ");
|
||||
}
|
||||
if (modifiers.fFlags & Modifiers::kCoherent_Flag) {
|
||||
this->write("coherent ");
|
||||
}
|
||||
if (modifiers.fFlags & Modifiers::kVolatile_Flag) {
|
||||
this->write("volatile ");
|
||||
}
|
||||
if (modifiers.fFlags & Modifiers::kRestrict_Flag) {
|
||||
this->write("restrict ");
|
||||
}
|
||||
if ((modifiers.fFlags & Modifiers::kIn_Flag) &&
|
||||
(modifiers.fFlags & Modifiers::kOut_Flag)) {
|
||||
this->write("inout ");
|
||||
|
@ -420,11 +420,9 @@ void IRGenerator::checkVarDeclaration(int offset, const Modifiers& modifiers, co
|
||||
}
|
||||
int permitted = Modifiers::kConst_Flag;
|
||||
if (storage == Variable::Storage::kGlobal) {
|
||||
permitted |=
|
||||
Modifiers::kIn_Flag | Modifiers::kOut_Flag | Modifiers::kUniform_Flag |
|
||||
Modifiers::kFlat_Flag | Modifiers::kVarying_Flag | Modifiers::kNoPerspective_Flag |
|
||||
Modifiers::kRestrict_Flag | Modifiers::kVolatile_Flag | Modifiers::kReadOnly_Flag |
|
||||
Modifiers::kWriteOnly_Flag | Modifiers::kCoherent_Flag | Modifiers::kBuffer_Flag;
|
||||
permitted |= Modifiers::kIn_Flag | Modifiers::kOut_Flag | Modifiers::kUniform_Flag |
|
||||
Modifiers::kFlat_Flag | Modifiers::kVarying_Flag |
|
||||
Modifiers::kNoPerspective_Flag | Modifiers::kBuffer_Flag;
|
||||
}
|
||||
this->checkModifiers(offset, modifiers, permitted);
|
||||
}
|
||||
@ -1039,11 +1037,6 @@ void IRGenerator::checkModifiers(int offset, const Modifiers& modifiers, int per
|
||||
CHECK(Modifiers::kUniform_Flag, "uniform")
|
||||
CHECK(Modifiers::kFlat_Flag, "flat")
|
||||
CHECK(Modifiers::kNoPerspective_Flag, "noperspective")
|
||||
CHECK(Modifiers::kReadOnly_Flag, "readonly")
|
||||
CHECK(Modifiers::kWriteOnly_Flag, "writeonly")
|
||||
CHECK(Modifiers::kCoherent_Flag, "coherent")
|
||||
CHECK(Modifiers::kVolatile_Flag, "volatile")
|
||||
CHECK(Modifiers::kRestrict_Flag, "restrict")
|
||||
CHECK(Modifiers::kBuffer_Flag, "buffer")
|
||||
CHECK(Modifiers::kHasSideEffects_Flag, "sk_has_side_effects")
|
||||
CHECK(Modifiers::kVarying_Flag, "varying")
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -41,11 +41,6 @@ struct Token {
|
||||
TK_CONST,
|
||||
TK_FLAT,
|
||||
TK_NOPERSPECTIVE,
|
||||
TK_READONLY,
|
||||
TK_WRITEONLY,
|
||||
TK_COHERENT,
|
||||
TK_VOLATILE,
|
||||
TK_RESTRICT,
|
||||
TK_BUFFER,
|
||||
TK_INLINE,
|
||||
TK_HASSIDEEFFECTS,
|
||||
|
@ -49,11 +49,6 @@ static int parse_modifier_token(Token::Kind token) {
|
||||
case Token::Kind::TK_INOUT: return Modifiers::kIn_Flag | Modifiers::kOut_Flag;
|
||||
case Token::Kind::TK_FLAT: return Modifiers::kFlat_Flag;
|
||||
case Token::Kind::TK_NOPERSPECTIVE: return Modifiers::kNoPerspective_Flag;
|
||||
case Token::Kind::TK_READONLY: return Modifiers::kReadOnly_Flag;
|
||||
case Token::Kind::TK_WRITEONLY: return Modifiers::kWriteOnly_Flag;
|
||||
case Token::Kind::TK_COHERENT: return Modifiers::kCoherent_Flag;
|
||||
case Token::Kind::TK_VOLATILE: return Modifiers::kVolatile_Flag;
|
||||
case Token::Kind::TK_RESTRICT: return Modifiers::kRestrict_Flag;
|
||||
case Token::Kind::TK_BUFFER: return Modifiers::kBuffer_Flag;
|
||||
case Token::Kind::TK_HASSIDEEFFECTS: return Modifiers::kHasSideEffects_Flag;
|
||||
case Token::Kind::TK_VARYING: return Modifiers::kVarying_Flag;
|
||||
@ -1078,7 +1073,7 @@ Layout Parser::layout() {
|
||||
}
|
||||
|
||||
/* layout? (UNIFORM | CONST | IN | OUT | INOUT | LOWP | MEDIUMP | HIGHP | FLAT | NOPERSPECTIVE |
|
||||
READONLY | WRITEONLY | COHERENT | VOLATILE | RESTRICT | BUFFER | VARYING | INLINE)* */
|
||||
BUFFER | VARYING | INLINE)* */
|
||||
Modifiers Parser::modifiers() {
|
||||
Layout layout = this->layout();
|
||||
int flags = 0;
|
||||
|
@ -2886,13 +2886,6 @@ static bool is_dead(const Variable& var, const ProgramUsage* usage) {
|
||||
|
||||
void SPIRVCodeGenerator::writeGlobalVar(ProgramKind kind, const VarDeclaration& varDecl) {
|
||||
const Variable& var = varDecl.var();
|
||||
// These haven't been implemented in our SPIR-V generator yet and we only currently use them
|
||||
// in the OpenGL backend.
|
||||
SkASSERT(!(var.modifiers().fFlags & (Modifiers::kReadOnly_Flag |
|
||||
Modifiers::kWriteOnly_Flag |
|
||||
Modifiers::kCoherent_Flag |
|
||||
Modifiers::kVolatile_Flag |
|
||||
Modifiers::kRestrict_Flag)));
|
||||
// 9999 is a sentinel value used in our built-in modules that causes us to ignore these
|
||||
// declarations, beyond adding them to the symbol table.
|
||||
constexpr int kBuiltinIgnore = 9999;
|
||||
@ -2950,13 +2943,6 @@ void SPIRVCodeGenerator::writeGlobalVar(ProgramKind kind, const VarDeclaration&
|
||||
|
||||
void SPIRVCodeGenerator::writeVarDeclaration(const VarDeclaration& varDecl, OutputStream& out) {
|
||||
const Variable& var = varDecl.var();
|
||||
// These haven't been implemented in our SPIR-V generator yet and we only currently use them
|
||||
// in the OpenGL backend.
|
||||
SkASSERT(!(var.modifiers().fFlags & (Modifiers::kReadOnly_Flag |
|
||||
Modifiers::kWriteOnly_Flag |
|
||||
Modifiers::kCoherent_Flag |
|
||||
Modifiers::kVolatile_Flag |
|
||||
Modifiers::kRestrict_Flag)));
|
||||
SpvId id = this->nextId();
|
||||
fVariableMap[&var] = id;
|
||||
SpvId type = this->getPointerType(var.type(), SpvStorageClassFunction);
|
||||
|
@ -43,23 +43,23 @@ static uint8_t SKSL_INCLUDE_sksl_geom[] = {134,0,
|
||||
9,59,0,
|
||||
43,9,0,66,0,3,
|
||||
23,10,0,
|
||||
31,
|
||||
8,0,16,0,0,70,0,1,8,0,
|
||||
30,
|
||||
8,128,70,0,1,8,0,
|
||||
43,11,0,87,0,
|
||||
46,12,0,
|
||||
9,59,0,
|
||||
40,9,0,3,
|
||||
23,13,0,
|
||||
31,
|
||||
8,0,16,0,0,92,0,1,12,0,
|
||||
30,
|
||||
8,128,92,0,1,12,0,
|
||||
40,11,0,
|
||||
23,14,0,
|
||||
31,
|
||||
8,0,16,0,0,111,0,0,
|
||||
30,
|
||||
8,128,111,0,0,
|
||||
40,11,0,
|
||||
23,15,0,
|
||||
31,
|
||||
8,0,16,0,0,122,0,0,
|
||||
30,
|
||||
8,128,122,0,0,
|
||||
40,11,0,7,0,
|
||||
7,0,
|
||||
10,0,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1326,7 +1326,7 @@ static uint8_t SKSL_INCLUDE_sksl_public[] = {19,2,
|
||||
40,139,1,2,
|
||||
1,
|
||||
39,
|
||||
49,138,1,0,3,0,1,2,56,
|
||||
49,138,1,0,3,0,1,2,51,
|
||||
21,
|
||||
40,123,0,155,0,2,
|
||||
39,
|
||||
@ -1344,7 +1344,7 @@ static uint8_t SKSL_INCLUDE_sksl_public[] = {19,2,
|
||||
40,142,1,2,
|
||||
1,
|
||||
39,
|
||||
49,141,1,0,3,0,1,2,56,
|
||||
49,141,1,0,3,0,1,2,51,
|
||||
21,
|
||||
40,115,0,147,0,2,
|
||||
39,
|
||||
|
@ -26,15 +26,10 @@ struct Modifiers {
|
||||
kUniform_Flag = 1 << 3,
|
||||
kFlat_Flag = 1 << 4,
|
||||
kNoPerspective_Flag = 1 << 5,
|
||||
kReadOnly_Flag = 1 << 6,
|
||||
kWriteOnly_Flag = 1 << 7,
|
||||
kCoherent_Flag = 1 << 8,
|
||||
kVolatile_Flag = 1 << 9,
|
||||
kRestrict_Flag = 1 << 10,
|
||||
kBuffer_Flag = 1 << 11,
|
||||
kHasSideEffects_Flag = 1 << 12,
|
||||
kVarying_Flag = 1 << 13,
|
||||
kInline_Flag = 1 << 14,
|
||||
kBuffer_Flag = 1 << 6,
|
||||
kHasSideEffects_Flag = 1 << 7,
|
||||
kVarying_Flag = 1 << 8,
|
||||
kInline_Flag = 1 << 9,
|
||||
};
|
||||
|
||||
Modifiers()
|
||||
@ -59,21 +54,6 @@ struct Modifiers {
|
||||
if (fFlags & kNoPerspective_Flag) {
|
||||
result += "noperspective ";
|
||||
}
|
||||
if (fFlags & kReadOnly_Flag) {
|
||||
result += "readonly ";
|
||||
}
|
||||
if (fFlags & kWriteOnly_Flag) {
|
||||
result += "writeonly ";
|
||||
}
|
||||
if (fFlags & kCoherent_Flag) {
|
||||
result += "coherent ";
|
||||
}
|
||||
if (fFlags & kVolatile_Flag) {
|
||||
result += "volatile ";
|
||||
}
|
||||
if (fFlags & kRestrict_Flag) {
|
||||
result += "restrict ";
|
||||
}
|
||||
if (fFlags & kBuffer_Flag) {
|
||||
result += "buffer ";
|
||||
}
|
||||
|
@ -34,11 +34,6 @@ UNIFORM = "uniform"
|
||||
CONST = "const"
|
||||
FLAT = "flat"
|
||||
NOPERSPECTIVE = "noperspective"
|
||||
READONLY = "readonly"
|
||||
WRITEONLY = "writeonly"
|
||||
COHERENT = "coherent"
|
||||
VOLATILE = "volatile"
|
||||
RESTRICT = "restrict"
|
||||
BUFFER = "buffer"
|
||||
INLINE = "inline"
|
||||
HASSIDEEFFECTS = "sk_has_side_effects"
|
||||
|
@ -1,33 +1,23 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 3: 'const' is not permitted here
|
||||
error: 3: 'in' is not permitted here
|
||||
error: 3: 'out' is not permitted here
|
||||
error: 3: 'uniform' is not permitted here
|
||||
error: 3: 'flat' is not permitted here
|
||||
error: 3: 'noperspective' is not permitted here
|
||||
error: 3: 'readonly' is not permitted here
|
||||
error: 3: 'writeonly' is not permitted here
|
||||
error: 3: 'coherent' is not permitted here
|
||||
error: 3: 'volatile' is not permitted here
|
||||
error: 3: 'restrict' is not permitted here
|
||||
error: 3: 'buffer' is not permitted here
|
||||
error: 3: 'varying' is not permitted here
|
||||
error: 6: 'const' is not permitted here
|
||||
error: 6: 'uniform' is not permitted here
|
||||
error: 6: 'flat' is not permitted here
|
||||
error: 6: 'noperspective' is not permitted here
|
||||
error: 6: 'readonly' is not permitted here
|
||||
error: 6: 'writeonly' is not permitted here
|
||||
error: 6: 'coherent' is not permitted here
|
||||
error: 6: 'volatile' is not permitted here
|
||||
error: 6: 'restrict' is not permitted here
|
||||
error: 6: 'buffer' is not permitted here
|
||||
error: 1: 'const' is not permitted here
|
||||
error: 1: 'in' is not permitted here
|
||||
error: 1: 'out' is not permitted here
|
||||
error: 1: 'uniform' is not permitted here
|
||||
error: 1: 'flat' is not permitted here
|
||||
error: 1: 'noperspective' is not permitted here
|
||||
error: 1: 'buffer' is not permitted here
|
||||
error: 1: 'varying' is not permitted here
|
||||
error: 4: 'const' is not permitted here
|
||||
error: 4: 'uniform' is not permitted here
|
||||
error: 4: 'flat' is not permitted here
|
||||
error: 4: 'noperspective' is not permitted here
|
||||
error: 4: 'buffer' is not permitted here
|
||||
error: 4: 'sk_has_side_effects' is not permitted here
|
||||
error: 4: 'varying' is not permitted here
|
||||
error: 4: 'inline' is not permitted here
|
||||
error: 6: 'in uniform' variables only permitted within fragment processors
|
||||
error: 6: 'varying' is only permitted in runtime effects
|
||||
error: 6: 'sk_has_side_effects' is not permitted here
|
||||
error: 6: 'varying' is not permitted here
|
||||
error: 6: 'inline' is not permitted here
|
||||
error: 9: 'in uniform' variables only permitted within fragment processors
|
||||
error: 9: 'varying' is only permitted in runtime effects
|
||||
error: 9: 'sk_has_side_effects' is not permitted here
|
||||
error: 9: 'inline' is not permitted here
|
||||
30 errors
|
||||
20 errors
|
||||
|
@ -4,5 +4,5 @@ error: 2: modifier 'const' is not permitted on a struct field
|
||||
error: 3: modifier 'uniform' is not permitted on a struct field
|
||||
error: 4: modifier 'flat' is not permitted on a struct field
|
||||
error: 5: modifier 'noperspective' is not permitted on a struct field
|
||||
error: 6: modifier 'coherent volatile restrict buffer varying inout' is not permitted on a struct field
|
||||
error: 6: modifier 'buffer varying inout' is not permitted on a struct field
|
||||
5 errors
|
||||
|
Loading…
Reference in New Issue
Block a user