Robert Phillips | 88a32ef | 2018-06-07 11:05:56 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 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 "GrDebugMarkerOp.h" |
| 9 | |
| 10 | #include "GrCaps.h" |
| 11 | #include "GrContext.h" |
| 12 | #include "GrContextPriv.h" |
| 13 | #include "GrGpuCommandBuffer.h" |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame] | 14 | #include "GrMemoryPool.h" |
Robert Phillips | 88a32ef | 2018-06-07 11:05:56 -0400 | [diff] [blame] | 15 | #include "GrOpFlushState.h" |
| 16 | |
| 17 | std::unique_ptr<GrOp> GrDebugMarkerOp::Make(GrContext* context, |
| 18 | GrRenderTargetProxy* proxy, |
| 19 | const SkString& str) { |
Robert Phillips | c994a93 | 2018-06-19 13:09:54 -0400 | [diff] [blame] | 20 | GrOpMemoryPool* pool = context->contextPriv().opMemoryPool(); |
| 21 | |
| 22 | return pool->allocate<GrDebugMarkerOp>(proxy, str); |
Robert Phillips | 88a32ef | 2018-06-07 11:05:56 -0400 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | void GrDebugMarkerOp::onExecute(GrOpFlushState* state) { |
| 26 | //SkDebugf("%s\n", fStr.c_str()); |
| 27 | if (state->caps().gpuTracingSupport()) { |
| 28 | state->commandBuffer()->insertEventMarker(fStr.c_str()); |
| 29 | } |
| 30 | } |