crosire / d3d8to9

A D3D8 pseudo-driver which converts API calls and bytecode shaders to equivalent D3D9 ones.
BSD 2-Clause "Simplified" License
880 stars 78 forks source link

Check VertexShader instruction count #45

Closed elishacloud closed 6 years ago

elishacloud commented 6 years ago

This update will check the VertexShader instruction count before adding any more instructions to the shader to ensure that the count never exceeds 128 instructions. This will fix the issue with d3d8to9 and BloodRayne/BloodRayne 2. See comments on these two threads:

A few notes here:

  1. Initialization of the output registers are not always needed because sometimes (like the case with BloodRayne) they are already initialized in the existing VertexShader from the game.
  2. It seems that only initialization of the oT (Texture Coordinate) register is actually needed. I have not found a case where initialization of the other registers are needed. The ENBDev DX8 to DX9 convertor only initializes the oT (Texture Coordinate) register. See comments here.