OLD | NEW |
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 Loading... |
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 SkAutoTDeleteArray<SkPoint>* sampleLocations
) { |
| 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()); |
| 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 |
| 4158 SkASSERT(*effectiveSampleCnt >= rt->desc().fSampleCnt); |
| 4159 |
| 4160 if (this->caps()->sampleLocationsSupport()) { |
| 4161 sampleLocations->reset(new SkPoint[*effectiveSampleCnt]); |
| 4162 for (int i = 0; i < *effectiveSampleCnt; ++i) { |
| 4163 GrGLfloat pos[2]; |
| 4164 GL_CALL(GetMultisamplefv(GR_GL_SAMPLE_POSITION, i, pos)); |
| 4165 if (kTopLeft_GrSurfaceOrigin == rt->origin()) { |
| 4166 (*sampleLocations)[i].set(pos[0], pos[1]); |
| 4167 } else { |
| 4168 (*sampleLocations)[i].set(pos[0], 1 - pos[1]); |
| 4169 } |
| 4170 } |
| 4171 } |
| 4172 } |
| 4173 |
4141 void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) { | 4174 void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) { |
4142 SkASSERT(type); | 4175 SkASSERT(type); |
4143 switch (type) { | 4176 switch (type) { |
4144 case kTexture_GrXferBarrierType: { | 4177 case kTexture_GrXferBarrierType: { |
4145 GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt); | 4178 GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt); |
4146 if (glrt->textureFBOID() != glrt->renderFBOID()) { | 4179 if (glrt->textureFBOID() != glrt->renderFBOID()) { |
4147 // The render target uses separate storage so no need for glText
ureBarrier. | 4180 // 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, | 4181 // 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. | 4182 // but we could resolve only the bounds that will be read if we
do it here instead. |
4150 return; | 4183 return; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4307 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4340 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
4308 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4341 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
4309 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4342 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
4310 copyParams->fWidth = texture->width(); | 4343 copyParams->fWidth = texture->width(); |
4311 copyParams->fHeight = texture->height(); | 4344 copyParams->fHeight = texture->height(); |
4312 return true; | 4345 return true; |
4313 } | 4346 } |
4314 } | 4347 } |
4315 return false; | 4348 return false; |
4316 } | 4349 } |
OLD | NEW |