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 #ifndef BRW_NIR_RT_H 25 #define BRW_NIR_RT_H 26 27 #include "brw_nir.h" 28 #include "brw_rt.h" 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 void brw_nir_lower_raygen(nir_shader *nir); 35 void brw_nir_lower_any_hit(nir_shader *nir, 36 const struct intel_device_info *devinfo); 37 void brw_nir_lower_closest_hit(nir_shader *nir); 38 void brw_nir_lower_miss(nir_shader *nir); 39 void brw_nir_lower_callable(nir_shader *nir); 40 void brw_nir_lower_combined_intersection_any_hit(nir_shader *intersection, 41 const nir_shader *any_hit, 42 const struct intel_device_info *devinfo); 43 44 /* We reserve the first 16B of the stack for callee data pointers */ 45 #define BRW_BTD_STACK_RESUME_BSR_ADDR_OFFSET 0 46 #define BRW_BTD_STACK_CALL_DATA_PTR_OFFSET 8 47 #define BRW_BTD_STACK_CALLEE_DATA_SIZE 16 48 49 /* We require the stack to be 8B aligned at the start of a shader */ 50 #define BRW_BTD_STACK_ALIGN 8 51 52 bool brw_nir_lower_ray_queries(nir_shader *shader, 53 const struct intel_device_info *devinfo); 54 55 void brw_nir_lower_shader_returns(nir_shader *shader); 56 57 bool brw_nir_lower_shader_calls(nir_shader *shader); 58 59 void brw_nir_lower_rt_intrinsics(nir_shader *shader, 60 const struct intel_device_info *devinfo); 61 void brw_nir_lower_intersection_shader(nir_shader *intersection, 62 const nir_shader *any_hit, 63 const struct intel_device_info *devinfo); 64 65 nir_shader * 66 brw_nir_create_raygen_trampoline(const struct brw_compiler *compiler, 67 void *mem_ctx); 68 nir_shader * 69 brw_nir_create_trivial_return_shader(const struct brw_compiler *compiler, 70 void *mem_ctx); 71 72 #ifdef __cplusplus 73 } 74 #endif 75 76 #endif /* BRW_NIR_RT_H */ 77