Skip to content
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

Added shared memory option for the render buffer #344

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

leozide
Copy link

@leozide leozide commented Jan 15, 2018

This change adds the +SM command line option, which tells POV-Ray to use a memory mapped file to back the rendering buffer in vfeDisplay. This way other applications can also map the same file and read from the buffer as its being filled.

I've made this change so that my application (www.leocad.org) can export a .pov file, call the POV-Ray console version and show the rendering progress in its own window (like the Windows version of POV-RAY).

Tested with 3.7.1 on Windows and macOS and it works without any issues. This is my first time changing the POV-Ray source so please let me know if there's anything you'd like me to change.

@c-lipka
Copy link
Contributor

c-lipka commented Jan 15, 2018

Be advised that the VFE module you're using as a hook is not part of the portable portion of POV-Ray. Instead, it is an optional helper module to simplify interfacing a GUI to the official interface, which is POVMS. While it so happens that currently all official incarnations of POV-Ray make use of this module, there is no guarantee that it will be present in future or inofficial incarnations.

Probably a better place to hook into is the back-end image buffer used to assemble the image prior to generating the output file. The code is located in the source/base/image/image.cpp directory. It already features a code path to switch to an alternative image buffer; look for FileRGBFTImage.

@leozide
Copy link
Author

leozide commented Jan 16, 2018

I was afraid something like this would happen, I'll take a look at moving the hook to where you suggested.

@c-lipka
Copy link
Contributor

c-lipka commented Jan 17, 2018

You'll find that the image buffers currently used in that role use single precision float colour channels; this is necessary since the buffer is agnostic of the output image encoding details such as bit depth and gamma. 16-bit integers would only be good enough for 8-bit output file types, or 16-bit output file types using linear encoding, and half-precision floats would only be good enough for 8-bit and high dynamic range output file types.

You can reduce the memory size somewhat by dropping the "F" ("filter") channel, which isn't actually used. I haven't gotten around to throwing out that channel yet.

@chris20 chris20 self-assigned this Nov 9, 2024
@chris20 chris20 added the feature proposal for a new feature, or alleged bug triaged as intentional but warranting improvement label Nov 9, 2024
@chris20 chris20 added this to the v3.8.0-beta.3 milestone Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature proposal for a new feature, or alleged bug triaged as intentional but warranting improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants