File indexing completed on 2026-04-09 07:49:42
0001 #pragma once
0002
0003
0004
0005
0006 #include <bitset>
0007
0008 struct SOPTIX_Properties
0009 {
0010 unsigned rtcoreVersion ;
0011 unsigned limitMaxTraceDepth ;
0012 unsigned limitMaxTraversableGraphDepth ;
0013 unsigned limitMaxPrimitivesPerGas ;
0014 unsigned limitMaxInstancesPerIas ;
0015 unsigned limitMaxInstanceId ;
0016 unsigned limitNumBitsInstanceVisibilityMask ;
0017 unsigned limitMaxSbtRecordsPerGas ;
0018 unsigned limitMaxSbtOffset ;
0019
0020 unsigned visibilityMask_FULL() const ;
0021 unsigned visibilityMask(unsigned idx) const ;
0022
0023 SOPTIX_Properties(OptixDeviceContext context);
0024 std::string desc() const ;
0025 };
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 inline unsigned SOPTIX_Properties::visibilityMask_FULL() const
0042 {
0043 return ( 0x1 << limitNumBitsInstanceVisibilityMask ) - 1 ;
0044 }
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109 inline unsigned SOPTIX_Properties::visibilityMask(unsigned idx) const
0110 {
0111 unsigned FULL = visibilityMask_FULL();
0112 assert( FULL == 0xffu );
0113 unsigned BITS = std::bitset<32>(FULL).count();
0114 assert( BITS == 8 );
0115 unsigned marker_bit = std::min( idx, BITS - 1 );
0116 unsigned visibilityMask = 0x1 << marker_bit ;
0117 assert( ( visibilityMask & 0xffffff00 ) == 0 ) ;
0118 return visibilityMask ;
0119 }
0120
0121
0122
0123
0124 inline SOPTIX_Properties::SOPTIX_Properties(OptixDeviceContext context)
0125 {
0126
0127 OPTIX_CHECK( optixDeviceContextGetProperty(context, OPTIX_DEVICE_PROPERTY_LIMIT_MAX_TRACE_DEPTH , &limitMaxTraceDepth , sizeof(unsigned int)) );
0128 OPTIX_CHECK( optixDeviceContextGetProperty(context, OPTIX_DEVICE_PROPERTY_LIMIT_MAX_TRAVERSABLE_GRAPH_DEPTH , &limitMaxTraversableGraphDepth , sizeof(unsigned int)) );
0129 OPTIX_CHECK( optixDeviceContextGetProperty(context, OPTIX_DEVICE_PROPERTY_LIMIT_MAX_PRIMITIVES_PER_GAS , &limitMaxPrimitivesPerGas , sizeof(unsigned int)) );
0130 OPTIX_CHECK( optixDeviceContextGetProperty(context, OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCES_PER_IAS , &limitMaxInstancesPerIas , sizeof(unsigned int)) );
0131 OPTIX_CHECK( optixDeviceContextGetProperty(context, OPTIX_DEVICE_PROPERTY_RTCORE_VERSION , &rtcoreVersion , sizeof(unsigned int)) );
0132 OPTIX_CHECK( optixDeviceContextGetProperty(context, OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCE_ID , &limitMaxInstanceId , sizeof(unsigned int)) );
0133 OPTIX_CHECK( optixDeviceContextGetProperty(context, OPTIX_DEVICE_PROPERTY_LIMIT_NUM_BITS_INSTANCE_VISIBILITY_MASK , &limitNumBitsInstanceVisibilityMask , sizeof(unsigned int)) );
0134 OPTIX_CHECK( optixDeviceContextGetProperty(context, OPTIX_DEVICE_PROPERTY_LIMIT_MAX_SBT_RECORDS_PER_GAS , &limitMaxSbtRecordsPerGas , sizeof(unsigned int)) );
0135 OPTIX_CHECK( optixDeviceContextGetProperty(context, OPTIX_DEVICE_PROPERTY_LIMIT_MAX_SBT_OFFSET , &limitMaxSbtOffset , sizeof(unsigned int)) );
0136 }
0137
0138 inline std::string SOPTIX_Properties::desc() const
0139 {
0140 std::stringstream ss ;
0141 ss
0142 << "SOPTIX_Properties::desc" << std::endl
0143 << std::setw(40) << "limitMaxTraceDepth"
0144 << " : "
0145 << std::setw(10) << limitMaxTraceDepth
0146 << std::endl
0147 << std::setw(40) << "limitMaxTraversableGraphDepth"
0148 << " : "
0149 << std::setw(10) << limitMaxTraversableGraphDepth
0150 << std::endl
0151 << std::setw(40) << "limitMaxPrimitivesPerGas"
0152 << " : "
0153 << std::setw(10) << limitMaxPrimitivesPerGas
0154 << std::setw(10) << std::hex << limitMaxPrimitivesPerGas << std::dec
0155 << std::endl
0156 << std::setw(40) << "limitMaxInstancesPerIas"
0157 << " : "
0158 << std::setw(10) << limitMaxInstancesPerIas
0159 << std::setw(10) << std::hex << limitMaxInstancesPerIas << std::dec
0160 << std::endl
0161 << std::setw(40) << "rtcoreVersion"
0162 << " : "
0163 << std::setw(10) << rtcoreVersion
0164 << std::endl
0165 << std::setw(40) << "limitMaxInstanceId"
0166 << " : "
0167 << std::setw(10) << limitMaxInstanceId
0168 << std::setw(10) << std::hex << limitMaxInstanceId << std::dec
0169 << std::endl
0170 << std::setw(40) << "limitNumBitsInstanceVisibilityMask"
0171 << " : "
0172 << std::setw(10) << limitNumBitsInstanceVisibilityMask
0173 << std::endl
0174 << std::setw(40) << "visibilityMask_FULL()"
0175 << " : "
0176 << std::setw(10) << visibilityMask_FULL()
0177 << std::setw(10) << std::hex << visibilityMask_FULL() << std::dec
0178 << std::endl
0179 << std::setw(40) << "limitMaxSbtRecordsPerGas"
0180 << " : "
0181 << std::setw(10) << limitMaxSbtRecordsPerGas
0182 << std::setw(10) << std::hex << limitMaxSbtRecordsPerGas << std::dec
0183 << std::endl
0184 << std::setw(40) << "limitMaxSbtOffset"
0185 << " : "
0186 << std::setw(10) << limitMaxSbtOffset
0187 << std::setw(10) << std::hex << limitMaxSbtOffset << std::dec
0188 << std::endl
0189 ;
0190
0191 std::string str = ss.str();
0192 return str ;
0193 }
0194
0195