Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(903)

Side by Side Diff: src/gpu/gl/GrGLGpu.cpp

Issue 2120163002: Enable blend optimizations with instanced draws (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_ingorecov
Patch Set: fixes for perf regressions Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/instanced/GLInstancedRendering.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
26 #include "SkMipMap.h" 27 #include "SkMipMap.h"
27 #include "SkPixmap.h" 28 #include "SkPixmap.h"
28 #include "SkStrokeRec.h" 29 #include "SkStrokeRec.h"
29 #include "SkTemplates.h" 30 #include "SkTemplates.h"
30 #include "SkTypes.h" 31 #include "SkTypes.h"
31 32
32 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) 33 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
33 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X) 34 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X)
34 35
35 #define SKIP_CACHE_CHECK true 36 #define SKIP_CACHE_CHECK true
36 37
37 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR 38 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR
38 #define CLEAR_ERROR_BEFORE_ALLOC(iface) GrGLClearErr(iface) 39 #define CLEAR_ERROR_BEFORE_ALLOC(iface) GrGLClearErr(iface)
39 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL_NOERRCHECK(iface, call) 40 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL_NOERRCHECK(iface, call)
40 #define CHECK_ALLOC_ERROR(iface) GR_GL_GET_ERROR(iface) 41 #define CHECK_ALLOC_ERROR(iface) GR_GL_GET_ERROR(iface)
41 #else 42 #else
42 #define CLEAR_ERROR_BEFORE_ALLOC(iface) 43 #define CLEAR_ERROR_BEFORE_ALLOC(iface)
43 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL(iface, call) 44 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL(iface, call)
44 #define CHECK_ALLOC_ERROR(iface) GR_GL_NO_ERROR 45 #define CHECK_ALLOC_ERROR(iface) GR_GL_NO_ERROR
45 #endif 46 #endif
46 47
47 /////////////////////////////////////////////////////////////////////////////// 48 ///////////////////////////////////////////////////////////////////////////////
48 49
50 using gr_instanced::InstancedRendering;
51 using gr_instanced::GLInstancedRendering;
49 52
50 static const GrGLenum gXfermodeEquation2Blend[] = { 53 static const GrGLenum gXfermodeEquation2Blend[] = {
51 // Basic OpenGL blend equations. 54 // Basic OpenGL blend equations.
52 GR_GL_FUNC_ADD, 55 GR_GL_FUNC_ADD,
53 GR_GL_FUNC_SUBTRACT, 56 GR_GL_FUNC_SUBTRACT,
54 GR_GL_FUNC_REVERSE_SUBTRACT, 57 GR_GL_FUNC_REVERSE_SUBTRACT,
55 58
56 // GL_KHR_blend_equation_advanced. 59 // GL_KHR_blend_equation_advanced.
57 GR_GL_SCREEN, 60 GR_GL_SCREEN,
58 GR_GL_OVERLAY, 61 GR_GL_OVERLAY,
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 fWireRectArrayBuffer.reset(); 471 fWireRectArrayBuffer.reset();
469 fPLSSetupProgram.fProgram = 0; 472 fPLSSetupProgram.fProgram = 0;
470 fPLSSetupProgram.fArrayBuffer.reset(); 473 fPLSSetupProgram.fArrayBuffer.reset();
471 if (this->glCaps().shaderCaps()->pathRenderingSupport()) { 474 if (this->glCaps().shaderCaps()->pathRenderingSupport()) {
472 this->glPathRendering()->disconnect(type); 475 this->glPathRendering()->disconnect(type);
473 } 476 }
474 } 477 }
475 478
476 /////////////////////////////////////////////////////////////////////////////// 479 ///////////////////////////////////////////////////////////////////////////////
477 480
481 InstancedRendering* GrGLGpu::createInstancedRenderingIfSupported() {
482 return GLInstancedRendering::CreateIfSupported(this);
483 }
484
478 void GrGLGpu::onResetContext(uint32_t resetBits) { 485 void GrGLGpu::onResetContext(uint32_t resetBits) {
479 // we don't use the zb at all 486 // we don't use the zb at all
480 if (resetBits & kMisc_GrGLBackendState) { 487 if (resetBits & kMisc_GrGLBackendState) {
481 GL_CALL(Disable(GR_GL_DEPTH_TEST)); 488 GL_CALL(Disable(GR_GL_DEPTH_TEST));
482 GL_CALL(DepthMask(GR_GL_FALSE)); 489 GL_CALL(DepthMask(GR_GL_FALSE));
483 490
484 fHWBufferState[kTexel_GrBufferType].invalidate(); 491 fHWBufferState[kTexel_GrBufferType].invalidate();
485 fHWBufferState[kDrawIndirect_GrBufferType].invalidate(); 492 fHWBufferState[kDrawIndirect_GrBufferType].invalidate();
486 fHWBufferState[kXferCpuToGpu_GrBufferType].invalidate(); 493 fHWBufferState[kXferCpuToGpu_GrBufferType].invalidate();
487 fHWBufferState[kXferGpuToCpu_GrBufferType].invalidate(); 494 fHWBufferState[kXferGpuToCpu_GrBufferType].invalidate();
(...skipping 4114 matching lines...) Expand 10 before | Expand all | Expand 10 after
4602 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4609 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4603 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4610 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4604 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4611 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4605 copyParams->fWidth = texture->width(); 4612 copyParams->fWidth = texture->width();
4606 copyParams->fHeight = texture->height(); 4613 copyParams->fHeight = texture->height();
4607 return true; 4614 return true;
4608 } 4615 }
4609 } 4616 }
4610 return false; 4617 return false;
4611 } 4618 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/instanced/GLInstancedRendering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698