From 64cc810ad165724f9c666a75bd52e41c67f13564 Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Tue, 5 Mar 2013 20:06:05 +0000 Subject: 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 --- experimental/iOSSampleApp/SkSampleUIView.mm | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'experimental/iOSSampleApp/SkSampleUIView.mm') 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 -- cgit v1.2.3