aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/iOSSampleApp/SkSampleUIView.mm
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-05 20:06:05 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-05 20:06:05 +0000
commit64cc810ad165724f9c666a75bd52e41c67f13564 (patch)
treedc05e9b5db78f18c9dcf75f9c62d2d05ea84a66f /experimental/iOSSampleApp/SkSampleUIView.mm
parentacf3ecc7f70567a26f1435b5d3de45b316338b3e (diff)
Make SkOSWindow return the sample count and stencil bit count for its GL context.
Review URL: https://codereview.chromium.org/12437010 git-svn-id: http://skia.googlecode.com/svn/trunk@7995 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/iOSSampleApp/SkSampleUIView.mm')
-rw-r--r--experimental/iOSSampleApp/SkSampleUIView.mm24
1 files changed, 18 insertions, 6 deletions
diff --git a/experimental/iOSSampleApp/SkSampleUIView.mm b/experimental/iOSSampleApp/SkSampleUIView.mm
index 2ed5402ba6..9fc95bd152 100644
--- a/experimental/iOSSampleApp/SkSampleUIView.mm
+++ b/experimental/iOSSampleApp/SkSampleUIView.mm
@@ -61,8 +61,8 @@ public:
SkASSERT(false);
break;
}
-
- bool result = win->attach(fBackend, msaaSampleCount);
+ SkOSWindow::AttachmentInfo info;
+ bool result = win->attach(fBackend, msaaSampleCount, &info);
if (!result) {
SkDebugf("Failed to initialize GL");
return;
@@ -165,7 +165,9 @@ public:
virtual void windowSizeChanged(SampleWindow* win) SK_OVERRIDE {
#if SK_SUPPORT_GPU
if (NULL != fCurContext) {
- win->attach(fBackend, fMSAASampleCount);
+ SkOSWindow::AttachmentInfo info;
+
+ win->attach(fBackend, fMSAASampleCount, &info);
glBindFramebuffer(GL_FRAMEBUFFER, fLayerFBO);
GrBackendRenderTargetDesc desc;
@@ -173,9 +175,9 @@ public:
desc.fHeight = SkScalarRound(win->height());
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fRenderTargetHandle = fLayerFBO;
- glGetIntegerv(GL_SAMPLES, &desc.fSampleCnt);
- glGetIntegerv(GL_STENCIL_BITS, &desc.fStencilBits);
-
+ desc.fSampleCnt = info.fSampleCount;
+ desc.fStencilBits = info.fStencilBits;
+
SkSafeUnref(fCurRenderTarget);
fCurRenderTarget = fCurContext->wrapBackendRenderTarget(desc);
}
@@ -480,4 +482,14 @@ static FPSState gFPS;
}
}
+- (void)getAttachmentInfo:(SkOSWindow::AttachmentInfo*)info {
+ glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
+ glGetRenderbufferParameteriv(GL_RENDERBUFFER,
+ GL_RENDERBUFFER_STENCIL_SIZE,
+ &info->fStencilBits);
+ glGetRenderbufferParameteriv(GL_RENDERBUFFER,
+ GL_RENDERBUFFER_SAMPLES_APPLE,
+ &info->fSampleCount);
+}
+
@end