Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1717393002: Add "sample locations" feature to GrProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_getmultisamp
Patch Set: assert Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLGpu.h" 8 #include "GrGLGpu.h"
9 #include "GrGLGLSL.h" 9 #include "GrGLGLSL.h"
10 #include "GrGLStencilAttachment.h" 10 #include "GrGLStencilAttachment.h"
(...skipping 3765 matching lines...) Expand 10 before | Expand all | Expand 10 after
3776 dstGLRect.fBottom, 3776 dstGLRect.fBottom,
3777 dstGLRect.fLeft + dstGLRect.fWidth, 3777 dstGLRect.fLeft + dstGLRect.fWidth,
3778 dstGLRect.fBottom + dstGLRect.fHeight, 3778 dstGLRect.fBottom + dstGLRect.fHeight,
3779 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST)); 3779 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST));
3780 this->unbindTextureFBOForCopy(GR_GL_DRAW_FRAMEBUFFER, dst); 3780 this->unbindTextureFBOForCopy(GR_GL_DRAW_FRAMEBUFFER, dst);
3781 this->unbindTextureFBOForCopy(GR_GL_READ_FRAMEBUFFER, src); 3781 this->unbindTextureFBOForCopy(GR_GL_READ_FRAMEBUFFER, src);
3782 this->didWriteToSurface(dst, &dstRect); 3782 this->didWriteToSurface(dst, &dstRect);
3783 return true; 3783 return true;
3784 } 3784 }
3785 3785
3786 void GrGLGpu::onGetMultisampleSpecs(GrRenderTarget* rt,
3787 const GrStencilSettings& stencil,
3788 int* effectiveSampleCnt,
3789 SamplePattern* pattern) {
3790 SkASSERT(!rt->hasMixedSamples() || rt->renderTargetPriv().getStencilAttachme nt() ||
3791 stencil.isDisabled());
3792
3793 this->flushStencil(stencil);
3794 this->flushHWAAState(rt, true, !stencil.isDisabled());
3795 this->flushRenderTarget(static_cast<GrGLRenderTarget*>(rt), &SkIRect::EmptyI Rect());
3796
3797 if (0 != this->caps()->maxRasterSamples()) {
3798 GR_GL_GetIntegerv(this->glInterface(), GR_GL_EFFECTIVE_RASTER_SAMPLES, e ffectiveSampleCnt);
3799 } else {
3800 GR_GL_GetIntegerv(this->glInterface(), GR_GL_SAMPLES, effectiveSampleCnt );
3801 }
3802 if (this->caps()->sampleLocationsSupport()) {
3803 pattern->reset(*effectiveSampleCnt);
3804 for (int i = 0; i < *effectiveSampleCnt; ++i) {
3805 GrGLfloat pos[2];
3806 GL_CALL(GetMultisamplefv(GR_GL_SAMPLE_POSITION, i, pos));
3807 // OpenGL pixel space and Skia device space have inverted y directio ns.
3808 (*pattern)[i].set(pos[0] - 0.5f, 0.5f - pos[1]);
Mark Kilgard 2016/02/22 18:41:04 so do samples in Skia are in a [-0.5, 0.5) range w
Chris Dalton 2016/02/22 19:10:43 The 0.5, 0.5 offset was added by me just because i
bsalomon 2016/02/22 20:28:26 Skia's device coordinates have integers at the bor
Chris Dalton 2016/02/22 21:19:11 Agreed. Now that I think about it I also prefer 0.
Chris Dalton 2016/02/22 22:17:55 Done.
3809 }
3810 }
3811 }
3812
3786 void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) { 3813 void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) {
3787 SkASSERT(type); 3814 SkASSERT(type);
3788 switch (type) { 3815 switch (type) {
3789 case kTexture_GrXferBarrierType: { 3816 case kTexture_GrXferBarrierType: {
3790 GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt); 3817 GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt);
3791 if (glrt->textureFBOID() != glrt->renderFBOID()) { 3818 if (glrt->textureFBOID() != glrt->renderFBOID()) {
3792 // The render target uses separate storage so no need for glText ureBarrier. 3819 // The render target uses separate storage so no need for glText ureBarrier.
3793 // FIXME: The render target will resolve automatically when its texture is bound, 3820 // FIXME: The render target will resolve automatically when its texture is bound,
3794 // but we could resolve only the bounds that will be read if we do it here instead. 3821 // but we could resolve only the bounds that will be read if we do it here instead.
3795 return; 3822 return;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
3952 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 3979 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
3953 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 3980 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
3954 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 3981 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
3955 copyParams->fWidth = texture->width(); 3982 copyParams->fWidth = texture->width();
3956 copyParams->fHeight = texture->height(); 3983 copyParams->fHeight = texture->height();
3957 return true; 3984 return true;
3958 } 3985 }
3959 } 3986 }
3960 return false; 3987 return false;
3961 } 3988 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698