1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright (c) 2017 Lima Project 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a copy 5bf215546Sopenharmony_ci * of this software and associated documentation files (the "Software"), to deal 6bf215546Sopenharmony_ci * in the Software without restriction, including without limitation the rights 7bf215546Sopenharmony_ci * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8bf215546Sopenharmony_ci * copies of the Software, and to permit persons to whom the Software is 9bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 12bf215546Sopenharmony_ci * all copies or substantial portions of the Software. 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17bf215546Sopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19bf215546Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20bf215546Sopenharmony_ci * THE SOFTWARE. 21bf215546Sopenharmony_ci * 22bf215546Sopenharmony_ci */ 23bf215546Sopenharmony_ci 24bf215546Sopenharmony_ci#ifndef LIMA_IR_H 25bf215546Sopenharmony_ci#define LIMA_IR_H 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ci#include <stdio.h> 28bf215546Sopenharmony_ci#include <lima_screen.h> 29bf215546Sopenharmony_ci 30bf215546Sopenharmony_ci#include "nir.h" 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ci#define gpir_debug(...) \ 33bf215546Sopenharmony_ci do { \ 34bf215546Sopenharmony_ci if (lima_debug & LIMA_DEBUG_GP) \ 35bf215546Sopenharmony_ci printf("gpir: " __VA_ARGS__); \ 36bf215546Sopenharmony_ci } while (0) 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_ci#define gpir_error(...) \ 39bf215546Sopenharmony_ci fprintf(stderr, "gpir: " __VA_ARGS__) 40bf215546Sopenharmony_ci 41bf215546Sopenharmony_ci#define ppir_debug(...) \ 42bf215546Sopenharmony_ci do { \ 43bf215546Sopenharmony_ci if (lima_debug & LIMA_DEBUG_PP) \ 44bf215546Sopenharmony_ci printf("ppir: " __VA_ARGS__); \ 45bf215546Sopenharmony_ci } while (0) 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_ci#define ppir_error(...) \ 48bf215546Sopenharmony_ci fprintf(stderr, "ppir: " __VA_ARGS__) 49bf215546Sopenharmony_ci 50bf215546Sopenharmony_ci 51bf215546Sopenharmony_cistruct ra_regs; 52bf215546Sopenharmony_cistruct lima_vs_compiled_shader; 53bf215546Sopenharmony_cistruct lima_fs_compiled_shader; 54bf215546Sopenharmony_ci 55bf215546Sopenharmony_ci/* gpir interface */ 56bf215546Sopenharmony_cibool gpir_compile_nir(struct lima_vs_compiled_shader *prog, struct nir_shader *nir, 57bf215546Sopenharmony_ci struct util_debug_callback *debug); 58bf215546Sopenharmony_ci 59bf215546Sopenharmony_ci 60bf215546Sopenharmony_ci/* ppir interface */ 61bf215546Sopenharmony_cibool ppir_compile_nir(struct lima_fs_compiled_shader *prog, struct nir_shader *nir, 62bf215546Sopenharmony_ci struct ra_regs *ra, 63bf215546Sopenharmony_ci struct util_debug_callback *debug); 64bf215546Sopenharmony_cistruct ra_regs *ppir_regalloc_init(void *mem_ctx); 65bf215546Sopenharmony_ci 66bf215546Sopenharmony_civoid lima_nir_lower_uniform_to_scalar(nir_shader *shader); 67bf215546Sopenharmony_cibool lima_nir_scale_trig(nir_shader *shader); 68bf215546Sopenharmony_cibool lima_nir_lower_ftrunc(nir_shader *shader); 69bf215546Sopenharmony_cibool lima_nir_split_load_input(nir_shader *shader); 70bf215546Sopenharmony_cibool lima_nir_split_loads(nir_shader *shader); 71bf215546Sopenharmony_ci 72bf215546Sopenharmony_civoid lima_nir_duplicate_load_consts(nir_shader *shader); 73bf215546Sopenharmony_civoid lima_nir_duplicate_load_inputs(nir_shader *shader); 74bf215546Sopenharmony_civoid lima_nir_duplicate_load_uniforms(nir_shader *shader); 75bf215546Sopenharmony_ci 76bf215546Sopenharmony_cibool lima_nir_lower_txp(nir_shader *shader); 77bf215546Sopenharmony_ci 78bf215546Sopenharmony_ci#endif 79