1 /* 2 * Copyright © 2024 Collabora Ltd. 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #ifndef PANVK_BLEND_H 7 #define PANVK_BLEND_H 8 9 #include <stdbool.h> 10 11 #include "util/hash_table.h" 12 #include "util/simple_mtx.h" 13 14 #include "pan_blend.h" 15 16 #include "panvk_macros.h" 17 #include "panvk_mempool.h" 18 19 struct vk_color_blend_state; 20 struct panvk_device; 21 22 struct panvk_blend_shader { 23 struct pan_blend_shader_key key; 24 mali_ptr binary; 25 }; 26 27 struct panvk_blend_shader_cache { 28 struct panvk_pool bin_pool; 29 struct hash_table *ht; 30 simple_mtx_t lock; 31 }; 32 33 #ifdef PAN_ARCH 34 VkResult panvk_per_arch(blend_shader_cache_init)(struct panvk_device *dev); 35 36 void panvk_per_arch(blend_shader_cache_cleanup)(struct panvk_device *dev); 37 38 struct panvk_blend_info { 39 bool any_dest_read; 40 bool needs_shader; 41 bool shader_loads_blend_const; 42 }; 43 44 VkResult panvk_per_arch(blend_emit_descs)( 45 struct panvk_device *dev, const struct vk_color_blend_state *cb, 46 const VkFormat *color_attachment_formats, uint8_t *color_attachment_samples, 47 const struct pan_shader_info *fs_info, mali_ptr fs_code, 48 struct mali_blend_packed *bds, struct panvk_blend_info *blend_info); 49 50 #endif 51 52 #endif 53