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 "GrGLBuffer.h" | 9 #include "GrGLBuffer.h" |
10 #include "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
(...skipping 4414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4425 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4)); | 4425 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4)); |
4426 } | 4426 } |
4427 | 4427 |
4428 // Unbind: | 4428 // Unbind: |
4429 GL_CALL(FramebufferTexture2D(GR_GL_FRAMEBUFFER, GR_GL_COLOR_ATTACHMENT0, | 4429 GL_CALL(FramebufferTexture2D(GR_GL_FRAMEBUFFER, GR_GL_COLOR_ATTACHMENT0, |
4430 GR_GL_TEXTURE_2D, 0, 0)); | 4430 GR_GL_TEXTURE_2D, 0, 0)); |
4431 | 4431 |
4432 return true; | 4432 return true; |
4433 } | 4433 } |
4434 | 4434 |
4435 void GrGLGpu::onGetMultisampleSpecs(GrRenderTarget* rt, const GrStencilSettings&
stencil, | 4435 void GrGLGpu::onGetMultisampleSpecs(GrRenderTarget* rt, |
4436 int* effectiveSampleCnt, SamplePattern* samp
lePattern) { | 4436 const GrStencilSettings& stencil, |
| 4437 int* effectiveSampleCnt, |
| 4438 SkAutoTDeleteArray<SkPoint>* sampleLocations
) { |
4437 SkASSERT(!rt->hasMixedSamples() || rt->renderTargetPriv().getStencilAttachme
nt() || | 4439 SkASSERT(!rt->hasMixedSamples() || rt->renderTargetPriv().getStencilAttachme
nt() || |
4438 stencil.isDisabled()); | 4440 stencil.isDisabled()); |
4439 | 4441 |
4440 this->flushStencil(stencil); | 4442 this->flushStencil(stencil); |
4441 this->flushHWAAState(rt, true, !stencil.isDisabled()); | 4443 this->flushHWAAState(rt, true, !stencil.isDisabled()); |
4442 this->flushRenderTarget(static_cast<GrGLRenderTarget*>(rt), &SkIRect::EmptyI
Rect()); | 4444 this->flushRenderTarget(static_cast<GrGLRenderTarget*>(rt), &SkIRect::EmptyI
Rect()); |
4443 | 4445 |
4444 if (0 != this->caps()->maxRasterSamples()) { | 4446 if (0 != this->caps()->maxRasterSamples()) { |
4445 GR_GL_GetIntegerv(this->glInterface(), GR_GL_EFFECTIVE_RASTER_SAMPLES, e
ffectiveSampleCnt); | 4447 GR_GL_GetIntegerv(this->glInterface(), GR_GL_EFFECTIVE_RASTER_SAMPLES, e
ffectiveSampleCnt); |
4446 } else { | 4448 } else { |
4447 GR_GL_GetIntegerv(this->glInterface(), GR_GL_SAMPLES, effectiveSampleCnt
); | 4449 GR_GL_GetIntegerv(this->glInterface(), GR_GL_SAMPLES, effectiveSampleCnt
); |
4448 } | 4450 } |
4449 | 4451 |
4450 SkASSERT(*effectiveSampleCnt >= rt->desc().fSampleCnt); | 4452 SkASSERT(*effectiveSampleCnt >= rt->desc().fSampleCnt); |
4451 | 4453 |
4452 if (this->caps()->sampleLocationsSupport()) { | 4454 if (this->caps()->sampleLocationsSupport()) { |
4453 samplePattern->reset(*effectiveSampleCnt); | 4455 sampleLocations->reset(new SkPoint[*effectiveSampleCnt]); |
4454 for (int i = 0; i < *effectiveSampleCnt; ++i) { | 4456 for (int i = 0; i < *effectiveSampleCnt; ++i) { |
4455 GrGLfloat pos[2]; | 4457 GrGLfloat pos[2]; |
4456 GL_CALL(GetMultisamplefv(GR_GL_SAMPLE_POSITION, i, pos)); | 4458 GL_CALL(GetMultisamplefv(GR_GL_SAMPLE_POSITION, i, pos)); |
4457 if (kTopLeft_GrSurfaceOrigin == rt->origin()) { | 4459 if (kTopLeft_GrSurfaceOrigin == rt->origin()) { |
4458 (*samplePattern)[i].set(pos[0], pos[1]); | 4460 (*sampleLocations)[i].set(pos[0], pos[1]); |
4459 } else { | 4461 } else { |
4460 (*samplePattern)[i].set(pos[0], 1 - pos[1]); | 4462 (*sampleLocations)[i].set(pos[0], 1 - pos[1]); |
4461 } | 4463 } |
4462 } | 4464 } |
4463 } | 4465 } |
4464 } | 4466 } |
4465 | 4467 |
4466 void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) { | 4468 void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) { |
4467 SkASSERT(type); | 4469 SkASSERT(type); |
4468 switch (type) { | 4470 switch (type) { |
4469 case kTexture_GrXferBarrierType: { | 4471 case kTexture_GrXferBarrierType: { |
4470 GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt); | 4472 GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4607 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4609 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
4608 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4610 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
4609 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4611 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
4610 copyParams->fWidth = texture->width(); | 4612 copyParams->fWidth = texture->width(); |
4611 copyParams->fHeight = texture->height(); | 4613 copyParams->fHeight = texture->height(); |
4612 return true; | 4614 return true; |
4613 } | 4615 } |
4614 } | 4616 } |
4615 return false; | 4617 return false; |
4616 } | 4618 } |
OLD | NEW |