GithubHelp home page GithubHelp logo

Direct3DDevice8::Release about d3d8to9 HOT 9 CLOSED

crosire avatar crosire commented on June 15, 2024
Direct3DDevice8::Release

from d3d8to9.

Comments (9)

CookiePLMonster avatar CookiePLMonster commented on June 15, 2024

I tested that and noticed it in fact crashes on app exit when the device is killed (wrapper's refcount is 0, underlying interface's refcount is 2)... So the question is, where do the refcounts desync?

from d3d8to9.

CookiePLMonster avatar CookiePLMonster commented on June 15, 2024

UPDATE: The exit crash seems to solved by re-reading the reference counter after releasing render target/depth target with myRef = InterlockedExchange(&_ref, ref);. Thus, the initial question in the issue is valid once again.

from d3d8to9.

crosire avatar crosire commented on June 15, 2024

Was done because of the crash you mentioned and at the time this was the quickest solution.

from d3d8to9.

CookiePLMonster avatar CookiePLMonster commented on June 15, 2024

Something as simple as inserting this

// Obtain the reference counter after releasing surfaces again myRef = InterlockedExchange(&_ref, ref);

below proxy->Release() seems to work great though. One could just --myRef when releasing rendertargets but I feel re-reading the actual refcount is safer.

from d3d8to9.

crosire avatar crosire commented on June 15, 2024

Technically it would be better to put it one line above the _proxy->Release() call to keep constistent with all other Release implementations. Should still work.

from d3d8to9.

CookiePLMonster avatar CookiePLMonster commented on June 15, 2024

Sure. It matters little but if consistency can be preserved, best to go for it!

from d3d8to9.

CookiePLMonster avatar CookiePLMonster commented on June 15, 2024

While you're here, I know it's not really related but I'm not a linkedin user and leaving a message here is probably the best - are you fine with a game specific fork of d3d8to9 maintained in a never-to-be-merged branch? Here it's about a GameMaker generated executable so we don't really have control on how d3d8 calls are issued (and there is a LOT of redundancy which cannot be easily avoided) and it'd be easiest to address from inside this dll.

from d3d8to9.

CookiePLMonster avatar CookiePLMonster commented on June 15, 2024

I have identified the root cause of the refcount issue (device release ended up in a would-be infinite loop only bailed from thanks to refcount underflow) and updated #2 to include the fix!

from d3d8to9.

crosire avatar crosire commented on June 15, 2024

@CookiePLMonster Sure, you can use it however you see fit as long as it follows the license.

from d3d8to9.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.