GithubHelp home page GithubHelp logo

Comments (11)

elishacloud avatar elishacloud commented on June 1, 2024 1

Yes, I just verified #18 and it seemed to work fine. I did not find any issues with it.

from d3d8to9.

crosire avatar crosire commented on June 1, 2024
auto &rt = _current_rendertarget;
auto &ds = _current_depthstencil;
if (rt != nullptr && ds != nullptr && myRef <= 3)
{
    rt->Release(); rt = nullptr;
    ds->Release(); ds = nullptr;
}
else if (rt != nullptr && myRef <= 2)
{
    rt->Release(); rt = nullptr;
}
else if (ds != nullptr && myRef <= 2)
{
    ds->Release(); ds = nullptr;
}

from d3d8to9.

elishacloud avatar elishacloud commented on June 1, 2024

I don't think those changes are safe. I tried that with one of my games (Rayman 3: Hoodlum Havoc) and it crashed on exit, whereas it never crashed before. Event Viewer showed it as crashing in d3d8.dll (this wrapper).

from d3d8to9.

crosire avatar crosire commented on June 1, 2024

Mmh. Well, then it's probably better to follow the "Never change a running system" matra.

from d3d8to9.

elishacloud avatar elishacloud commented on June 1, 2024

Ok, if I change the declaration then it works without crashing:

auto* rt = _current_rendertarget;
auto* ds = _current_depthstencil;
if (rt != nullptr && ds != nullptr && myRef <= 3)
{
	rt->Release(); rt = nullptr;
	ds->Release(); ds = nullptr;
}
else if (rt != nullptr && myRef <= 2)
{
	rt->Release(); rt = nullptr;
}
else if (ds != nullptr && myRef <= 2)
{
	ds->Release(); ds = nullptr;
}

from d3d8to9.

crosire avatar crosire commented on June 1, 2024

That doesn't reset the fields to nullptr though, which is bad too.

from d3d8to9.

CookiePLMonster avatar CookiePLMonster commented on June 1, 2024

Indeed, auto& shouldn't be used in here. But other than this, it looks good and it does reset the fields to nullptr (missed the assignments after Release(), crosire?).

The only thing I'd change is <= to == - defensive approach is really not needed in here, I guess.

from d3d8to9.

elishacloud avatar elishacloud commented on June 1, 2024

Yes, that code seems to work for me. No crashes or other issues.

from d3d8to9.

CookiePLMonster avatar CookiePLMonster commented on June 1, 2024

The one I posted in here was wrong again though (too sleepy, it seems). I'll fix and issue a PR.

from d3d8to9.

crosire avatar crosire commented on June 1, 2024

No, it doesn't reset the fields to nullptr. It only sets the local auto variables to nullptr. But I see you fixed that in the PR.

from d3d8to9.

crosire avatar crosire commented on June 1, 2024

I don't have any way to test #18 currently, so would greatly appreciate if @elishacloud could verify things still work with it.

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.