Remove special handling of stencil formats and just use GrBackendFormts.
Before this change each backend had its own special stencil format
struct that contained information like the actual format, stencil bits,
etc. This change removes all of that and instead reliess on static
helper functions that can return all this information based on the
backend format.
Besides being cleaner, this change helps move towards being able to
combine all surface attachment classes into a unified class.
Bug: skia:10727
Change-Id: I26003e44f55ce32293e9092bafce5baef6f938d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322958
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/gl/GrGLStencilAttachment.cpp b/src/gpu/gl/GrGLStencilAttachment.cpp
index c98d866..c56fb9c 100644
--- a/src/gpu/gl/GrGLStencilAttachment.cpp
+++ b/src/gpu/gl/GrGLStencilAttachment.cpp
@@ -13,9 +13,9 @@
size_t GrGLStencilAttachment::onGpuMemorySize() const {
uint64_t size = this->width();
size *= this->height();
- size *= fFormat.fTotalBits;
+ size *= GrGLFormatBytesPerBlock(fFormat);
size *= this->numSamples();
- return static_cast<size_t>(size / 8);
+ return static_cast<size_t>(size);
}
void GrGLStencilAttachment::onRelease() {
@@ -36,7 +36,7 @@
}
GrBackendFormat GrGLStencilAttachment::backendFormat() const {
- return GrBackendFormat::MakeGL(fFormat.fInternalFormat, GR_GL_TEXTURE_NONE);
+ return GrBackendFormat::MakeGL(GrGLFormatToEnum(fFormat), GR_GL_TEXTURE_NONE);
}
void GrGLStencilAttachment::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,