1*c8dee2aaSAndroid Build Coastguard Worker /* 2*c8dee2aaSAndroid Build Coastguard Worker * Copyright 2024 Google LLC 3*c8dee2aaSAndroid Build Coastguard Worker * 4*c8dee2aaSAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license that can be 5*c8dee2aaSAndroid Build Coastguard Worker * found in the LICENSE file. 6*c8dee2aaSAndroid Build Coastguard Worker */ 7*c8dee2aaSAndroid Build Coastguard Worker 8*c8dee2aaSAndroid Build Coastguard Worker #ifndef skgpu_graphite_precompile_Precompile_DEFINED 9*c8dee2aaSAndroid Build Coastguard Worker #define skgpu_graphite_precompile_Precompile_DEFINED 10*c8dee2aaSAndroid Build Coastguard Worker 11*c8dee2aaSAndroid Build Coastguard Worker #include "include/core/SkSpan.h" 12*c8dee2aaSAndroid Build Coastguard Worker #include "include/gpu/graphite/GraphiteTypes.h" 13*c8dee2aaSAndroid Build Coastguard Worker 14*c8dee2aaSAndroid Build Coastguard Worker namespace skgpu::graphite { 15*c8dee2aaSAndroid Build Coastguard Worker 16*c8dee2aaSAndroid Build Coastguard Worker class Context; 17*c8dee2aaSAndroid Build Coastguard Worker class PaintOptions; 18*c8dee2aaSAndroid Build Coastguard Worker class PrecompileContext; 19*c8dee2aaSAndroid Build Coastguard Worker 20*c8dee2aaSAndroid Build Coastguard Worker /** 21*c8dee2aaSAndroid Build Coastguard Worker * Describes the required properties of a RenderPass that will be combined with the 22*c8dee2aaSAndroid Build Coastguard Worker * other portions of the Precompilation API (i.e., paintOptions and drawTypes) to yield 23*c8dee2aaSAndroid Build Coastguard Worker * a pipeline. 24*c8dee2aaSAndroid Build Coastguard Worker */ 25*c8dee2aaSAndroid Build Coastguard Worker struct SK_API RenderPassProperties { 26*c8dee2aaSAndroid Build Coastguard Worker DepthStencilFlags fDSFlags = DepthStencilFlags::kNone; 27*c8dee2aaSAndroid Build Coastguard Worker SkColorType fDstCT = kRGBA_8888_SkColorType; 28*c8dee2aaSAndroid Build Coastguard Worker bool fRequiresMSAA = false; 29*c8dee2aaSAndroid Build Coastguard Worker }; 30*c8dee2aaSAndroid Build Coastguard Worker 31*c8dee2aaSAndroid Build Coastguard Worker /** 32*c8dee2aaSAndroid Build Coastguard Worker * Precompilation allows clients to create pipelines ahead of time based on what they expect 33*c8dee2aaSAndroid Build Coastguard Worker * to draw. This can reduce performance hitches, due to inline compilation, during the actual 34*c8dee2aaSAndroid Build Coastguard Worker * drawing. Graphite will always be able to perform an inline compilation if some SkPaint 35*c8dee2aaSAndroid Build Coastguard Worker * combination was omitted from precompilation. 36*c8dee2aaSAndroid Build Coastguard Worker * 37*c8dee2aaSAndroid Build Coastguard Worker * @param precompileContext thread-safe helper holding required portions of the Context 38*c8dee2aaSAndroid Build Coastguard Worker * @param paintOptions captures a set of SkPaints that will be drawn 39*c8dee2aaSAndroid Build Coastguard Worker * @param drawTypes communicates which primitives those paints will be drawn with 40*c8dee2aaSAndroid Build Coastguard Worker * @param renderPassProperties describes the RenderPasses needed for the desired Pipelines 41*c8dee2aaSAndroid Build Coastguard Worker */ 42*c8dee2aaSAndroid Build Coastguard Worker void SK_API Precompile(PrecompileContext* precompileContext, 43*c8dee2aaSAndroid Build Coastguard Worker const PaintOptions& paintOptions, 44*c8dee2aaSAndroid Build Coastguard Worker DrawTypeFlags drawTypes, 45*c8dee2aaSAndroid Build Coastguard Worker SkSpan<const RenderPassProperties> renderPassProperties); 46*c8dee2aaSAndroid Build Coastguard Worker 47*c8dee2aaSAndroid Build Coastguard Worker } // namespace skgpu::graphite 48*c8dee2aaSAndroid Build Coastguard Worker 49*c8dee2aaSAndroid Build Coastguard Worker #endif // skgpu_graphite_precompile_Precompile_DEFINED 50