1 /* 2 * Copyright © 2020 Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 */ 23 24 #pragma once 25 26 #include "brw_nir.h" 27 #include "brw_rt.h" 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 void brw_nir_lower_raygen(nir_shader *nir); 34 void brw_nir_lower_any_hit(nir_shader *nir, 35 const struct intel_device_info *devinfo); 36 void brw_nir_lower_closest_hit(nir_shader *nir); 37 void brw_nir_lower_miss(nir_shader *nir); 38 void brw_nir_lower_callable(nir_shader *nir); 39 void brw_nir_lower_combined_intersection_any_hit(nir_shader *intersection, 40 const nir_shader *any_hit, 41 const struct intel_device_info *devinfo); 42 43 /* We reserve the first 16B of the stack for callee data pointers */ 44 #define BRW_BTD_STACK_RESUME_BSR_ADDR_OFFSET 0 45 #define BRW_BTD_STACK_CALL_DATA_PTR_OFFSET 8 46 #define BRW_BTD_STACK_CALLEE_DATA_SIZE 16 47 48 /* We require the stack to be 8B aligned at the start of a shader */ 49 #define BRW_BTD_STACK_ALIGN 8 50 51 bool brw_nir_lower_ray_queries(nir_shader *shader, 52 const struct intel_device_info *devinfo); 53 54 void brw_nir_lower_shader_returns(nir_shader *shader); 55 56 bool brw_nir_lower_shader_calls(nir_shader *shader, struct brw_bs_prog_key *key); 57 58 void brw_nir_lower_rt_intrinsics(nir_shader *shader, 59 const struct intel_device_info *devinfo); 60 void brw_nir_lower_intersection_shader(nir_shader *intersection, 61 const nir_shader *any_hit, 62 const struct intel_device_info *devinfo); 63 64 nir_shader * 65 brw_nir_create_raygen_trampoline(const struct brw_compiler *compiler, 66 void *mem_ctx); 67 nir_shader * 68 brw_nir_create_trivial_return_shader(const struct brw_compiler *compiler, 69 void *mem_ctx); 70 71 #ifdef __cplusplus 72 } 73 #endif 74