Metal stencil support
Bug: skia:
Change-Id: I697a39bc756bb8f18ea2c6a1f8151dbc103bf9fe
Reviewed-on: https://skia-review.googlesource.com/c/157567
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/mtl/GrMtlCaps.h b/src/gpu/mtl/GrMtlCaps.h
index 1d897b7..c10f656 100644
--- a/src/gpu/mtl/GrMtlCaps.h
+++ b/src/gpu/mtl/GrMtlCaps.h
@@ -9,7 +9,7 @@
#define GrMtlCaps_DEFINED
#include "GrCaps.h"
-
+#include "GrMtlStencilAttachment.h"
#include "SkTDArray.h"
#import <Metal/Metal.h>
@@ -21,6 +21,8 @@
*/
class GrMtlCaps : public GrCaps {
public:
+ typedef GrMtlStencilAttachment::Format StencilFormat;
+
GrMtlCaps(const GrContextOptions& contextOptions, id<MTLDevice> device,
MTLFeatureSet featureSet);
@@ -38,14 +40,13 @@
return true;
}
-#if 0
/**
* Returns both a supported and most prefered stencil format to use in draws.
*/
- const StencilFormat& preferedStencilFormat() const {
- return fPreferedStencilFormat;
+ const StencilFormat& preferredStencilFormat() const {
+ return fPreferredStencilFormat;
}
-#endif
+
bool canCopyAsBlit(GrPixelConfig dstConfig, int dstSampleCount, GrSurfaceOrigin dstOrigin,
GrPixelConfig srcConfig, int srcSampleCount, GrSurfaceOrigin srcOrigin,
const SkIRect& srcRect, const SkIPoint& dstPoint,
@@ -82,6 +83,8 @@
private:
void initFeatureSet(MTLFeatureSet featureSet);
+ void initStencilFormat(const id<MTLDevice> device);
+
void initGrCaps(const id<MTLDevice> device);
void initShaderCaps();
@@ -121,6 +124,8 @@
SkTDArray<int> fSampleCounts;
+ StencilFormat fPreferredStencilFormat;
+
typedef GrCaps INHERITED;
};