Use a priori knowledge about the number of stencil bits in Dawn, Metal and Vulkan backends
The goal here is to centralize more of the program key creation w/in GrProgramInfo. For Dawn,
Metal and Vulkan, afaict, the number of stencil bits is always 8. We can use this information
to stop passing the GrStencilSettings object around. For GL, the number of stencil bits is
variable but it is never part of the key.
Bug: skia:9455
Change-Id: I8fd2bea2422c5b9df69fc184d3a82013eef5407e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254177
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrProgramInfo.cpp b/src/gpu/GrProgramInfo.cpp
index 3391b61..a646f56 100644
--- a/src/gpu/GrProgramInfo.cpp
+++ b/src/gpu/GrProgramInfo.cpp
@@ -7,6 +7,19 @@
#include "src/gpu/GrProgramInfo.h"
+#include "src/gpu/GrStencilSettings.h"
+
+GrStencilSettings GrProgramInfo::nonGLStencilSettings() const {
+ GrStencilSettings stencil;
+
+ if (this->pipeline().isStencilEnabled()) {
+ stencil.reset(*this->pipeline().getUserStencil(),
+ this->pipeline().hasStencilClip(),
+ 8);
+ }
+
+ return stencil;
+}
#ifdef SK_DEBUG
#include "src/gpu/GrMesh.h"