crosire / d3d8to9

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

Shader lifetime improvement #158

Closed nv-ajaus closed 1 year ago

nv-ajaus commented 1 year ago

This is a proposal to fix the issue outlined in https://github.com/crosire/d3d8to9/issues/155. Basically, D3D8.1 and D3D9 lifetimes have different rules but d3d8to9 currently doesn't follow the D3D8.1 behavior (which is that shaders share a lifetime with the device that created them and are implicitly destroyed). This causes some D3D8 applications to leak shader and device objects even if they are well behaved under plain D3D8.x.

Here is a test that shows this behavior: d3d8_refcounttest.zip