Files
larp/shaders/replace/e8c962358d862e3f.compute.hlsl

2142 lines
141 KiB
HLSL

// e8c962358d862e3f, compute: CS_RTDistantShadowTraceLeakPlug32_Tiled_d6296256_Wrapped, the
// directional shadow of each pixel of a tile toward the light, then of its neighbouring pixel,
// with a short contact ray first for some pixel classes.
//
// The layer's translation of the console program (its DXIL decompiled), with its
// bindings restored as the translation makes them (README "Bindings": heap views through
// ResourceDescriptorHeap typed as the translation's handles, at the slots the translation reads
// from the table lists, t252 space1; user data b0 space0 16 dwords, [WaveSize(32)]
// [numthreads(32, 1, 1)]) and these changes, marked where they are:
// - the five walks of the console's ray-tracing structure (console sites 1 to 5) and the root
// loads before them (header +48) are host ray queries of three structure views
// (e8c962358d862e3f.compute.views): site 1 of view 0 (t248), sites 2 and 4 of view 1 (t249),
// sites 3 and 5 of view 2 (t250);
// - the candidate body of sites 2 to 5 (the alpha test) is candidate_decision, run in each of
// their Proceed loops for a non-opaque candidate with the candidate's fields from the query,
// whose commit ends the lane's search; its two reads of the first lane's value read each
// lane's own;
// - the record tests after sites 2 and 4 take the committed instance's contribution and the
// committed triangle's geometry index from the query;
// - the candidate loops of sites 2 to 5 stop where their walks stop: the walk counts its passes per
// lane and ends a lane with nothing committed when !(0xFFFF > count), a literal (site 2 v31
// 0x2404, site 3 v31 0x348C, site 4 v30 0x47FC, site 5 v30 0x587C); the loop counts its candidates
// and stops (Abort) at the same test. No X reads the count (each path from it writes the register
// before any read), so a capped lane is a miss to the code after.
// A pass of the console's walk is a node visit and a pass of the candidate loop is a candidate,
// and a ray has at most as many candidates as node visits: so the host's stop never ends a ray
// the console would not have ended, and it may let one go on that the console would have ended.
// Site 1's walk has the same cap (v32 0x1424) and X1 counts a count > 0xFFFE as a hit (0x151C),
// but its query culls non-opaque triangles and has no candidate to count: its count is 0 at X1.
// - title memory by address (t254, u253), which only the walks and those field reads read, is not
// bound, the walks' group-shared stack is not declared, and the definitions only the walks read
// are gone; with the walks go the translation's bounds on their loops (4096 passes, which ended
// the program).
// The rest is the translation as it came: every name is a number of the decompile.
//
// The walks' wave-stack registers. Each walk keeps its stack in one VGPR by v_writelane, which
// writes lanes 0 to 14 whatever EXEC is. Site 1's is v12, which is also the shadow value: 1.0 for
// every lane (0x7B4) before site 1, hit ? 0 : 1.0 on site 1's lanes after it (0x1530). On the
// console a lane outside site 1 is left with the stack's words in v12 (lanes 12 to 14: 0, from
// 0x7E0-0x800 and 0xB54-0xB5C) whenever another lane of its wave enters site 1, and the wave gate
// reads v12 (0x3654-0x3668) before anything rewrites it on lanes sites 2 and 3 do not hit. The
// translation gives each walk's stack a value of its own (the walk's SSA), and so does this: v12
// (_3836) is 1.0 on those lanes. The same holds for site 2's stack, v29, which the gate reads on
// lanes outside sites 2 to 5 (v24 = v29 ^ 1, 0x3614): here and in the translation it is what it
// was before site 2 (_3838). Sites 3, 4 and 5's stack registers (v28, v24, v27) are read after
// their sites only where another term decides the result (0x35B4-0x35DC, 0x598C-0x59B8) or after
// they are rewritten (v24 = 0 at 0x48D8).
#include "view_heap_layout.hlsli"
static bool _19651;
static uint _19772;
struct BindlessCBV_1_1_1
{
float4 _m0[4096];
};
ByteAddressBuffer _39 : register(t252, space1);
// A table's constant view, by its dword of the table's list (t252): with the top bit set its constants lie in
// the heap view (the raw view of the title's graphics heap as the card reads it in place, at the view heap
// slot after the null slot that ends the title's slots) at the offset in its low 28 bits times 16; otherwise
// the dword is the slot of a raw view that begins at them. Row `row` of them (16 bytes).
float4 table_cbv(uint e, uint row)
{
bool placed = (e >> 31u) != 0u;
ByteAddressBuffer b = ResourceDescriptorHeap[min(placed ? HEAP_VIEW_SLOT : e, NULL_SLOT)];
return asfloat(b.Load4((placed ? (e << 4u) : 0u) + (row << 4u)));
}
RWBuffer<float4> heap_rwbuf(uint i) { RWBuffer<float4> r = ResourceDescriptorHeap[i]; return r; }
RWTexture2D<float4> heap_rwtex2d(uint i) { RWTexture2D<float4> r = ResourceDescriptorHeap[i]; return r; }
// The host top levels of the structure views this program traces (e8c962358d862e3f.compute.views):
// view 0, C, table slot 1 +0xA0 (site 1); view 1, P, +0x60 (sites 2 and 4); view 2, Q, +0x20
// (sites 3 and 5).
RaytracingAccelerationStructure scene_c : register(t248, space1);
RaytracingAccelerationStructure scene_p : register(t249, space1);
RaytracingAccelerationStructure scene_q : register(t250, space1);
// The bytes (0, 4, 8 or 12) by which the raw view at each host view heap slot begins before the
// console's view (larp_shader::emit::SLOT_SHIFTS, t253 space1): added to every byte offset through a
// view from the heap, except where the sum passes 2^32, as the translation does.
ByteAddressBuffer view_shifts : register(t253, space1);
uint shifted(uint slot, uint off) { uint s = view_shifts.Load<uint>(min(slot, 2097151u) * 4); uint b = off + s; return b < s ? off : b; }
ByteAddressBuffer heap_srv_raw(uint i) { ByteAddressBuffer r = ResourceDescriptorHeap[i]; return r; }
Texture2D<float4> heap_tex2d(uint i) { Texture2D<float4> r = ResourceDescriptorHeap[i]; return r; }
Texture2D<float4> heap_tex2d_nu(uint i) { Texture2D<float4> r = ResourceDescriptorHeap[NonUniformResourceIndex(i)]; return r; }
cbuffer _50_52 : register(b0, space0)
{
float4 _52_m0[4] : packoffset(c0);
};
SamplerState _55 : register(s0, space0);
SamplerState _56 : register(s1, space0);
static uint3 gl_WorkGroupID;
static uint gl_LocalInvocationIndex;
struct SPIRV_Cross_Input
{
uint3 gl_WorkGroupID : SV_GroupID;
uint gl_LocalInvocationIndex : SV_GroupIndex;
};
uint spvPackHalf2x16(float2 value)
{
uint2 Packed = f32tof16(value);
return Packed.x | (Packed.y << 16);
}
float2 spvUnpackHalf2x16(uint value)
{
return f16tof32(uint2(value & 0xffff, value >> 16));
}
// The candidate body of sites 2 to 5 (console C 0x20D8, 0x3168, 0x44D0, 0x5558 to J 0x22E4,
// 0x3374, 0x46DC, 0x5764), as the translation has it at site 2; the four bodies of the
// translation are this code, each with its own names. It is the alpha test of a non-opaque
// candidate: the record r = the instance's contribution (instance +52 & 0x3FFF) + the triangle's
// geometry index (triangle +48 >> 8) of the title's 116-byte record buffer R (table s4 +0x100);
// R[r] +4 bit 5 clear: commit when R[r] & 7 == 3; else the material (instance +48: InstanceID
// bits 10-22 index the 68-byte table at s4 +0x20, whose +60 >> 16 plus InstanceID bits 0-9 index
// the UV matrices at s4 +0x2A0) maps the candidate's world position origin + t dir to a UV, and
// the candidate commits when channel 1 of the material's texture there (its +48) is at least
// R[r] +84. It returns the decision (the console's v48 at site 2): 0xFFFFFFFF commits.
// The walk's t range and face tests (_6437 t >= t min, _6438 t < t max, _6440 not culled) hold
// for every candidate the query presents; the instance and triangle pointers are not 0.
// The two v_readfirstlane of the console (0x2234, 0x2268) read each lane's own value: on the
// console every lane in a body is in the wave's one instance, here lanes in the loop can have
// different candidates; so the texture index is per lane.
uint candidate_decision(uint _6495, uint _6598, uint _6677, float _6434, float _3971, float _3968, float _3965, float _716, float _625, float _628, uint _3844, uint _3848, uint _3853)
{
bool _6437 = true;
bool _6438 = true;
bool _6440 = true;
uint _6599 = _6598 + (16383u & asuint(asfloat(_6495)));
uint _6600 = _6599 * 116u;
uint _6608 = min(asuint(asfloat(_39.Load<uint>((_3848 >> 2u) * 4 + 0))), NULL_SLOT);
bool _6617 = 0u == (32u & asuint(asfloat(heap_srv_raw(_6608).Load<uint>(shifted(_6608, (min((_6600 + 4u), 2147483584u) >> 2u) * 4 + 0)))));
uint _6637;
if (_6617)
{
uint _6623 = min(asuint(asfloat(_39.Load<uint>((_3848 >> 2u) * 4 + 0))), NULL_SLOT);
_6637 = (_6437 && (_6438 && (_6440 && (3u == (7u & asuint(asfloat(heap_srv_raw(_6623).Load<uint>(shifted(_6623, (min(_6600, 2147483584u) >> 2u) * 4 + 0))))))))) ? 4294967295u : 0u;
}
else
{
_6637 = _6599;
}
uint _6911;
if (_6617)
{
_6911 = _6637;
}
else
{
precise float _6639 = _625 * _6434;
precise float _6640 = _6639 + _3968;
precise float _6641 = _628 * _6434;
precise float _6642 = _6641 + _3965;
uint _6686 = min(asuint(asfloat(_39.Load<uint>((_3848 >> 2u) * 4 + 0))), NULL_SLOT);
precise float _6699 = _716 * _6434;
precise float _6700 = _6699 + _3971;
uint _6701 = ((_6677 >> 10u) & 8191u) * 68u;
uint _6709 = min(asuint(asfloat(_39.Load<uint>((_3844 >> 2u) * 4 + 0))), NULL_SLOT);
uint _6726 = ((asuint(asfloat(heap_srv_raw(_6709).Load<uint>(shifted(_6709, (min((_6701 + 60u), 2147483584u) >> 2u) * 4 + 0)))) >> 16u) + (1023u & _6677)) << 5u;
uint _6732 = min(asuint(asfloat(_39.Load<uint>((_3853 >> 2u) * 4 + 0))), NULL_SLOT);
precise float _6781 = asfloat(heap_srv_raw(_6732).Load<uint>(shifted(_6732, (min((_6726 + 4u), 2147483584u) >> 2u) * 4 + 0))) * _6640;
precise float _6782 = asfloat(heap_srv_raw(_6732).Load<uint>(shifted(_6732, (min((_6726 + 20u), 2147483584u) >> 2u) * 4 + 0))) * _6640;
precise float _6783 = asfloat(heap_srv_raw(_6732).Load<uint>(shifted(_6732, (min((_6726 + 8u), 2147483584u) >> 2u) * 4 + 0))) * _6642;
precise float _6784 = _6783 + asfloat(heap_srv_raw(_6732).Load<uint>(shifted(_6732, (min((_6726 + 12u), 2147483584u) >> 2u) * 4 + 0)));
precise float _6785 = asfloat(heap_srv_raw(_6732).Load<uint>(shifted(_6732, (min(_6726, 2147483584u) >> 2u) * 4 + 0))) * _6700;
precise float _6786 = _6785 + _6781;
precise float _6788 = asfloat(heap_srv_raw(_6732).Load<uint>(shifted(_6732, (min((_6726 + 16u), 2147483584u) >> 2u) * 4 + 0))) * _6700;
precise float _6789 = _6788 + _6782;
precise float _6790 = asfloat(heap_srv_raw(_6732).Load<uint>(shifted(_6732, (min((_6726 + 24u), 2147483584u) >> 2u) * 4 + 0))) * _6642;
precise float _6791 = _6790 + asfloat(heap_srv_raw(_6732).Load<uint>(shifted(_6732, (min((_6726 + 28u), 2147483584u) >> 2u) * 4 + 0)));
precise float _6796 = _6786 + _6784;
precise float _6797 = _6789 + _6791;
float4 _6801 = heap_tex2d_nu(min(min(((asuint(asfloat(heap_srv_raw(_6709).Load<uint>(shifted(_6709, (min((_6701 + 48u), 2147483584u) >> 2u) * 4 + 0)))) << 5u) >> 5u), TITLE_LIMIT), NULL_SLOT)).SampleLevel(_55, float2(_6796, _6797), 0.0f);
uint _6804 = asuint(_6801.x);
uint _6808 = _6804 & 2147483647u;
uint _6809 = _6808 - 939524096u;
uint _6815 = ((_6809 + 4095u) + ((_6809 >> 13u) & 1u)) >> 13u;
uint _6821 = _6808 >> 23u;
uint _6823 = 126u - _6821;
uint _6826 = (_6823 > 31u) ? 31u : _6823;
uint _6832 = (_6821 == 0u) ? 0u : ((_6808 & 8388607u) | 8388608u);
uint _6833 = _6832 >> _6826;
uint _6834 = _6826 - 1u;
uint _6857 = asuint(_6801.y);
uint _6860 = _6857 & 2147483647u;
uint _6861 = _6860 - 939524096u;
uint _6866 = ((_6861 + 4095u) + ((_6861 >> 13u) & 1u)) >> 13u;
uint _6871 = _6860 >> 23u;
uint _6872 = 126u - _6871;
uint _6874 = (_6872 > 31u) ? 31u : _6872;
uint _6878 = (_6871 == 0u) ? 0u : ((_6860 & 8388607u) | 8388608u);
uint _6879 = _6878 >> _6874;
uint _6880 = _6874 - 1u;
uint _6903 = (((((_6808 > 2139095040u) ? (((_6808 >> 13u) & 1023u) | 32256u) : ((_6808 < 947912704u) ? (_6833 + (((_6832 >> _6834) & 1u) & (uint((_6832 & ((1u << _6834) - 1u)) != 0u) | (_6833 & 1u)))) : ((_6808 == 2139095040u) ? 31744u : ((_6815 >= 31744u) ? 31744u : _6815)))) | ((_6804 >> 16u) & 32768u)) | ((((_6860 > 2139095040u) ? (((_6860 >> 13u) & 1023u) | 32256u) : ((_6860 < 947912704u) ? (_6879 + (((_6878 >> _6880) & 1u) & (uint((_6878 & ((1u << _6880) - 1u)) != 0u) | (_6879 & 1u)))) : ((_6860 == 2139095040u) ? 31744u : ((_6866 >= 31744u) ? 31744u : _6866)))) | ((_6857 >> 16u) & 32768u)) << 16u)) >> 16u) & 65535u;
_6911 = (_6437 && (_6438 && (_6440 && (spvUnpackHalf2x16(_6903).x >= asfloat(heap_srv_raw(_6686).Load<uint>(shifted(_6686, (min(((_6637 * 116u) + 84u), 2147483584u) >> 2u) * 4 + 0))))))) ? 4294967295u : 0u;
}
return _6911;
}
void comp_main()
{
uint4 _73 = asuint(_52_m0[1u]);
uint _75 = gl_WorkGroupID.x + _73.w;
uint _78 = WaveReadLaneFirst(gl_LocalInvocationIndex);
uint _84 = (_78 & 4294967264u) + WaveGetLaneIndex();
uint _89 = _73.y;
uint _97 = min((((_89 + 128u) >> 5u) << 2u), 2147483584u);
uint _119 = _73.x;
uint _205;
uint _206;
uint _207;
if (firstbitlow(WaveActiveBallot(true).x) == countbits((WaveGetLaneIndex() >= 32u) ? 4294967295u : ((1u << (WaveGetLaneIndex() & 31u)) - 1u)))
{
uint _177 = min(asuint(asfloat(_39.Load<uint>((min((((_89 + 64u) >> 5u) << 2u), 2147483584u) >> 2u) * 4 + 0))), NULL_SLOT);
uint _194 = WaveReadLaneFirst(asuint(heap_rwbuf(min(asuint(asfloat(_39.Load<uint>((min((((_119 + 1920u) >> 5u) << 2u), 2147483584u) >> 2u) * 4 + 0))), NULL_SLOT))[min((asuint(asfloat(heap_srv_raw(_177).Load<uint>(shifted(_177, (min(((asuint(table_cbv(asuint(asfloat(_39.Load<uint>((min((((_89 + 352u) >> 5u) << 2u), 2147483584u) >> 2u) * 4 + 0))), 0u)).x & 31u) << 3u), 2147483584u) >> 2u) * 4 + 0)))) + (_75 >> 1u)), 134217727u)].x));
_205 = (_194 >> 16u) & 65535u;
_206 = ((_194 >> 8u) & 255u) << 4u;
_207 = (_194 & 255u) << 4u;
}
else
{
_205 = 0u;
_206 = 0u;
_207 = 0u;
}
uint _213 = min(asuint(asfloat(_39.Load<uint>((_97 >> 2u) * 4 + 0))), NULL_SLOT);
uint _215 = min(68u, 2147483584u);
uint _221 = min(72u, 2147483584u);
uint _227 = min(76u, 2147483584u);
float _232 = asfloat(heap_srv_raw(_213).Load<uint>(shifted(_213, (_227 >> 2u) * 4 + 0)));
uint _233 = min(80u, 2147483584u);
float _238 = asfloat(heap_srv_raw(_213).Load<uint>(shifted(_213, (_233 >> 2u) * 4 + 0)));
uint _239 = WaveReadLaneFirst(_207);
uint _240 = WaveReadLaneFirst(_206);
uint _241 = WaveReadLaneFirst(_205);
uint _242 = _239 + ((_84 % 8u) << 1u);
uint _243 = _240 + ((((_84 / 8u) % 4u) << 1u) + ((_75 << 3u) & 8u));
bool _246 = asfloat(heap_srv_raw(_213).Load<uint>(shifted(_213, (_215 >> 2u) * 4 + 0))) > float(_242);
bool _247 = asfloat(heap_srv_raw(_213).Load<uint>(shifted(_213, (_221 >> 2u) * 4 + 0))) > float(_243);
if (!(_246 ? (!_247) : true))
{
uint _250 = _243 >> 1u;
uint _253 = _242 >> 1u;
uint _254 = _250 << 1u;
uint _255 = _253 << 1u;
uint _260 = min((((_119 + 2240u) >> 5u) << 2u), 2147483584u);
uint _274 = ((_243 >> 3u) + (_242 >> 3u)) + asuint(table_cbv(asuint(asfloat(_39.Load<uint>((_260 >> 2u) * 4 + 0))), 13u)).w;
uint _275 = 1u + _274;
uint _276 = 1u & _274;
uint _278 = _276 | _255;
uint _280 = ((_275 >> 1u) & 1u) | _254;
precise float _283 = 0.5f + float(_278);
precise float _285 = 0.5f + float(_280);
precise float _286 = _232 * _283;
uint _287 = asuint(_286);
precise float _288 = _238 * _285;
uint _289 = asuint(_288);
if (!((0.0f > _286) || ((1.0f <= _286) || ((0.0f > _288) || (1.0f <= _288)))))
{
uint _303 = min((((_119 + 320u) >> 5u) << 2u), 2147483584u);
uint _309 = min(asuint(asfloat(_39.Load<uint>((_303 >> 2u) * 4 + 0))), NULL_SLOT);
uint _315 = min((((_89 + 224u) >> 5u) << 2u), 2147483584u);
uint _321 = min(asuint(asfloat(_39.Load<uint>((_315 >> 2u) * 4 + 0))), NULL_SLOT);
uint _325 = 1u | _255;
uint _326 = 1u | _254;
uint _331 = (_275 & 2u) | _276;
bool _332 = (_241 & 6u) == 6u;
uint _333 = min(1520u, 2147483584u);
float4 _340 = heap_tex2d(_321).Load(int3(uint2(_255, _254), 0u));
float _343 = _340.x;
uint _344 = asuint(_343);
float4 _345 = heap_tex2d(_321).Load(int3(uint2(_325, _254), 0u));
float _347 = _345.x;
uint _348 = asuint(_347);
float4 _349 = heap_tex2d(_321).Load(int3(uint2(_255, _326), 0u));
float _351 = _349.x;
uint _352 = asuint(_351);
float4 _353 = heap_tex2d(_321).Load(int3(uint2(_325, _326), 0u));
float _355 = _353.x;
uint _356 = asuint(_355);
bool _359 = 1u == (1u & (asuint(asfloat(heap_srv_raw(_309).Load<uint>(shifted(_309, (_333 >> 2u) * 4 + 0)))) ^ (_250 ^ _253)));
uint _362 = (_246 && (_247 && _359)) ? 4286578687u : 2139095039u;
uint _368 = (_246 && (_247 && (0.0f == _343))) ? _362 : _344;
uint _372 = (_246 && (_247 && (0.0f == _347))) ? _362 : _348;
float _373 = asfloat(_372);
float _374 = asfloat(_368);
bool _375 = _373 > _374;
bool _380 = _359 ? (!_375) : true;
bool _382 = _359 ? false : (_373 < _374);
uint _386 = _380 ? (_382 ? _372 : _368) : _372;
uint _390 = (_246 && (_247 && (0.0f == _351))) ? _362 : _352;
float _391 = asfloat(_390);
float _392 = asfloat(_386);
bool _393 = _391 > _392;
bool _397 = _359 ? false : (_391 < _392);
uint _402 = (_359 ? (!_393) : true) ? (_397 ? _390 : _386) : _390;
uint _406 = (_246 && (_247 && (0.0f == _355))) ? _362 : _356;
float _407 = asfloat(_406);
float _408 = asfloat(_402);
bool _409 = _407 > _408;
bool _413 = _359 ? false : (_407 < _408);
uint _414 = _413 ? 3u : ((_359 && _409) ? 3u : (_397 ? 2u : ((_359 && _393) ? 2u : (_382 ? 1u : (_380 ? 0u : ((_359 && _375) ? 1u : _275))))));
uint _474;
uint _475;
uint _476;
uint _477;
uint _478;
if (_331 != _414)
{
precise float _423 = 1.0f / abs(asfloat((_359 ? (!_409) : true) ? (_413 ? _406 : _402) : _406));
precise float _437 = (-0.0f) - abs(asfloat((_246 && (_247 && (3u == _331))) ? _356 : ((_246 && (_247 && (2u == _331))) ? _352 : ((_246 && (_247 && (1u == _331))) ? _348 : _344))));
precise float _439 = _437 * _423;
precise float _440 = _439 + 1.0f;
bool _442 = !(0.02500000037252902984619140625f > abs(_440));
uint _448 = _442 ? ((_414 & 1u) | _255) : _278;
uint _450 = _442 ? ((_442 ? (_414 >> 1u) : _280) | _254) : _280;
precise float _458 = 0.5f + asfloat(_442 ? asuint(float(_448)) : _289);
precise float _462 = 0.5f + asfloat(_442 ? asuint(float(_450)) : _287);
precise float _466 = _232 * asfloat(_442 ? asuint(_458) : _289);
precise float _470 = _238 * asfloat(_442 ? asuint(_462) : _331);
_474 = _448;
_475 = _450;
_476 = _442 ? asuint(_470) : _289;
_477 = _442 ? asuint(_466) : _287;
_478 = _442 ? _414 : _331;
}
else
{
_474 = _278;
_475 = _280;
_476 = _289;
_477 = _287;
_478 = _331;
}
uint _498 = min(asuint(asfloat(_39.Load<uint>((_97 >> 2u) * 4 + 0))), NULL_SLOT);
uint _500 = min(8u, 2147483584u);
uint _505 = min(12u, 2147483584u);
uint _511 = min(16u, 2147483584u);
uint _516 = min(20u, 2147483584u);
uint _522 = min(24u, 2147483584u);
uint _528 = min(28u, 2147483584u);
uint _534 = min(32u, 2147483584u);
uint _539 = min(36u, 2147483584u);
uint _545 = min(40u, 2147483584u);
uint _551 = min(44u, 2147483584u);
uint _557 = min(48u, 2147483584u);
uint _569 = (_241 >> 2u) & 1u;
float4 _573 = heap_tex2d(min(asuint(asfloat(_39.Load<uint>((min((((_119 + 1664u) >> 5u) << 2u), 2147483584u) >> 2u) * 4 + 0))), NULL_SLOT)).Load(int3(uint2(_474, _475), 0u));
uint _582 = min((((_119 + 800u) >> 5u) << 2u), 2147483584u);
uint _595 = min((((_89 + 384u) >> 5u) << 2u), 2147483584u);
uint _601 = asuint(asfloat(_39.Load<uint>((_595 >> 2u) * 4 + 0)));
uint4 _605 = asuint(table_cbv(_601, 0u));
uint _606 = _605.x;
uint _607 = _605.y;
uint _608 = _605.z;
uint4 _611 = asuint(table_cbv(_601, 1u));
uint _612 = _611.x;
uint _613 = _611.y;
uint _614 = _611.z;
uint4 _617 = asuint(table_cbv(_601, 2u));
uint _618 = _617.x;
uint _619 = _617.y;
uint _620 = _617.z;
uint _624 = asuint(heap_tex2d(min(asuint(asfloat(_39.Load<uint>((_582 >> 2u) * 4 + 0))), NULL_SLOT)).Load(int3(uint2(_474, _475), 0u)).y);
float _625 = asfloat(_614);
precise float _626 = 0.0f - _625;
float _628 = asfloat(_620);
precise float _629 = 0.0f - _628;
uint _631 = WaveReadLaneFirst(asuint(_626));
uint _632 = WaveReadLaneFirst(asuint(_629));
precise float _633 = 255.0f * _573.y;
precise float _635 = 255.0f * _573.z;
precise float _636 = 255.0f * _573.w;
uint _641 = (uint(_635) << 8u) | uint(_633);
precise float _647 = asfloat(_476) * (-2.0f);
precise float _649 = _647 + 1.0f;
precise float _654 = asfloat(_477) * 2.0f;
precise float _656 = _654 + (-1.0f);
precise float _658 = asfloat(heap_srv_raw(_498).Load<uint>(shifted(_498, (_516 >> 2u) * 4 + 0))) * _649;
precise float _659 = asfloat(heap_srv_raw(_498).Load<uint>(shifted(_498, (_534 >> 2u) * 4 + 0))) * _649;
precise float _661 = 0.00024420025874860584735870361328125f * float(4095u & _641);
precise float _663 = asfloat(heap_srv_raw(_498).Load<uint>(shifted(_498, (_551 >> 2u) * 4 + 0))) * _649;
precise float _664 = asfloat(heap_srv_raw(_498).Load<uint>(shifted(_498, (_511 >> 2u) * 4 + 0))) * _656;
precise float _665 = _664 + _658;
precise float _666 = asfloat(heap_srv_raw(_498).Load<uint>(shifted(_498, (_528 >> 2u) * 4 + 0))) * _656;
precise float _667 = _666 + _659;
precise float _668 = 0.00024420025874860584735870361328125f * float((((uint(_636) << 16u) | _641) >> 12u) & 4095u);
precise float _669 = _661 * 2.0f;
precise float _670 = _669 + (-1.0f);
precise float _674 = asfloat(heap_srv_raw(_498).Load<uint>(shifted(_498, (_545 >> 2u) * 4 + 0))) * _656;
precise float _675 = _674 + _663;
precise float _676 = asfloat(heap_srv_raw(_498).Load<uint>(shifted(_498, (_522 >> 2u) * 4 + 0))) + _665;
precise float _677 = _668 * 2.0f;
precise float _678 = _677 + (-1.0f);
precise float _680 = 1.0f - abs(_670);
precise float _681 = asfloat(heap_srv_raw(_498).Load<uint>(shifted(_498, (_505 >> 2u) * 4 + 0))) + 1.0f;
precise float _682 = asfloat(heap_srv_raw(_498).Load<uint>(shifted(_498, (_539 >> 2u) * 4 + 0))) + _667;
uint _683 = 3u & _624;
precise float _686 = _680 - abs(_678);
float _687 = asfloat((_246 && (_247 && (3u == _478))) ? _356 : ((_246 && (_247 && (2u == _478))) ? _352 : ((_246 && (_247 && (1u == _478))) ? _348 : _344)));
precise float _688 = _681 - _687;
precise float _689 = (-0.0f) - _686;
float _696 = clamp(((asuint(_689) & 2147483647u) == 0u) ? _689 : max(_689, _689), 0.0f, 1.0f);
precise float _697 = 1.0f / _688;
precise float _700 = (-0.0f) - _696;
precise float _703 = _678 + ((_246 && (_247 && (0.0f <= _678))) ? _700 : _696);
precise float _709 = asfloat(heap_srv_raw(_498).Load<uint>(shifted(_498, (_500 >> 2u) * 4 + 0))) * _697;
precise float _710 = asfloat(heap_srv_raw(_498).Load<uint>(shifted(_498, (_557 >> 2u) * 4 + 0))) + _675;
precise float _711 = _670 + ((_246 && (_247 && (0.0f <= _670))) ? _700 : _696);
precise float _712 = _703 * _703;
uint _713 = 7u & _624;
float _716 = asfloat(_608);
precise float _717 = 0.0f - _716;
precise float _719 = _711 * _711;
precise float _720 = _719 + _712;
precise float _723 = _686 * _686;
precise float _724 = _723 + _720;
uint _725 = WaveReadLaneFirst(asuint(_717));
float _726 = rsqrt(_724);
precise float _731 = (-0.0f) - _709;
float _732 = (_246 && (_247 && ((1u == _683) || ((2u == _713) || (1u == (1u & (_624 >> 6u))))))) ? _731 : _709;
uint _733 = asuint(_732);
float _734 = abs(_732);
precise float _735 = _682 * _734;
precise float _736 = _735 + 0.0f;
precise float _737 = _710 * _734;
precise float _738 = _737 + 0.0f;
precise float _740 = _676 * _734;
precise float _741 = _740 + 0.0f;
precise float _742 = _711 * _726;
uint _743 = asuint(_742);
precise float _744 = _703 * _726;
uint _745 = asuint(_744);
precise float _746 = _686 * _726;
uint _747 = asuint(_746);
uint _887;
if (_332)
{
precise float _749 = asfloat(_606) * _741;
precise float _751 = asfloat(_607) * _741;
precise float _753 = asfloat(_612) * _736;
precise float _754 = _753 + _749;
precise float _756 = asfloat(_613) * _736;
precise float _757 = _756 + _751;
precise float _759 = asfloat(_618) * _738;
precise float _760 = _759 + _754;
precise float _762 = asfloat(_619) * _738;
precise float _763 = _762 + _757;
uint _769 = asuint(asfloat(_39.Load<uint>((_595 >> 2u) * 4 + 0)));
uint4 _774 = asuint(table_cbv(_769, 9u));
uint4 _780 = asuint(table_cbv(_769, 10u));
uint4 _786 = asuint(table_cbv(_769, 11u));
uint4 _792 = asuint(table_cbv(_769, 15u));
uint4 _798 = asuint(table_cbv(_769, 14u));
uint4 _803 = asuint(table_cbv(_769, 13u));
precise float _808 = asfloat(_786.x) * _760;
precise float _809 = _808 + asfloat(_792.x);
precise float _812 = asfloat(_780.x) * _760;
precise float _813 = _812 + asfloat(_798.x);
precise float _816 = asfloat(_774.x) * _760;
precise float _817 = _816 + asfloat(_803.x);
precise float _820 = asfloat(_786.y) * _763;
precise float _821 = _820 + asfloat(_792.y);
precise float _824 = asfloat(_774.y) * _763;
precise float _825 = _824 + asfloat(_803.y);
precise float _828 = asfloat(_780.y) * _763;
precise float _829 = _828 + asfloat(_798.y);
float _830 = abs(_809);
float _831 = abs(_821);
uint _833 = asuint(_830);
uint _834 = asuint(_831);
float _840 = (((_833 | _834) & 2147483647u) == 0u) ? asfloat(_833 & _834) : max(_830, _831);
float _842 = abs(_817);
float _843 = abs(_825);
uint _845 = asuint(_842);
uint _846 = asuint(_843);
float _852 = (((_845 | _846) & 2147483647u) == 0u) ? asfloat(_845 & _846) : max(_842, _843);
float _854 = abs(_813);
float _855 = abs(_829);
uint _857 = asuint(_854);
uint _858 = asuint(_855);
float _864 = (((_857 | _858) & 2147483647u) == 0u) ? asfloat(_857 & _858) : max(_854, _855);
uint _867 = asuint(_852) | asuint(_864);
float _871 = ((_867 & 2147483647u) == 0u) ? asfloat(_867) : min(_852, _864);
uint _874 = asuint(_871) | asuint(_840);
precise float _879 = (((_874 & 2147483647u) == 0u) ? asfloat(_874) : min(_871, _840)) * 16.666667938232421875f;
precise float _881 = _879 + (-7.0f);
_887 = uint(_246 && (_247 && ((-1.0f) < _881)));
}
else
{
_887 = _569;
}
uint _892 = min((((_119 + 960u) >> 5u) << 2u), 2147483584u);
bool _912 = 1u != _683;
float _916 = asfloat(asuint(table_cbv(asuint(asfloat(_39.Load<uint>((_260 >> 2u) * 4 + 0))), 13u)).x);
float _917 = asfloat(2147483647u & _733);
precise float _918 = _916 * _917;
precise float _919 = 255.0f * heap_tex2d(min(asuint(asfloat(_39.Load<uint>((_892 >> 2u) * 4 + 0))), NULL_SLOT)).Load(int3(uint2(_474, _475), 0u)).w;
precise float _921 = 8.0f * _918;
uint _923 = asuint(_921);
uint _926 = 31u & uint(_919);
bool _936 = 1u < (4294967293u + _713);
bool _937 = 5u == _926;
bool _938 = 5u != _926;
precise float _939 = 0.5f * ((((953267991u | _923) & 2147483647u) == 0u) ? asfloat(953267991u & _923) : max(9.9999997473787516355514526367188e-05f, _921));
uint _941 = (_241 >> 13u) & 1u;
bool _942 = _941 != 0u;
bool _944 = _912 && (_936 && _937);
float _945 = asfloat(_631);
precise float _946 = _945 * _744;
float _949 = asfloat(_725);
precise float _951 = _949 * _742;
precise float _952 = _951 + asfloat(_944 ? asuint(_946) : _747);
float _955 = asfloat(_632);
precise float _957 = _955 * _746;
precise float _958 = _957 + asfloat(_944 ? asuint(_952) : _747);
bool _967 = _246 && (_247 && (_912 && (_936 && (_937 && (0.0f > asfloat(_944 ? asuint(_958) : _747))))));
precise float _968 = (-0.0f) - _742;
uint _971 = _944 ? asuint(_967 ? _968 : _742) : _743;
precise float _972 = (-0.0f) - _744;
uint _975 = _944 ? asuint(_967 ? _972 : _744) : _745;
precise float _976 = (-0.0f) - _746;
uint _979 = _944 ? asuint(_967 ? _976 : _746) : _747;
bool _982 = 3u != _713;
bool _984 = _982 ? (!_942) : true;
bool _985 = _938 ? _984 : true;
uint _3836;
uint _3837;
uint _3838;
uint _3839;
uint _3840;
bool _19638;
bool _20064;
if (_912 ? (_936 ? (_937 ? _984 : _985) : _985) : _985)
{
_3836 = 1065353216u;
_3837 = 0u;
_3838 = _941;
_3839 = 0u;
_3840 = 0u;
_20064 = false;
_19638 = true;
}
else
{
// Site 1's root load (header +48 of structure view 0, console 0x810) is the constant 1:
// the root test's skip is gone and an empty top level gives a miss through the query.
uint _1043 = 1u;
bool _1044 = int(_1043) > int(0u);
bool _1055 = !_1044;
bool _1056 = _938 ? _1055 : true;
uint _3822;
uint _3823;
uint _3824;
bool _19640;
bool _20063;
if (_912 ? (_936 ? (_937 ? _1055 : _1056) : _1056) : _1056)
{
_3822 = 0u;
_3823 = 0u;
_3824 = 0u;
_20063 = false;
_19640 = true;
}
else
{
precise float _1062 = 0.0625f * _939;
bool _1076 = _982 && (_942 && (0u == (_944 ? uint(_967) : 0u)));
bool _1077 = _938 && _1076;
float _1088 = asfloat((_246 && (_247 && (_912 ? (_936 ? (_937 ? _1076 : _1077) : _1077) : _1077))) ? asuint(_1062) : 1036831949u);
precise float _1089 = asfloat(_975) * _1088;
precise float _1090 = _1089 + _736;
precise float _1092 = asfloat(_971) * _1088;
precise float _1093 = _1092 + _741;
precise float _1095 = asfloat(_979) * _1088;
precise float _1096 = _1095 + _738;
precise float _1098 = 0.5f + float((3u & (_475 + _474)) & 255u);
precise float _1101 = 0.25f * _1098;
precise float _1103 = _1101 + 1.0f;
precise float _1104 = _1090 * _1090;
precise float _1105 = 0.00124999997206032276153564453125f * _1103;
precise float _1107 = _1093 * _1093;
precise float _1108 = _1107 + _1104;
precise float _1112 = _1105 * _917;
precise float _1113 = _1096 * _1096;
precise float _1114 = _1113 + _1108;
float _1115 = rsqrt(_1114);
precise float _1117 = _1093 * _1115;
precise float _1118 = _1090 * _1115;
precise float _1119 = _1096 * _1115;
precise float _1121 = (-0.0f) - _1112;
precise float _1122 = _1121 * _1117;
precise float _1123 = _1122 + _1093;
precise float _1124 = _1121 * _1118;
precise float _1125 = _1124 + _1090;
precise float _1126 = _1121 * _1119;
precise float _1127 = _1126 + _1096;
// Site 1, the walk (console E 0x908 to X 0x1500) as a host ray query of structure
// view 0 (t248: table slot 1 +0xA0). The ray as the walk's node tests take it: origin
// _1123 _1125 _1127 (the contact ray's start, console v17 v26 v29), direction _949
// _945 _955 (-s18 -s22 -s62, copied inside the walk at 0x948-0x960), t min 0 (the
// triangle test takes 0 <= t, 0x130C), t max 20 (v33, 0x8F8). Flags 0x84:
// ACCEPT_FIRST_HIT_AND_END_SEARCH (a commit sets the lane's action to 0 and ends its
// walk, 0x1320) and CULL_NON_OPAQUE (only a candidate whose opacity, triangle +48 bit
// 0 or'ed with the instance's force bits, is 1, opaque, goes on to the t test and the
// commit, 0x12AC-0x12E4; there is no body); no face is culled (cull multiplier 0,
// 0xFDC). Instance mask 0x10 (instance +48 bit 28, 0xB6C). Outputs at X: _3822 (the
// committed triangle pointer, v31) committed ? 1 : 0, which the hit test after X
// (& 4, != 0) takes as a hit; _3823 (the iteration count, v32, > 0xFFFE counts as a
// hit) 0, as the query has no candidate to count (the header); _3824 (v33, the t max
// each commit shortens) the committed t, else 20.
float3 rq1_origin = float3(_1123, _1125, _1127);
float3 rq1_direction = float3(_949, _945, _955);
bool rq1_hit = false;
float rq1_t = 20.0f;
if (!any(isnan(rq1_origin)) && !any(isnan(rq1_direction)))
{
RayQuery<RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_CULL_NON_OPAQUE> rq1;
RayDesc rq1_ray = { rq1_origin, 0.0f, rq1_direction, 20.0f };
rq1.TraceRayInline(scene_c, RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_CULL_NON_OPAQUE, 0x10u, rq1_ray);
while (rq1.Proceed())
{
}
if (rq1.CommittedStatus() == COMMITTED_TRIANGLE_HIT)
{
rq1_hit = true;
rq1_t = rq1.CommittedRayT();
}
}
_3822 = rq1_hit ? 1u : 0u;
_3823 = 0u;
_3824 = asuint(rq1_t);
_20063 = false;
_19640 = true;
}
uint _20009;
uint _20010;
uint _20011;
uint _20012;
uint _20013;
bool _20087;
if (_19640)
{
bool _3833 = (65534u < _3823) || (0u != ((0u != _3822) ? ((4u > (4u & _3822)) ? 1u : 2u) : 0u));
_20009 = _3833 ? 0u : 1065353216u;
_20010 = uint(_3833);
_20011 = 1u;
_20012 = _3823;
_20013 = _3824;
_20087 = true;
}
else
{
_20009 = _19772;
_20010 = _19772;
_20011 = _19772;
_20012 = _19772;
_20013 = _19772;
_20087 = false;
}
_3836 = _20009;
_3837 = _20010;
_3838 = _20011;
_3839 = _20012;
_3840 = _20013;
_20064 = _20063;
_19638 = _20087;
}
bool _19636;
if (_19638)
{
uint _3844 = min((((_119 + 32u) >> 5u) << 2u), 2147483584u);
uint _3848 = min((((_119 + 256u) >> 5u) << 2u), 2147483584u);
uint _3853 = min((((_119 + 672u) >> 5u) << 2u), 2147483584u);
bool _3854 = 0u != _887;
uint _10626;
uint _10627;
uint _10628;
uint _10629;
bool _10630;
bool _19654;
bool _20073;
if (_332 ? false : (!_3854))
{
_10626 = _3836;
_10627 = _887;
_10628 = _3838;
_10629 = _3839;
_10630 = false;
_20073 = _20064;
_19654 = true;
}
else
{
float _3857 = asfloat(_975);
precise float _3858 = _625 * _3857;
precise float _3860 = (-140.0f) + _917;
float _3868 = asfloat(_971);
precise float _3869 = _716 * _3868;
precise float _3870 = _3869 + _3858;
precise float _3871 = 0.01666666753590106964111328125f * _3860;
float _3873 = clamp(_3871, 0.0f, 1.0f);
float _3879 = asfloat(_979);
precise float _3880 = _628 * _3879;
precise float _3881 = _3880 + _3870;
// Site 2's root load (header +48 of structure view 1, console 0x15C4) is the constant 1: the root
// test's skip is gone and an empty top level gives a miss through the query.
uint _3919 = 1u;
precise float _3920 = (-2.0f) * _3873;
precise float _3921 = _3920 + 3.0f;
float _3923 = abs(_3881);
uint _3926 = asuint(_3923);
precise float _3933 = 0.5f * _939;
precise float _3934 = _939 * _3879;
precise float _3935 = _3873 * _3921;
precise float _3936 = 1.0f / ((((1036831949u | _3926) & 2147483647u) == 0u) ? asfloat(1036831949u & _3926) : max(0.100000001490116119384765625f, _3923));
precise float _3937 = _939 * _3857;
precise float _3939 = _939 * _3868;
precise float _3940 = _3873 * _3935;
precise float _3941 = 0.5f * _3937;
precise float _3942 = _3941 + _736;
precise float _3943 = 0.5f * _3934;
precise float _3944 = _3943 + _738;
precise float _3945 = 0.5f * _3939;
precise float _3946 = _3945 + _741;
precise float _3947 = _3940 * (-5.0f);
precise float _3949 = _3947 + 8.5f;
precise float _3951 = 0.20000000298023223876953125f * _3936;
precise float _3953 = _3951 + _3933;
bool _3955 = int(_3919) > int(0u);
precise float _3962 = (-0.0f) - _628;
precise float _3963 = 4096.0f * _3962;
precise float _3965 = _3963 + _3944;
precise float _3966 = (-0.0f) - _625;
precise float _3967 = 4096.0f * _3966;
precise float _3968 = _3967 + _3942;
precise float _3969 = (-0.0f) - _716;
precise float _3970 = 4096.0f * _3969;
precise float _3971 = _3970 + _3946;
precise float _3972 = _3953 + _3949;
bool _3979 = !_3955;
uint _7135;
uint _7136;
uint _7137;
bool _19656;
bool _20067;
// The committed hit's instance +52 (contribution) and triangle +48 >> 8 (geometry index), which
// the record test after X reads.
uint rq2_contribution = 0u;
uint rq2_geometry = 0u;
if (_332 ? _3979 : (_3854 ? _3979 : true))
{
_7135 = 0u;
_7136 = 0u;
_7137 = asuint(_3953);
_20067 = _20064;
_19656 = true;
}
else
{
// Site 2, the walk (console E 0x16D0 to X 0x24E0, back edges 0x2474, 0x24D0) as a host ray query of
// structure view 1 (t249: table slot 1 +0x60), with its candidate body in the Proceed loop. The ray as
// the walk's node tests take it: origin _3971 _3968 _3965 (v18 v19 v20, the pixel's position - 4096
// dir), direction _716 _625 _628 (s18 s22 s62, v14 v15 v16), t min _3933 (v24, 0x15E0; the triangle
// test 0x2080), t max 4096 - t min (v32, 0x16A0). Flags 0x14: ACCEPT_FIRST_HIT_AND_END_SEARCH (a
// commit, an opaque candidate's or the body's, sets the lane's action to 0 and ends its walk, 0x22E8)
// and CULL_BACK_FACING_TRIANGLES (cull multiplier 1, 0x1D8C, with the instance's cull-disable and
// counter-clockwise flags as D3D12 applies them); no opacity flag: the walk runs the body where
// (triangle +48 bit 0 | the instance's force bits) is not 1, opaque, which is D3D12's opacity, so the
// body runs on CANDIDATE_NON_OPAQUE_TRIANGLE. Instance mask 0xA0 (instance +48 & 0xA0000000, 0x191C).
// A lane traces where t min < t max and the ray is ordered (the walk takes t min <= t < t max).
// Outputs at X: _7135 (the committed triangle pointer, v26) and _7136 (the committed instance pointer,
// v27) committed ? 1 : 0, which the record test after X takes as a hit and whose fields it reads from
// the query (below); _7137 (v32, the t max) the committed t, else its value at E.
float3 rq2_origin = float3(_3971, _3968, _3965);
float3 rq2_direction = float3(_716, _625, _628);
float rq2_tmin = _3933;
float rq2_tmax = 4096.0f - _3933;
bool rq2_hit = false;
float rq2_t = 0.0f;
if ((rq2_tmin < rq2_tmax) && !any(isnan(rq2_origin)) && !any(isnan(rq2_direction)))
{
uint rq2_count = 0u;
RayQuery<RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_CULL_BACK_FACING_TRIANGLES> rq2;
RayDesc rq2_ray = { rq2_origin, rq2_tmin, rq2_direction, rq2_tmax };
rq2.TraceRayInline(scene_p, RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_CULL_BACK_FACING_TRIANGLES, 0xA0u, rq2_ray);
while (rq2.Proceed())
{
// The walk's stop: it counts its passes (v31) and ends the lane with nothing committed when
// !(0xFFFF > count) (0x2404); this loop counts its candidates and stops at the same test.
rq2_count += 1u;
if (!(65535u > rq2_count))
{
rq2.Abort();
break;
}
if ((rq2.CandidateType() == CANDIDATE_NON_OPAQUE_TRIANGLE)
&& (candidate_decision(rq2.CandidateInstanceContributionToHitGroupIndex(), rq2.CandidateGeometryIndex(),
rq2.CandidateInstanceID(), rq2.CandidateTriangleRayT(), _3971, _3968, _3965, _716, _625, _628,
_3844, _3848, _3853) == 4294967295u))
{
// The body's commit ends the lane's walk (action 0, as accept-first does).
rq2.CommitNonOpaqueTriangleHit();
rq2.Abort();
}
}
if (rq2.CommittedStatus() == COMMITTED_TRIANGLE_HIT)
{
rq2_hit = true;
rq2_t = rq2.CommittedRayT();
rq2_contribution = rq2.CommittedInstanceContributionToHitGroupIndex();
rq2_geometry = rq2.CommittedGeometryIndex();
}
}
_7135 = rq2_hit ? 1u : 0u;
_7136 = rq2_hit ? 1u : 0u;
_7137 = rq2_hit ? asuint(rq2_t) : asuint(rq2_tmax);
_20067 = _20064;
_19656 = true;
}
uint _19894;
uint _19897;
uint _19900;
uint _19903;
bool _19906;
bool _20072;
bool _20091;
if (_19656)
{
uint _7377;
uint _7378;
if (0u != _7135)
{
// The committed hit's instance +52 and triangle +48 >> 8 (console 0x2538, 0x2558, 0x2584; instance +60 only as
// the triangle's base): the query's contribution and geometry index.
uint _7188 = rq2_contribution;
uint _7284 = (0u != _7136) ? rq2_geometry : 0u;
uint _7291 = min(asuint(asfloat(_39.Load<uint>((_303 >> 2u) * 4 + 0))), NULL_SLOT);
uint _7301 = (16383u & (_7284 + asuint(asfloat(_7188)))) * 116u;
uint _7308 = min(asuint(asfloat(_39.Load<uint>((_3848 >> 2u) * 4 + 0))), NULL_SLOT);
uint _7374;
if (asuint(asfloat(heap_srv_raw(_7291).Load<uint>(shifted(_7291, (min(1808u, 2147483584u) >> 2u) * 4 + 0)))) == asuint(asfloat(heap_srv_raw(_7308).Load<uint>(shifted(_7308, (min((_7301 + 8u), 2147483584u) >> 2u) * 4 + 0)))))
{
uint _7324 = min(asuint(asfloat(_39.Load<uint>((_3848 >> 2u) * 4 + 0))), NULL_SLOT);
uint _7331 = asuint(asfloat(heap_srv_raw(_7324).Load<uint>(shifted(_7324, (min((_7301 + 88u), 2147483584u) >> 2u) * 4 + 0))));
uint _7334 = _7331 >> 9u;
uint _7335 = _7331 >> 18u;
float _7350 = exp2(float(int((_7331 >> 27u) - 24u)));
precise float _7356 = float(510u & _7334) * _7350;
precise float _7357 = float(510u & _7331) * _7350;
precise float _7358 = float(510u & _7335) * _7350;
precise float _7361 = asfloat((1u == (1u & _7334)) ? 3212836864u : 1065353216u) * _7356;
precise float _7363 = asfloat((1u == (1u & _7331)) ? 3212836864u : 1065353216u) * _7357;
precise float _7365 = asfloat((1u == (1u & _7335)) ? 3212836864u : 1065353216u) * _7358;
precise float _7366 = _7361 * _7361;
precise float _7367 = _7363 * _7363;
precise float _7368 = _7367 + _7366;
precise float _7369 = _7365 * _7365;
precise float _7370 = _7369 + _7368;
_7374 = (sqrt(_7370) > _921) ? 4294967295u : 0u;
}
else
{
_7374 = 0u;
}
_7377 = uint(4294967295u == _7374);
_7378 = 4294967295u;
}
else
{
_7377 = 0u;
_7378 = 0u;
}
bool _7379 = 4294967295u == _7378;
uint _10582;
uint _10583;
uint _10584;
uint _10585;
uint _10586;
bool _19664;
bool _20071;
if (_7379)
{
_10582 = 953267991u;
_10583 = 953267991u;
_10584 = 0u;
_10585 = 953267991u;
_10586 = _7137;
_20071 = _20067;
_19664 = true;
}
else
{
precise float _7387 = 4096.0f - _3972;
uint _7388 = asuint(_7387);
// Site 3's root load (header +48 of structure view 2, console 0x26F4) is the constant 1: the root
// test's skip is gone and an empty top level gives a miss through the query.
uint _7431 = 1u;
bool _7432 = int(_7431) > int(0u);
uint _10559;
uint _10560;
uint _10561;
bool _19666;
bool _20070;
if (_7432)
{
// Site 3, the walk (console E 0x2760 to X 0x3560, back edges 0x34FC, 0x3558) as a host ray query of
// structure view 2 (t250: table slot 1 +0x20), with its candidate body in the Proceed loop. The ray as
// the walk's node tests take it: origin _3971 _3968 _3965 (v18 v19 v20, as site 2's), direction _716
// _625 _628 (s18 s22 s62, v14 v15 v16), t min _3972 (v23, 0x167C in site 2's setup; the triangle test
// 0x3110), t max _7388 = 4096 - t min (v21, 0x26DC). Flags 0x14: ACCEPT_FIRST_HIT_AND_END_SEARCH (a
// commit, an opaque candidate's or the body's, sets the lane's action to 0 and ends its walk, 0x3378)
// and CULL_BACK_FACING_TRIANGLES (cull multiplier 1, 0x2E1C, with the instance's cull-disable and
// counter-clockwise flags as D3D12 applies them); no opacity flag: the walk runs the body where
// (triangle +48 bit 0 | the instance's force bits) is not 1, opaque, which is D3D12's opacity, so the
// body runs on CANDIDATE_NON_OPAQUE_TRIANGLE. Instance mask 0xA0 (instance +48 & 0xA0000000, 0x29AC).
// A lane traces where t min < t max and the ray is ordered (the walk takes t min <= t < t max).
// Outputs at X: _10560 (the committed triangle pointer, v29) committed ? 1 : 0, which the hit test
// after X (& 4, != 0) takes as a hit; _10559 (v21, the t max) the committed t, else its value at E,
// the hit position's t after X; _10561 (v32, which the walk uses for the triangle's +48 word) its
// value at E.
float3 rq3_origin = float3(_3971, _3968, _3965);
float3 rq3_direction = float3(_716, _625, _628);
float rq3_tmin = _3972;
float rq3_tmax = asfloat(_7388);
bool rq3_hit = false;
float rq3_t = 0.0f;
if ((rq3_tmin < rq3_tmax) && !any(isnan(rq3_origin)) && !any(isnan(rq3_direction)))
{
uint rq3_count = 0u;
RayQuery<RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_CULL_BACK_FACING_TRIANGLES> rq3;
RayDesc rq3_ray = { rq3_origin, rq3_tmin, rq3_direction, rq3_tmax };
rq3.TraceRayInline(scene_q, RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_CULL_BACK_FACING_TRIANGLES, 0xA0u, rq3_ray);
while (rq3.Proceed())
{
// The walk's stop: it counts its passes (v31) and ends the lane with nothing committed when
// !(0xFFFF > count) (0x348C); this loop counts its candidates and stops at the same test.
rq3_count += 1u;
if (!(65535u > rq3_count))
{
rq3.Abort();
break;
}
if ((rq3.CandidateType() == CANDIDATE_NON_OPAQUE_TRIANGLE)
&& (candidate_decision(rq3.CandidateInstanceContributionToHitGroupIndex(), rq3.CandidateGeometryIndex(),
rq3.CandidateInstanceID(), rq3.CandidateTriangleRayT(), _3971, _3968, _3965, _716, _625, _628,
_3844, _3848, _3853) == 4294967295u))
{
// The body's commit ends the lane's walk (action 0, as accept-first does).
rq3.CommitNonOpaqueTriangleHit();
rq3.Abort();
}
}
if (rq3.CommittedStatus() == COMMITTED_TRIANGLE_HIT)
{
rq3_hit = true;
rq3_t = rq3.CommittedRayT();
}
}
_10559 = rq3_hit ? asuint(rq3_t) : _7388;
_10560 = rq3_hit ? 1u : 0u;
_10561 = _7137;
_20070 = _20067;
_19666 = true;
}
else
{
_10559 = _7388;
_10560 = 0u;
_10561 = _7137;
_20070 = _20067;
_19666 = true;
}
uint _19907;
uint _19908;
uint _19909;
uint _19910;
uint _19911;
bool _20093;
if (_19666)
{
bool _10567 = 0u != ((0u != _10560) ? ((4u > (4u & _10560)) ? 1u : 2u) : 0u);
float _10569 = asfloat(_10559);
precise float _10570 = _628 * _10569;
precise float _10571 = _10570 + _3965;
precise float _10573 = _625 * _10569;
precise float _10574 = _10573 + _3968;
precise float _10576 = _716 * _10569;
precise float _10577 = _10576 + _3971;
_19907 = _10567 ? asuint(_10571) : 953267991u;
_19908 = _10567 ? asuint(_10574) : 953267991u;
_19909 = uint(_10567);
_19910 = _10567 ? asuint(_10577) : 953267991u;
_19911 = _10561;
_20093 = true;
}
else
{
_19907 = _19772;
_19908 = _19772;
_19909 = _19772;
_19910 = _19772;
_19911 = _19772;
_20093 = false;
}
_10582 = _19907;
_10583 = _19908;
_10584 = _19909;
_10585 = _19910;
_10586 = _19911;
_20071 = _20070;
_19664 = _20093;
}
uint _19893;
uint _19896;
uint _19899;
uint _19902;
bool _19905;
bool _20090;
if (_19664)
{
bool _10587 = 0u != _10584;
bool _10588 = !_7379;
uint _19892;
uint _19895;
uint _19898;
uint _19901;
if (_10587 ? false : _10588)
{
_19892 = _3836;
_19895 = _7377;
_19898 = _10585;
_19901 = _10586;
}
else
{
bool _10591 = (0u == _10584) ? false : _10588;
bool _10593 = _10587 ? _10591 : (_7379 && _10591);
float _10594 = asfloat(_10583);
precise float _10595 = _10594 * _10594;
float _10598 = asfloat(_10585);
precise float _10600 = _10598 * _10598;
precise float _10601 = _10600 + asfloat(_10593 ? asuint(_10595) : 0u);
float _10604 = asfloat(_10582);
precise float _10606 = _10604 * _10604;
precise float _10607 = _10606 + asfloat(_10593 ? asuint(_10601) : 0u);
precise float _10615 = (-200.0f) + asfloat(_10593 ? asuint(sqrt(asfloat(_10593 ? asuint(_10607) : 0u))) : 0u);
precise float _10620 = (-0.01666666753590106964111328125f) * asfloat(_10593 ? asuint(_10615) : 0u);
_19892 = _10593 ? asuint(clamp(_10620, 0.0f, 1.0f)) : 0u;
_19895 = _7377;
_19898 = _10585;
_19901 = _10586;
}
_19893 = _19892;
_19896 = _19895;
_19899 = _19898;
_19902 = _19901;
_19905 = true;
_20090 = true;
}
else
{
_19893 = _19772;
_19896 = _19772;
_19899 = _19772;
_19902 = _19772;
_19905 = _19651;
_20090 = false;
}
_19894 = _19893;
_19897 = _19896;
_19900 = _19899;
_19903 = _19902;
_19906 = _19905;
_20072 = _20071;
_20091 = _20090;
}
else
{
_19894 = _19772;
_19897 = _19772;
_19900 = _19772;
_19903 = _19772;
_19906 = _19651;
_20072 = _20067;
_20091 = false;
}
_10626 = _19894;
_10627 = _19897;
_10628 = _19900;
_10629 = _19903;
_10630 = _19906;
_20073 = _20072;
_19654 = _20091;
}
bool _20086;
if (_19654)
{
uint _10637 = min((((_89 + 320u) >> 5u) << 2u), 2147483584u);
bool _10638 = 0.0f == _687;
uint _10650;
uint _10651;
uint _10652;
uint _10653;
if (_10638)
{
heap_rwtex2d(min(asuint(asfloat(_39.Load<uint>((_10637 >> 2u) * 4 + 0))), NULL_SLOT))[uint2(_253, _250)] = 0.0f.xxxx;
_10650 = 0u;
_10651 = 0u;
_10652 = 0u;
_10653 = 0u;
}
else
{
_10650 = _255;
_10651 = _254;
_10652 = _474;
_10653 = _475;
}
bool _20085;
if (_10638)
{
_20085 = _20073;
}
else
{
uint _10654 = WaveReadLaneFirst(_10626);
float _10657 = asfloat(_10626);
uint4 _10663 = WaveActiveBallot(_246 && (_247 && (!(asfloat(_10654) == _10657))));
uint _10688;
if (countbits(WaveActiveBallot(_246 && (_247 && (0u != ((!_10630) ? (1u ^ _10628) : _10627)))).x) != 0u)
{
_10688 = 4294967295u;
}
else
{
_10688 = (asuint(table_cbv(asuint(asfloat(_39.Load<uint>((_260 >> 2u) * 4 + 0))), 13u)).y != 0u) ? 4294967295u : 0u;
}
bool _10700 = 4294967295u == _10688;
uint _10703 = uint(_246 && (_247 && _10700));
uint _17795;
uint _17796;
uint _17797;
uint _17798;
uint _17799;
uint _17800;
uint _17801;
bool _19674;
bool _20084;
if (_10700 ? false : ((asuint(table_cbv(asuint(asfloat(_39.Load<uint>((_260 >> 2u) * 4 + 0))), 14u)).y & 16u) == 0u))
{
_17795 = _10652;
_17796 = _10653;
_17797 = _476;
_17798 = _477;
_17799 = _733;
_17800 = _10626;
_17801 = _10703;
_20084 = _20073;
_19674 = true;
}
else
{
uint _19773;
uint _19775;
uint _19777;
uint _19779;
uint _19781;
uint _19783;
uint _19785;
bool _20083;
bool _20096;
if (((countbits(_10663.x) != 0u) ? 0u : 1u) == 0u)
{
uint _10724 = min(asuint(asfloat(_39.Load<uint>((_97 >> 2u) * 4 + 0))), NULL_SLOT);
uint _10778 = 1u ^ ((_10652 & 1u) | _10650);
uint _10779 = 1u ^ ((_10653 & 1u) | _10651);
uint _10792 = asuint(heap_tex2d(min(asuint(asfloat(_39.Load<uint>((_582 >> 2u) * 4 + 0))), NULL_SLOT)).Load(int3(uint2(_10778, _10779), 0u)).y);
precise float _10794 = 0.5f + float(_10778);
precise float _10795 = 0.5f + float(_10779);
precise float _10799 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_505 >> 2u) * 4 + 0))) + 1.0f;
precise float _10800 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_233 >> 2u) * 4 + 0))) * _10795;
precise float _10802 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_227 >> 2u) * 4 + 0))) * _10794;
precise float _10804 = _10800 * (-2.0f);
precise float _10805 = _10804 + 1.0f;
precise float _10806 = _10802 * 2.0f;
precise float _10807 = _10806 + (-1.0f);
precise float _10808 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_516 >> 2u) * 4 + 0))) * _10805;
precise float _10809 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_534 >> 2u) * 4 + 0))) * _10805;
precise float _10810 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_551 >> 2u) * 4 + 0))) * _10805;
precise float _10811 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_511 >> 2u) * 4 + 0))) * _10807;
precise float _10812 = _10811 + _10808;
precise float _10813 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_528 >> 2u) * 4 + 0))) * _10807;
precise float _10814 = _10813 + _10809;
precise float _10815 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_545 >> 2u) * 4 + 0))) * _10807;
precise float _10816 = _10815 + _10810;
precise float _10817 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_522 >> 2u) * 4 + 0))) + _10812;
precise float _10818 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_539 >> 2u) * 4 + 0))) + _10814;
precise float _10819 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_557 >> 2u) * 4 + 0))) + _10816;
uint _10821 = 3u & _10792;
uint _10822 = 7u & _10792;
precise float _10826 = _10799 - heap_tex2d(min(asuint(asfloat(_39.Load<uint>((_315 >> 2u) * 4 + 0))), NULL_SLOT)).Load(int3(uint2(_10778, _10779), 0u)).x;
precise float _10828 = 1.0f / _10826;
precise float _10829 = asfloat(heap_srv_raw(_10724).Load<uint>(shifted(_10724, (_500 >> 2u) * 4 + 0))) * _10828;
precise float _10834 = (-0.0f) - _10829;
float _10835 = (_246 && (_247 && ((1u == _10821) || ((2u == _10822) || (1u == (1u & (_10792 >> 6u))))))) ? _10834 : _10829;
uint _10836 = asuint(_10835);
float _10838 = abs(_10835);
precise float _10839 = _10817 * _10838;
precise float _10840 = _10839 + 0.0f;
precise float _10841 = _10818 * _10838;
precise float _10842 = _10841 + 0.0f;
precise float _10843 = _10819 * _10838;
precise float _10844 = _10843 + 0.0f;
uint _10977;
if (_332)
{
precise float _10846 = asfloat(_606) * _10840;
precise float _10848 = asfloat(_607) * _10840;
precise float _10850 = asfloat(_612) * _10842;
precise float _10851 = _10850 + _10846;
precise float _10853 = asfloat(_613) * _10842;
precise float _10854 = _10853 + _10848;
precise float _10856 = asfloat(_618) * _10844;
precise float _10857 = _10856 + _10851;
precise float _10859 = asfloat(_619) * _10844;
precise float _10860 = _10859 + _10854;
uint _10866 = asuint(asfloat(_39.Load<uint>((_595 >> 2u) * 4 + 0)));
uint4 _10870 = asuint(table_cbv(_10866, 9u));
uint4 _10875 = asuint(table_cbv(_10866, 10u));
uint4 _10880 = asuint(table_cbv(_10866, 11u));
uint4 _10885 = asuint(table_cbv(_10866, 15u));
uint4 _10890 = asuint(table_cbv(_10866, 14u));
uint4 _10895 = asuint(table_cbv(_10866, 13u));
precise float _10900 = asfloat(_10880.x) * _10857;
precise float _10901 = _10900 + asfloat(_10885.x);
precise float _10904 = asfloat(_10875.x) * _10857;
precise float _10905 = _10904 + asfloat(_10890.x);
precise float _10908 = asfloat(_10880.y) * _10860;
precise float _10909 = _10908 + asfloat(_10885.y);
precise float _10912 = asfloat(_10875.y) * _10860;
precise float _10913 = _10912 + asfloat(_10890.y);
precise float _10916 = asfloat(_10870.x) * _10857;
precise float _10917 = _10916 + asfloat(_10895.x);
precise float _10920 = asfloat(_10870.y) * _10860;
precise float _10921 = _10920 + asfloat(_10895.y);
float _10922 = abs(_10901);
float _10923 = abs(_10909);
uint _10925 = asuint(_10922);
uint _10926 = asuint(_10923);
float _10932 = (((_10925 | _10926) & 2147483647u) == 0u) ? asfloat(_10925 & _10926) : max(_10922, _10923);
float _10934 = abs(_10905);
float _10935 = abs(_10913);
uint _10937 = asuint(_10934);
uint _10938 = asuint(_10935);
float _10944 = (((_10937 | _10938) & 2147483647u) == 0u) ? asfloat(_10937 & _10938) : max(_10934, _10935);
float _10946 = abs(_10917);
float _10947 = abs(_10921);
uint _10949 = asuint(_10946);
uint _10950 = asuint(_10947);
float _10956 = (((_10949 | _10950) & 2147483647u) == 0u) ? asfloat(_10949 & _10950) : max(_10946, _10947);
uint _10959 = asuint(_10956) | asuint(_10944);
float _10963 = ((_10959 & 2147483647u) == 0u) ? asfloat(_10959) : min(_10956, _10944);
uint _10966 = asuint(_10963) | asuint(_10932);
precise float _10971 = (((_10966 & 2147483647u) == 0u) ? asfloat(_10966) : min(_10963, _10932)) * 16.666667938232421875f;
precise float _10972 = _10971 + (-7.0f);
_10977 = uint(_246 && (_247 && ((-1.0f) < _10972)));
}
else
{
_10977 = _569;
}
float _10986 = asfloat(2147483647u & _10836);
precise float _10987 = _916 * _10986;
precise float _10989 = 8.0f * _10987;
uint _10990 = asuint(_10989);
bool _10991 = 1u < (4294967293u + _10822);
precise float _10999 = 0.5f * ((((953267991u | _10990) & 2147483647u) == 0u) ? asfloat(953267991u & _10990) : max(9.9999997473787516355514526367188e-05f, _10989));
precise float _11003 = 255.0f * heap_tex2d(min(asuint(asfloat(_39.Load<uint>((_892 >> 2u) * 4 + 0))), NULL_SLOT)).Load(int3(uint2(_10778, _10779), 0u)).w;
bool _11006 = 5u == (31u & uint(_11003));
bool _11007 = 1u != _10821;
bool _11009 = _10991 && (_11006 && _11007);
precise float _11010 = (-0.0f) - _625;
precise float _11011 = _11010 * _744;
precise float _11014 = (-0.0f) - _716;
precise float _11016 = _11014 * _742;
precise float _11017 = _11016 + asfloat(_11009 ? asuint(_11011) : _10821);
precise float _11020 = (-0.0f) - _628;
precise float _11022 = _11020 * _746;
precise float _11023 = _11022 + asfloat(_11009 ? asuint(_11017) : _10821);
bool _11032 = _246 && (_247 && (_10991 && (_11006 && (_11007 && (0.0f > asfloat(_11009 ? asuint(_11023) : _10821))))));
bool _11042 = 0u != _10977;
uint _17772;
uint _17773;
bool _19676;
bool _20082;
if (_332 ? false : (!_11042))
{
_17772 = 1065353216u;
_17773 = 1u;
_20082 = _20073;
_19676 = true;
}
else
{
float _11045 = asfloat(_11009 ? asuint(_11032 ? _972 : _744) : _745);
precise float _11046 = _625 * _11045;
precise float _11048 = (-140.0f) + _10986;
float _11055 = asfloat(_11009 ? asuint(_11032 ? _968 : _742) : _743);
precise float _11056 = _716 * _11055;
precise float _11057 = _11056 + _11046;
precise float _11058 = 0.01666666753590106964111328125f * _11048;
float _11059 = clamp(_11058, 0.0f, 1.0f);
float _11065 = asfloat(_11009 ? asuint(_11032 ? _976 : _746) : _747);
precise float _11066 = _628 * _11065;
precise float _11067 = _11066 + _11057;
precise float _11069 = (-2.0f) * _11059;
precise float _11070 = _11069 + 3.0f;
// Site 4's root load (header +48 of structure view 1, console 0x39CC) is the constant 1: the root
// test's skip is gone and an empty top level gives a miss through the query.
uint _11107 = 1u;
float _11108 = abs(_11067);
uint _11110 = asuint(_11108);
precise float _11117 = 0.5f * _10999;
precise float _11118 = _11059 * _11070;
precise float _11119 = _10999 * _11065;
precise float _11120 = _10999 * _11045;
precise float _11121 = 1.0f / ((((1036831949u | _11110) & 2147483647u) == 0u) ? asfloat(1036831949u & _11110) : max(0.100000001490116119384765625f, _11108));
precise float _11123 = _10999 * _11055;
precise float _11124 = _11059 * _11118;
precise float _11125 = 0.5f * _11119;
precise float _11126 = _11125 + _10844;
precise float _11127 = 0.5f * _11123;
precise float _11128 = _11127 + _10840;
precise float _11129 = 0.5f * _11120;
precise float _11130 = _11129 + _10842;
precise float _11131 = _11124 * (-5.0f);
precise float _11132 = _11131 + 8.5f;
precise float _11133 = 0.20000000298023223876953125f * _11121;
precise float _11134 = _11133 + _11117;
bool _11142 = int(_11107) > int(0u);
precise float _11143 = 4096.0f * _11020;
precise float _11144 = _11143 + _11126;
precise float _11145 = 4096.0f * _11010;
precise float _11146 = _11145 + _11130;
precise float _11147 = 4096.0f * _11014;
precise float _11148 = _11147 + _11128;
precise float _11149 = _11134 + _11132;
bool _11156 = !_11142;
uint _14295;
uint _14296;
uint _14297;
bool _19678;
bool _20076;
// The committed hit's instance +52 (contribution) and triangle +48 >> 8 (geometry index), which
// the record test after X reads.
uint rq4_contribution = 0u;
uint rq4_geometry = 0u;
if (_332 ? _11156 : (_11042 ? _11156 : true))
{
_14295 = 0u;
_14296 = 0u;
_14297 = asuint(_11134);
_20076 = _20073;
_19678 = true;
}
else
{
// Site 4, the walk (console E 0x3AD0 to X 0x48D8, back edges 0x486C, 0x48C8) as a host ray query of
// structure view 1 (t249: table slot 1 +0x60), with its candidate body in the Proceed loop. The ray as
// the walk's node tests take it: origin _11148 _11146 _11144 (v17 v18 v19, the neighbouring pixel's
// position - 4096 dir), direction _716 _625 _628 (s18 s22 s62, v14 v15 v16), t min _11117 (v23,
// 0x39E4; the triangle test 0x4478), t max 4096 - t min (v31, 0x3AA0). Flags 0x14:
// ACCEPT_FIRST_HIT_AND_END_SEARCH (a commit, an opaque candidate's or the body's, sets the lane's
// action to 0 and ends its walk, 0x46E0) and CULL_BACK_FACING_TRIANGLES (cull multiplier 1, 0x4180,
// with the instance's cull-disable and counter-clockwise flags as D3D12 applies them); no opacity
// flag: the walk runs the body where (triangle +48 bit 0 | the instance's force bits) is not 1,
// opaque, which is D3D12's opacity, so the body runs on CANDIDATE_NON_OPAQUE_TRIANGLE. Instance mask
// 0xA0 (instance +48 & 0xA0000000, 0x3D14). A lane traces where t min < t max and the ray is ordered
// (the walk takes t min <= t < t max). Outputs at X: _14295 (the committed triangle pointer, v25) and
// _14296 (the committed instance pointer, v29) committed ? 1 : 0, which the record test after X takes
// as a hit and whose fields it reads from the query (below); _14297 (v31, the t max) the committed t,
// else its value at E.
float3 rq4_origin = float3(_11148, _11146, _11144);
float3 rq4_direction = float3(_716, _625, _628);
float rq4_tmin = _11117;
float rq4_tmax = 4096.0f - _11117;
bool rq4_hit = false;
float rq4_t = 0.0f;
if ((rq4_tmin < rq4_tmax) && !any(isnan(rq4_origin)) && !any(isnan(rq4_direction)))
{
uint rq4_count = 0u;
RayQuery<RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_CULL_BACK_FACING_TRIANGLES> rq4;
RayDesc rq4_ray = { rq4_origin, rq4_tmin, rq4_direction, rq4_tmax };
rq4.TraceRayInline(scene_p, RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_CULL_BACK_FACING_TRIANGLES, 0xA0u, rq4_ray);
while (rq4.Proceed())
{
// The walk's stop: it counts its passes (v30) and ends the lane with nothing committed when
// !(0xFFFF > count) (0x47FC); this loop counts its candidates and stops at the same test.
rq4_count += 1u;
if (!(65535u > rq4_count))
{
rq4.Abort();
break;
}
if ((rq4.CandidateType() == CANDIDATE_NON_OPAQUE_TRIANGLE)
&& (candidate_decision(rq4.CandidateInstanceContributionToHitGroupIndex(), rq4.CandidateGeometryIndex(),
rq4.CandidateInstanceID(), rq4.CandidateTriangleRayT(), _11148, _11146, _11144, _716, _625, _628,
_3844, _3848, _3853) == 4294967295u))
{
// The body's commit ends the lane's walk (action 0, as accept-first does).
rq4.CommitNonOpaqueTriangleHit();
rq4.Abort();
}
}
if (rq4.CommittedStatus() == COMMITTED_TRIANGLE_HIT)
{
rq4_hit = true;
rq4_t = rq4.CommittedRayT();
rq4_contribution = rq4.CommittedInstanceContributionToHitGroupIndex();
rq4_geometry = rq4.CommittedGeometryIndex();
}
}
_14295 = rq4_hit ? 1u : 0u;
_14296 = rq4_hit ? 1u : 0u;
_14297 = rq4_hit ? asuint(rq4_t) : asuint(rq4_tmax);
_20076 = _20073;
_19678 = true;
}
uint _19788;
uint _19791;
bool _20081;
bool _20099;
if (_19678)
{
uint _14533;
uint _14534;
uint _14535;
if (0u != _14295)
{
// The committed hit's instance +52 and triangle +48 >> 8 (console 0x4930, 0x494C, 0x497C; instance +60 only as
// the triangle's base): the query's contribution and geometry index.
uint _14348 = rq4_contribution;
uint _14444 = (0u != _14296) ? rq4_geometry : 0u;
uint _14451 = min(asuint(asfloat(_39.Load<uint>((_303 >> 2u) * 4 + 0))), NULL_SLOT);
uint _14460 = (16383u & (_14444 + asuint(asfloat(_14348)))) * 116u;
uint _14467 = min(asuint(asfloat(_39.Load<uint>((_3848 >> 2u) * 4 + 0))), NULL_SLOT);
uint _14529;
uint _14530;
if (asuint(asfloat(heap_srv_raw(_14451).Load<uint>(shifted(_14451, (min(1808u, 2147483584u) >> 2u) * 4 + 0)))) == asuint(asfloat(heap_srv_raw(_14467).Load<uint>(shifted(_14467, (min((_14460 + 8u), 2147483584u) >> 2u) * 4 + 0)))))
{
uint _14482 = min(asuint(asfloat(_39.Load<uint>((_3848 >> 2u) * 4 + 0))), NULL_SLOT);
uint _14489 = asuint(asfloat(heap_srv_raw(_14482).Load<uint>(shifted(_14482, (min((_14460 + 88u), 2147483584u) >> 2u) * 4 + 0))));
uint _14491 = _14489 >> 9u;
uint _14492 = _14489 >> 18u;
float _14499 = float(510u & _14489);
float _14506 = exp2(float(int((_14489 >> 27u) - 24u)));
precise float _14511 = float(510u & _14491) * _14506;
precise float _14512 = _14499 * _14506;
precise float _14513 = float(510u & _14492) * _14506;
precise float _14516 = asfloat((1u == (1u & _14491)) ? 3212836864u : 1065353216u) * _14511;
precise float _14518 = asfloat((1u == (1u & _14489)) ? 3212836864u : 1065353216u) * _14512;
precise float _14520 = asfloat((1u == (1u & _14492)) ? 3212836864u : 1065353216u) * _14513;
precise float _14521 = _14516 * _14516;
precise float _14522 = _14518 * _14518;
precise float _14523 = _14522 + _14521;
precise float _14524 = _14520 * _14520;
precise float _14525 = _14524 + _14523;
_14529 = (sqrt(_14525) > _10989) ? 4294967295u : 0u;
_14530 = asuint(_14499);
}
else
{
_14529 = 0u;
_14530 = _14297;
}
_14533 = uint(4294967295u == _14529);
_14534 = 4294967295u;
_14535 = _14530;
}
else
{
_14533 = 0u;
_14534 = 0u;
_14535 = _14297;
}
bool _14536 = 4294967295u == _14534;
uint _17730;
uint _17731;
uint _17732;
uint _17733;
bool _19686;
bool _20080;
if (_14536)
{
_17730 = 953267991u;
_17731 = 953267991u;
_17732 = 0u;
_17733 = 953267991u;
_20080 = _20076;
_19686 = true;
}
else
{
precise float _14544 = 4096.0f - _11149;
uint _14545 = asuint(_14544);
// Site 5's root load (header +48 of structure view 2, console 0x4AE8) is the constant 1: the root
// test's skip is gone and an empty top level gives a miss through the query.
uint _14588 = 1u;
bool _14589 = int(_14588) > int(0u);
uint _17716;
uint _17717;
bool _19688;
bool _20079;
if (_14589)
{
// Site 5, the walk (console E 0x4B50 to X 0x5950, back edges 0x58EC, 0x5948) as a host ray query of
// structure view 2 (t250: table slot 1 +0x20), with its candidate body in the Proceed loop. The ray as
// the walk's node tests take it: origin _11148 _11146 _11144 (v17 v18 v19, as site 4's), direction
// _716 _625 _628 (s18 s22 s62, v14 v15 v16), t min _11149 (v21, 0x3A7C in site 4's setup; the triangle
// test 0x5500), t max _14545 = 4096 - t min (v22, 0x4AD0). Flags 0x14: ACCEPT_FIRST_HIT_AND_END_SEARCH
// (a commit, an opaque candidate's or the body's, sets the lane's action to 0 and ends its walk,
// 0x5768) and CULL_BACK_FACING_TRIANGLES (cull multiplier 1, 0x5208, with the instance's cull-disable
// and counter-clockwise flags as D3D12 applies them); no opacity flag: the walk runs the body where
// (triangle +48 bit 0 | the instance's force bits) is not 1, opaque, which is D3D12's opacity, so the
// body runs on CANDIDATE_NON_OPAQUE_TRIANGLE. Instance mask 0xA0 (instance +48 & 0xA0000000, 0x4D9C).
// A lane traces where t min < t max and the ray is ordered (the walk takes t min <= t < t max).
// Outputs at X: _17717 (the committed triangle pointer, v28) committed ? 1 : 0, which the hit test
// after X (!= 0) takes as a hit; _17716 (v22, the t max) the committed t, else its value at E, the hit
// position's t after X.
float3 rq5_origin = float3(_11148, _11146, _11144);
float3 rq5_direction = float3(_716, _625, _628);
float rq5_tmin = _11149;
float rq5_tmax = asfloat(_14545);
bool rq5_hit = false;
float rq5_t = 0.0f;
if ((rq5_tmin < rq5_tmax) && !any(isnan(rq5_origin)) && !any(isnan(rq5_direction)))
{
uint rq5_count = 0u;
RayQuery<RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_CULL_BACK_FACING_TRIANGLES> rq5;
RayDesc rq5_ray = { rq5_origin, rq5_tmin, rq5_direction, rq5_tmax };
rq5.TraceRayInline(scene_q, RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_CULL_BACK_FACING_TRIANGLES, 0xA0u, rq5_ray);
while (rq5.Proceed())
{
// The walk's stop: it counts its passes (v30) and ends the lane with nothing committed when
// !(0xFFFF > count) (0x587C); this loop counts its candidates and stops at the same test.
rq5_count += 1u;
if (!(65535u > rq5_count))
{
rq5.Abort();
break;
}
if ((rq5.CandidateType() == CANDIDATE_NON_OPAQUE_TRIANGLE)
&& (candidate_decision(rq5.CandidateInstanceContributionToHitGroupIndex(), rq5.CandidateGeometryIndex(),
rq5.CandidateInstanceID(), rq5.CandidateTriangleRayT(), _11148, _11146, _11144, _716, _625, _628,
_3844, _3848, _3853) == 4294967295u))
{
// The body's commit ends the lane's walk (action 0, as accept-first does).
rq5.CommitNonOpaqueTriangleHit();
rq5.Abort();
}
}
if (rq5.CommittedStatus() == COMMITTED_TRIANGLE_HIT)
{
rq5_hit = true;
rq5_t = rq5.CommittedRayT();
}
}
_17716 = rq5_hit ? asuint(rq5_t) : _14545;
_17717 = rq5_hit ? 1u : 0u;
_20079 = _20076;
_19688 = true;
}
else
{
_17716 = _14545;
_17717 = 0u;
_20079 = _20076;
_19688 = true;
}
uint _19792;
uint _19793;
uint _19794;
uint _19795;
bool _20101;
if (_19688)
{
bool _17718 = 0u != _17717;
float _17720 = asfloat(_17716);
_19792 = _17718 ? asuint(mad(_628, _17720, _11144)) : 953267991u;
_19793 = _17718 ? asuint(mad(_625, _17720, _11146)) : 953267991u;
_19794 = uint(_17718);
_19795 = _17718 ? asuint(mad(_716, _17720, _11148)) : 953267991u;
_20101 = true;
}
else
{
_19792 = _19772;
_19793 = _19772;
_19794 = _19772;
_19795 = _19772;
_20101 = false;
}
_17730 = _19792;
_17731 = _19793;
_17732 = _19794;
_17733 = _19795;
_20080 = _20079;
_19686 = _20101;
}
uint _19787;
uint _19790;
bool _20098;
if (_19686)
{
bool _17734 = 0u != _17732;
bool _17735 = !_14536;
uint _19786;
uint _19789;
if (_17734 ? false : _17735)
{
_19786 = 1065353216u;
_19789 = _14533;
}
else
{
bool _17738 = (0u == _17732) ? false : _17735;
bool _17740 = _17734 ? _17738 : (_14536 && _17738);
float _17741 = asfloat(_17733);
precise float _17742 = _17741 * _17741;
float _17747 = asfloat(_17731);
float _17752 = asfloat(_17730);
precise float _17762 = (-200.0f) + asfloat(_17740 ? asuint(sqrt(asfloat(_17740 ? asuint(mad(_17752, _17752, asfloat(_17740 ? asuint(mad(_17747, _17747, asfloat(_17740 ? asuint((_17741 == 0.0f) ? 0.0f : _17742) : _614))) : _614))) : _614))) : _608);
float _17765 = asfloat(_17740 ? asuint(_17762) : _608);
precise float _17766 = (-0.01666666753590106964111328125f) * _17765;
_19786 = _17740 ? asuint(clamp((_17765 == 0.0f) ? 0.0f : _17766, 0.0f, 1.0f)) : 0u;
_19789 = _14533;
}
_19787 = _19786;
_19790 = _19789;
_20098 = true;
}
else
{
_19787 = _19772;
_19790 = _19772;
_20098 = false;
}
_19788 = _19787;
_19791 = _19790;
_20081 = _20080;
_20099 = _20098;
}
else
{
_19788 = _19772;
_19791 = _19772;
_20081 = _20076;
_20099 = false;
}
_17772 = _19788;
_17773 = _19791;
_20082 = _20081;
_19676 = _20099;
}
uint _19771;
uint _19774;
uint _19776;
uint _19778;
uint _19780;
uint _19782;
uint _19784;
bool _20095;
if (_19676)
{
precise float _17775 = asfloat(_17772) + _10657;
precise float _17776 = _17775 * 0.5f;
uint _17790;
if (_10700)
{
_17790 = 4294967295u;
}
else
{
_17790 = (_246 && (_247 && (uint(countbits(WaveActiveBallot(_246 && (_247 && (0u != _17773))).x) != 0u) != 0u))) ? 4294967295u : 0u;
}
_19771 = _10778;
_19774 = _10779;
_19776 = asuint(_10800);
_19778 = asuint(_10802);
_19780 = _10836;
_19782 = asuint(_17776);
_19784 = uint(_246 && (_247 && (4294967295u == _17790)));
_20095 = true;
}
else
{
_19771 = _19772;
_19774 = _19772;
_19776 = _19772;
_19778 = _19772;
_19780 = _19772;
_19782 = _19772;
_19784 = _19772;
_20095 = false;
}
_19773 = _19771;
_19775 = _19774;
_19777 = _19776;
_19779 = _19778;
_19781 = _19780;
_19783 = _19782;
_19785 = _19784;
_20083 = _20082;
_20096 = _20095;
}
else
{
_19773 = _10652;
_19775 = _10653;
_19777 = _476;
_19779 = _477;
_19781 = _733;
_19783 = _10626;
_19785 = _10703;
_20083 = _20073;
_20096 = true;
}
_17795 = _19773;
_17796 = _19775;
_17797 = _19777;
_17798 = _19779;
_17799 = _19781;
_17800 = _19783;
_17801 = _19785;
_20084 = _20083;
_19674 = _20096;
}
if (_19674)
{
uint _17802 = WaveReadLaneFirst(_17801);
bool _17803 = _17802 != 0u;
uint _18732;
uint _18733;
if (_17803)
{
_18732 = _17800;
_18733 = (_246 && (_247 && _17803)) ? 0u : 1065353216u;
}
else
{
uint _17812 = min(asuint(asfloat(_39.Load<uint>((_315 >> 2u) * 4 + 0))), NULL_SLOT);
uint _17815 = 1u | _17795;
uint _17828 = 1u | _17796;
uint _17834 = min(asuint(asfloat(_39.Load<uint>((_97 >> 2u) * 4 + 0))), NULL_SLOT);
float _17839 = asfloat(heap_srv_raw(_17834).Load<uint>(shifted(_17834, (_528 >> 2u) * 4 + 0)));
float _17843 = asfloat(heap_srv_raw(_17834).Load<uint>(shifted(_17834, (_534 >> 2u) * 4 + 0)));
float _17847 = asfloat(heap_srv_raw(_17834).Load<uint>(shifted(_17834, (_539 >> 2u) * 4 + 0)));
float _17851 = asfloat(heap_srv_raw(_17834).Load<uint>(shifted(_17834, (_545 >> 2u) * 4 + 0)));
float _17855 = asfloat(heap_srv_raw(_17834).Load<uint>(shifted(_17834, (_511 >> 2u) * 4 + 0)));
float _17859 = asfloat(heap_srv_raw(_17834).Load<uint>(shifted(_17834, (_516 >> 2u) * 4 + 0)));
float _17863 = asfloat(heap_srv_raw(_17834).Load<uint>(shifted(_17834, (_522 >> 2u) * 4 + 0)));
uint _17869 = min(asuint(asfloat(_39.Load<uint>((_303 >> 2u) * 4 + 0))), NULL_SLOT);
float _17877 = mad(asfloat(_17797), -2.0f, 1.0f);
float _17879 = mad(asfloat(_17798), 2.0f, -1.0f);
uint4 _17894 = asuint(table_cbv(asuint(asfloat(_39.Load<uint>((min((((_89 + 448u) >> 5u) << 2u), 2147483584u) >> 2u) * 4 + 0))), 16u));
float4 _17897 = heap_tex2d(_17812).Load(int3(uint2(_10650, _10651), 0u));
float _17899 = _17897.x;
uint _17900 = asuint(_17899);
float4 _17901 = heap_tex2d(_17812).Load(int3(uint2(_17815, _10651), 0u));
float _17903 = _17901.x;
uint _17904 = asuint(_17903);
float4 _17905 = heap_tex2d(_17812).Load(int3(uint2(_10650, _17828), 0u));
float _17907 = _17905.x;
uint _17908 = asuint(_17907);
float4 _17909 = heap_tex2d(_17812).Load(int3(uint2(_17815, _17828), 0u));
float _17911 = _17909.x;
uint _17912 = asuint(_17911);
float _17916 = asfloat(heap_srv_raw(_17834).Load<uint>(shifted(_17834, (_551 >> 2u) * 4 + 0)));
float _17920 = asfloat(heap_srv_raw(_17834).Load<uint>(shifted(_17834, (_557 >> 2u) * 4 + 0)));
float _17924 = mad(_17839, _17879, mad(_17843, _17877, _17847));
float _17929 = asfloat(_17894.x);
precise float _17930 = asfloat(_17894.y) - _17929;
precise float _17933 = _17924 * _744;
precise float _17938 = 1.0f / _17930;
precise float _17941 = abs(asfloat(_17799)) - _17929;
bool _17942 = 1u == (1u & (asuint(asfloat(heap_srv_raw(_17869).Load<uint>(shifted(_17869, (_333 >> 2u) * 4 + 0)))) ^ ((_17796 ^ _17795) >> 1u)));
precise float _17946 = _17941 * _17938;
precise float _17953 = 1.0f - abs(mad(mad(_17851, _17879, mad(_17916, _17877, _17920)), _746, mad(mad(_17855, _17879, mad(_17859, _17877, _17863)), _742, ((_17924 == 0.0f) || (_744 == 0.0f)) ? 0.0f : _17933)));
uint _17959 = (_246 && (_247 && _17942)) ? 4286578687u : 2139095039u;
precise float _17960 = _17953 * _17953;
float _17962 = (_17953 == 0.0f) ? 0.0f : _17960;
float _17966 = float(int(uint(int(mad(12.0f, clamp(((_17941 == 0.0f) || (_17938 == 0.0f)) ? 0.0f : _17946, 0.0f, 1.0f), 4.0f)))));
precise float _17971 = 4.0f * mad(5.0f, _17962, 1.0f);
precise float _17973 = 0.5f * _17966;
uint _17976 = asuint((_17966 == 0.0f) ? 0.0f : _17973);
bool _17980 = _246 && (_247 && (3u == (7u & asuint(heap_tex2d(min(asuint(asfloat(_39.Load<uint>((_582 >> 2u) * 4 + 0))), NULL_SLOT)).Load(int3(uint2(_17795, _17796), 0u)).y))));
uint _17981 = _17980 ? 1024416809u : asuint(mad(_17962, 0.00999999977648258209228515625f, 0.02500000037252902984619140625f));
uint _17987 = (_246 && (_247 && _332)) ? _17976 : asuint(_17966);
uint _17991 = (_246 && (_247 && (0.0f == _17899))) ? _17959 : _17900;
uint _17995 = (_246 && (_247 && (0.0f == _17903))) ? _17959 : _17904;
float _17996 = asfloat(_17995);
float _17997 = asfloat(_17991);
bool _17998 = _17996 > _17997;
bool _18003 = _17942 ? (!_17998) : true;
bool _18005 = _17942 ? false : (_17996 < _17997);
uint _18008 = _18003 ? (_18005 ? _17995 : _17991) : _17995;
uint _18012 = (_246 && (_247 && (0.0f == _17907))) ? _17959 : _17908;
float _18013 = asfloat(_18012);
float _18014 = asfloat(_18008);
bool _18015 = _18013 > _18014;
bool _18019 = _17942 ? false : (_18013 < _18014);
uint _18024 = (_17942 ? (!_18015) : true) ? (_18019 ? _18012 : _18008) : _18012;
uint _18028 = (_246 && (_247 && (0.0f == _17911))) ? _17959 : _17912;
float _18029 = asfloat(_18028);
float _18030 = asfloat(_18024);
bool _18031 = _18029 > _18030;
bool _18035 = _17942 ? false : (_18029 < _18030);
uint _18036 = _18035 ? 3u : ((_17942 && _18031) ? 3u : (_18019 ? 2u : ((_17942 && _18015) ? 2u : (_18005 ? 1u : (_18003 ? 0u : ((_17942 && _17998) ? 1u : _17976))))));
uint _18071;
uint _18072;
uint _18073;
if (0u != _18036)
{
precise float _18044 = 1.0f / abs(asfloat((_17942 ? (!_18031) : true) ? (_18035 ? _18028 : _18024) : _18028));
precise float _18046 = (-0.0f) - abs(_17899);
float _18047 = mad(_18046, _18044, 1.0f);
bool _18051 = abs(_18047) >= asfloat(_17981);
_18071 = _18051 ? ((_18036 & 1u) | _10650) : _10650;
_18072 = _18051 ? ((_18051 ? (_18036 >> 1u) : _17981) | _10651) : _10651;
_18073 = _18051 ? ((_246 && (_247 && (_18051 && (3u == _18036)))) ? _17912 : (_18051 ? ((_246 && (_247 && (_18051 && (2u == _18036)))) ? _17908 : _17904) : asuint(_18047))) : _17900;
}
else
{
_18071 = _10650;
_18072 = _10651;
_18073 = _17900;
}
uint _18092 = min(asuint(asfloat(_39.Load<uint>((_97 >> 2u) * 4 + 0))), NULL_SLOT);
float _18097 = asfloat(heap_srv_raw(_18092).Load<uint>(shifted(_18092, (_215 >> 2u) * 4 + 0)));
float _18101 = asfloat(heap_srv_raw(_18092).Load<uint>(shifted(_18092, (_221 >> 2u) * 4 + 0)));
float _18105 = asfloat(heap_srv_raw(_18092).Load<uint>(shifted(_18092, (_227 >> 2u) * 4 + 0)));
float _18109 = asfloat(heap_srv_raw(_18092).Load<uint>(shifted(_18092, (_233 >> 2u) * 4 + 0)));
precise float _18112 = 0.5f + float(_18071);
precise float _18113 = 0.5f + float(_18072);
float4 _18114 = heap_tex2d(min(asuint(asfloat(_39.Load<uint>((min((((_89 + 288u) >> 5u) << 2u), 2147483584u) >> 2u) * 4 + 0))), NULL_SLOT)).Load(int3(uint2(_18071, _18072), 0u));
precise float _18118 = _18114.y + _18113;
precise float _18119 = _18114.x + _18112;
precise float _18120 = _18109 * _18118;
bool _18121 = _18109 == 0.0f;
float _18124 = (_18121 || (_18118 == 0.0f)) ? 0.0f : _18120;
precise float _18125 = _18105 * _18119;
bool _18126 = _18105 == 0.0f;
float _18129 = (_18126 || (_18119 == 0.0f)) ? 0.0f : _18125;
float _18131 = mad(_18129, 2.0f, -1.0f);
bool _18133 = abs(mad(_18124, 2.0f, -1.0f)) < 1.0f;
bool _18135 = abs(_18131) < 1.0f;
uint _19768;
uint _19770;
if (_18133 ? (!_18135) : true)
{
_19768 = _17800;
_19770 = 1065353216u;
}
else
{
uint _18147 = min(asuint(asfloat(_39.Load<uint>((min(((_89 >> 5u) << 2u), 2147483584u) >> 2u) * 4 + 0))), NULL_SLOT);
uint _18188 = asuint(heap_tex2d(min(asuint(asfloat(_39.Load<uint>((_582 >> 2u) * 4 + 0))), NULL_SLOT)).Load(int3(uint2(_18071, _18072), 0u)).y);
precise float _18189 = _18101 * 0.5f;
float _18191 = (_18101 == 0.0f) ? 0.0f : _18189;
precise float _18194 = 1.0f + floor(mad(_18097, _18129, -0.5f));
precise float _18195 = 1.0f + floor(mad(_18101, _18124, -0.5f));
float _18196 = mad(_18191, _18124, -0.25f);
precise float _18198 = 1.0f / _18191;
precise float _18199 = _18097 * 0.5f;
float _18201 = (_18097 == 0.0f) ? 0.0f : _18199;
precise float _18202 = _18105 * _18194;
precise float _18206 = _18109 * _18195;
precise float _18211 = _18113 + _18113;
float _18212 = mad(_18201, _18129, -0.25f);
precise float _18213 = 1.0f / _18201;
float4 _18217 = heap_tex2d(min(asuint(asfloat(_39.Load<uint>((min((((_89 + 256u) >> 5u) << 2u), 2147483584u) >> 2u) * 4 + 0))), NULL_SLOT)).GatherRed(_56, float2((_18126 || (_18194 == 0.0f)) ? 0.0f : _18202, (_18121 || (_18195 == 0.0f)) ? 0.0f : _18206));
precise float _18222 = 1.0f + floor(_18196);
precise float _18223 = (-0.0f) - _18211;
float _18224 = mad(_18223, _18109, 1.0f);
precise float _18226 = _18112 + _18112;
uint _18232 = min(asuint(asfloat(_39.Load<uint>((_97 >> 2u) * 4 + 0))), NULL_SLOT);
float _18238 = asfloat(heap_srv_raw(_18232).Load<uint>(shifted(_18232, (min(4u, 2147483584u) >> 2u) * 4 + 0)));
float _18242 = asfloat(heap_srv_raw(_18232).Load<uint>(shifted(_18232, (_500 >> 2u) * 4 + 0)));
uint _18252 = asuint(asfloat(_39.Load<uint>((_260 >> 2u) * 4 + 0)));
uint4 _18256 = asuint(table_cbv(_18252, 0u));
uint4 _18262 = asuint(table_cbv(_18252, 1u));
uint4 _18268 = asuint(table_cbv(_18252, 2u));
uint4 _18274 = asuint(table_cbv(_18252, 3u));
float _18278 = frac(_18196);
float _18280 = (_18278 >= 1.0f) ? 0.999999940395355224609375f : _18278;
precise float _18282 = 1.0f + floor(_18212);
precise float _18283 = 1.0f - mad(_18109, _18118, _18124);
precise float _18284 = _18222 * _18198;
float _18289 = mad(_18226, _18105, -1.0f);
float _18290 = frac(_18212);
float _18292 = (_18290 >= 1.0f) ? 0.999999940395355224609375f : _18290;
precise float _18293 = _18282 * _18213;
precise float _18298 = 1.0f - _18280;
precise float _18301 = 1.0f - _18292;
float4 _18304 = heap_tex2d(min(asuint(asfloat(_39.Load<uint>((min((((_89 + 192u) >> 5u) << 2u), 2147483584u) >> 2u) * 4 + 0))), NULL_SLOT)).GatherRed(_56, float2(((_18282 == 0.0f) || (_18213 == 0.0f)) ? 0.0f : _18293, ((_18222 == 0.0f) || (_18198 == 0.0f)) ? 0.0f : _18284));
uint _18306 = asuint(_18304.x);
uint _18308 = asuint(_18304.y);
uint _18310 = asuint(_18304.z);
uint _18312 = asuint(_18304.w);
precise float _18313 = _18298 * _18292;
bool _18314 = _18298 == 0.0f;
bool _18315 = _18292 == 0.0f;
float _18317 = (_18314 || _18315) ? 0.0f : _18313;
float _18329 = asfloat(heap_srv_raw(_18147).Load<uint>(shifted(_18147, (min(276u, 2147483584u) >> 2u) * 4 + 0)));
float _18335 = asfloat(heap_srv_raw(_18147).Load<uint>(shifted(_18147, (min(280u, 2147483584u) >> 2u) * 4 + 0)));
float _18336 = mad(_17839, _18289, mad(_17843, _18224, _17847));
precise float _18337 = _18298 * _18301;
bool _18338 = _18301 == 0.0f;
float _18340 = (_18314 || _18338) ? 0.0f : _18337;
float _18341 = mad(_17855, _18289, mad(_17859, _18224, _17863));
precise float _18342 = asfloat(heap_srv_raw(_18232).Load<uint>(shifted(_18232, (_505 >> 2u) * 4 + 0))) + 1.0f;
precise float _18353 = _18342 - asfloat(_18073);
float _18355 = mad(asfloat(_18262.x), _18131, mad(asfloat(_18262.y), _18283, asfloat(_18262.z)));
float _18357 = mad(asfloat(_18256.x), _18131, mad(asfloat(_18256.y), _18283, asfloat(_18256.z)));
float _18359 = mad(asfloat(_18268.x), _18131, mad(asfloat(_18268.y), _18283, asfloat(_18268.z)));
precise float _18360 = _18280 * _18292;
bool _18361 = _18280 == 0.0f;
float _18363 = (_18361 || _18315) ? 0.0f : _18360;
precise float _18364 = 1.0f / _18353;
precise float _18366 = _18301 * _18280;
float _18368 = (_18338 || _18361) ? 0.0f : _18366;
precise float _18369 = 1.0f / _18101;
float _18370 = mad(_17851, _18289, mad(_17916, _18224, _17920));
precise float _18371 = _18242 * _18364;
float _18375 = ((_18242 == 0.0f) || (_18364 == 0.0f)) ? 0.0f : _18371;
precise float _18389 = (-0.0f) - _18375;
float _18390 = (_246 && (_247 && (_18133 && (_18135 && ((1u == (3u & _18188)) || ((2u == (7u & _18188)) || (1u == (1u & (_18188 >> 6u))))))))) ? _18389 : _18375;
float _18391 = abs(_18217.w);
precise float _18392 = _18357 * _18391;
bool _18393 = _18357 == 0.0f;
bool _18394 = _18391 == 0.0f;
precise float _18397 = _18359 * _18391;
bool _18398 = _18359 == 0.0f;
precise float _18401 = _18355 * _18391;
bool _18402 = _18355 == 0.0f;
float _18405 = abs(_18217.z);
precise float _18406 = _18355 * _18405;
bool _18407 = _18405 == 0.0f;
float _18410 = abs(_18217.x);
precise float _18411 = _18355 * _18410;
bool _18412 = _18410 == 0.0f;
precise float _18415 = _18359 * _18405;
float _18418 = abs(_18217.y);
precise float _18419 = _18355 * _18418;
bool _18420 = _18418 == 0.0f;
precise float _18423 = _18357 * _18405;
float _18426 = abs(_18390);
precise float _18427 = (-0.0f) - ((_18402 || _18407) ? 0.0f : _18406);
precise float _18429 = _18359 * _18418;
precise float _18432 = (-0.0f) - ((_18398 || _18407) ? 0.0f : _18415);
precise float _18434 = _18357 * _18410;
precise float _18437 = _18357 * _18418;
precise float _18440 = _18359 * _18410;
precise float _18443 = (-0.0f) - ((_18402 || _18420) ? 0.0f : _18419);
precise float _18445 = (-0.0f) - ((_18402 || _18394) ? 0.0f : _18401);
precise float _18447 = (-0.0f) - ((_18402 || _18412) ? 0.0f : _18411);
precise float _18449 = (-0.0f) - ((_18393 || _18407) ? 0.0f : _18423);
float _18451 = asfloat(_18274.y);
precise float _18452 = _18451 + mad(_18336, _18426, _18427);
precise float _18453 = (-0.0f) - ((_18393 || _18420) ? 0.0f : _18437);
precise float _18455 = _18451 + mad(_18336, _18426, _18443);
precise float _18456 = (-0.0f) - ((_18398 || _18420) ? 0.0f : _18429);
precise float _18458 = (-0.0f) - ((_18398 || _18394) ? 0.0f : _18397);
float _18460 = asfloat(_18274.x);
precise float _18461 = _18460 + mad(_18341, _18426, _18449);
precise float _18462 = _18329 * _18452;
bool _18463 = _18329 == 0.0f;
bool _18464 = _18452 == 0.0f;
precise float _18467 = _18452 * _18452;
precise float _18469 = _18460 + mad(_18341, _18426, _18453);
precise float _18470 = (-0.0f) - ((_18398 || _18412) ? 0.0f : _18440);
precise float _18472 = _18329 * _18455;
bool _18473 = _18455 == 0.0f;
precise float _18476 = _18455 * _18455;
precise float _18478 = (-0.0f) - ((_18393 || _18412) ? 0.0f : _18434);
precise float _18480 = _18451 + mad(_18336, _18426, _18445);
precise float _18481 = (-0.0f) - ((_18393 || _18394) ? 0.0f : _18392);
precise float _18483 = _18451 + mad(_18336, _18426, _18447);
precise float _18484 = (-0.0f) - asfloat(heap_srv_raw(_18147).Load<uint>(shifted(_18147, (min(272u, 2147483584u) >> 2u) * 4 + 0)));
precise float _18485 = (-0.0f) - ((_18463 || _18464) ? 0.0f : _18462);
float _18487 = asfloat(_18274.z);
precise float _18488 = _18487 + mad(_18370, _18426, _18432);
precise float _18490 = _18487 + mad(_18370, _18426, _18456);
precise float _18491 = (-0.0f) - ((_18463 || _18473) ? 0.0f : _18472);
precise float _18494 = _18460 + mad(_18341, _18426, _18481);
precise float _18495 = _18329 * _18480;
bool _18496 = _18480 == 0.0f;
precise float _18499 = _18480 * _18480;
precise float _18501 = _18329 * _18483;
bool _18502 = _18483 == 0.0f;
precise float _18505 = _18460 + mad(_18341, _18426, _18478);
precise float _18506 = _18483 * _18483;
precise float _18508 = (-0.0f) - _18488;
float _18509 = mad(_18508, _18335, mad(_18461, _18484, _18485));
precise float _18511 = (-0.0f) - _18490;
float _18512 = mad(_18511, _18335, mad(_18469, _18484, _18491));
precise float _18515 = _18487 + mad(_18370, _18426, _18458);
precise float _18516 = (-0.0f) - ((_18463 || _18496) ? 0.0f : _18495);
precise float _18519 = _18487 + mad(_18370, _18426, _18470);
precise float _18520 = (-0.0f) - ((_18463 || _18502) ? 0.0f : _18501);
precise float _18523 = _18426 * _18238;
float _18527 = ((_18426 == 0.0f) || (_18238 == 0.0f)) ? 0.0f : _18523;
precise float _18528 = (-0.0f) - _18509;
precise float _18530 = (-0.0f) - _18512;
precise float _18539 = (-0.0f) - _18515;
float _18540 = mad(_18539, _18335, mad(_18494, _18484, _18516));
precise float _18542 = (-0.0f) - _18519;
float _18543 = mad(_18542, _18335, mad(_18505, _18484, _18520));
precise float _18546 = _18527 * _18369;
float _18550 = ((_18527 == 0.0f) || (_18369 == 0.0f)) ? 0.0f : _18546;
precise float _18553 = asfloat(_17980 ? 1109393408u : asuint(_17971)) * asfloat((_246 && (_247 && (_18133 && (_18135 && (0.0f > _18390))))) ? 1073741824u : 1094713344u);
precise float _18554 = (-0.0f) - _18540;
precise float _18556 = (-0.0f) - _18543;
uint _18560 = (_18310 >> 8u) & 15u;
precise float _18561 = _18553 * _18550;
float _18565 = ((_18553 == 0.0f) || (_18550 == 0.0f)) ? 0.0f : _18561;
uint _18567 = (_18308 >> 8u) & 15u;
uint _18569 = (_18312 >> 8u) & 15u;
uint _18574 = (_18306 >> 8u) & 15u;
float _18606 = asfloat((_246 && (_247 && (_18133 && (_18135 && ((0u != _18560) && (sqrt(mad(_18528, _18509, mad(_18488, _18488, mad(_18461, _18461, _18464 ? 0.0f : _18467)))) < _18565)))))) ? 1065353216u : 0u);
precise float _18607 = _18317 * _18606;
float _18611 = ((_18317 == 0.0f) || (_18606 == 0.0f)) ? 0.0f : _18607;
float _18612 = asfloat((_246 && (_247 && (_18133 && (_18135 && ((0u != _18567) && (sqrt(mad(_18530, _18512, mad(_18490, _18490, mad(_18469, _18469, _18473 ? 0.0f : _18476)))) < _18565)))))) ? 1065353216u : 0u);
precise float _18613 = _18363 * _18612;
float _18617 = ((_18363 == 0.0f) || (_18612 == 0.0f)) ? 0.0f : _18613;
float _18618 = asfloat((_246 && (_247 && (_18133 && (_18135 && ((0u != _18574) && (sqrt(mad(_18556, _18543, mad(_18519, _18519, mad(_18505, _18505, _18502 ? 0.0f : _18506)))) < _18565)))))) ? 1065353216u : 0u);
precise float _18619 = _18368 * _18618;
float _18623 = ((_18368 == 0.0f) || (_18618 == 0.0f)) ? 0.0f : _18619;
float _18624 = asfloat((_246 && (_247 && (_18133 && (_18135 && ((0u != _18569) && (sqrt(mad(_18554, _18540, mad(_18515, _18515, mad(_18494, _18494, _18496 ? 0.0f : _18499)))) < _18565)))))) ? 1065353216u : 0u);
precise float _18627 = _18340 * _18624;
float _18631 = ((_18340 == 0.0f) || (_18624 == 0.0f)) ? 0.0f : _18627;
precise float _18632 = mad(_18340, _18624, _18611) + mad(_18368, _18618, _18617);
uint _19767;
uint _19769;
if (9.9999997473787516355514526367188e-05f < _18632)
{
precise float _18634 = 1.0f / _18632;
float _18636 = float(_18560 & 255u);
float _18640 = float(_18310 & 255u);
float _18642 = float(_18312 & 255u);
precise float _18645 = 0.0039215688593685626983642578125f * _18640;
float _18648 = (_18640 == 0.0f) ? 0.0f : _18645;
precise float _18649 = _18634 * _18611;
bool _18650 = _18634 == 0.0f;
float _18653 = (_18650 || (_18611 == 0.0f)) ? 0.0f : _18649;
precise float _18654 = _18634 * _18631;
float _18657 = (_18650 || (_18631 == 0.0f)) ? 0.0f : _18654;
precise float _18658 = _18634 * _18617;
float _18661 = (_18650 || (_18617 == 0.0f)) ? 0.0f : _18658;
precise float _18662 = _18634 * _18623;
float _18665 = (_18650 || (_18623 == 0.0f)) ? 0.0f : _18662;
precise float _18666 = _18648 * _18648;
float _18668 = (_18648 == 0.0f) ? 0.0f : _18666;
precise float _18669 = _18636 * _18653;
bool _18671 = _18653 == 0.0f;
float _18677 = float(_18308 & 255u);
precise float _18678 = 0.0039215688593685626983642578125f * _18642;
float _18680 = (_18642 == 0.0f) ? 0.0f : _18678;
precise float _18682 = 0.0039215688593685626983642578125f * _18677;
float _18684 = (_18677 == 0.0f) ? 0.0f : _18682;
precise float _18686 = _18684 * _18684;
float _18691 = float(_18306 & 255u);
precise float _18692 = _18680 * _18680;
precise float _18695 = _18668 * _18653;
precise float _18699 = 1.0f + mad(float(_18574 & 255u), _18665, mad(float(_18567 & 255u), _18661, mad(float(_18569 & 255u), _18657, ((_18636 == 0.0f) || _18671) ? 0.0f : _18669)));
precise float _18701 = 0.0039215688593685626983642578125f * _18691;
float _18703 = (_18691 == 0.0f) ? 0.0f : _18701;
uint _18707 = asuint(_18699) | _17987;
float _18711 = ((_18707 & 2147483647u) == 0u) ? asfloat(_18707) : min(_18699, asfloat(_17987));
uint _18712 = asuint(_18711);
precise float _18713 = _18703 * _18703;
float _18724 = mad((_18703 == 0.0f) ? 0.0f : _18713, _18665, mad((_18684 == 0.0f) ? 0.0f : _18686, _18661, mad((_18680 == 0.0f) ? 0.0f : _18692, _18657, ((_18668 == 0.0f) || _18671) ? 0.0f : _18695)));
precise float _18725 = 1.0f / ((((1065353216u | _18712) & 2147483647u) == 0u) ? asfloat(1065353216u & _18712) : max(1.0f, _18711));
precise float _18727 = asfloat(_17800) - _18724;
_19767 = asuint(mad(_18725, _18727, _18724));
_19769 = _18712;
}
else
{
_19767 = _17800;
_19769 = 1065353216u;
}
_19768 = _19767;
_19770 = _19769;
}
_18732 = _19768;
_18733 = _19770;
}
precise float _18737 = 0.5f + asfloat(_18733);
uint _18742 = uint(_18737);
heap_rwtex2d(min(asuint(asfloat(_39.Load<uint>((_10637 >> 2u) * 4 + 0))), NULL_SLOT))[uint2(_253, _250)] = asfloat(((((15u < _18742) ? 15u : _18742) << 8u) | ((_246 && (_247 && (0u != _3837))) ? 8192u : 0u)) | uint(mad(255.0f, sqrt(asfloat(_18732)), 0.5f))).xxxx;
}
_20085 = _20084;
}
_20086 = _20085;
}
else
{
_20086 = _20073;
}
_19636 = _20086;
}
else
{
_19636 = _20064;
}
if (_19636)
{
return;
}
}
}
}
[WaveSize(32)]
[numthreads(32, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_WorkGroupID = stage_input.gl_WorkGroupID;
gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex;
comp_main();
}