Created
April 19, 2023 02:56
-
-
Save psychicEgg/1e9fe407081c6c5bf96027a6eddcb9b4 to your computer and use it in GitHub Desktop.
ChatGPT Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Elite Dangerous, Radar during data link scanning | |
// | |
// Compiled HLSL to DXBC, modded DXBC | |
// | |
// | |
// Input signature: | |
// | |
// Name Index Mask Register SysValue Format Used | |
// -------------------- ----- ------ -------- -------- ------- ------ | |
// __USER_VERTEX_M_TEXCOORD 0 xy 0 NONE float xy | |
// | |
// | |
// Output signature: | |
// | |
// Name Index Mask Register SysValue Format Used | |
// -------------------- ----- ------ -------- -------- ------- ------ | |
// SV_TARGET 0 xyzw 0 TARGET float xyzw | |
// | |
ps_5_0 | |
dcl_globalFlags refactoringAllowed | |
dcl_constantbuffer cb1[146], immediateIndexed | |
dcl_constantbuffer cb2[18], immediateIndexed | |
dcl_sampler s0, mode_default | |
dcl_resource_texture2d (float,float,float,float) t0 | |
dcl_resource_texture2d (float,float,float,float) t1 | |
dcl_resource_texture1d (float,float,float,float) t120 | |
dcl_input_ps linear v0.xy | |
dcl_output o0.xyzw | |
dcl_temps 7 | |
add r0.xy, v0.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000) | |
dp2 r0.x, r0.xyxx, r0.xyxx | |
sqrt r0.z, r0.x | |
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v0.xyxx, t0.xyzw, s0 | |
lt r0.w, l(0.010000), r1.w | |
and r0.w, r0.w, l(0x3f800000) | |
mul r1.xyz, r0.wwww, r1.xyzx | |
mul r1.xyz, r1.xyzx, cb2[9].yyyy | |
add r0.w, r0.z, r0.z | |
ge r2.x, cb2[0].x, r0.w | |
and r2.w, r2.x, l(0x3f800000) | |
if_nz cb2[13].w | |
max r3.x, cb2[10].x, l(0.000000) | |
else | |
mov r3.x, cb2[10].x | |
endif | |
mul r3.y, cb2[0].x, l(0.500000) | |
mul r3.z, r3.y, r3.x | |
mad r3.x, -r3.x, r3.y, r0.z | |
movc r3.y, cb2[13].w, l(0.175000), l(0.100000) | |
ge r3.w, cb2[10].y, l(0.500000) | |
if_nz r3.w | |
add r3.w, -cb2[10].y, l(0.500000) | |
mad r3.w, -|r3.w|, l(2.000000), l(1.000000) | |
max r3.w, r3.w, l(0.050000) | |
mul r3.y, r3.y, r3.w | |
else | |
lt r3.w, l(0.000000), cb2[10].x | |
if_nz r3.w | |
if_z cb2[13].w | |
add r3.w, -cb2[10].y, l(0.500000) | |
mad r3.w, -|r3.w|, l(2.000000), l(1.000000) | |
max r3.w, r3.w, l(0.050000) | |
mul r3.y, r3.y, r3.w | |
endif | |
else | |
if_nz cb2[13].w | |
mov r3.y, l(0) | |
else | |
add r3.w, cb2[10].y, l(0.400000) | |
mul_sat r3.w, r3.w, l(1.66666663) | |
mul r3.y, r3.w, r3.y | |
endif | |
endif | |
endif | |
rsq r0.x, r0.x | |
mul r0.x, r0.x, r0.y | |
lt r0.y, |r3.x|, r3.y | |
lt r0.x, cb2[10].w, -r0.x | |
and r0.x, r0.x, r0.y | |
if_nz r0.x | |
lt r0.x, r0.z, r3.z | |
add r0.y, r0.z, l(0.010000) | |
lt r0.y, r0.y, r3.z | |
and r0.xy, r0.xyxx, l(0x3f800000, 0x3f800000, 0, 0) | |
movc r0.x, cb2[13].w, r0.x, r0.y | |
mul r4.x, |r3.x|, l(12.000000) | |
mov r4.y, l(0) | |
sample_indexable(texture2d)(float,float,float,float) r0.y, r4.xyxx, t1.yxzw, s0 | |
mul r0.y, r0.y, l(3.000000) | |
if_nz cb2[13].w | |
div_sat r3.z, |r3.x|, r3.y | |
add r3.z, -r3.z, l(1.000000) | |
mul r3.z, r2.w, r3.z | |
mul r3.z, r0.x, r3.z | |
else | |
div_sat r3.x, |r3.x|, r3.y | |
add r3.x, -r3.x, l(1.000000) | |
mul r3.x, r2.w, r3.x | |
add r0.x, -r0.x, l(1.000000) | |
mul r3.z, r0.x, r3.x | |
endif | |
mul r0.x, cb2[0].x, l(0.050000) | |
mad r3.x, -cb2[0].x, l(0.500000), r0.z | |
div r0.x, |r3.x|, |r0.x| | |
min r0.x, r0.x, l(1.000000) | |
mul r0.x, r0.x, r3.z | |
add r3.x, cb2[10].y, l(0.400000) | |
mul_sat r3.x, r3.x, l(7.14285755) | |
mul r0.x, r0.x, r3.x | |
dp2 r0.x, cb2[10].zzzz, r0.xxxx | |
mul r0.y, r0.y, r0.x | |
mul r3.xyz, r0.yyyy, l(0.000000, 1.250000, 4.000000, 0.000000) | |
else | |
mov r3.xyz, l(0,0,0,0) | |
mov r0.x, l(0) | |
endif | |
mad r2.xyz, r1.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), r3.xyzx | |
max r0.x, r0.x, r1.w | |
lt r0.y, r0.w, cb2[0].x | |
if_nz r0.y | |
mul r0.y, cb2[0].z, cb2[16].w | |
mul r0.w, cb2[0].z, cb2[0].y | |
mul r0.yw, r0.yyyw, l(0.000000, 1000.000000, 0.000000, 1000.000000) | |
div r0.y, r0.y, r0.w | |
ge r1.x, r0.y, -r0.y | |
frc r0.y, |r0.y| | |
movc r0.y, r1.x, r0.y, -r0.y | |
mad r0.y, r0.y, r0.w, l(250.000000) | |
mad r0.z, r0.z, l(6.56000042), l(-1.000000) | |
mul r0.z, r0.z, l(3.321928) | |
exp r0.z, r0.z | |
mad r0.z, r0.z, l(500.000000), l(-250.000000) | |
mul r0.z, r0.z, l(0.001000) | |
round_ni r0.z, r0.z | |
mad r0.z, r0.z, l(1000.000000), l(250.000000) | |
add r0.w, -cb2[17].y, l(1.000000) | |
div r0.w, r0.w, cb2[17].y | |
mad r0.z, r0.w, l(1000.000000), r0.z | |
add r0.y, r0.y, -r0.z | |
mul r0.y, |r0.y|, l(0.001000) | |
round_ni r0.y, r0.y | |
mad_sat r0.y, -r0.y, cb2[17].y, l(1.000000) | |
dp2 r0.y, r0.yyyy, cb2[17].xxxx | |
max r1.w, r0.y, l(0.250000) | |
mul r1.xyz, r1.wwww, r2.wwww | |
mul r1.xyzw, r2.xyzw, r1.xyzw | |
mul r2.xyz, r1.xyzx, l(6.150000, 4.190000, 1.680000, 0.000000) | |
mul r0.x, r0.x, r1.w | |
endif | |
mul r0.yzw, r2.yyyy, cb2[2].xxyz | |
mad r0.yzw, r2.xxxx, cb2[1].xxyz, r0.yyzw | |
mad r0.yzw, r2.zzzz, cb2[3].xxyz, r0.yyzw | |
// Disable original output | |
//mul o0.w, r0.x, cb2[11].x | |
//mul o0.xyz, r0.yzwy, cb1[145].yyyy | |
// Mod | |
// r0.yzwx holds the final colour values | |
mul r1.w, r0.x, cb2[11].x | |
mul r1.xyz, r0.yzwy, cb1[145].yyyy | |
// Import custom colours for Outer Rim (236) and Grid (237) | |
ld_indexable(texture1d)(float,float,float,float) r2.xyzw, l(236, 0, 0, 0), t120.xyzw | |
ld_indexable(texture1d)(float,float,float,float) r3.xyzw, l(237, 0, 0, 0), t120.xyzw | |
// Get a pseudo greyscale by adding red and green channels | |
// I don't use this method anymore, but preserve it here to prevent | |
// breaking everyone's themes | |
add r4.y, r1.y, r1.x | |
// Import colour mode y106 (Custom = 100, XML = 199) | |
ld_indexable(texture1d)(float,float,float,float) r4.z, l(106, 0, 0, 0), t120.wxyz | |
eq r4.zw, r4.zzzz, l(0.000000, 0.000000, 100.000000, 199.000000) | |
// Outer rim defined by alpha (r0.x) > 0.165 | |
lt r4.x, l(0.165000), r0.x | |
// Multiply custom Rim colour by greyscale | |
mul r5.xyz, r2.xyzx, r4.yyyy | |
// Multiply default alpha by custom Rim alpha | |
mul r5.w, r1.w, r2.w | |
// Conditional move to Custom Rim colour if alpha (r0.x) > 0.165 (r4.x == 1) | |
movc r5.xyzw, r4.xxxx, r5.xyzw, r1.xyzw | |
// Grid defined by alpha (r0.x) < 0.165 | |
ge r0.w, l(0.165000), r0.x | |
// Multiply custom Grid colour by greyscale | |
mul r6.xyz, r3.xyzx, r4.yyyy | |
// Multiply default alpha by custom Grid alpha | |
mul r6.w, r1.w, r3.w | |
// Conditional move for grid area (r0.w == 1) r6.xyzw, else r5.xyzw (rim area) | |
movc r5.xyzw, r0.wwww, r6.xyzw, r5.xyzw | |
// Conditional move of Custom colour if Custom mode active (r4.z == 1), else default Elite (r1.xyzw) | |
movc r5.xyzw, r4.zzzz, r5.xyzw, r1.xyzw | |
// if XML mode, r4.w == 1 | |
if_nz r4.w | |
// Build XML colours, save result to r5.xyz | |
ld_indexable(texture1d)(float,float,float,float) r0.xyz, l(150, 0, 0, 0), t120.xyzw | |
ld_indexable(texture1d)(float,float,float,float) r2.xyz, l(151, 0, 0, 0), t120.xyzw | |
// r1.y is the default green channel, 151.rgb is the modifier | |
mul r2.xyz, r1.yyyy, r2.xyzx | |
// r1.x is the default red channel, 150.rgb is the modifier, add the modified green channel | |
mad r0.xyz, r0.xyzx, r1.xxxx, r2.xyzx | |
ld_indexable(texture1d)(float,float,float,float) r1.xyw, l(152, 0, 0, 0), t120.xywz | |
// r1.z is the default blue channel, 152.rgb is the modifier, add the modified green & red channels | |
mad r5.xyz, r1.xywx, r1.zzzz, r0.xyzx | |
// Multiply the XML output by Custom Rim brightness (r2.w) | |
mul r1.xyzw, r2.wwww, r5.xyzw | |
// Conditional move to XML Rim colour if alpha (r0.x) > 0.165 (r4.x == 1), else r5 without the custom alpha | |
movc r1.xyzw, r4.xxxx, r1.xyzw, r5.xyzw | |
// Multiply the XML output by Custom Grid brightness (r3.w) | |
mul r2.xyzw, r3.wwww, r1.xyzw | |
// Conditional move to XML Grid colour if alpha (r0.w) < 0.165 (r4.x == 1), else apply Rim colour (r1.xyzw) | |
movc o0.xyzw, r0.wwww, r2.xyzw, r1.xyzw | |
else | |
mov o0.xyzw, r5.xyzw | |
endif | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment