@@ -48,12 +48,6 @@ class VulkanPipelineCache {
4848 VulkanPipelineCache (VulkanPipelineCache const &) = delete ;
4949 VulkanPipelineCache& operator =(VulkanPipelineCache const &) = delete ;
5050
51- static inline bool isAsyncPrewarmingSupported (VulkanContext const & context) {
52- return context.asyncPipelineCachePrewarmingEnabled () &&
53- context.isDynamicRenderingSupported () &&
54- context.isVertexInputDynamicStateSupported ();
55- }
56-
5751 static constexpr uint32_t SHADER_MODULE_COUNT = 2 ;
5852 static constexpr uint32_t VERTEX_ATTRIBUTE_COUNT = MAX_VERTEX_ATTRIBUTE_COUNT;
5953
@@ -94,7 +88,18 @@ class VulkanPipelineCache {
9488
9589 static_assert (sizeof (RasterState) == 16 , " RasterState must not have implicit padding." );
9690
97- VulkanPipelineCache (DriverBase& driver, VkDevice device, VulkanContext const & context);
91+ /* *
92+ * Creates a new instance of a pipeline cache for graphics pipelines.
93+ *
94+ * @param driver The driver this is being instantiated for. This is used only for construction of
95+ * the callback manager, which references the driver for scheduling callbacks.
96+ * @param device The device that the pipelines will be created and run on.
97+ * @param context Information about the current instance of Vulkan, such as supported extensions,
98+ * and enabled features.
99+ * @param isAsyncPrewarmingEnabled true if async cache prewarming is enabled (in which case a
100+ * threadpool for such jobs will be spawned), false if not.
101+ */
102+ VulkanPipelineCache (DriverBase& driver, VkDevice device, VulkanContext const & context, bool isAsyncPrewarmingEnabled = false );
98103
99104 // Loads a fake pipeline into memory on a separate thread, with the intent of
100105 // preloading the Vulkan cache with enough information to have a cache hit when
@@ -235,6 +240,9 @@ class VulkanPipelineCache {
235240 CallbackManager mCallbackManager ;
236241
237242 [[maybe_unused]] VulkanContext const & mContext ;
243+
244+ // Keep track of whether or not cache prewarming is enabled.
245+ bool mIsAsyncPrewarmingEnabled = false ;
238246};
239247
240248} // namespace filament::backend
0 commit comments