Git Product home page Git Product logo

Comments (14)

AJenbo avatar AJenbo commented on May 2, 2024 2

Thanks for the PR, although it fails on the build servers, it defiantly points us in the direction of the issue. I strongly belive that this issue will be dealt with once we have dx.cpp unstubbed. I have already started this work but I'm currently away on holiday, I expect to resume (and probably finish) that work next week and if this dosen't solve it I will target the issue directly based on your findings. Once it is fixed I think it would be fitting with a new release, especially once all the upstream work is synced.

from devilutionx.

AJenbo avatar AJenbo commented on May 2, 2024 2

After cleaning up dx.cpp this is the conclusion I have come to.
image

Diablo originally rendered to a back buffer that did not contain any color information, whenever it had completed the rendering of a frame it would blit the updated parts to the framebuffer in the graphics card. The framebuffer would also have the color pallet injected, at this could be updated regardless of where in the rendering process the next frame where since this was happening in the off-screen back buffer.

The way DevilutionX currently handles things is so having the color information associated with the back buffer, the blitting is then done to a 32bit buffer (converting the colors in the process) this is done so that it is more convenient to display on modern systems via SDL/OpenGL. This is also fine, the problem occurs when the palette is changed during the rendering of a frame; since we cannot change the palette of the 32bit image (because it is full color) we apply the new palette to the back buffer and copy the new result, this can then result in an unfinished frame being presented on screen.

The solution I'm planning is to add an additional 8bit buffer where the color change can safely be performed on the latest completed image, and then do the conversion from there.

An alternate solution would be to make the pipeline 8bit, but it's not where we want to head in the future (full 32bit pipeline). The extra 500kb copy pr frame also shouldn't be much of an issue for modern systems. An alternative solution would be to make sure that all palette updates happens at the end of a frame rendering, but I would prefer not changing any parts of the engine for now.

from devilutionx.

AJenbo avatar AJenbo commented on May 2, 2024 2

Testing @Chance4us's workaround it appears to solve the issue satisfactorily with no noticeable side effects so going to go with it for now. Basically, it defers the updating of the pallet until the next frame is rendered (would probably not show until then anyway), except for when doing fade in/out in the menus.

from devilutionx.

MaxDesiatov avatar MaxDesiatov commented on May 2, 2024 1

I don't think this is fixed upstream, even after render.cpp cleanup. I've done a clean rebuild from 82adedb which has the most fresh upstream changes and this is still reproducible for me on a 32-bit build on macOS 10.14.4.

from devilutionx.

AJenbo avatar AJenbo commented on May 2, 2024 1

I have identified the issue as being related to color cycling. If disabled the mouse will stop flickering, but then you won't have animated lava.

from devilutionx.

Chance4us avatar Chance4us commented on May 2, 2024 1

I think this issue is almost solved.
Please try to replace "sdl_update_entire_surface();" by "memcpy(logical_palette, orig_palette, 1024);" in the file devilutionX/SourceX/storm/storm_dx.cpp
By only this change the flickering is gone completely. Unfortunately the main menu and the cutscenes are no more visible at all.

from devilutionx.

Chance4us avatar Chance4us commented on May 2, 2024 1

There is no need for "sdl_update_entire_surface();" or "memcpy(logical_palette, orig_palette, 1024);" at all. I'll try to workaround the SDL_BlitSurface(pal_surface, &src_rect, surface, NULL) causing flickering in devilutionX/SourceX/dx.cpp

from devilutionx.

 avatar commented on May 2, 2024 1

For what it's worth, Diablo II handled Direct Draw by using two different buffers. Essentially one is just temporary and like Diablo 1, 8-bit with the palettes. This then gets copied to the front buffer which is 32-bit and is what is shown on screen.

from devilutionx.

 avatar commented on May 2, 2024

Yes , Source Code deleted reported this to me.

I will look into it. I think the upstream might have a fix for this.

from devilutionx.

 avatar commented on May 2, 2024

@AJenbo do we know where the code that might concern this might be located? I wonder if there is some rendering issue. Ironically, this is only an issue in DevilutionX .

from devilutionx.

AJenbo avatar AJenbo commented on May 2, 2024

I believe this issue might have been resolved, possibly by cleaned up render.
But also dx.cpp is still heavily stubbed so cleaning it might solve the problem.
If that doesn't do it then probably by the time we add hardware acceleration it should go away.

from devilutionx.

AJenbo avatar AJenbo commented on May 2, 2024

Your right and not in the https://github.com/diasurgical/devilutionX/tree/render branch either :(

That leaves cleaning up dx.cpp and rewriting the render as possibly "free" fixes.

from devilutionx.

Chance4us avatar Chance4us commented on May 2, 2024

Issue is being directly or indirectly affected by following source file / functions:
devilutionX/Source/palette.cpp
function1: void __cdecl palette_update_caves() -> color cycling for lava
function2: void __fastcall palette_update_quest_palette(int n) -> Poisoned Water Supply Quest -> change the color of poisoned water to clean blue water
I tried to comment out the content of both functions with the result as color cycling would be disabled and the flickering is gone.

from devilutionx.

Chance4us avatar Chance4us commented on May 2, 2024

Please check failed pull request #86. Maybe the code has to be a little bit modified.

from devilutionx.

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.