2 * Copyright © 2016 Red Hat.
3 * Copyright © 2016 Bas Nieuwenhuizen
5 * based in part on anv driver which is:
6 * Copyright © 2015 Intel Corporation
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
31 #include "radv_private.h"
35 struct radv_shader_module
{
36 struct nir_shader
*nir
;
37 unsigned char sha1
[20];
42 struct radv_shader_variant
{
45 struct radeon_winsys_bo
*bo
;
47 struct ac_shader_config config
;
49 struct ac_shader_variant_info info
;
56 struct nir_shader
*nir
;
59 struct list_head slab_list
;
62 struct radv_shader_slab
{
63 struct list_head slabs
;
64 struct list_head shaders
;
65 struct radeon_winsys_bo
*bo
;
71 radv_optimize_nir(struct nir_shader
*shader
);
74 radv_shader_compile_to_nir(struct radv_device
*device
,
75 struct radv_shader_module
*module
,
76 const char *entrypoint_name
,
77 gl_shader_stage stage
,
78 const VkSpecializationInfo
*spec_info
);
81 radv_alloc_shader_memory(struct radv_device
*device
,
82 struct radv_shader_variant
*shader
);
85 radv_destroy_shader_slabs(struct radv_device
*device
);
87 struct radv_shader_variant
*
88 radv_shader_variant_create(struct radv_device
*device
,
89 struct radv_shader_module
*module
,
90 struct nir_shader
*const *shaders
,
92 struct radv_pipeline_layout
*layout
,
93 const struct ac_shader_variant_key
*key
,
95 unsigned *code_size_out
);
97 struct radv_shader_variant
*
98 radv_create_gs_copy_shader(struct radv_device
*device
, struct nir_shader
*nir
,
99 void **code_out
, unsigned *code_size_out
,
103 radv_shader_variant_destroy(struct radv_device
*device
,
104 struct radv_shader_variant
*variant
);
107 radv_get_shader_name(struct radv_shader_variant
*var
, gl_shader_stage stage
);
110 radv_shader_dump_stats(struct radv_device
*device
,
111 struct radv_shader_variant
*variant
,
112 gl_shader_stage stage
,