|
|
|||
File indexing completed on 2026-04-09 07:49:02
0001 #pragma once 0002 /** 0003 InstanceId_NOT_IN_USE 0004 ====================== 0005 0006 Initially planned to bitpack inside InstanceId but turns out to not be very useful:: 0007 0008 unsigned instance_id = optixGetInstanceId() ; // see IAS_Builder::Build and InstanceId.h 0009 0010 Due to the OptiX 7 limits and the flat nature of ins_idx in single IAS approach:: 0011 0012 limitMaxInstanceId : 16777215 ffffff 6*4 = 24 bits ~16.77M 0013 0014 This was developed whilst unaware of the 24bit optix limitation : limitMaxInstanceId 0015 0016 JUNO geometry, has the flat instance id reaching to : 46116 0017 (this may be with struts skipped, so full total could be a few thousands more than that) 0018 see SBT::dumpIAS 0019 0020 So could use 16 bits for that, leaving 8 bits going spare in the. But thats 0021 too tight (255) for general gas_idx. So probably not much utility in 0022 bitpacking in the instanceId:: 0023 0024 0025 In [32]: 0x3fff 14bits 0026 Out[32]: 16383 0027 0028 In [12]: 0x7fff 15bits 0029 Out[12]: 32767 0030 0031 In [11]: 0xffff 16 bits 0032 Out[11]: 65535 0033 0034 0035 In [19]: "%x" % ( 0x7fff | 0xffc000 ) 0036 Out[19]: 'ffffff' 0037 0038 In [21]: 0x3ff 0039 Out[21]: 1023 0040 0041 In [22]: "%x" % (0x3ff << 10) 0042 Out[22]: 'ffc00' 0043 0044 1 1 0045 3 11 0046 7 111 0047 f 1111 0048 0049 0050 The above is thinking in terms of the old model with split pots 0051 of transforms for each instance. But with optix7 are currently 0052 using a single IAS with all transforms of all instances in it. 0053 So 14 bits is not enough, would need to use 16 bits for JUNO flat instances. 0054 0055 8-bits (255) could hold gas_idx : but its a bit too tight to be a general approach, 0056 and there is actually no need to do that as can use the flat instance_idx to lookup 0057 the instrumented transform giving gas_idx that way. 0058 0059 **/ 0060 0061 struct InstanceId_NOT_IN_USE 0062 { 0063 //enum { ins_bits = 14, gas_bits = 10 } ; 0064 enum { ins_bits = 16, gas_bits = 8 } ; 0065 0066 static constexpr unsigned ins_mask = ( 1 << ins_bits ) - 1 ; 0067 static constexpr unsigned gas_mask = ( 1 << gas_bits ) - 1 ; 0068 0069 static unsigned Encode(unsigned ins_idx, unsigned gas_idx ); 0070 static void Decode(unsigned& ins_idx, unsigned& gas_idx, const unsigned identity ); 0071 }; 0072 0073 inline unsigned InstanceId_NOT_IN_USE::Encode(unsigned ins_idx, unsigned gas_idx ) 0074 { 0075 assert( ins_idx < ins_mask ); 0076 assert( gas_idx < gas_mask ); 0077 unsigned identity = (( 1 + ins_idx ) << gas_bits ) | (( 1 + gas_idx ) << 0 ) ; 0078 return identity ; 0079 } 0080 0081 inline void InstanceId_NOT_IN_USE::Decode(unsigned& ins_idx, unsigned& gas_idx, const unsigned identity ) 0082 { 0083 ins_idx = (( (ins_mask << gas_bits ) & identity ) >> gas_bits ) - 1u ; 0084 gas_idx = (( gas_mask & identity ) >> 0 ) - 1u ; 0085 } 0086 0087 0088
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|