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
;
54 struct nir_shader
*nir
;
57 struct list_head slab_list
;
60 struct radv_shader_slab
{
61 struct list_head slabs
;
62 struct list_head shaders
;
63 struct radeon_winsys_bo
*bo
;
69 radv_shader_compile_to_nir(struct radv_device
*device
,
70 struct radv_shader_module
*module
,
71 const char *entrypoint_name
,
72 gl_shader_stage stage
,
73 const VkSpecializationInfo
*spec_info
);
76 radv_alloc_shader_memory(struct radv_device
*device
,
77 struct radv_shader_variant
*shader
);
80 radv_destroy_shader_slabs(struct radv_device
*device
);
82 struct radv_shader_variant
*
83 radv_shader_variant_create(struct radv_device
*device
,
84 struct radv_shader_module
*module
,
85 struct nir_shader
*shader
,
86 struct radv_pipeline_layout
*layout
,
87 const struct ac_shader_variant_key
*key
,
89 unsigned *code_size_out
);
91 struct radv_shader_variant
*
92 radv_create_gs_copy_shader(struct radv_device
*device
, struct nir_shader
*nir
,
93 void **code_out
, unsigned *code_size_out
,
97 radv_shader_variant_destroy(struct radv_device
*device
,
98 struct radv_shader_variant
*variant
);
101 radv_shader_stage_to_user_data_0(gl_shader_stage stage
, bool has_gs
,
105 radv_get_shader_name(struct radv_shader_variant
*var
, gl_shader_stage stage
);
108 radv_shader_dump_stats(struct radv_device
*device
,
109 struct radv_shader_variant
*variant
,
110 gl_shader_stage stage
,