196c5ddc4Srjs/* 296c5ddc4Srjs * Copyright (C) 2016 Intel Corporation 396c5ddc4Srjs * 496c5ddc4Srjs * Permission is hereby granted, free of charge, to any person obtaining a 596c5ddc4Srjs * copy of this software and associated documentation files (the "Software"), 696c5ddc4Srjs * to deal in the Software without restriction, including without limitation 796c5ddc4Srjs * the rights to use, copy, modify, merge, publish, distribute, sublicense, 896c5ddc4Srjs * and/or sell copies of the Software, and to permit persons to whom the 996c5ddc4Srjs * Software is furnished to do so, subject to the following conditions: 1096c5ddc4Srjs * 1196c5ddc4Srjs * The above copyright notice and this permission notice (including the next 1296c5ddc4Srjs * paragraph) shall be included in all copies or substantial portions of the 1396c5ddc4Srjs * Software. 1496c5ddc4Srjs * 1596c5ddc4Srjs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1696c5ddc4Srjs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1796c5ddc4Srjs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1896c5ddc4Srjs * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1996c5ddc4Srjs * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 2096c5ddc4Srjs * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 2196c5ddc4Srjs * IN THE SOFTWARE. 2296c5ddc4Srjs */ 2396c5ddc4Srjs 2496c5ddc4Srjs 2596c5ddc4Srjs/* Instructions, enums and structures for RT. 2696c5ddc4Srjs * 2796c5ddc4Srjs * This file has been generated, do not hand edit. 2896c5ddc4Srjs */ 2996c5ddc4Srjs 3096c5ddc4Srjs#ifndef GFX_PACK_H 3196c5ddc4Srjs#define GFX_PACK_H 3296c5ddc4Srjs 3396c5ddc4Srjs#include <stdio.h> 3496c5ddc4Srjs#include <stdint.h> 3596c5ddc4Srjs#include <stdbool.h> 3696c5ddc4Srjs#include <assert.h> 3796c5ddc4Srjs#include <math.h> 3896c5ddc4Srjs 3996c5ddc4Srjs#ifndef __gen_validate_value 4096c5ddc4Srjs#define __gen_validate_value(x) 4196c5ddc4Srjs#endif 4296c5ddc4Srjs 4396c5ddc4Srjs#ifndef __intel_field_functions 4496c5ddc4Srjs#define __intel_field_functions 4596c5ddc4Srjs 4696c5ddc4Srjs#ifdef NDEBUG 4796c5ddc4Srjs#define NDEBUG_UNUSED __attribute__((unused)) 4896c5ddc4Srjs#else 4996c5ddc4Srjs#define NDEBUG_UNUSED 5096c5ddc4Srjs#endif 5196c5ddc4Srjs 5296c5ddc4Srjsunion __intel_value { 5396c5ddc4Srjs float f; 5496c5ddc4Srjs uint32_t dw; 5596c5ddc4Srjs}; 5696c5ddc4Srjs 5796c5ddc4Srjsstatic inline __attribute__((always_inline)) uint64_t 5896c5ddc4Srjs__gen_mbo(uint32_t start, uint32_t end) 5996c5ddc4Srjs{ 6096c5ddc4Srjs return (~0ull >> (64 - (end - start + 1))) << start; 6196c5ddc4Srjs} 6296c5ddc4Srjs 6396c5ddc4Srjsstatic inline __attribute__((always_inline)) uint64_t 6496c5ddc4Srjs__gen_uint(uint64_t v, uint32_t start, NDEBUG_UNUSED uint32_t end) 6596c5ddc4Srjs{ 6696c5ddc4Srjs __gen_validate_value(v); 6796c5ddc4Srjs 6896c5ddc4Srjs#ifndef NDEBUG 6996c5ddc4Srjs const int width = end - start + 1; 7096c5ddc4Srjs if (width < 64) { 7196c5ddc4Srjs const uint64_t max = (1ull << width) - 1; 7296c5ddc4Srjs assert(v <= max); 7396c5ddc4Srjs } 7496c5ddc4Srjs#endif 7596c5ddc4Srjs 7696c5ddc4Srjs return v << start; 7796c5ddc4Srjs} 7896c5ddc4Srjs 7996c5ddc4Srjsstatic inline __attribute__((always_inline)) uint64_t 8096c5ddc4Srjs__gen_sint(int64_t v, uint32_t start, uint32_t end) 8196c5ddc4Srjs{ 8296c5ddc4Srjs const int width = end - start + 1; 8396c5ddc4Srjs 8496c5ddc4Srjs __gen_validate_value(v); 8596c5ddc4Srjs 8696c5ddc4Srjs#ifndef NDEBUG 8796c5ddc4Srjs if (width < 64) { 8896c5ddc4Srjs const int64_t max = (1ll << (width - 1)) - 1; 8996c5ddc4Srjs const int64_t min = -(1ll << (width - 1)); 9096c5ddc4Srjs assert(min <= v && v <= max); 9196c5ddc4Srjs } 9296c5ddc4Srjs#endif 9396c5ddc4Srjs 9496c5ddc4Srjs const uint64_t mask = ~0ull >> (64 - width); 9596c5ddc4Srjs 9696c5ddc4Srjs return (v & mask) << start; 9796c5ddc4Srjs} 9896c5ddc4Srjs 9996c5ddc4Srjsstatic inline __attribute__((always_inline)) uint64_t 10096c5ddc4Srjs__gen_offset(uint64_t v, NDEBUG_UNUSED uint32_t start, NDEBUG_UNUSED uint32_t end) 10196c5ddc4Srjs{ 10296c5ddc4Srjs __gen_validate_value(v); 10396c5ddc4Srjs#ifndef NDEBUG 10496c5ddc4Srjs uint64_t mask = (~0ull >> (64 - (end - start + 1))) << start; 10596c5ddc4Srjs 10696c5ddc4Srjs assert((v & ~mask) == 0); 10796c5ddc4Srjs#endif 10896c5ddc4Srjs 10996c5ddc4Srjs return v; 11096c5ddc4Srjs} 11196c5ddc4Srjs 11296c5ddc4Srjsstatic inline __attribute__((always_inline)) uint64_t 11396c5ddc4Srjs__gen_address(__gen_user_data *data, void *location, 11496c5ddc4Srjs __gen_address_type address, uint32_t delta, 11596c5ddc4Srjs __attribute__((unused)) uint32_t start, uint32_t end) 11696c5ddc4Srjs{ 11796c5ddc4Srjs uint64_t addr_u64 = __gen_combine_address(data, location, address, delta); 11896c5ddc4Srjs if (end == 31) { 11996c5ddc4Srjs return addr_u64; 12096c5ddc4Srjs } else if (end < 63) { 12196c5ddc4Srjs const unsigned shift = 63 - end; 12296c5ddc4Srjs return (addr_u64 << shift) >> shift; 12396c5ddc4Srjs } else { 12496c5ddc4Srjs return addr_u64; 12596c5ddc4Srjs } 12696c5ddc4Srjs} 12796c5ddc4Srjs 12896c5ddc4Srjsstatic inline __attribute__((always_inline)) uint32_t 12996c5ddc4Srjs__gen_float(float v) 13096c5ddc4Srjs{ 13196c5ddc4Srjs __gen_validate_value(v); 13296c5ddc4Srjs return ((union __intel_value) { .f = (v) }).dw; 13396c5ddc4Srjs} 13496c5ddc4Srjs 13596c5ddc4Srjsstatic inline __attribute__((always_inline)) uint64_t 13696c5ddc4Srjs__gen_sfixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits) 13796c5ddc4Srjs{ 13896c5ddc4Srjs __gen_validate_value(v); 13996c5ddc4Srjs 14096c5ddc4Srjs const float factor = (1 << fract_bits); 14196c5ddc4Srjs 14296c5ddc4Srjs#ifndef NDEBUG 14396c5ddc4Srjs const float max = ((1 << (end - start)) - 1) / factor; 14496c5ddc4Srjs const float min = -(1 << (end - start)) / factor; 14596c5ddc4Srjs assert(min <= v && v <= max); 14696c5ddc4Srjs#endif 14796c5ddc4Srjs 14896c5ddc4Srjs const int64_t int_val = llroundf(v * factor); 14996c5ddc4Srjs const uint64_t mask = ~0ull >> (64 - (end - start + 1)); 15096c5ddc4Srjs 15196c5ddc4Srjs return (int_val & mask) << start; 15296c5ddc4Srjs} 15396c5ddc4Srjs 15496c5ddc4Srjsstatic inline __attribute__((always_inline)) uint64_t 15596c5ddc4Srjs__gen_ufixed(float v, uint32_t start, NDEBUG_UNUSED uint32_t end, uint32_t fract_bits) 15696c5ddc4Srjs{ 15796c5ddc4Srjs __gen_validate_value(v); 15896c5ddc4Srjs 15996c5ddc4Srjs const float factor = (1 << fract_bits); 16096c5ddc4Srjs 16196c5ddc4Srjs#ifndef NDEBUG 16296c5ddc4Srjs const float max = ((1 << (end - start + 1)) - 1) / factor; 16396c5ddc4Srjs const float min = 0.0f; 16496c5ddc4Srjs assert(min <= v && v <= max); 16596c5ddc4Srjs#endif 16696c5ddc4Srjs 16796c5ddc4Srjs const uint64_t uint_val = llroundf(v * factor); 16896c5ddc4Srjs 16996c5ddc4Srjs return uint_val << start; 17096c5ddc4Srjs} 17196c5ddc4Srjs 17296c5ddc4Srjs#ifndef __gen_address_type 17396c5ddc4Srjs#error #define __gen_address_type before including this file 17496c5ddc4Srjs#endif 17596c5ddc4Srjs 17696c5ddc4Srjs#ifndef __gen_user_data 17796c5ddc4Srjs#error #define __gen_combine_address before including this file 17896c5ddc4Srjs#endif 17996c5ddc4Srjs 18096c5ddc4Srjs#undef NDEBUG_UNUSED 18196c5ddc4Srjs 18296c5ddc4Srjs#endif 18396c5ddc4Srjs 18496c5ddc4Srjs 18596c5ddc4Srjs#define GFX_BINDLESS_SHADER_RECORD_length 2 18696c5ddc4Srjsstruct GFX_BINDLESS_SHADER_RECORD { 18796c5ddc4Srjs uint32_t OffsetToLocalArguments; 18896c5ddc4Srjs uint32_t BindlessShaderDispatchMode; 18996c5ddc4Srjs#define RT_SIMD16 0 19096c5ddc4Srjs#define RT_SIMD8 1 19196c5ddc4Srjs uint64_t KernelStartPointer; 19296c5ddc4Srjs}; 19396c5ddc4Srjs 19496c5ddc4Srjsstatic inline __attribute__((always_inline)) void 19596c5ddc4SrjsGFX_BINDLESS_SHADER_RECORD_pack(__attribute__((unused)) __gen_user_data *data, 19696c5ddc4Srjs __attribute__((unused)) void * restrict dst, 19796c5ddc4Srjs __attribute__((unused)) const struct GFX_BINDLESS_SHADER_RECORD * restrict values) 19896c5ddc4Srjs{ 19996c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 20096c5ddc4Srjs 20196c5ddc4Srjs dw[0] = 20296c5ddc4Srjs __gen_uint(values->OffsetToLocalArguments, 0, 2) | 20396c5ddc4Srjs __gen_uint(values->BindlessShaderDispatchMode, 4, 4) | 20496c5ddc4Srjs __gen_offset(values->KernelStartPointer, 6, 31); 20596c5ddc4Srjs 20696c5ddc4Srjs dw[1] = 0; 20796c5ddc4Srjs} 20896c5ddc4Srjs 20996c5ddc4Srjs#define GFX_RT_GENERAL_SBT_HANDLE_length 8 21096c5ddc4Srjsstruct GFX_RT_GENERAL_SBT_HANDLE { 21196c5ddc4Srjs struct GFX_BINDLESS_SHADER_RECORD General; 21296c5ddc4Srjs}; 21396c5ddc4Srjs 21496c5ddc4Srjsstatic inline __attribute__((always_inline)) void 21596c5ddc4SrjsGFX_RT_GENERAL_SBT_HANDLE_pack(__attribute__((unused)) __gen_user_data *data, 21696c5ddc4Srjs __attribute__((unused)) void * restrict dst, 21796c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_GENERAL_SBT_HANDLE * restrict values) 21896c5ddc4Srjs{ 21996c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 22096c5ddc4Srjs 22196c5ddc4Srjs GFX_BINDLESS_SHADER_RECORD_pack(data, &dw[0], &values->General); 22296c5ddc4Srjs 22396c5ddc4Srjs dw[2] = 0; 22496c5ddc4Srjs 22596c5ddc4Srjs dw[3] = 0; 22696c5ddc4Srjs 22796c5ddc4Srjs dw[4] = 0; 22896c5ddc4Srjs 22996c5ddc4Srjs dw[5] = 0; 23096c5ddc4Srjs 23196c5ddc4Srjs dw[6] = 0; 23296c5ddc4Srjs 23396c5ddc4Srjs dw[7] = 0; 23496c5ddc4Srjs} 23596c5ddc4Srjs 23696c5ddc4Srjs#define GFX_RT_TRIANGLES_SBT_HANDLE_length 8 23796c5ddc4Srjsstruct GFX_RT_TRIANGLES_SBT_HANDLE { 23896c5ddc4Srjs struct GFX_BINDLESS_SHADER_RECORD ClosestHit; 23996c5ddc4Srjs struct GFX_BINDLESS_SHADER_RECORD AnyHit; 24096c5ddc4Srjs}; 24196c5ddc4Srjs 24296c5ddc4Srjsstatic inline __attribute__((always_inline)) void 24396c5ddc4SrjsGFX_RT_TRIANGLES_SBT_HANDLE_pack(__attribute__((unused)) __gen_user_data *data, 24496c5ddc4Srjs __attribute__((unused)) void * restrict dst, 24596c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_TRIANGLES_SBT_HANDLE * restrict values) 24696c5ddc4Srjs{ 24796c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 24896c5ddc4Srjs 24996c5ddc4Srjs GFX_BINDLESS_SHADER_RECORD_pack(data, &dw[0], &values->ClosestHit); 25096c5ddc4Srjs 25196c5ddc4Srjs GFX_BINDLESS_SHADER_RECORD_pack(data, &dw[2], &values->AnyHit); 25296c5ddc4Srjs 25396c5ddc4Srjs dw[4] = 0; 25496c5ddc4Srjs 25596c5ddc4Srjs dw[5] = 0; 25696c5ddc4Srjs 25796c5ddc4Srjs dw[6] = 0; 25896c5ddc4Srjs 25996c5ddc4Srjs dw[7] = 0; 26096c5ddc4Srjs} 26196c5ddc4Srjs 26296c5ddc4Srjs#define GFX_RT_PROCEDURAL_SBT_HANDLE_length 8 26396c5ddc4Srjsstruct GFX_RT_PROCEDURAL_SBT_HANDLE { 26496c5ddc4Srjs struct GFX_BINDLESS_SHADER_RECORD ClosestHit; 26596c5ddc4Srjs struct GFX_BINDLESS_SHADER_RECORD Intersection; 26696c5ddc4Srjs}; 26796c5ddc4Srjs 26896c5ddc4Srjsstatic inline __attribute__((always_inline)) void 26996c5ddc4SrjsGFX_RT_PROCEDURAL_SBT_HANDLE_pack(__attribute__((unused)) __gen_user_data *data, 27096c5ddc4Srjs __attribute__((unused)) void * restrict dst, 27196c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_PROCEDURAL_SBT_HANDLE * restrict values) 27296c5ddc4Srjs{ 27396c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 27496c5ddc4Srjs 27596c5ddc4Srjs GFX_BINDLESS_SHADER_RECORD_pack(data, &dw[0], &values->ClosestHit); 27696c5ddc4Srjs 27796c5ddc4Srjs GFX_BINDLESS_SHADER_RECORD_pack(data, &dw[2], &values->Intersection); 27896c5ddc4Srjs 27996c5ddc4Srjs dw[4] = 0; 28096c5ddc4Srjs 28196c5ddc4Srjs dw[5] = 0; 28296c5ddc4Srjs 28396c5ddc4Srjs dw[6] = 0; 28496c5ddc4Srjs 28596c5ddc4Srjs dw[7] = 0; 28696c5ddc4Srjs} 28796c5ddc4Srjs 28896c5ddc4Srjs#define GFX_RT_SHADER_TABLE_length 2 28996c5ddc4Srjsstruct GFX_RT_SHADER_TABLE { 29096c5ddc4Srjs __gen_address_type BaseAddress; 29196c5ddc4Srjs uint32_t Stride; 29296c5ddc4Srjs}; 29396c5ddc4Srjs 29496c5ddc4Srjsstatic inline __attribute__((always_inline)) void 29596c5ddc4SrjsGFX_RT_SHADER_TABLE_pack(__attribute__((unused)) __gen_user_data *data, 29696c5ddc4Srjs __attribute__((unused)) void * restrict dst, 29796c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_SHADER_TABLE * restrict values) 29896c5ddc4Srjs{ 29996c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 30096c5ddc4Srjs 30196c5ddc4Srjs const uint64_t v0 = 30296c5ddc4Srjs __gen_uint(values->Stride, 48, 63); 30396c5ddc4Srjs const uint64_t v0_address = 30496c5ddc4Srjs __gen_address(data, &dw[0], values->BaseAddress, v0, 0, 47); 30596c5ddc4Srjs dw[0] = v0_address; 30696c5ddc4Srjs dw[1] = (v0_address >> 32) | (v0 >> 32); 30796c5ddc4Srjs} 30896c5ddc4Srjs 30996c5ddc4Srjs#define GFX_RT_DISPATCH_GLOBALS_length 20 31096c5ddc4Srjsstruct GFX_RT_DISPATCH_GLOBALS { 31196c5ddc4Srjs __gen_address_type MemBaseAddress; 31296c5ddc4Srjs struct GFX_BINDLESS_SHADER_RECORD CallStackHandler; 31396c5ddc4Srjs uint32_t AsyncRTStackSize; 31496c5ddc4Srjs uint32_t NumDSSRTStacks; 31596c5ddc4Srjs uint32_t MaxBVHLevels; 31696c5ddc4Srjs uint32_t Flags; 31796c5ddc4Srjs#define RT_DEPTH_TEST_LESS_EQUAL 1 31896c5ddc4Srjs struct GFX_RT_SHADER_TABLE HitGroupTable; 31996c5ddc4Srjs struct GFX_RT_SHADER_TABLE MissGroupTable; 32096c5ddc4Srjs uint32_t SWStackSize; 32196c5ddc4Srjs uint32_t LaunchWidth; 32296c5ddc4Srjs uint32_t LaunchHeight; 32396c5ddc4Srjs uint32_t LaunchDepth; 32496c5ddc4Srjs struct GFX_RT_SHADER_TABLE CallableGroupTable; 32596c5ddc4Srjs __gen_address_type ResumeShaderTable; 32696c5ddc4Srjs}; 32796c5ddc4Srjs 32896c5ddc4Srjsstatic inline __attribute__((always_inline)) void 32996c5ddc4SrjsGFX_RT_DISPATCH_GLOBALS_pack(__attribute__((unused)) __gen_user_data *data, 33096c5ddc4Srjs __attribute__((unused)) void * restrict dst, 33196c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_DISPATCH_GLOBALS * restrict values) 33296c5ddc4Srjs{ 33396c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 33496c5ddc4Srjs 33596c5ddc4Srjs const uint64_t v0_address = 33696c5ddc4Srjs __gen_address(data, &dw[0], values->MemBaseAddress, 0, 0, 63); 33796c5ddc4Srjs dw[0] = v0_address; 33896c5ddc4Srjs dw[1] = v0_address >> 32; 33996c5ddc4Srjs 34096c5ddc4Srjs GFX_BINDLESS_SHADER_RECORD_pack(data, &dw[2], &values->CallStackHandler); 34196c5ddc4Srjs 34296c5ddc4Srjs dw[4] = 34396c5ddc4Srjs __gen_uint(values->AsyncRTStackSize, 0, 31); 34496c5ddc4Srjs 34596c5ddc4Srjs dw[5] = 34696c5ddc4Srjs __gen_uint(values->NumDSSRTStacks, 0, 15); 34796c5ddc4Srjs 34896c5ddc4Srjs dw[6] = 34996c5ddc4Srjs __gen_uint(values->MaxBVHLevels, 0, 2); 35096c5ddc4Srjs 35196c5ddc4Srjs dw[7] = 35296c5ddc4Srjs __gen_uint(values->Flags, 0, 0); 35396c5ddc4Srjs 35496c5ddc4Srjs GFX_RT_SHADER_TABLE_pack(data, &dw[8], &values->HitGroupTable); 35596c5ddc4Srjs 35696c5ddc4Srjs GFX_RT_SHADER_TABLE_pack(data, &dw[10], &values->MissGroupTable); 35796c5ddc4Srjs 35896c5ddc4Srjs dw[12] = 35996c5ddc4Srjs __gen_uint(values->SWStackSize, 0, 31); 36096c5ddc4Srjs 36196c5ddc4Srjs dw[13] = 36296c5ddc4Srjs __gen_uint(values->LaunchWidth, 0, 31); 36396c5ddc4Srjs 36496c5ddc4Srjs dw[14] = 36596c5ddc4Srjs __gen_uint(values->LaunchHeight, 0, 31); 36696c5ddc4Srjs 36796c5ddc4Srjs dw[15] = 36896c5ddc4Srjs __gen_uint(values->LaunchDepth, 0, 31); 36996c5ddc4Srjs 37096c5ddc4Srjs GFX_RT_SHADER_TABLE_pack(data, &dw[16], &values->CallableGroupTable); 37196c5ddc4Srjs 37296c5ddc4Srjs const uint64_t v18_address = 37396c5ddc4Srjs __gen_address(data, &dw[18], values->ResumeShaderTable, 0, 0, 63); 37496c5ddc4Srjs dw[18] = v18_address; 37596c5ddc4Srjs dw[19] = v18_address >> 32; 37696c5ddc4Srjs} 37796c5ddc4Srjs 37896c5ddc4Srjs#define GFX_RT_BVH_VEC3_length 3 37996c5ddc4Srjsstruct GFX_RT_BVH_VEC3 { 38096c5ddc4Srjs float X; 38196c5ddc4Srjs float Y; 38296c5ddc4Srjs float Z; 38396c5ddc4Srjs}; 38496c5ddc4Srjs 38596c5ddc4Srjsstatic inline __attribute__((always_inline)) void 38696c5ddc4SrjsGFX_RT_BVH_VEC3_pack(__attribute__((unused)) __gen_user_data *data, 38796c5ddc4Srjs __attribute__((unused)) void * restrict dst, 38896c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_BVH_VEC3 * restrict values) 38996c5ddc4Srjs{ 39096c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 39196c5ddc4Srjs 39296c5ddc4Srjs dw[0] = 39396c5ddc4Srjs __gen_float(values->X); 39496c5ddc4Srjs 39596c5ddc4Srjs dw[1] = 39696c5ddc4Srjs __gen_float(values->Y); 39796c5ddc4Srjs 39896c5ddc4Srjs dw[2] = 39996c5ddc4Srjs __gen_float(values->Z); 40096c5ddc4Srjs} 40196c5ddc4Srjs 40296c5ddc4Srjs#define GFX_RT_BVH_length 16 40396c5ddc4Srjsstruct GFX_RT_BVH { 40496c5ddc4Srjs uint64_t RootNodeOffset; 40596c5ddc4Srjs struct GFX_RT_BVH_VEC3 BoundsMin; 40696c5ddc4Srjs struct GFX_RT_BVH_VEC3 BoundsMax; 40796c5ddc4Srjs}; 40896c5ddc4Srjs 40996c5ddc4Srjsstatic inline __attribute__((always_inline)) void 41096c5ddc4SrjsGFX_RT_BVH_pack(__attribute__((unused)) __gen_user_data *data, 41196c5ddc4Srjs __attribute__((unused)) void * restrict dst, 41296c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_BVH * restrict values) 41396c5ddc4Srjs{ 41496c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 41596c5ddc4Srjs 41696c5ddc4Srjs const uint64_t v0 = 41796c5ddc4Srjs __gen_offset(values->RootNodeOffset, 0, 63); 41896c5ddc4Srjs dw[0] = v0; 41996c5ddc4Srjs dw[1] = v0 >> 32; 42096c5ddc4Srjs 42196c5ddc4Srjs GFX_RT_BVH_VEC3_pack(data, &dw[2], &values->BoundsMin); 42296c5ddc4Srjs 42396c5ddc4Srjs GFX_RT_BVH_VEC3_pack(data, &dw[5], &values->BoundsMax); 42496c5ddc4Srjs 42596c5ddc4Srjs dw[8] = 0; 42696c5ddc4Srjs 42796c5ddc4Srjs dw[9] = 0; 42896c5ddc4Srjs 42996c5ddc4Srjs dw[10] = 0; 43096c5ddc4Srjs 43196c5ddc4Srjs dw[11] = 0; 43296c5ddc4Srjs 43396c5ddc4Srjs dw[12] = 0; 43496c5ddc4Srjs 43596c5ddc4Srjs dw[13] = 0; 43696c5ddc4Srjs 43796c5ddc4Srjs dw[14] = 0; 43896c5ddc4Srjs 43996c5ddc4Srjs dw[15] = 0; 44096c5ddc4Srjs} 44196c5ddc4Srjs 44296c5ddc4Srjs#define GFX_RT_BVH_INTERNAL_NODE_length 16 44396c5ddc4Srjsstruct GFX_RT_BVH_INTERNAL_NODE { 44496c5ddc4Srjs struct GFX_RT_BVH_VEC3 Origin; 44596c5ddc4Srjs int32_t ChildOffset; 44696c5ddc4Srjs uint32_t NodeType; 44796c5ddc4Srjs#define NODE_TYPE_INTERNAL 0 44896c5ddc4Srjs#define NODE_TYPE_INSTANCE 1 44996c5ddc4Srjs#define NODE_TYPE_PROCEDURAL 3 45096c5ddc4Srjs#define NODE_TYPE_QUAD 4 45196c5ddc4Srjs#define NODE_TYPE_INVALID 7 45296c5ddc4Srjs int32_t ChildBoundsExponentX; 45396c5ddc4Srjs int32_t ChildBoundsExponentY; 45496c5ddc4Srjs int32_t ChildBoundsExponentZ; 45596c5ddc4Srjs uint32_t NodeRayMask; 45696c5ddc4Srjs uint32_t ChildSize[6]; 45796c5ddc4Srjs uint32_t ChildType[6]; 45896c5ddc4Srjs uint32_t StartPrimitive[6]; 45996c5ddc4Srjs uint32_t ChildLowerXBound[6]; 46096c5ddc4Srjs uint32_t ChildUpperXBound[6]; 46196c5ddc4Srjs uint32_t ChildLowerYBound[6]; 46296c5ddc4Srjs uint32_t ChildUpperYBound[6]; 46396c5ddc4Srjs uint32_t ChildLowerZBound[6]; 46496c5ddc4Srjs uint32_t ChildUpperZBound[6]; 46596c5ddc4Srjs}; 46696c5ddc4Srjs 46796c5ddc4Srjsstatic inline __attribute__((always_inline)) void 46896c5ddc4SrjsGFX_RT_BVH_INTERNAL_NODE_pack(__attribute__((unused)) __gen_user_data *data, 46996c5ddc4Srjs __attribute__((unused)) void * restrict dst, 47096c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_BVH_INTERNAL_NODE * restrict values) 47196c5ddc4Srjs{ 47296c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 47396c5ddc4Srjs 47496c5ddc4Srjs GFX_RT_BVH_VEC3_pack(data, &dw[0], &values->Origin); 47596c5ddc4Srjs 47696c5ddc4Srjs dw[3] = 47796c5ddc4Srjs __gen_sint(values->ChildOffset, 0, 31); 47896c5ddc4Srjs 47996c5ddc4Srjs dw[4] = 48096c5ddc4Srjs __gen_uint(values->NodeType, 0, 7) | 48196c5ddc4Srjs __gen_sint(values->ChildBoundsExponentX, 16, 23) | 48296c5ddc4Srjs __gen_sint(values->ChildBoundsExponentY, 24, 31); 48396c5ddc4Srjs 48496c5ddc4Srjs dw[5] = 48596c5ddc4Srjs __gen_sint(values->ChildBoundsExponentZ, 0, 8) | 48696c5ddc4Srjs __gen_uint(values->NodeRayMask, 8, 15) | 48796c5ddc4Srjs __gen_uint(values->ChildSize[0], 16, 17) | 48896c5ddc4Srjs __gen_uint(values->ChildType[0], 18, 21) | 48996c5ddc4Srjs __gen_uint(values->StartPrimitive[0], 18, 21) | 49096c5ddc4Srjs __gen_uint(values->ChildSize[1], 24, 25) | 49196c5ddc4Srjs __gen_uint(values->ChildType[1], 26, 29) | 49296c5ddc4Srjs __gen_uint(values->StartPrimitive[1], 26, 29); 49396c5ddc4Srjs 49496c5ddc4Srjs dw[6] = 49596c5ddc4Srjs __gen_uint(values->ChildSize[2], 0, 1) | 49696c5ddc4Srjs __gen_uint(values->ChildType[2], 2, 5) | 49796c5ddc4Srjs __gen_uint(values->StartPrimitive[2], 2, 5) | 49896c5ddc4Srjs __gen_uint(values->ChildSize[3], 8, 9) | 49996c5ddc4Srjs __gen_uint(values->ChildType[3], 10, 13) | 50096c5ddc4Srjs __gen_uint(values->StartPrimitive[3], 10, 13) | 50196c5ddc4Srjs __gen_uint(values->ChildSize[4], 16, 17) | 50296c5ddc4Srjs __gen_uint(values->ChildType[4], 18, 21) | 50396c5ddc4Srjs __gen_uint(values->StartPrimitive[4], 18, 21) | 50496c5ddc4Srjs __gen_uint(values->ChildSize[5], 24, 25) | 50596c5ddc4Srjs __gen_uint(values->ChildType[5], 26, 29) | 50696c5ddc4Srjs __gen_uint(values->StartPrimitive[5], 26, 29); 50796c5ddc4Srjs 50896c5ddc4Srjs dw[7] = 50996c5ddc4Srjs __gen_uint(values->ChildLowerXBound[0], 0, 7) | 51096c5ddc4Srjs __gen_uint(values->ChildLowerXBound[1], 8, 15) | 51196c5ddc4Srjs __gen_uint(values->ChildLowerXBound[2], 16, 23) | 51296c5ddc4Srjs __gen_uint(values->ChildLowerXBound[3], 24, 31); 51396c5ddc4Srjs 51496c5ddc4Srjs dw[8] = 51596c5ddc4Srjs __gen_uint(values->ChildLowerXBound[4], 0, 7) | 51696c5ddc4Srjs __gen_uint(values->ChildLowerXBound[5], 8, 15) | 51796c5ddc4Srjs __gen_uint(values->ChildUpperXBound[0], 16, 23) | 51896c5ddc4Srjs __gen_uint(values->ChildUpperXBound[1], 24, 31); 51996c5ddc4Srjs 52096c5ddc4Srjs dw[9] = 52196c5ddc4Srjs __gen_uint(values->ChildUpperXBound[2], 0, 7) | 52296c5ddc4Srjs __gen_uint(values->ChildUpperXBound[3], 8, 15) | 52396c5ddc4Srjs __gen_uint(values->ChildUpperXBound[4], 16, 23) | 52496c5ddc4Srjs __gen_uint(values->ChildUpperXBound[5], 24, 31); 52596c5ddc4Srjs 52696c5ddc4Srjs dw[10] = 52796c5ddc4Srjs __gen_uint(values->ChildLowerYBound[0], 0, 7) | 52896c5ddc4Srjs __gen_uint(values->ChildLowerYBound[1], 8, 15) | 52996c5ddc4Srjs __gen_uint(values->ChildLowerYBound[2], 16, 23) | 53096c5ddc4Srjs __gen_uint(values->ChildLowerYBound[3], 24, 31); 53196c5ddc4Srjs 53296c5ddc4Srjs dw[11] = 53396c5ddc4Srjs __gen_uint(values->ChildLowerYBound[4], 0, 7) | 53496c5ddc4Srjs __gen_uint(values->ChildLowerYBound[5], 8, 15) | 53596c5ddc4Srjs __gen_uint(values->ChildUpperYBound[0], 16, 23) | 53696c5ddc4Srjs __gen_uint(values->ChildUpperYBound[1], 24, 31); 53796c5ddc4Srjs 53896c5ddc4Srjs dw[12] = 53996c5ddc4Srjs __gen_uint(values->ChildUpperYBound[2], 0, 7) | 54096c5ddc4Srjs __gen_uint(values->ChildUpperYBound[3], 8, 15) | 54196c5ddc4Srjs __gen_uint(values->ChildUpperYBound[4], 16, 23) | 54296c5ddc4Srjs __gen_uint(values->ChildUpperYBound[5], 24, 31); 54396c5ddc4Srjs 54496c5ddc4Srjs dw[13] = 54596c5ddc4Srjs __gen_uint(values->ChildLowerZBound[0], 0, 7) | 54696c5ddc4Srjs __gen_uint(values->ChildLowerZBound[1], 8, 15) | 54796c5ddc4Srjs __gen_uint(values->ChildLowerZBound[2], 16, 23) | 54896c5ddc4Srjs __gen_uint(values->ChildLowerZBound[3], 24, 31); 54996c5ddc4Srjs 55096c5ddc4Srjs dw[14] = 55196c5ddc4Srjs __gen_uint(values->ChildLowerZBound[4], 0, 7) | 55296c5ddc4Srjs __gen_uint(values->ChildLowerZBound[5], 8, 15) | 55396c5ddc4Srjs __gen_uint(values->ChildUpperZBound[0], 16, 23) | 55496c5ddc4Srjs __gen_uint(values->ChildUpperZBound[1], 24, 31); 55596c5ddc4Srjs 55696c5ddc4Srjs dw[15] = 55796c5ddc4Srjs __gen_uint(values->ChildUpperZBound[2], 0, 7) | 55896c5ddc4Srjs __gen_uint(values->ChildUpperZBound[3], 8, 15) | 55996c5ddc4Srjs __gen_uint(values->ChildUpperZBound[4], 16, 23) | 56096c5ddc4Srjs __gen_uint(values->ChildUpperZBound[5], 24, 31); 56196c5ddc4Srjs} 56296c5ddc4Srjs 56396c5ddc4Srjs#define GFX_RT_BVH_PRIMITIVE_LEAF_DESCRIPTOR_length 2 56496c5ddc4Srjsstruct GFX_RT_BVH_PRIMITIVE_LEAF_DESCRIPTOR { 56596c5ddc4Srjs uint32_t ShaderIndex; 56696c5ddc4Srjs uint32_t GeometryRayMask; 56796c5ddc4Srjs uint32_t GeometryIndex; 56896c5ddc4Srjs uint32_t LeafType; 56996c5ddc4Srjs#define TYPE_QUAD 0 57096c5ddc4Srjs#define TYPE_OPAQUE_CULLING_ENABLED 0 57196c5ddc4Srjs#define TYPE_OPAQUE_CULLING_DISABLED 1 57296c5ddc4Srjs uint32_t GeometryFlags; 57396c5ddc4Srjs#define GEOMETRY_OPAQUE 1 57496c5ddc4Srjs}; 57596c5ddc4Srjs 57696c5ddc4Srjsstatic inline __attribute__((always_inline)) void 57796c5ddc4SrjsGFX_RT_BVH_PRIMITIVE_LEAF_DESCRIPTOR_pack(__attribute__((unused)) __gen_user_data *data, 57896c5ddc4Srjs __attribute__((unused)) void * restrict dst, 57996c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_BVH_PRIMITIVE_LEAF_DESCRIPTOR * restrict values) 58096c5ddc4Srjs{ 58196c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 58296c5ddc4Srjs 58396c5ddc4Srjs dw[0] = 58496c5ddc4Srjs __gen_uint(values->ShaderIndex, 0, 23) | 58596c5ddc4Srjs __gen_uint(values->GeometryRayMask, 24, 31); 58696c5ddc4Srjs 58796c5ddc4Srjs dw[1] = 58896c5ddc4Srjs __gen_uint(values->GeometryIndex, 0, 28) | 58996c5ddc4Srjs __gen_uint(values->LeafType, 29, 29) | 59096c5ddc4Srjs __gen_uint(values->GeometryFlags, 30, 31); 59196c5ddc4Srjs} 59296c5ddc4Srjs 59396c5ddc4Srjs#define GFX_RT_BVH_QUAD_LEAF_length 16 59496c5ddc4Srjsstruct GFX_RT_BVH_QUAD_LEAF { 59596c5ddc4Srjs struct GFX_RT_BVH_PRIMITIVE_LEAF_DESCRIPTOR LeafDescriptor; 59696c5ddc4Srjs uint32_t PrimitiveIndex0; 59796c5ddc4Srjs uint32_t PrimitiveIndex1Delta; 59896c5ddc4Srjs uint32_t j0; 59996c5ddc4Srjs uint32_t j1; 60096c5ddc4Srjs uint32_t j2; 60196c5ddc4Srjs bool LastQuad; 60296c5ddc4Srjs struct GFX_RT_BVH_VEC3 QuadVertex[4]; 60396c5ddc4Srjs}; 60496c5ddc4Srjs 60596c5ddc4Srjsstatic inline __attribute__((always_inline)) void 60696c5ddc4SrjsGFX_RT_BVH_QUAD_LEAF_pack(__attribute__((unused)) __gen_user_data *data, 60796c5ddc4Srjs __attribute__((unused)) void * restrict dst, 60896c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_BVH_QUAD_LEAF * restrict values) 60996c5ddc4Srjs{ 61096c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 61196c5ddc4Srjs 61296c5ddc4Srjs GFX_RT_BVH_PRIMITIVE_LEAF_DESCRIPTOR_pack(data, &dw[0], &values->LeafDescriptor); 61396c5ddc4Srjs 61496c5ddc4Srjs dw[2] = 61596c5ddc4Srjs __gen_uint(values->PrimitiveIndex0, 0, 31); 61696c5ddc4Srjs 61796c5ddc4Srjs dw[3] = 61896c5ddc4Srjs __gen_uint(values->PrimitiveIndex1Delta, 0, 16) | 61996c5ddc4Srjs __gen_uint(values->j0, 16, 17) | 62096c5ddc4Srjs __gen_uint(values->j1, 18, 19) | 62196c5ddc4Srjs __gen_uint(values->j2, 20, 21) | 62296c5ddc4Srjs __gen_uint(values->LastQuad, 22, 22); 62396c5ddc4Srjs 62496c5ddc4Srjs GFX_RT_BVH_VEC3_pack(data, &dw[4], &values->QuadVertex[0]); 62596c5ddc4Srjs 62696c5ddc4Srjs GFX_RT_BVH_VEC3_pack(data, &dw[7], &values->QuadVertex[1]); 62796c5ddc4Srjs 62896c5ddc4Srjs GFX_RT_BVH_VEC3_pack(data, &dw[10], &values->QuadVertex[2]); 62996c5ddc4Srjs 63096c5ddc4Srjs GFX_RT_BVH_VEC3_pack(data, &dw[13], &values->QuadVertex[3]); 63196c5ddc4Srjs} 63296c5ddc4Srjs 63396c5ddc4Srjs#define GFX_RT_BVH_INSTANCE_LEAF_length 32 63496c5ddc4Srjsstruct GFX_RT_BVH_INSTANCE_LEAF { 63596c5ddc4Srjs uint32_t ShaderIndex; 63696c5ddc4Srjs uint32_t GeometryRayMask; 63796c5ddc4Srjs uint32_t InstanceContributionToHitGroupIndex; 63896c5ddc4Srjs uint32_t LeafType; 63996c5ddc4Srjs#define TYPE_OPAQUE_CULLING_ENABLED 0 64096c5ddc4Srjs#define TYPE_OPAQUE_CULLING_DISABLED 1 64196c5ddc4Srjs uint32_t GeometryFlags; 64296c5ddc4Srjs#define GEOMETRY_OPAQUE 1 64396c5ddc4Srjs __gen_address_type StartNodeAddress; 64496c5ddc4Srjs uint32_t InstanceFlags; 64596c5ddc4Srjs#define TRIANGLE_CULL_DISABLE 1 64696c5ddc4Srjs#define TRIANGLE_FRONT_COUNTERCLOCKWISE 2 64796c5ddc4Srjs#define FORCE_OPAQUE 4 64896c5ddc4Srjs#define FORCE_NON_OPAQUE 8 64996c5ddc4Srjs float WorldToObjectm00; 65096c5ddc4Srjs float WorldToObjectm01; 65196c5ddc4Srjs float WorldToObjectm02; 65296c5ddc4Srjs float WorldToObjectm10; 65396c5ddc4Srjs float WorldToObjectm11; 65496c5ddc4Srjs float WorldToObjectm12; 65596c5ddc4Srjs float WorldToObjectm20; 65696c5ddc4Srjs float WorldToObjectm21; 65796c5ddc4Srjs float WorldToObjectm22; 65896c5ddc4Srjs float ObjectToWorldm30; 65996c5ddc4Srjs float ObjectToWorldm31; 66096c5ddc4Srjs float ObjectToWorldm32; 66196c5ddc4Srjs __gen_address_type BVHAddress; 66296c5ddc4Srjs uint32_t InstanceID; 66396c5ddc4Srjs uint32_t InstanceIndex; 66496c5ddc4Srjs float ObjectToWorldm00; 66596c5ddc4Srjs float ObjectToWorldm01; 66696c5ddc4Srjs float ObjectToWorldm02; 66796c5ddc4Srjs float ObjectToWorldm10; 66896c5ddc4Srjs float ObjectToWorldm11; 66996c5ddc4Srjs float ObjectToWorldm12; 67096c5ddc4Srjs float ObjectToWorldm20; 67196c5ddc4Srjs float ObjectToWorldm21; 67296c5ddc4Srjs float ObjectToWorldm22; 67396c5ddc4Srjs float WorldToObjectm30; 67496c5ddc4Srjs float WorldToObjectm31; 67596c5ddc4Srjs float WorldToObjectm32; 67696c5ddc4Srjs}; 67796c5ddc4Srjs 67896c5ddc4Srjsstatic inline __attribute__((always_inline)) void 67996c5ddc4SrjsGFX_RT_BVH_INSTANCE_LEAF_pack(__attribute__((unused)) __gen_user_data *data, 68096c5ddc4Srjs __attribute__((unused)) void * restrict dst, 68196c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_BVH_INSTANCE_LEAF * restrict values) 68296c5ddc4Srjs{ 68396c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 68496c5ddc4Srjs 68596c5ddc4Srjs dw[0] = 68696c5ddc4Srjs __gen_uint(values->ShaderIndex, 0, 23) | 68796c5ddc4Srjs __gen_uint(values->GeometryRayMask, 24, 31); 68896c5ddc4Srjs 68996c5ddc4Srjs dw[1] = 69096c5ddc4Srjs __gen_uint(values->InstanceContributionToHitGroupIndex, 0, 23) | 69196c5ddc4Srjs __gen_uint(values->LeafType, 29, 29) | 69296c5ddc4Srjs __gen_uint(values->GeometryFlags, 30, 31); 69396c5ddc4Srjs 69496c5ddc4Srjs const uint64_t v2 = 69596c5ddc4Srjs __gen_uint(values->InstanceFlags, 48, 55); 69696c5ddc4Srjs const uint64_t v2_address = 69796c5ddc4Srjs __gen_address(data, &dw[2], values->StartNodeAddress, v2, 0, 47); 69896c5ddc4Srjs dw[2] = v2_address; 69996c5ddc4Srjs dw[3] = (v2_address >> 32) | (v2 >> 32); 70096c5ddc4Srjs 70196c5ddc4Srjs dw[4] = 70296c5ddc4Srjs __gen_float(values->WorldToObjectm00); 70396c5ddc4Srjs 70496c5ddc4Srjs dw[5] = 70596c5ddc4Srjs __gen_float(values->WorldToObjectm01); 70696c5ddc4Srjs 70796c5ddc4Srjs dw[6] = 70896c5ddc4Srjs __gen_float(values->WorldToObjectm02); 70996c5ddc4Srjs 71096c5ddc4Srjs dw[7] = 71196c5ddc4Srjs __gen_float(values->WorldToObjectm10); 71296c5ddc4Srjs 71396c5ddc4Srjs dw[8] = 71496c5ddc4Srjs __gen_float(values->WorldToObjectm11); 71596c5ddc4Srjs 71696c5ddc4Srjs dw[9] = 71796c5ddc4Srjs __gen_float(values->WorldToObjectm12); 71896c5ddc4Srjs 71996c5ddc4Srjs dw[10] = 72096c5ddc4Srjs __gen_float(values->WorldToObjectm20); 72196c5ddc4Srjs 72296c5ddc4Srjs dw[11] = 72396c5ddc4Srjs __gen_float(values->WorldToObjectm21); 72496c5ddc4Srjs 72596c5ddc4Srjs dw[12] = 72696c5ddc4Srjs __gen_float(values->WorldToObjectm22); 72796c5ddc4Srjs 72896c5ddc4Srjs dw[13] = 72996c5ddc4Srjs __gen_float(values->ObjectToWorldm30); 73096c5ddc4Srjs 73196c5ddc4Srjs dw[14] = 73296c5ddc4Srjs __gen_float(values->ObjectToWorldm31); 73396c5ddc4Srjs 73496c5ddc4Srjs dw[15] = 73596c5ddc4Srjs __gen_float(values->ObjectToWorldm32); 73696c5ddc4Srjs 73796c5ddc4Srjs const uint64_t v16_address = 73896c5ddc4Srjs __gen_address(data, &dw[16], values->BVHAddress, 0, 0, 47); 73996c5ddc4Srjs dw[16] = v16_address; 74096c5ddc4Srjs dw[17] = v16_address >> 32; 74196c5ddc4Srjs 74296c5ddc4Srjs dw[18] = 74396c5ddc4Srjs __gen_uint(values->InstanceID, 0, 31); 74496c5ddc4Srjs 74596c5ddc4Srjs dw[19] = 74696c5ddc4Srjs __gen_uint(values->InstanceIndex, 0, 31); 74796c5ddc4Srjs 74896c5ddc4Srjs dw[20] = 74996c5ddc4Srjs __gen_float(values->ObjectToWorldm00); 75096c5ddc4Srjs 75196c5ddc4Srjs dw[21] = 75296c5ddc4Srjs __gen_float(values->ObjectToWorldm01); 75396c5ddc4Srjs 75496c5ddc4Srjs dw[22] = 75596c5ddc4Srjs __gen_float(values->ObjectToWorldm02); 75696c5ddc4Srjs 75796c5ddc4Srjs dw[23] = 75896c5ddc4Srjs __gen_float(values->ObjectToWorldm10); 75996c5ddc4Srjs 76096c5ddc4Srjs dw[24] = 76196c5ddc4Srjs __gen_float(values->ObjectToWorldm11); 76296c5ddc4Srjs 76396c5ddc4Srjs dw[25] = 76496c5ddc4Srjs __gen_float(values->ObjectToWorldm12); 76596c5ddc4Srjs 76696c5ddc4Srjs dw[26] = 76796c5ddc4Srjs __gen_float(values->ObjectToWorldm20); 76896c5ddc4Srjs 76996c5ddc4Srjs dw[27] = 77096c5ddc4Srjs __gen_float(values->ObjectToWorldm21); 77196c5ddc4Srjs 77296c5ddc4Srjs dw[28] = 77396c5ddc4Srjs __gen_float(values->ObjectToWorldm22); 77496c5ddc4Srjs 77596c5ddc4Srjs dw[29] = 77696c5ddc4Srjs __gen_float(values->WorldToObjectm30); 77796c5ddc4Srjs 77896c5ddc4Srjs dw[30] = 77996c5ddc4Srjs __gen_float(values->WorldToObjectm31); 78096c5ddc4Srjs 78196c5ddc4Srjs dw[31] = 78296c5ddc4Srjs __gen_float(values->WorldToObjectm32); 78396c5ddc4Srjs} 78496c5ddc4Srjs 78596c5ddc4Srjs#define GFX_RT_BVH_PROCEDURAL_LEAF_length 16 78696c5ddc4Srjsstruct GFX_RT_BVH_PROCEDURAL_LEAF { 78796c5ddc4Srjs struct GFX_RT_BVH_PRIMITIVE_LEAF_DESCRIPTOR LeafDescriptor; 78896c5ddc4Srjs uint32_t NumPrimitives; 78996c5ddc4Srjs uint32_t LastPrimitive; 79096c5ddc4Srjs uint32_t PrimitiveIndex[13]; 79196c5ddc4Srjs}; 79296c5ddc4Srjs 79396c5ddc4Srjsstatic inline __attribute__((always_inline)) void 79496c5ddc4SrjsGFX_RT_BVH_PROCEDURAL_LEAF_pack(__attribute__((unused)) __gen_user_data *data, 79596c5ddc4Srjs __attribute__((unused)) void * restrict dst, 79696c5ddc4Srjs __attribute__((unused)) const struct GFX_RT_BVH_PROCEDURAL_LEAF * restrict values) 79796c5ddc4Srjs{ 79896c5ddc4Srjs uint32_t * restrict dw = (uint32_t * restrict) dst; 79996c5ddc4Srjs 80096c5ddc4Srjs GFX_RT_BVH_PRIMITIVE_LEAF_DESCRIPTOR_pack(data, &dw[0], &values->LeafDescriptor); 80196c5ddc4Srjs 80296c5ddc4Srjs dw[2] = 80396c5ddc4Srjs __gen_uint(values->NumPrimitives, 0, 3) | 80496c5ddc4Srjs __gen_uint(values->LastPrimitive, 19, 31); 80596c5ddc4Srjs 80696c5ddc4Srjs dw[3] = 80796c5ddc4Srjs __gen_uint(values->PrimitiveIndex[0], 0, 31); 80896c5ddc4Srjs 80996c5ddc4Srjs dw[4] = 81096c5ddc4Srjs __gen_uint(values->PrimitiveIndex[1], 0, 31); 81196c5ddc4Srjs 81296c5ddc4Srjs dw[5] = 81396c5ddc4Srjs __gen_uint(values->PrimitiveIndex[2], 0, 31); 81496c5ddc4Srjs 81596c5ddc4Srjs dw[6] = 81696c5ddc4Srjs __gen_uint(values->PrimitiveIndex[3], 0, 31); 81796c5ddc4Srjs 81896c5ddc4Srjs dw[7] = 81996c5ddc4Srjs __gen_uint(values->PrimitiveIndex[4], 0, 31); 82096c5ddc4Srjs 82196c5ddc4Srjs dw[8] = 82296c5ddc4Srjs __gen_uint(values->PrimitiveIndex[5], 0, 31); 82396c5ddc4Srjs 82496c5ddc4Srjs dw[9] = 82596c5ddc4Srjs __gen_uint(values->PrimitiveIndex[6], 0, 31); 82696c5ddc4Srjs 82796c5ddc4Srjs dw[10] = 82896c5ddc4Srjs __gen_uint(values->PrimitiveIndex[7], 0, 31); 82996c5ddc4Srjs 83096c5ddc4Srjs dw[11] = 83196c5ddc4Srjs __gen_uint(values->PrimitiveIndex[8], 0, 31); 83296c5ddc4Srjs 83396c5ddc4Srjs dw[12] = 83496c5ddc4Srjs __gen_uint(values->PrimitiveIndex[9], 0, 31); 83596c5ddc4Srjs 83696c5ddc4Srjs dw[13] = 83796c5ddc4Srjs __gen_uint(values->PrimitiveIndex[10], 0, 31); 83896c5ddc4Srjs 83996c5ddc4Srjs dw[14] = 84096c5ddc4Srjs __gen_uint(values->PrimitiveIndex[11], 0, 31); 84196c5ddc4Srjs 84296c5ddc4Srjs dw[15] = 84396c5ddc4Srjs __gen_uint(values->PrimitiveIndex[12], 0, 31); 84496c5ddc4Srjs} 84596c5ddc4Srjs 84696c5ddc4Srjs#endif /* GFX_PACK_H */ 847