101e04c3fSmrg/*
201e04c3fSmrg * Copyright © 2017 Intel Corporation
301e04c3fSmrg *
401e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
501e04c3fSmrg * copy of this software and associated documentation files (the "Software"),
601e04c3fSmrg * to deal in the Software without restriction, including without limitation
701e04c3fSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
801e04c3fSmrg * and/or sell copies of the Software, and to permit persons to whom the
901e04c3fSmrg * Software is furnished to do so, subject to the following conditions:
1001e04c3fSmrg *
1101e04c3fSmrg * The above copyright notice and this permission notice (including the next
1201e04c3fSmrg * paragraph) shall be included in all copies or substantial portions of the
1301e04c3fSmrg * Software.
1401e04c3fSmrg *
1501e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1601e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1701e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1801e04c3fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1901e04c3fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2001e04c3fSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2101e04c3fSmrg * IN THE SOFTWARE.
2201e04c3fSmrg */
2301e04c3fSmrg
2401e04c3fSmrg#ifndef GL_NIR_LINKER_H
2501e04c3fSmrg#define GL_NIR_LINKER_H
2601e04c3fSmrg
2701e04c3fSmrg#ifdef __cplusplus
2801e04c3fSmrgextern "C" {
2901e04c3fSmrg#endif
3001e04c3fSmrg
3101e04c3fSmrgstruct gl_context;
3201e04c3fSmrgstruct gl_shader_program;
3301e04c3fSmrg
347ec681f3Smrgstruct gl_nir_linker_options {
357ec681f3Smrg   bool fill_parameters;
367ec681f3Smrg};
377ec681f3Smrg
387ec681f3Smrg#define nir_foreach_gl_uniform_variable(var, shader) \
397ec681f3Smrg   nir_foreach_variable_with_modes(var, shader, nir_var_uniform | \
407ec681f3Smrg                                                nir_var_mem_ubo | \
417ec681f3Smrg                                                nir_var_mem_ssbo)
427ec681f3Smrg
437ec681f3Smrgbool gl_nir_link_spirv(struct gl_context *ctx,
447ec681f3Smrg                       struct gl_shader_program *prog,
457ec681f3Smrg                       const struct gl_nir_linker_options *options);
467ec681f3Smrg
477ec681f3Smrgbool gl_nir_link_glsl(struct gl_context *ctx, struct gl_shader_program *prog);
487ec681f3Smrg
4901e04c3fSmrgbool gl_nir_link_uniforms(struct gl_context *ctx,
507ec681f3Smrg                          struct gl_shader_program *prog,
517ec681f3Smrg                          bool fill_parameters);
5201e04c3fSmrg
5301e04c3fSmrgvoid gl_nir_set_uniform_initializers(struct gl_context *ctx,
5401e04c3fSmrg                                     struct gl_shader_program *prog);
5501e04c3fSmrg
5601e04c3fSmrgvoid nir_build_program_resource_list(struct gl_context *ctx,
577ec681f3Smrg                                     struct gl_shader_program *prog,
587ec681f3Smrg                                     bool rebuild_resourse_list);
5901e04c3fSmrg
6001e04c3fSmrgvoid gl_nir_link_assign_atomic_counter_resources(struct gl_context *ctx,
6101e04c3fSmrg                                                 struct gl_shader_program *prog);
6201e04c3fSmrg
637ec681f3Smrgvoid gl_nir_link_check_atomic_counter_resources(struct gl_context *ctx,
647ec681f3Smrg                                                struct gl_shader_program *prog);
657ec681f3Smrg
6601e04c3fSmrgvoid gl_nir_link_assign_xfb_resources(struct gl_context *ctx,
6701e04c3fSmrg                                      struct gl_shader_program *prog);
6801e04c3fSmrg
697ec681f3Smrgbool gl_nir_link_uniform_blocks(struct gl_context *ctx,
707ec681f3Smrg                                struct gl_shader_program *prog);
717ec681f3Smrg
7201e04c3fSmrg#ifdef __cplusplus
7301e04c3fSmrg} /* extern "C" */
7401e04c3fSmrg#endif
7501e04c3fSmrg
7601e04c3fSmrg#endif /* GL_NIR_LINKER_H */
77