Add push constant support to GrCaps.
Change-Id: I2ef63443a68f3ebc31c7f9ad1e614b320be3e673
Bug: skia:5039
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324121
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h
index 230a8f7..89d729e 100644
--- a/src/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -204,6 +204,8 @@
return this->maxWindowRectangles() > 0 && this->onIsWindowRectanglesSupportedForRT(rt);
}
+ int maxPushConstantsSize() const { return fMaxPushConstantsSize; }
+
virtual bool isFormatSRGB(const GrBackendFormat&) const = 0;
bool isFormatCompressed(const GrBackendFormat& format) const;
@@ -542,6 +544,7 @@
int fMaxTileSize;
int fMaxWindowRectangles;
int fInternalMultisampleCount;
+ int fMaxPushConstantsSize = 0;
GrDriverBugWorkarounds fDriverBugWorkarounds;
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 70acc3c..c95d6c4 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -409,6 +409,11 @@
fAvoidUpdateBuffers = true;
}
+ if (kQualcomm_VkVendor == properties.vendorID) {
+ // Adreno devices don't support push constants well
+ fMaxPushConstantsSize = 0;
+ }
+
if (kARM_VkVendor == properties.vendorID) {
// ARM seems to do better with more fine triangles as opposed to using the sample mask.
// (At least in our current round rect op.)
@@ -593,6 +598,8 @@
// TODO: check if RT's larger than 4k incur a performance cost on ARM.
fMaxPreferredRenderTargetSize = fMaxRenderTargetSize;
+ fMaxPushConstantsSize = std::min(properties.limits.maxPushConstantsSize, (uint32_t)INT_MAX);
+
// Assuming since we will always map in the end to upload the data we might as well just map
// from the get go. There is no hard data to suggest this is faster or slower.
fBufferMapThreshold = 0;