Remove support for unsized arrays
These only existed for geometry shader interface blocks.
Change-Id: Ie82252715fe5e6babb85e3b437c6edd811fab955
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442695
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/GrSPIRVVaryingHandler.cpp b/src/gpu/GrSPIRVVaryingHandler.cpp
index a0c8ea9..064ce6d 100644
--- a/src/gpu/GrSPIRVVaryingHandler.cpp
+++ b/src/gpu/GrSPIRVVaryingHandler.cpp
@@ -96,10 +96,7 @@
int elementSize = grsltype_to_location_size(var.getType());
SkASSERT(elementSize > 0);
- int numElements = 1;
- if (var.isArray() && !var.isUnsizedArray()) {
- numElements = var.getArrayCount();
- }
+ int numElements = var.isArray() ? var.getArrayCount() : 1;
SkASSERT(numElements > 0);
locationIndex += elementSize * numElements;
}
diff --git a/src/gpu/GrShaderVar.cpp b/src/gpu/GrShaderVar.cpp
index 78c9331..accbe2c 100644
--- a/src/gpu/GrShaderVar.cpp
+++ b/src/gpu/GrShaderVar.cpp
@@ -32,15 +32,11 @@
}
GrSLType effectiveType = this->getType();
if (this->isArray()) {
- if (this->isUnsizedArray()) {
- out->appendf("%s %s[]", GrGLSLTypeString(effectiveType), this->getName().c_str());
- } else {
- SkASSERT(this->getArrayCount() > 0);
- out->appendf("%s %s[%d]",
- GrGLSLTypeString(effectiveType),
- this->getName().c_str(),
- this->getArrayCount());
- }
+ SkASSERT(this->getArrayCount() > 0);
+ out->appendf("%s %s[%d]",
+ GrGLSLTypeString(effectiveType),
+ this->getName().c_str(),
+ this->getArrayCount());
} else {
out->appendf("%s %s", GrGLSLTypeString(effectiveType), this->getName().c_str());
}
diff --git a/src/gpu/GrShaderVar.h b/src/gpu/GrShaderVar.h
index f4e8d4f..45bdce2 100644
--- a/src/gpu/GrShaderVar.h
+++ b/src/gpu/GrShaderVar.h
@@ -29,7 +29,6 @@
/** Values for array count that have special meaning. We allow 1-sized arrays. */
enum {
kNonArray = 0, // not an array
- kUnsizedArray = -1, // an unsized array (declared with [])
};
/** Defaults to a void with no type modifier or layout qualifier. */
@@ -85,9 +84,6 @@
/** Is the var an array. */
bool isArray() const { return kNonArray != fCount; }
- /** Is this an unsized array, (i.e. declared with []). */
- bool isUnsizedArray() const { return kUnsizedArray == fCount; }
-
/** Get the array length. */
int getArrayCount() const { return fCount; }
diff --git a/src/gpu/vk/GrVkVaryingHandler.cpp b/src/gpu/vk/GrVkVaryingHandler.cpp
index e6925ea..bf57012 100644
--- a/src/gpu/vk/GrVkVaryingHandler.cpp
+++ b/src/gpu/vk/GrVkVaryingHandler.cpp
@@ -90,10 +90,7 @@
int elementSize = grsltype_to_location_size(var.getType());
SkASSERT(elementSize > 0);
- int numElements = 1;
- if (var.isArray() && !var.isUnsizedArray()) {
- numElements = var.getArrayCount();
- }
+ int numElements = var.isArray() ? var.getArrayCount() : 1;
SkASSERT(numElements > 0);
locationIndex += elementSize * numElements;
}