New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ULTIMA8: Merge RenderSurface and SoftRenderSurface #5288
Conversation
Also, these
Yes, this is always the best, as it simplifies the code significantly. Especially in your case, when there is only one game/family of games based on the engine, e.g. you know that some alien format will not arrive anyway. |
Sounds good I'll rebase this branch and start down that path.
Indeed! Watching work on that inspired me to cycle back around to this as I wasn't sure how to tackle this previously.
Alright, I think I embrace the BlendBlit PixelFormat for this engine so I might be able to use the new code there. Thanks! |
ea786ac
to
7c794c1
Compare
I should point out that there's usually a trade-off between simplicity and compatibility here since not all backends support the pixel format required by the common blending routines, and some of the ones that do perform an additional conversion pass in software that may introduce additional overhead on lower end machines. I'd be interested to know what the Ultima8 engine is using alpha blending for - I wouldn't have expected a game from 1994-1996 to need it. |
Understood. I'm curious to know how well this engine performs on lower end as well, but have yet to check. There's a config key "bpp" currently to set 16 or 32 to see how much that pass would effect those machines.
Dragging items did a mask and blend in the original game to produce a light grey outline of the item. Street lights on ground , smoke effects from chimneys, and black potions for invisibility have similar blends Pentagram enhanced these as a full blending, which I think is a bit nicer. Also, there's a few extras for "Show Highlight Items" and "Show Touching Items" that blend colors - although those could be potentially handled by a modified pallete for those items. |
What I'd suggest if possible is to select a format based on what the backend reports as supported. If the engine specifically requires RGB565 or RGBA8888, you can pass an array with those formats as the third parameter to
That sounds like a neat enhancement. Does support for the original mask/blend effects exist in the current code, or is it just the enhanced version? |
// | ||
// Desc: Fill alpha channel | ||
// | ||
void RenderSurface::FillAlpha(uint8 alpha, const Rect &r) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I correct in thinking that this is essentially the same as Graphics::Surface::setAlpha()
except with an additional Rect parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you are correct. It was used in Pentagram for a two pass rendering of TextWidget for the normal scaled paint and then the composited unscaled paint to render a higher res font.
I've been maintaining this method and testing with CHECK_ALPHA_FILLS, although it's currently not used as the composited painting was abandoned although not completely removed when ported to ScummVM.
I'll keep this in mind.
Nope, never implemented an original version option. |
This was not needed for a full-height clipping window when top left is the same as the offset (GameMapGump) and was incorrect for other movable gumps.
6f3b24c
to
5b3faad
Compare
…ble performance increase over other shape paint methods
I think additional changes I'd like to make are starting to fall out of scope for this pull request. I'll hold off on those for the moment. Any additional review is appreciated. Currently the benchmarks show a small improvement on my machine: PR #5288 |
Thanks for doing the cleanup! overall it LGTM - there are further improvements to be made but this should make them a lot easier! |
5513b45
to
07f8c23
Compare
I'll go ahead and complete this PR as I have a number of follow-up changes ready at this point. |
Hi all! I'm doing these changes through a pull request to get feedback on them.
My aim is to simplify custom rendering in the engine and possibly eliminate methods that could be handled by ManagedSurface.
Should I flatten the render_surface.inl into the paint shape methods?
ShapeFrame owns a height, width, and pixels: should these be put in a Graphics::Surface before the custom blit or stored as a surface in ShapeFrame directly?
Should I consider forcing the bpp on RenderSurface rather than letting it be configured by Ultima8Engine::GraphicSysInit?
Any other suggestions?