1 /* 2 * Copyright © 2016 Red Hat. 3 * Copyright © 2016 Bas Nieuwenhuizen 4 * 5 * based in part on anv driver which is: 6 * Copyright © 2015 Intel Corporation 7 * 8 * SPDX-License-Identifier: MIT 9 */ 10 11 #ifndef RADV_PIPELINE_COMPUTE_H 12 #define RADV_PIPELINE_COMPUTE_H 13 14 #include "radv_pipeline.h" 15 16 struct radv_physical_device; 17 struct radv_shader_binary; 18 struct radv_shader_info; 19 20 struct radv_compute_pipeline { 21 struct radv_pipeline base; 22 23 struct { 24 struct radeon_cmdbuf cs; 25 uint64_t va; 26 uint64_t size; 27 } indirect; 28 }; 29 30 RADV_DECL_PIPELINE_DOWNCAST(compute, RADV_PIPELINE_COMPUTE) 31 32 struct radv_compute_pipeline_metadata { 33 uint32_t wave32; 34 uint32_t grid_base_sgpr; 35 uint32_t push_const_sgpr; 36 uint64_t inline_push_const_mask; 37 uint32_t indirect_desc_sets_sgpr; 38 }; 39 40 uint32_t radv_get_compute_resource_limits(const struct radv_physical_device *pdev, const struct radv_shader_info *info); 41 42 void radv_get_compute_shader_metadata(const struct radv_device *device, const struct radv_shader *cs, 43 struct radv_compute_pipeline_metadata *metadata); 44 45 void radv_compute_pipeline_init(struct radv_compute_pipeline *pipeline, const struct radv_pipeline_layout *layout, 46 struct radv_shader *shader); 47 48 struct radv_shader *radv_compile_cs(struct radv_device *device, struct vk_pipeline_cache *cache, 49 struct radv_shader_stage *cs_stage, bool keep_executable_info, 50 bool keep_statistic_info, bool is_internal, struct radv_shader_binary **cs_binary); 51 52 VkResult radv_compute_pipeline_create(VkDevice _device, VkPipelineCache _cache, 53 const VkComputePipelineCreateInfo *pCreateInfo, 54 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipeline); 55 56 void radv_destroy_compute_pipeline(struct radv_device *device, struct radv_compute_pipeline *pipeline); 57 58 void radv_compute_pipeline_hash(const struct radv_device *device, const VkComputePipelineCreateInfo *pCreateInfo, 59 unsigned char *hash); 60 61 #endif /* RADV_PIPELINE_COMPUTE_H */ 62