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>
This commit is contained in:
Jim Van Verth 2020-10-08 15:46:36 -04:00 committed by Skia Commit-Bot
parent 48d8724097
commit 4b3d1f3900
2 changed files with 10 additions and 0 deletions

View File

@ -204,6 +204,8 @@ public:
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 @@ protected:
int fMaxTileSize;
int fMaxWindowRectangles;
int fInternalMultisampleCount;
int fMaxPushConstantsSize = 0;
GrDriverBugWorkarounds fDriverBugWorkarounds;

View File

@ -409,6 +409,11 @@ void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface*
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 @@ void GrVkCaps::initGrCaps(const GrVkInterface* vkInterface,
// 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;