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" |
11 #include "GrGLGpuCommandBuffer.h" | 11 #include "GrGLGpuCommandBuffer.h" |
12 #include "GrGLStencilAttachment.h" | 12 #include "GrGLStencilAttachment.h" |
13 #include "GrGLTextureRenderTarget.h" | 13 #include "GrGLTextureRenderTarget.h" |
14 #include "GrGpuResourcePriv.h" | 14 #include "GrGpuResourcePriv.h" |
15 #include "GrMesh.h" | 15 #include "GrMesh.h" |
16 #include "GrPipeline.h" | 16 #include "GrPipeline.h" |
17 #include "GrPLSGeometryProcessor.h" | 17 #include "GrPLSGeometryProcessor.h" |
18 #include "GrRenderTargetPriv.h" | 18 #include "GrRenderTargetPriv.h" |
19 #include "GrSurfacePriv.h" | 19 #include "GrSurfacePriv.h" |
20 #include "GrTexturePriv.h" | 20 #include "GrTexturePriv.h" |
21 #include "GrTypes.h" | 21 #include "GrTypes.h" |
22 #include "builders/GrGLShaderStringBuilder.h" | 22 #include "builders/GrGLShaderStringBuilder.h" |
23 #include "glsl/GrGLSL.h" | 23 #include "glsl/GrGLSL.h" |
24 #include "glsl/GrGLSLCaps.h" | 24 #include "glsl/GrGLSLCaps.h" |
25 #include "glsl/GrGLSLPLSPathRendering.h" | 25 #include "glsl/GrGLSLPLSPathRendering.h" |
26 #include "instanced/GLInstancedRendering.h" | |
27 #include "SkMipMap.h" | 26 #include "SkMipMap.h" |
28 #include "SkPixmap.h" | 27 #include "SkPixmap.h" |
29 #include "SkStrokeRec.h" | 28 #include "SkStrokeRec.h" |
30 #include "SkTemplates.h" | 29 #include "SkTemplates.h" |
31 #include "SkTypes.h" | 30 #include "SkTypes.h" |
32 | 31 |
33 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) | 32 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) |
34 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X) | 33 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X) |
35 | 34 |
36 #define SKIP_CACHE_CHECK true | 35 #define SKIP_CACHE_CHECK true |
37 | 36 |
38 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR | 37 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR |
39 #define CLEAR_ERROR_BEFORE_ALLOC(iface) GrGLClearErr(iface) | 38 #define CLEAR_ERROR_BEFORE_ALLOC(iface) GrGLClearErr(iface) |
40 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL_NOERRCHECK(iface, call) | 39 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL_NOERRCHECK(iface, call) |
41 #define CHECK_ALLOC_ERROR(iface) GR_GL_GET_ERROR(iface) | 40 #define CHECK_ALLOC_ERROR(iface) GR_GL_GET_ERROR(iface) |
42 #else | 41 #else |
43 #define CLEAR_ERROR_BEFORE_ALLOC(iface) | 42 #define CLEAR_ERROR_BEFORE_ALLOC(iface) |
44 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL(iface, call) | 43 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL(iface, call) |
45 #define CHECK_ALLOC_ERROR(iface) GR_GL_NO_ERROR | 44 #define CHECK_ALLOC_ERROR(iface) GR_GL_NO_ERROR |
46 #endif | 45 #endif |
47 | 46 |
48 /////////////////////////////////////////////////////////////////////////////// | 47 /////////////////////////////////////////////////////////////////////////////// |
49 | 48 |
50 using gr_instanced::InstancedRendering; | |
51 using gr_instanced::GLInstancedRendering; | |
52 | 49 |
53 static const GrGLenum gXfermodeEquation2Blend[] = { | 50 static const GrGLenum gXfermodeEquation2Blend[] = { |
54 // Basic OpenGL blend equations. | 51 // Basic OpenGL blend equations. |
55 GR_GL_FUNC_ADD, | 52 GR_GL_FUNC_ADD, |
56 GR_GL_FUNC_SUBTRACT, | 53 GR_GL_FUNC_SUBTRACT, |
57 GR_GL_FUNC_REVERSE_SUBTRACT, | 54 GR_GL_FUNC_REVERSE_SUBTRACT, |
58 | 55 |
59 // GL_KHR_blend_equation_advanced. | 56 // GL_KHR_blend_equation_advanced. |
60 GR_GL_SCREEN, | 57 GR_GL_SCREEN, |
61 GR_GL_OVERLAY, | 58 GR_GL_OVERLAY, |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 fWireRectArrayBuffer.reset(); | 468 fWireRectArrayBuffer.reset(); |
472 fPLSSetupProgram.fProgram = 0; | 469 fPLSSetupProgram.fProgram = 0; |
473 fPLSSetupProgram.fArrayBuffer.reset(); | 470 fPLSSetupProgram.fArrayBuffer.reset(); |
474 if (this->glCaps().shaderCaps()->pathRenderingSupport()) { | 471 if (this->glCaps().shaderCaps()->pathRenderingSupport()) { |
475 this->glPathRendering()->disconnect(type); | 472 this->glPathRendering()->disconnect(type); |
476 } | 473 } |
477 } | 474 } |
478 | 475 |
479 /////////////////////////////////////////////////////////////////////////////// | 476 /////////////////////////////////////////////////////////////////////////////// |
480 | 477 |
481 InstancedRendering* GrGLGpu::createInstancedRenderingIfSupported() { | |
482 return GLInstancedRendering::CreateIfSupported(this); | |
483 } | |
484 | |
485 void GrGLGpu::onResetContext(uint32_t resetBits) { | 478 void GrGLGpu::onResetContext(uint32_t resetBits) { |
486 // we don't use the zb at all | 479 // we don't use the zb at all |
487 if (resetBits & kMisc_GrGLBackendState) { | 480 if (resetBits & kMisc_GrGLBackendState) { |
488 GL_CALL(Disable(GR_GL_DEPTH_TEST)); | 481 GL_CALL(Disable(GR_GL_DEPTH_TEST)); |
489 GL_CALL(DepthMask(GR_GL_FALSE)); | 482 GL_CALL(DepthMask(GR_GL_FALSE)); |
490 | 483 |
491 fHWBufferState[kTexel_GrBufferType].invalidate(); | 484 fHWBufferState[kTexel_GrBufferType].invalidate(); |
492 fHWBufferState[kDrawIndirect_GrBufferType].invalidate(); | 485 fHWBufferState[kDrawIndirect_GrBufferType].invalidate(); |
493 fHWBufferState[kXferCpuToGpu_GrBufferType].invalidate(); | 486 fHWBufferState[kXferCpuToGpu_GrBufferType].invalidate(); |
494 fHWBufferState[kXferGpuToCpu_GrBufferType].invalidate(); | 487 fHWBufferState[kXferGpuToCpu_GrBufferType].invalidate(); |
(...skipping 4114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4609 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4602 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
4610 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4603 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
4611 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4604 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
4612 copyParams->fWidth = texture->width(); | 4605 copyParams->fWidth = texture->width(); |
4613 copyParams->fHeight = texture->height(); | 4606 copyParams->fHeight = texture->height(); |
4614 return true; | 4607 return true; |
4615 } | 4608 } |
4616 } | 4609 } |
4617 return false; | 4610 return false; |
4618 } | 4611 } |
OLD | NEW |