Line data Source code
1 : /*
2 : * Copyright 2016 Google Inc.
3 : *
4 : * Use of this source code is governed by a BSD-style license that can be
5 : * found in the LICENSE file.
6 : */
7 :
8 : #include "GrGpuCommandBuffer.h"
9 :
10 : #include "GrCaps.h"
11 : #include "GrFixedClip.h"
12 : #include "GrGpu.h"
13 : #include "GrPrimitiveProcessor.h"
14 : #include "GrRenderTarget.h"
15 : #include "SkRect.h"
16 :
17 0 : void GrGpuCommandBuffer::submit() {
18 0 : this->gpu()->handleDirtyContext();
19 0 : this->onSubmit();
20 0 : }
21 :
22 0 : void GrGpuCommandBuffer::clear(GrRenderTarget* rt, const GrFixedClip& clip, GrColor color) {
23 : #ifdef SK_DEBUG
24 0 : SkASSERT(rt);
25 0 : SkASSERT(!clip.scissorEnabled() ||
26 : (SkIRect::MakeWH(rt->width(), rt->height()).contains(clip.scissorRect()) &&
27 : SkIRect::MakeWH(rt->width(), rt->height()) != clip.scissorRect()));
28 : #endif
29 0 : this->onClear(rt, clip, color);
30 0 : }
31 :
32 0 : void GrGpuCommandBuffer::clearStencilClip(GrRenderTarget* rt, const GrFixedClip& clip,
33 : bool insideStencilMask) {
34 0 : this->onClearStencilClip(rt, clip, insideStencilMask);
35 0 : }
36 :
37 0 : bool GrGpuCommandBuffer::draw(const GrPipeline& pipeline,
38 : const GrPrimitiveProcessor& primProc,
39 : const GrMesh* mesh,
40 : int meshCount,
41 : const SkRect& bounds) {
42 0 : SkASSERT(pipeline.isInitialized());
43 0 : if (primProc.numAttribs() > this->gpu()->caps()->maxVertexAttributes()) {
44 0 : this->gpu()->stats()->incNumFailedDraws();
45 0 : return false;
46 : }
47 0 : this->onDraw(pipeline, primProc, mesh, meshCount, bounds);
48 0 : return true;
49 : }
50 :
|