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

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: move into GrProcessor Created 4 years, 9 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 4120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4131 dstGLRect.fBottom, 4131 dstGLRect.fBottom,
4132 dstGLRect.fLeft + dstGLRect.fWidth, 4132 dstGLRect.fLeft + dstGLRect.fWidth,
4133 dstGLRect.fBottom + dstGLRect.fHeight, 4133 dstGLRect.fBottom + dstGLRect.fHeight,
4134 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST)); 4134 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST));
4135 this->unbindTextureFBOForCopy(GR_GL_DRAW_FRAMEBUFFER, dst); 4135 this->unbindTextureFBOForCopy(GR_GL_DRAW_FRAMEBUFFER, dst);
4136 this->unbindTextureFBOForCopy(GR_GL_READ_FRAMEBUFFER, src); 4136 this->unbindTextureFBOForCopy(GR_GL_READ_FRAMEBUFFER, src);
4137 this->didWriteToSurface(dst, &dstRect); 4137 this->didWriteToSurface(dst, &dstRect);
4138 return true; 4138 return true;
4139 } 4139 }
4140 4140
4141 void GrGLGpu::onGetMultisampleSpecs(GrRenderTarget* rt,
4142 const GrStencilSettings& stencil,
4143 int* effectiveSampleCnt,
4144 SamplePattern* pattern) {
4145 SkASSERT(!rt->hasMixedSamples() || rt->renderTargetPriv().getStencilAttachme nt() ||
4146 stencil.isDisabled());
4147
4148 this->flushStencil(stencil);
4149 this->flushHWAAState(rt, true, !stencil.isDisabled());
4150 this->flushRenderTarget(static_cast<GrGLRenderTarget*>(rt), &SkIRect::EmptyI Rect());
bsalomon 2016/03/01 14:28:55 Is this why we wind up caching this on the RT? Is
Chris Dalton 2016/03/01 20:37:47 EXT_raster_multisample says: "The sample locat
4151
4152 if (0 != this->caps()->maxRasterSamples()) {
4153 GR_GL_GetIntegerv(this->glInterface(), GR_GL_EFFECTIVE_RASTER_SAMPLES, e ffectiveSampleCnt);
4154 } else {
4155 GR_GL_GetIntegerv(this->glInterface(), GR_GL_SAMPLES, effectiveSampleCnt );
4156 }
4157 if (this->caps()->sampleLocationsSupport()) {
4158 pattern->reset(*effectiveSampleCnt);
4159 for (int i = 0; i < *effectiveSampleCnt; ++i) {
4160 GrGLfloat pos[2];
4161 GL_CALL(GetMultisamplefv(GR_GL_SAMPLE_POSITION, i, pos));
4162 // OpenGL window space and Skia device space have inverted y directi ons.
4163 (*pattern)[i].set(pos[0], 1 - pos[1]);
bsalomon 2016/03/01 14:28:55 Skia conceptually places the origin at the top of
Chris Dalton 2016/03/01 20:37:47 Ah, good point. Device space is a Skia concept, so
Chris Dalton 2016/03/07 16:09:38 Done.
4164 }
4165 }
4166 }
4167
4141 void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) { 4168 void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) {
4142 SkASSERT(type); 4169 SkASSERT(type);
4143 switch (type) { 4170 switch (type) {
4144 case kTexture_GrXferBarrierType: { 4171 case kTexture_GrXferBarrierType: {
4145 GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt); 4172 GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt);
4146 if (glrt->textureFBOID() != glrt->renderFBOID()) { 4173 if (glrt->textureFBOID() != glrt->renderFBOID()) {
4147 // The render target uses separate storage so no need for glText ureBarrier. 4174 // The render target uses separate storage so no need for glText ureBarrier.
4148 // FIXME: The render target will resolve automatically when its texture is bound, 4175 // FIXME: The render target will resolve automatically when its texture is bound,
4149 // but we could resolve only the bounds that will be read if we do it here instead. 4176 // but we could resolve only the bounds that will be read if we do it here instead.
4150 return; 4177 return;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4334 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4308 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4335 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4309 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4336 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4310 copyParams->fWidth = texture->width(); 4337 copyParams->fWidth = texture->width();
4311 copyParams->fHeight = texture->height(); 4338 copyParams->fHeight = texture->height();
4312 return true; 4339 return true;
4313 } 4340 }
4314 } 4341 }
4315 return false; 4342 return false;
4316 } 4343 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698