Emit qualifiers in the GLSL ES-required order.
This should fix a failure in the ES2 conformance suite's "const_in_int".
Change-Id: I8b5487749291ef57712b8fe6c3949dc7c3e76883
Bug: skia:12499
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455157
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp b/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp
index 53aa8a0..e91d2f4 100644
--- a/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp
@@ -1052,15 +1052,24 @@
void GLSLCodeGenerator::writeModifiers(const Modifiers& modifiers,
bool globalContext) {
+ String layout = modifiers.fLayout.description();
+ if (layout.size()) {
+ this->write(layout + " ");
+ }
+
+ // For GLSL 4.1 and below, qualifier-order matters! These are written out in Modifier-bit order.
if (modifiers.fFlags & Modifiers::kFlat_Flag) {
this->write("flat ");
}
if (modifiers.fFlags & Modifiers::kNoPerspective_Flag) {
this->write("noperspective ");
}
- String layout = modifiers.fLayout.description();
- if (layout.size()) {
- this->write(layout + " ");
+
+ if (modifiers.fFlags & Modifiers::kConst_Flag) {
+ this->write("const ");
+ }
+ if (modifiers.fFlags & Modifiers::kUniform_Flag) {
+ this->write("uniform ");
}
if ((modifiers.fFlags & Modifiers::kIn_Flag) &&
(modifiers.fFlags & Modifiers::kOut_Flag)) {
@@ -1081,12 +1090,7 @@
this->write("out ");
}
}
- if (modifiers.fFlags & Modifiers::kUniform_Flag) {
- this->write("uniform ");
- }
- if (modifiers.fFlags & Modifiers::kConst_Flag) {
- this->write("const ");
- }
+
}
void GLSLCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf) {