1 // 2 // Copyright (C) 2009-2021 Intel Corporation 3 // 4 // SPDX-License-Identifier: MIT 5 // 6 // 7 8 // 9 // This file contains structure definitions shared by GRL OCL kernels and host code 10 // 11 12 #pragma once 13 14 #include "GRLGen12.h" 15 16 GRL_NAMESPACE_BEGIN(GRL) 17 GRL_NAMESPACE_BEGIN(RTAS) 18 GRL_NAMESPACE_BEGIN(MISC) 19 20 struct BatchedInitGlobalsData 21 { 22 qword p_build_globals; 23 qword p_bvh_buffer; 24 dword numPrimitives; 25 dword numGeometries; 26 dword numInstances; 27 dword instance_descs_start; 28 dword geo_meta_data_start; 29 dword node_data_start; 30 dword leaf_data_start; 31 dword procedural_data_start; 32 dword back_pointer_start; 33 dword sizeTotal; 34 dword leafType; 35 dword leafSize; 36 dword fatleaf_table_start; 37 dword innernode_table_start; 38 dword quad_indices_data_start; 39 }; 40 41 /// Header of debug buffer 42 /// 43 /// Header is placed at the begining of debug buffer. 44 /// After header there is circullar buffer space 45 typedef struct DebugBufferHeader 46 { 47 /// Offset to begin of buffer (after header) 48 dword headStart; 49 /// Offset to free memory in buffer (used by gpu) 50 dword gpuHead; 51 /// Offset to end of data in buffer that is ready to read (read on cpu, set on gpu, might be behind gpuHeader) 52 dword cpuHead; 53 /// Flag for buffer overflow 54 dword overflow; 55 /// Total size of buffer 56 dword totalSize; 57 /// Padding needed because otherwise GPU overrides tail with cacheline flush 58 dword pad[11]; 59 /// Offset to begin of data in buffer 60 dword tail; 61 } DebugBufferHeader; 62 63 enum InputDumpOperationType 64 { 65 INPUT_DUMP_OP_NOP, 66 INPUT_DUMP_OP_BATCH, 67 INPUT_DUMP_OP_BUILD, 68 INPUT_DUMP_OP_UPDATE, 69 INPUT_DUMP_OP_CLONE, 70 INPUT_DUMP_OP_COMPACT, 71 INPUT_DUMP_OP_SERIALIZE, 72 INPUT_DUMP_OP_DESERIALIZE, 73 INPUT_DUMP_OP_END_BUFFER 74 }; 75 76 // each operation starts with the same header structure and looks like this 77 78 // some defined struct { <-----------------start 79 // OpHeader 80 // .... struct type specific data 81 // } 82 // ... auxilary data of variable len 83 // <-------------------------------------- end - indicated by endOfData 84 typedef struct OpHeader 85 { 86 dword operationType; 87 dword endOfData; // offset to end of this primitive 88 } OpHeader; 89 90 // header for batch operations 91 typedef struct BatchOpHeader 92 { 93 OpHeader opHeader; 94 } BatchOpHeader; 95 96 // interpretation for operationType INPUT_DUMP_OP_BATCH 97 typedef struct InputBatch 98 { 99 BatchOpHeader header; 100 qword batchId; 101 dword vertexBufferDataSize; 102 dword firstContainedOpOffset; 103 104 // layout of batch is as below, each line is 128B aligned: 105 106 // 107 // InputBatch <-------------------------------- start 108 // optional: batchVertexData 109 // InputBuildDesc/InputCopy <------------------ start + firstContainedOpOffset 110 // optional: extra data of above token 111 // InputBuildDesc/InputCopy 112 // optional: extra data of above token 113 // ... 114 // InputBuildDesc/InputCopy 115 // optional: extra data of above token 116 // <-------------------------------------------- end = start + endOfData 117 } InputBatch; 118 119 // for operationType: 120 // INPUT_DUMP_OP_BUILD, 121 // INPUT_DUMP_OP_UPDATE, 122 // followed by auxilary data of variable len 123 typedef struct InputBuild 124 { 125 OpHeader header; 126 qword srcBvhPtr; 127 qword dstBvhPtr; 128 dword flags; 129 dword numGeos; 130 dword numInstances; 131 dword instArrayOfPtrs; 132 } InputBuild; 133 134 // for operationType: 135 // INPUT_DUMP_OP_CLONE, 136 // INPUT_DUMP_OP_COMPACT, 137 // INPUT_DUMP_OP_SERIALIZE, 138 // 139 // Not for INPUT_DUMP_OP_DESERIALIZE! 140 typedef struct InputCopy 141 { 142 OpHeader header; 143 qword srcBvhPtr; 144 qword dstBvhPtr; 145 } InputCopy; 146 147 // for INPUT_DUMP_OP_DESERIALIZE 148 // decode for debug tools follows this format 149 typedef struct InputDeserialize 150 { 151 OpHeader header; 152 qword dstBvhPtr; 153 } InputDeserialize; 154 155 typedef struct InputBatchPtrs 156 { 157 qword dumpDst; 158 qword globalDumpBuffer; 159 qword nonVertexDataStart; 160 dword vertexBuffersSize; 161 dword totalSize; 162 } InputBatchPtrs; 163 164 enum OutputDumpOperationType 165 { 166 OUTPUT_DUMP_OP_NOP, 167 OUTPUT_DUMP_OP_BATCH, 168 OUTPUT_DUMP_OP_DATA, 169 OUTPUT_DUMP_OP_END_BUFFER 170 }; 171 172 // interpretation for operationType OUTPUT_DUMP_OP_BATCH 173 typedef struct OutputBatch { 174 BatchOpHeader header; 175 qword batchId; 176 dword firstContainedOpOffset; 177 } OutputBatch; 178 179 // interpretation for operationType OUTPUT_DUMP_OP_DATA 180 typedef struct OutputData 181 { 182 OpHeader header; 183 qword srcBvhPtr; 184 } OutputData; 185 186 typedef struct OutputBatchPtrs 187 { 188 qword dumpDst; 189 qword dataStart; 190 dword dataSize; 191 dword totalSize; 192 } OutputBatchPtrs; 193 194 GRL_NAMESPACE_END(MISC) 195 GRL_NAMESPACE_END(RTAS) 196 GRL_NAMESPACE_END(GRL) 197