Use push constants cap in Metal.
* Sets the cap and uses it for verifying vertex/fragmentBytes size instead of a magic number. * Also makes maxPushConstantsSize unsigned to avoid warnings and unnecessary casting. Change-Id: I2aaea853604eb3c652ddbae3adb0168a4e41799a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324880 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
parent
88cda17bbe
commit
023f2e776e
@ -204,7 +204,7 @@ public:
|
||||
return this->maxWindowRectangles() > 0 && this->onIsWindowRectanglesSupportedForRT(rt);
|
||||
}
|
||||
|
||||
int maxPushConstantsSize() const { return fMaxPushConstantsSize; }
|
||||
uint32_t maxPushConstantsSize() const { return fMaxPushConstantsSize; }
|
||||
|
||||
virtual bool isFormatSRGB(const GrBackendFormat&) const = 0;
|
||||
|
||||
@ -544,7 +544,7 @@ protected:
|
||||
int fMaxTileSize;
|
||||
int fMaxWindowRectangles;
|
||||
int fInternalMultisampleCount;
|
||||
int fMaxPushConstantsSize = 0;
|
||||
uint32_t fMaxPushConstantsSize = 0;
|
||||
|
||||
GrDriverBugWorkarounds fDriverBugWorkarounds;
|
||||
|
||||
|
@ -287,6 +287,8 @@ void GrMtlCaps::initGrCaps(const id<MTLDevice> device) {
|
||||
fMaxPreferredRenderTargetSize = fMaxRenderTargetSize;
|
||||
fMaxTextureSize = fMaxRenderTargetSize;
|
||||
|
||||
fMaxPushConstantsSize = 4*1024;
|
||||
|
||||
// Init sample counts. All devices support 1 (i.e. 0 in skia).
|
||||
fSampleCounts.push_back(1);
|
||||
if (@available(iOS 9.0, *)) {
|
||||
|
@ -332,7 +332,7 @@ void GrMtlPipelineStateDataManager::uploadAndBindUniformBuffers(
|
||||
id<MTLRenderCommandEncoder> renderCmdEncoder) const {
|
||||
if (fUniformSize && fUniformsDirty) {
|
||||
if (@available(macOS 10.11, iOS 8.3, *)) {
|
||||
SkASSERT(fUniformSize <= 4*1024);
|
||||
SkASSERT(fUniformSize <= gpu->caps()->maxPushConstantsSize());
|
||||
[renderCmdEncoder setVertexBytes: fUniformData.get()
|
||||
length: fUniformSize
|
||||
atIndex: GrMtlUniformHandler::kUniformBinding];
|
||||
|
Loading…
Reference in New Issue
Block a user