xref: /aosp_15_r20/external/skia/tools/gpu/ProxyUtils.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 #ifndef ProxyUtils_DEFINED
9 #define ProxyUtils_DEFINED
10 
11 #include "include/private/gpu/ganesh/GrTypesPriv.h"
12 #include "src/gpu/ganesh/GrImageInfo.h"
13 #include "src/gpu/ganesh/GrPipeline.h"
14 #include "src/gpu/ganesh/GrTextureProxy.h"
15 #include "src/gpu/ganesh/GrUserStencilSettings.h"
16 
17 class GrDirectContext;
18 class GrProgramInfo;
19 class GrCPixmap;
20 
21 namespace sk_gpu_test {
22 
23 /** Returns the proxy backing an image if it is texture backed, otherwise nullptr. */
24 GrTextureProxy* GetTextureImageProxy(SkImage*, GrRecordingContext*);
25 
26 /** Makes a texture proxy containing the passed in color data. */
27 GrSurfaceProxyView MakeTextureProxyViewFromData(GrDirectContext*,
28                                                 GrRenderable,
29                                                 GrSurfaceOrigin,
30                                                 GrCPixmap pixmap);
31 
32 #if defined(SK_GANESH)
33 GrProgramInfo* CreateProgramInfo(const GrCaps*,
34                                  SkArenaAlloc*,
35                                  const GrSurfaceProxyView& writeView,
36                                  bool usesMSAASurface,
37                                  GrAppliedClip&&,
38                                  const GrDstProxyView&,
39                                  GrGeometryProcessor*,
40                                  SkBlendMode,
41                                  GrPrimitiveType,
42                                  GrXferBarrierFlags renderPassXferBarriers,
43                                  GrLoadOp colorLoadOp,
44                                  GrPipeline::InputFlags flags = GrPipeline::InputFlags::kNone,
45                                  const GrUserStencilSettings* stencil =
46                                                                 &GrUserStencilSettings::kUnused);
47 #endif
48 
49 }  // namespace sk_gpu_test
50 
51 #endif
52