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