d214d6ae69
Reason for revert: 1) Chromium roll failures: https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/307297/steps/screenshot_sync_tests%20on%20NVIDIA%20GPU%20on%20Linux%20%28with%20patch%29%20on%20Linux/logs/stdio 2) G3 roll failures 3) iOS failures: https://uberchromegw.corp.google.com/i/client.skia/builders/Perf-iOS-Clang-iPad4-GPU-SGX554-Arm7-Release/builds/7177/steps/perf_skia%20on%20iOS-9.2/logs/stdio Original issue's description: > Turned on SkSL->GLSL compiler > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2288033003 > > Committed: https://skia.googlesource.com/skia/+/9b0fe3d125f237d9884732a48414fa85fc71b4e3 > Committed: https://skia.googlesource.com/skia/+/b12b3c6908c62c908b3680be01e3b5bfd30de310 > Committed: https://skia.googlesource.com/skia/+/f008b0a59f45c0d4bea3e66faf3b01805009ec89 TBR=benjaminwagner@google.com,bsalomon@google.com,egdaniel@google.com,ethannicholas@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2387643003
93 lines
2.5 KiB
C++
93 lines
2.5 KiB
C++
/*
|
|
* Copyright 2016 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SKSL_LAYOUT
|
|
#define SKSL_LAYOUT
|
|
|
|
namespace SkSL {
|
|
|
|
/**
|
|
* Represents a layout block appearing before a variable declaration, as in:
|
|
*
|
|
* layout (location = 0) int x;
|
|
*/
|
|
struct Layout {
|
|
Layout(const ASTLayout& layout)
|
|
: fLocation(layout.fLocation)
|
|
, fBinding(layout.fBinding)
|
|
, fIndex(layout.fIndex)
|
|
, fSet(layout.fSet)
|
|
, fBuiltin(layout.fBuiltin)
|
|
, fOriginUpperLeft(layout.fOriginUpperLeft) {}
|
|
|
|
Layout(int location, int binding, int index, int set, int builtin, bool originUpperLeft)
|
|
: fLocation(location)
|
|
, fBinding(binding)
|
|
, fIndex(index)
|
|
, fSet(set)
|
|
, fBuiltin(builtin)
|
|
, fOriginUpperLeft(originUpperLeft) {}
|
|
|
|
std::string description() const {
|
|
std::string result;
|
|
std::string separator;
|
|
if (fLocation >= 0) {
|
|
result += separator + "location = " + to_string(fLocation);
|
|
separator = ", ";
|
|
}
|
|
if (fBinding >= 0) {
|
|
result += separator + "binding = " + to_string(fBinding);
|
|
separator = ", ";
|
|
}
|
|
if (fIndex >= 0) {
|
|
result += separator + "index = " + to_string(fIndex);
|
|
separator = ", ";
|
|
}
|
|
if (fSet >= 0) {
|
|
result += separator + "set = " + to_string(fSet);
|
|
separator = ", ";
|
|
}
|
|
if (fBuiltin >= 0) {
|
|
result += separator + "builtin = " + to_string(fBuiltin);
|
|
separator = ", ";
|
|
}
|
|
if (fOriginUpperLeft) {
|
|
result += separator + "origin_upper_left";
|
|
separator = ", ";
|
|
}
|
|
if (result.length() > 0) {
|
|
result = "layout (" + result + ")";
|
|
}
|
|
return result;
|
|
}
|
|
|
|
bool operator==(const Layout& other) const {
|
|
return fLocation == other.fLocation &&
|
|
fBinding == other.fBinding &&
|
|
fIndex == other.fIndex &&
|
|
fSet == other.fSet &&
|
|
fBuiltin == other.fBuiltin;
|
|
}
|
|
|
|
bool operator!=(const Layout& other) const {
|
|
return !(*this == other);
|
|
}
|
|
|
|
// everything but builtin is in the GLSL spec; builtin comes from SPIR-V and identifies which
|
|
// particular builtin value this object represents.
|
|
int fLocation;
|
|
int fBinding;
|
|
int fIndex;
|
|
int fSet;
|
|
int fBuiltin;
|
|
bool fOriginUpperLeft;
|
|
};
|
|
|
|
} // namespace
|
|
|
|
#endif
|