Skip to content

Commit 3636620

Browse files
egdanielSkia Commit-Bot
authored andcommitted
Require stencil bits on wrapped GrBackendRenderTargets to 0, 8, or 16.
This will allow us in a follow on change to put in a "fake" gl stencil format for the wrapped FBO. Bug: skia:10727 Change-Id: Iba1eca5114b34d25e6a220591d28a20f7b36b12b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321545 Commit-Queue: Greg Daniel <[email protected]> Reviewed-by: Brian Salomon <[email protected]>
1 parent 93f22bc commit 3636620

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

RELEASE_NOTES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Milestone 88
99

1010
* <insert new release notes here>
1111

12+
* GrBackendRenderTargets which are created with a stencilBits param, now require
13+
the stencilBits to be 0, 8, or 16.
14+
https://review.skia.org/321545
15+
1216
* * *
1317

1418
Milestone 87

include/gpu/GrBackendSurface.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,16 @@ class SK_API GrBackendRenderTarget {
412412
// Creates an invalid backend texture.
413413
GrBackendRenderTarget();
414414

415-
// The GrGLTextureInfo must have a valid fFormat.
415+
// The GrGLTextureInfo must have a valid fFormat. If wrapping in an SkSurface we require the
416+
// stencil bits to be either 0, 8 or 16.
416417
GrBackendRenderTarget(int width,
417418
int height,
418419
int sampleCnt,
419420
int stencilBits,
420421
const GrGLFramebufferInfo& glInfo);
421422

422423
#ifdef SK_DAWN
424+
// If wrapping in an SkSurface we require the stencil bits to be either 0, 8 or 16.
423425
GrBackendRenderTarget(int width,
424426
int height,
425427
int sampleCnt,

src/image/SkSurface_Gpu.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,13 @@ bool validate_backend_render_target(const GrCaps* caps, const GrBackendRenderTar
606606
if (!caps->isFormatAsColorTypeRenderable(grCT, rt.getBackendFormat(), rt.sampleCnt())) {
607607
return false;
608608
}
609+
610+
// We require the stencil bits to be either 0, 8, or 16.
611+
int stencilBits = rt.stencilBits();
612+
if (stencilBits != 0 && stencilBits != 8 && stencilBits != 16) {
613+
return false;
614+
}
615+
609616
return true;
610617
}
611618

0 commit comments

Comments
 (0)