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 | 8 |
9 #include "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
10 #include "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2028 | 2028 |
2029 void GrGLGpu::setColocatedSampleLocations(GrRenderTarget* rt, bool useColocatedS
ampleLocations) { | 2029 void GrGLGpu::setColocatedSampleLocations(GrRenderTarget* rt, bool useColocatedS
ampleLocations) { |
2030 GrGLRenderTarget* target = static_cast<GrGLRenderTarget*>(rt->asRenderTarget
()); | 2030 GrGLRenderTarget* target = static_cast<GrGLRenderTarget*>(rt->asRenderTarget
()); |
2031 SkASSERT(0 != target->renderFBOID()); | 2031 SkASSERT(0 != target->renderFBOID()); |
2032 | 2032 |
2033 if (!rt->isStencilBufferMultisampled() || | 2033 if (!rt->isStencilBufferMultisampled() || |
2034 useColocatedSampleLocations == target->usesColocatedSampleLocations()) { | 2034 useColocatedSampleLocations == target->usesColocatedSampleLocations()) { |
2035 return; | 2035 return; |
2036 } | 2036 } |
2037 | 2037 |
2038 GL_CALL(NamedFramebufferParameteri(target->renderFBOID(), | 2038 if (kGL_GrGLStandard == this->glStandard() && this->glVersion() >= GR_GL_VER
(4,5)) { |
2039 GR_GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOC
ATIONS, | 2039 GL_CALL(NamedFramebufferParameteri(target->renderFBOID(), |
2040 useColocatedSampleLocations)); | 2040 GR_GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE
_LOCATIONS, |
| 2041 useColocatedSampleLocations)); |
| 2042 } else { |
| 2043 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID())); |
| 2044 GL_CALL(FramebufferParameteri(GR_GL_FRAMEBUFFER, |
| 2045 GR_GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCA
TIONS, |
| 2046 useColocatedSampleLocations)); |
| 2047 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
| 2048 } |
2041 | 2049 |
2042 target->flagAsUsingColocatedSampleLocations(useColocatedSampleLocations); | 2050 target->flagAsUsingColocatedSampleLocations(useColocatedSampleLocations); |
2043 } | 2051 } |
2044 | 2052 |
2045 void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound)
{ | 2053 void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound)
{ |
2046 | 2054 |
2047 SkASSERT(target); | 2055 SkASSERT(target); |
2048 | 2056 |
2049 uint32_t rtID = target->getUniqueID(); | 2057 uint32_t rtID = target->getUniqueID(); |
2050 if (fHWBoundRenderTargetUniqueID != rtID) { | 2058 if (fHWBoundRenderTargetUniqueID != rtID) { |
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3311 this->setVertexArrayID(gpu, 0); | 3319 this->setVertexArrayID(gpu, 0); |
3312 } | 3320 } |
3313 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3321 int attrCount = gpu->glCaps().maxVertexAttributes(); |
3314 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3322 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
3315 fDefaultVertexArrayAttribState.resize(attrCount); | 3323 fDefaultVertexArrayAttribState.resize(attrCount); |
3316 } | 3324 } |
3317 attribState = &fDefaultVertexArrayAttribState; | 3325 attribState = &fDefaultVertexArrayAttribState; |
3318 } | 3326 } |
3319 return attribState; | 3327 return attribState; |
3320 } | 3328 } |
OLD | NEW |