TorqueGameEngines / Torque3D

Other
1.53k stars 162 forks source link

Strange code fragments #980

Open mjunix opened 1 year ago

mjunix commented 1 year ago
  1. Identical expressions on both side of the && operator: https://github.com/TorqueGameEngines/Torque3D/blob/eeab0c1e06807f88820ce5df1e19e2df942050d4/Engine/lib/opcode/Ice/IceLSS.h#L69
  2. Strange use of comma operator in if-condition: https://github.com/TorqueGameEngines/Torque3D/blob/eeab0c1e06807f88820ce5df1e19e2df942050d4/Engine/source/renderInstance/renderProbeMgr.cpp#L801
  3. Same code is executed regardless of condition: https://github.com/TorqueGameEngines/Torque3D/blob/eeab0c1e06807f88820ce5df1e19e2df942050d4/Engine/source/afx/xm/afxXM_Scale.cpp#L130-L133
  4. Nothing is done inside for-loop: https://github.com/TorqueGameEngines/Torque3D/blob/eeab0c1e06807f88820ce5df1e19e2df942050d4/Engine/source/gfx/D3D11/gfxD3D11Device.cpp#L72-L75
  5. Enum value zero is used in bitwise AND-operation: https://github.com/TorqueGameEngines/Torque3D/blob/eeab0c1e06807f88820ce5df1e19e2df942050d4/Engine/source/ts/tsSortedMesh.cpp#L89
  6. bufSize (used later in a for-loop) seems to be initialized to 0 but then never changed: https://github.com/TorqueGameEngines/Torque3D/blob/eeab0c1e06807f88820ce5df1e19e2df942050d4/Engine/source/gfx/gl/gfxGLTextureTarget.cpp#L169 https://github.com/TorqueGameEngines/Torque3D/blob/eeab0c1e06807f88820ce5df1e19e2df942050d4/Engine/source/gfx/gl/gfxGLTextureTarget.cpp#L211
  7. Looks strange to use bit mask values with logical OR-operator, perhaps bitwise OR should be used instead? https://github.com/TorqueGameEngines/Torque3D/blob/eeab0c1e06807f88820ce5df1e19e2df942050d4/Engine/source/T3D/gameBase/gameBase.cpp#L459
Azaezel commented 1 year ago

1) we don't generally tweak third party libraries, but the opcode libs not really being maintained, so should be ok to drill on that one for potential fixes 2) a definite typo. should be && 3) seems like copypasta where the rest follow this pattern: https://github.com/TorqueGameEngines/Torque3D/blob/6e35acf2a2295cccfe21032818551941ee000452/Engine/source/afx/xm/afxXM_Offset.cpp#L67-L92 . could see either stripping the check, or cooking up a (edit: non) weighted variant. that one'll take a bit more study. 4) can likely be chucked 5) ... unsure to be honest 6) I think should reference GFXGLDevice::getNumRenderTargets() given the todo-note and usage context? 7) yeah, pretty clear that one's a stray |