michael-fadely / sadx-dc-lighting

Sonic Adventure 1 palette lighting for SADX PC.
MIT License
39 stars 3 forks source link

Drop D3DX Effect system #52

Closed michael-fadely closed 7 years ago

michael-fadely commented 7 years ago

After the API is finalized, I'd like to drop the D3DX Effect system in favor of individual vertex and pixel shaders. This would reduce a lot of headaches with managing shader parameters.

For example, with textures in particular, the D3DX Effect system insists on storing an IDirect3DTexture9 pointer which it re-applies just before the scene is drawn. This is the source of the old lightning shield bug (#31). By dropping the effect system, I can use the textures assigned by the fixed-function pipeline as-is. This also means I can drop the IDirect3DDevice9::SetTexture detour function, which was only necessary to work around this behavior (since finding every instance of SetTexture in SADX's code isn't fun!).

This would also reduce shader duplicate code during dynamic compilation, as only certain flags (and parameters) are relevant in the vertex shader and pixel shader.