2014-07-08 03:11:14 -04:00
# include "FractoriumPch.h"
# include "Fractorium.h"
/// <summary>
/// Return whether the render timer is running.
/// </summary>
/// <returns>True if running, else false.</returns>
bool FractoriumEmberControllerBase : : RenderTimerRunning ( )
{
2016-02-12 00:38:21 -05:00
return m_RenderTimer - > isActive ( ) ;
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Start the render timer.
/// If a renderer has not been created yet, it will be created from the options.
/// </summary>
void FractoriumEmberControllerBase : : StartRenderTimer ( )
{
2016-02-12 00:38:21 -05:00
UpdateRender ( ) ;
m_RenderTimer - > start ( ) ;
m_RenderElapsedTimer . Tic ( ) ;
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Start the render timer after a short delay.
/// If the timer is already running, stop it first.
/// This is useful for stopping and restarting the render
/// process in response to things like a window resize.
/// </summary>
void FractoriumEmberControllerBase : : DelayedStartRenderTimer ( )
{
DeleteRenderer ( ) ;
2016-02-12 00:38:21 -05:00
m_RenderRestartTimer - > setSingleShot ( true ) ;
m_RenderRestartTimer - > start ( 300 ) ; //Will stop the timer if it's already running, and start again.
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Stop the render timer and abort the rendering process.
/// Optionally block until stopping is complete.
/// </summary>
/// <param name="wait">True to block, else false.</param>
void FractoriumEmberControllerBase : : StopRenderTimer ( bool wait )
{
2016-02-12 00:38:21 -05:00
m_RenderTimer - > stop ( ) ;
2014-07-08 03:11:14 -04:00
if ( m_Renderer . get ( ) )
m_Renderer - > Abort ( ) ;
if ( wait )
{
while ( m_Rendering | | RenderTimerRunning ( ) | | ( Renderer ( ) & & ( ! m_Renderer - > Aborted ( ) | | m_Renderer - > InRender ( ) ) ) )
QApplication : : processEvents ( ) ;
}
}
/// <summary>
/// Stop all timers, rendering and drawing and block until they are done.
/// </summary>
void FractoriumEmberControllerBase : : Shutdown ( )
{
StopRenderTimer ( true ) ;
2015-03-21 18:27:37 -04:00
ClearFinalImages ( ) ;
2014-07-08 03:11:14 -04:00
2015-12-31 16:41:59 -05:00
while ( m_Fractorium - > ui . GLDisplay - > Drawing ( ) )
2014-07-08 03:11:14 -04:00
QApplication : : processEvents ( ) ;
}
2015-03-21 18:27:37 -04:00
/// <summary>
/// Clear the output image buffers.
/// </summary>
void FractoriumEmberControllerBase : : ClearFinalImages ( )
{
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
Memset ( m_FinalImage ) ;
2015-03-21 18:27:37 -04:00
//Unsure if we should also call RendererCL::ClearFinal() as well. At the moment it seems unnecessary.
}
2014-07-08 03:11:14 -04:00
/// <summary>
/// Update the state of the renderer.
/// Upon changing values, some intelligence is used to avoid blindly restarting the
/// entire iteration proceess every time a value changes. This is because some values don't affect the
/// iteration, and only affect filtering and final accumulation. They are broken into three categories:
/// 1) Restart the entire process.
/// 2) Log/density filter, then final accum.
/// 3) Final accum only.
/// 4) Continue iterating.
/// </summary>
/// <param name="action">The action to take</param>
void FractoriumEmberControllerBase : : UpdateRender ( eProcessAction action )
{
AddProcessAction ( action ) ;
m_RenderElapsedTimer . Tic ( ) ;
}
/// <summary>
/// Call Shutdown() then delete the renderer and clear the textures in the output window if there is one.
2017-12-21 23:09:08 -05:00
/// Note the name is somewhat misleading because a new empty renderer is actually created as a placeholder.
/// This is that the program won't crash if the user adjusts any of the controls while the renderer is shut down.
2014-07-08 03:11:14 -04:00
/// </summary>
2017-12-21 23:09:08 -05:00
template < typename T >
void FractoriumEmberController < T > : : DeleteRenderer ( )
2014-07-08 03:11:14 -04:00
{
Shutdown ( ) ;
2017-12-21 23:09:08 -05:00
m_Renderer = make_unique < EmberNs : : Renderer < T , float > > ( ) ;
2014-07-08 03:11:14 -04:00
if ( GLController ( ) )
GLController ( ) - > ClearWindow ( ) ;
}
/// <summary>
2014-10-14 11:53:15 -04:00
/// Save the current render results to a file.
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
/// This could benefit from QImageWriter, however its compression capabilities are
2014-07-08 03:11:14 -04:00
/// severely lacking. A Png file comes out larger than a bitmap, so instead use the
/// Png and Jpg wrapper functions from the command line programs.
/// This will embed the id, url and nick fields from the options in the image comments.
/// </summary>
/// <param name="filename">The full path and filename</param>
2017-07-22 16:43:35 -04:00
/// <param name="comments">The comments to save in the png, jpg or exr</param>
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
/// <param name="pixels">The buffer containing the pixels</param>
/// <param name="width">The width in pixels of the image</param>
/// <param name="height">The height in pixels of the image</param>
2019-11-30 02:52:17 -05:00
/// <param name="png16Bit">Whether to use 16 bits per channel per pixel when saving as Png/32-bits per channel when saving as Exr.</param>
2017-07-22 16:43:35 -04:00
/// <param name="transparency">Whether to use alpha when saving as Png or Exr.</param>
void FractoriumEmberControllerBase : : SaveCurrentRender ( const QString & filename , const EmberImageComments & comments , vector < v4F > & pixels , size_t width , size_t height , bool png16Bit , bool transparency )
2014-07-08 03:11:14 -04:00
{
if ( filename ! = " " )
{
2019-11-30 02:52:17 -05:00
bool ret = false ;
2017-07-22 16:43:35 -04:00
auto size = width * height ;
auto settings = m_Fractorium - > m_Settings ;
2014-07-08 03:11:14 -04:00
QFileInfo fileInfo ( filename ) ;
QString suffix = fileInfo . suffix ( ) ;
2017-07-22 16:43:35 -04:00
string s = filename . toStdString ( ) ;
string id = settings - > Id ( ) . toStdString ( ) ;
string url = settings - > Url ( ) . toStdString ( ) ;
string nick = settings - > Nick ( ) . toStdString ( ) ;
2015-12-31 16:41:59 -05:00
2014-10-14 11:53:15 -04:00
//Ensure dimensions are valid.
2017-07-22 16:43:35 -04:00
if ( pixels . size ( ) < size )
2014-10-14 11:53:15 -04:00
{
m_Fractorium - > ShowCritical ( " Save Failed " , " Dimensions didn't match, not saving. " , true ) ;
return ;
}
2017-07-22 16:43:35 -04:00
auto data = pixels . data ( ) ;
2015-12-31 16:41:59 -05:00
2017-07-22 16:43:35 -04:00
if ( suffix . endsWith ( " bmp " , Qt : : CaseInsensitive ) | | suffix . endsWith ( " jpg " , Qt : : CaseInsensitive ) )
2014-07-08 03:11:14 -04:00
{
2017-07-22 16:43:35 -04:00
vector < byte > rgb8Image ( size * 3 ) ;
Rgba32ToRgb8 ( data , rgb8Image . data ( ) , width , height ) ;
2014-07-08 03:11:14 -04:00
2017-07-22 16:43:35 -04:00
if ( suffix . endsWith ( " bmp " , Qt : : CaseInsensitive ) )
2019-11-30 02:52:17 -05:00
ret = WriteBmp ( s . c_str ( ) , rgb8Image . data ( ) , width , height ) ;
2017-07-22 16:43:35 -04:00
else if ( suffix . endsWith ( " jpg " , Qt : : CaseInsensitive ) )
2019-11-30 02:52:17 -05:00
ret = WriteJpeg ( s . c_str ( ) , rgb8Image . data ( ) , width , height , 100 , true , comments , id , url , nick ) ;
2017-07-22 16:43:35 -04:00
}
else if ( suffix . endsWith ( " png " , Qt : : CaseInsensitive ) )
{
if ( ! png16Bit )
{
vector < byte > rgba8Image ( size * 4 ) ;
Rgba32ToRgba8 ( data , rgba8Image . data ( ) , width , height , transparency ) ;
2019-11-30 02:52:17 -05:00
ret = WritePng ( s . c_str ( ) , rgba8Image . data ( ) , width , height , 1 , true , comments , id , url , nick ) ;
2017-07-22 16:43:35 -04:00
}
else
{
vector < glm : : uint16 > rgba16Image ( size * 4 ) ;
Rgba32ToRgba16 ( data , rgba16Image . data ( ) , width , height , transparency ) ;
2019-11-30 02:52:17 -05:00
ret = WritePng ( s . c_str ( ) , ( byte * ) rgba16Image . data ( ) , width , height , 2 , true , comments , id , url , nick ) ;
2017-07-22 16:43:35 -04:00
}
}
else if ( suffix . endsWith ( " exr " , Qt : : CaseInsensitive ) )
{
2019-11-30 02:52:17 -05:00
if ( ! png16Bit ) //Repurpose this for EXR 32-bit.
{
vector < Rgba > rgba32Image ( size ) ;
Rgba32ToRgbaExr ( data , rgba32Image . data ( ) , width , height , transparency ) ;
ret = WriteExr16 ( s . c_str ( ) , rgba32Image . data ( ) , width , height , true , comments , id , url , nick ) ;
}
else
{
vector < float > r ( size ) ;
vector < float > g ( size ) ;
vector < float > b ( size ) ;
vector < float > a ( size ) ;
Rgba32ToRgba32Exr ( data , r . data ( ) , g . data ( ) , b . data ( ) , a . data ( ) , width , height , transparency ) ;
ret = WriteExr32 ( s . c_str ( ) , r . data ( ) , g . data ( ) , b . data ( ) , a . data ( ) , width , height , true , comments , id , url , nick ) ;
}
2017-07-22 16:43:35 -04:00
}
2014-07-08 03:11:14 -04:00
else
2014-10-14 11:53:15 -04:00
{
m_Fractorium - > ShowCritical ( " Save Failed " , " Unrecognized format " + suffix + " , not saving. " , true ) ;
return ;
}
2014-07-08 03:11:14 -04:00
2019-11-30 02:52:17 -05:00
if ( ret )
2014-07-08 03:11:14 -04:00
settings - > SaveFolder ( fileInfo . canonicalPath ( ) ) ;
else
2014-10-14 11:53:15 -04:00
m_Fractorium - > ShowCritical ( " Save Failed " , " Could not save file, try saving to a different folder. " , true ) ;
2014-07-08 03:11:14 -04:00
}
}
/// <summary>
/// Add a process action to the list of actions to take.
/// Called in response to the user changing something on the GUI.
/// </summary>
/// <param name="action">The action for the renderer to take</param>
void FractoriumEmberControllerBase : : AddProcessAction ( eProcessAction action )
{
2016-02-12 00:38:21 -05:00
rlg l ( m_Cs ) ;
2014-07-08 03:11:14 -04:00
m_ProcessActions . push_back ( action ) ;
if ( m_Renderer . get ( ) )
m_Renderer - > Abort ( ) ;
}
/// <summary>
/// Condense and clear the process actions into a single action and return.
/// Many actions may be specified, but only the one requiring the greatest amount
/// of processing matters. Extract and return the greatest and clear the vector.
/// </summary>
/// <returns>The most significant processing action desired</returns>
eProcessAction FractoriumEmberControllerBase : : CondenseAndClearProcessActions ( )
{
2016-02-12 00:38:21 -05:00
rlg l ( m_Cs ) ;
2015-12-31 19:00:36 -05:00
auto action = eProcessAction : : NOTHING ;
2014-07-08 03:11:14 -04:00
2015-05-03 20:13:14 -04:00
for ( auto a : m_ProcessActions )
if ( a > action )
action = a ;
2015-12-31 16:41:59 -05:00
2014-07-08 03:11:14 -04:00
m_ProcessActions . clear ( ) ;
return action ;
}
/// <summary>
/// Render progress callback function to update progress bar.
/// </summary>
/// <param name="ember">The ember currently being rendered</param>
/// <param name="foo">An extra dummy parameter</param>
/// <param name="fraction">The progress fraction from 0-100</param>
/// <param name="stage">The stage of iteration. 1 is iterating, 2 is density filtering, 2 is final accumulation.</param>
/// <param name="etaMs">The estimated milliseconds to completion of the current stage</param>
/// <returns>0 if the user has changed anything on the GUI, else 1 to continue rendering.</returns>
template < typename T >
int FractoriumEmberController < T > : : ProgressFunc ( Ember < T > & ember , void * foo , double fraction , int stage , double etaMs )
{
QString status ;
2014-12-11 00:50:15 -05:00
m_Fractorium - > m_ProgressBar - > setValue ( int ( fraction ) ) ; //Only really applies to iter and filter, because final accum only gives progress 0 and 100.
2014-07-08 03:11:14 -04:00
if ( stage = = 0 )
status = " Iterating " ;
else if ( stage = = 1 )
status = " Density Filtering " ;
else if ( stage = = 2 )
status = " Spatial Filtering + Final Accumulation " ;
m_Fractorium - > m_RenderStatusLabel - > setText ( status ) ;
return m_ProcessActions . empty ( ) ? 1 : 0 ; //If they've done anything, abort.
}
/// <summary>
/// Clear the undo list as well as the undo/redo index and state.
/// </summary>
template < typename T >
void FractoriumEmberController < T > : : ClearUndo ( )
{
m_UndoIndex = 0 ;
m_UndoList . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_EditState = eEditUndoState : : REGULAR_EDIT ;
2014-07-08 03:11:14 -04:00
m_LastEditWasUndoRedo = false ;
m_Fractorium - > ui . ActionUndo - > setEnabled ( false ) ;
m_Fractorium - > ui . ActionRedo - > setEnabled ( false ) ;
}
2014-10-14 11:53:15 -04:00
/// <summary>
/// The hierarchy/order of sizes is like so:
/// Ember
/// GL Widget
/// Texture (passed to RendererCL)
/// Viewport
/// Since this uses m_GL->SizesMatch(), which uses the renderer's dimensions, this
/// must be called after the renderer has set the current ember.
/// </summary>
/// <returns>True if dimensions had to be resized due to a mismatch, else false.</returns>
template < typename T >
bool FractoriumEmberController < T > : : SyncSizes ( )
{
bool changed = false ;
2016-02-12 00:38:21 -05:00
auto gl = m_Fractorium - > ui . GLDisplay ;
2015-08-10 23:10:23 -04:00
RendererCL < T , float > * rendererCL = nullptr ;
2014-10-14 11:53:15 -04:00
if ( ! m_GLController - > SizesMatch ( ) )
{
m_GLController - > ClearWindow ( ) ;
2016-02-13 20:24:51 -05:00
gl - > SetDimensions ( int ( m_Ember . m_FinalRasW ) , int ( m_Ember . m_FinalRasH ) ) ;
2014-10-14 11:53:15 -04:00
gl - > Allocate ( ) ;
gl - > SetViewport ( ) ;
2016-01-04 19:50:15 -05:00
if ( m_Renderer - > RendererType ( ) = = eRendererType : : OPENCL_RENDERER & & ( rendererCL = dynamic_cast < RendererCL < T , float > * > ( m_Renderer . get ( ) ) ) )
2014-10-14 11:53:15 -04:00
rendererCL - > SetOutputTexture ( gl - > OutputTexID ( ) ) ;
2015-01-02 18:11:36 -05:00
m_Fractorium - > CenterScrollbars ( ) ;
2014-10-14 11:53:15 -04:00
changed = true ;
}
return changed ;
}
2014-07-08 03:11:14 -04:00
/// <summary>
/// The main rendering function.
/// Called whenever the event loop is idle.
/// </summary>
2014-10-14 11:53:15 -04:00
/// <returns>True if nothing went wrong, else false.</returns>
2014-07-08 03:11:14 -04:00
template < typename T >
bool FractoriumEmberController < T > : : Render ( )
{
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
if ( ! m_Renderer . get ( ) )
return false ;
2014-07-08 03:11:14 -04:00
m_Rendering = true ;
2014-10-14 11:53:15 -04:00
bool success = true ;
2016-02-12 00:38:21 -05:00
auto gl = m_Fractorium - > ui . GLDisplay ;
2015-08-10 23:10:23 -04:00
RendererCL < T , float > * rendererCL = nullptr ;
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
eProcessAction qualityAction , action ;
//Quality is the only parameter we update inside the timer.
//This is to allow the user to rapidly increase the quality spinner
//without fully resetting the render. Instead, it will just keep iterating
//where it last left off in response to an increase.
T d = T ( m_Fractorium - > m_QualitySpin - > value ( ) ) ;
if ( d < m_Ember . m_Quality ) //Full restart if quality decreased.
{
m_Ember . m_Quality = d ;
qualityAction = eProcessAction : : FULL_RENDER ;
}
2015-12-31 19:00:36 -05:00
else if ( d > m_Ember . m_Quality & & ProcessState ( ) = = eProcessState : : ACCUM_DONE ) //If quality increased, keep iterating after current render finishes.
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
{
m_Ember . m_Quality = d ;
qualityAction = eProcessAction : : KEEP_ITERATING ;
}
else if ( IsClose ( d , m_Ember . m_Quality ) )
qualityAction = eProcessAction : : NOTHING ;
if ( qualityAction = = eProcessAction : : FULL_RENDER )
Update ( [ & ] { } ) ; //Stop the current render, a full restart is needed.
else if ( qualityAction = = eProcessAction : : KEEP_ITERATING )
m_ProcessActions . push_back ( qualityAction ) ; //Special, direct call to avoid resetting the render inside Update() because only KEEP_ITERATING is needed.
action = CondenseAndClearProcessActions ( ) ; //Combine with all other previously requested actions.
2014-07-08 03:11:14 -04:00
2016-01-04 19:50:15 -05:00
if ( m_Renderer - > RendererType ( ) = = eRendererType : : OPENCL_RENDERER )
2015-08-10 23:10:23 -04:00
rendererCL = dynamic_cast < RendererCL < T , float > * > ( m_Renderer . get ( ) ) ;
2014-07-08 03:11:14 -04:00
//Force temporal samples to always be 1. Perhaps change later when animation is implemented.
m_Ember . m_TemporalSamples = 1 ;
//Take care of solo xforms and set the current ember and action.
2015-12-31 19:00:36 -05:00
if ( action ! = eProcessAction : : NOTHING )
2014-07-08 03:11:14 -04:00
{
2017-05-31 22:50:05 -04:00
size_t i = 0 ;
2018-07-31 00:39:41 -04:00
int solo = m_Ember . m_Solo ;
2017-07-27 00:25:44 -04:00
bool forceFinal = m_Fractorium - > HaveFinal ( ) ;
2014-07-08 03:11:14 -04:00
if ( solo ! = - 1 )
{
2017-07-27 00:25:44 -04:00
m_TempOpacities . resize ( m_Ember . TotalXformCount ( forceFinal ) ) ;
2014-07-08 03:11:14 -04:00
2017-05-31 22:50:05 -04:00
while ( auto xform = m_Ember . GetTotalXform ( i ) )
2014-07-08 03:11:14 -04:00
{
2017-05-31 22:50:05 -04:00
m_TempOpacities [ i ] = xform - > m_Opacity ;
xform - > m_Opacity = i + + = = solo ? 1 : 0 ;
2014-07-08 03:11:14 -04:00
}
}
2017-05-31 22:50:05 -04:00
i = 0 ;
2014-07-08 03:11:14 -04:00
m_Renderer - > SetEmber ( m_Ember , action ) ;
if ( solo ! = - 1 )
2017-07-27 00:25:44 -04:00
while ( auto xform = m_Ember . GetTotalXform ( i , forceFinal ) )
2017-05-31 22:50:05 -04:00
xform - > m_Opacity = m_TempOpacities [ i + + ] ;
2014-07-08 03:11:14 -04:00
}
2014-10-14 11:53:15 -04:00
//Ensure sizes are equal and if not, update dimensions.
if ( SyncSizes ( ) )
{
2015-12-31 19:00:36 -05:00
action = eProcessAction : : FULL_RENDER ;
2014-10-14 11:53:15 -04:00
return true ;
}
2014-07-08 03:11:14 -04:00
//Determining if a completely new rendering process is being started.
2015-12-31 19:00:36 -05:00
bool iterBegin = ProcessState ( ) = = eProcessState : : NONE ;
2014-07-08 03:11:14 -04:00
if ( iterBegin )
{
2016-01-04 19:50:15 -05:00
if ( m_Renderer - > RendererType ( ) = = eRendererType : : CPU_RENDERER )
2014-07-08 03:11:14 -04:00
m_SubBatchCount = m_Fractorium - > m_Settings - > CpuSubBatch ( ) ;
2016-01-04 19:50:15 -05:00
else if ( m_Renderer - > RendererType ( ) = = eRendererType : : OPENCL_RENDERER )
2014-07-08 03:11:14 -04:00
m_SubBatchCount = m_Fractorium - > m_Settings - > OpenCLSubBatch ( ) ;
m_Fractorium - > m_ProgressBar - > setValue ( 0 ) ;
m_Fractorium - > m_RenderStatusLabel - > setText ( " Starting " ) ;
}
//If the rendering process hasn't finished, render with the current specified action.
2015-12-31 19:00:36 -05:00
if ( ProcessState ( ) ! = eProcessState : : ACCUM_DONE )
2014-07-08 03:11:14 -04:00
{
//if (m_Renderer->Run(m_FinalImage, 0) == RENDER_OK)//Full, non-incremental render for debugging.
2016-04-11 21:15:14 -04:00
bool update = iterBegin | | m_Fractorium - > m_Settings - > ContinuousUpdate ( ) ;
2018-10-05 22:50:38 -04:00
eRenderStatus result ;
2016-04-11 21:15:14 -04:00
2018-10-05 22:50:38 -04:00
if ( ( result = m_Renderer - > Run ( m_FinalImage , 0 , m_SubBatchCount , update ) ) = = eRenderStatus : : RENDER_OK ) //Force output on iterBegin or if the settings specify to always do it.
2014-07-08 03:11:14 -04:00
{
//The amount to increment sub batch while rendering proceeds is purely empirical.
//Change later if better values can be derived/observed.
2016-01-04 19:50:15 -05:00
if ( m_Renderer - > RendererType ( ) = = eRendererType : : OPENCL_RENDERER )
2014-07-08 03:11:14 -04:00
{
2016-03-28 21:49:10 -04:00
if ( m_SubBatchCount < ( 4 * m_Devices . size ( ) ) ) //More than 4 with OpenCL gives a sluggish UI.
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
m_SubBatchCount + = m_Devices . size ( ) ;
2014-07-08 03:11:14 -04:00
}
else
{
if ( m_SubBatchCount < 5 )
m_SubBatchCount + + ;
else if ( m_SubBatchCount < 105 ) //More than 105 with CPU gives a sluggish UI.
m_SubBatchCount + = 25 ;
}
//Rendering has finished, update final stats.
2015-12-31 19:00:36 -05:00
if ( ProcessState ( ) = = eProcessState : : ACCUM_DONE )
2014-07-08 03:11:14 -04:00
{
2016-02-12 00:38:21 -05:00
auto stats = m_Renderer - > Stats ( ) ;
auto iters = ToString < qulonglong > ( stats . m_Iters ) ;
auto scaledQuality = ToString ( uint ( m_Renderer - > ScaledQuality ( ) ) ) ;
auto renderTime = m_RenderElapsedTimer . Format ( m_RenderElapsedTimer . Toc ( ) ) ;
2014-07-08 03:11:14 -04:00
m_Fractorium - > m_ProgressBar - > setValue ( 100 ) ;
2015-07-29 20:25:02 -04:00
//Only certain stats can be reported with OpenCL.
2016-01-04 19:50:15 -05:00
if ( m_Renderer - > RendererType ( ) = = eRendererType : : OPENCL_RENDERER )
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
m_Fractorium - > m_RenderStatusLabel - > setText ( " Iters: " + iters + " . Scaled quality: " + scaledQuality + " . Total time: " + QString : : fromStdString ( renderTime ) + " . " ) ;
2014-07-08 03:11:14 -04:00
}
else
{
2014-12-11 00:50:15 -05:00
double percent = double ( stats . m_Badvals ) / double ( stats . m_Iters ) ;
2016-02-12 00:38:21 -05:00
auto badVals = ToString < qulonglong > ( stats . m_Badvals ) ;
auto badPercent = QLocale : : system ( ) . toString ( percent * 100 , ' f ' , 2 ) ;
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
m_Fractorium - > m_RenderStatusLabel - > setText ( " Iters: " + iters + " . Scaled quality: " + scaledQuality + " . Bad values: " + badVals + " ( " + badPercent + " %). Total time: " + QString : : fromStdString ( renderTime ) + " . " ) ;
2014-07-08 03:11:14 -04:00
}
2015-12-31 16:41:59 -05:00
2014-07-08 03:11:14 -04:00
if ( m_LastEditWasUndoRedo & & ( m_UndoIndex = = m_UndoList . size ( ) - 1 ) ) //Traversing through undo list, reached the end, so put back in regular edit mode.
{
2016-01-04 19:50:15 -05:00
m_EditState = eEditUndoState : : REGULAR_EDIT ;
2014-07-08 03:11:14 -04:00
}
2016-01-04 19:50:15 -05:00
else if ( m_EditState = = eEditUndoState : : REGULAR_EDIT ) //Regular edit, just add to the end of the undo list.
2014-07-08 03:11:14 -04:00
{
2016-02-12 00:38:21 -05:00
auto btn = QApplication : : mouseButtons ( ) ;
2019-05-30 22:16:23 -04:00
if ( ( action = = eProcessAction : : ACCUM_ONLY | | action = = eProcessAction : : FILTER_AND_ACCUM ) | |
( ! btn . testFlag ( Qt : : LeftButton ) & & ! btn . testFlag ( Qt : : RightButton ) & & ! btn . testFlag ( Qt : : MiddleButton ) ) )
2016-02-12 00:38:21 -05:00
{
m_UndoList . push_back ( m_Ember ) ;
m_UndoIndex = m_UndoList . size ( ) - 1 ;
m_Fractorium - > ui . ActionUndo - > setEnabled ( m_UndoList . size ( ) > 1 ) ;
m_Fractorium - > ui . ActionRedo - > setEnabled ( false ) ;
if ( m_UndoList . size ( ) > = UNDO_SIZE )
m_UndoList . pop_front ( ) ;
}
2016-05-15 02:33:08 -04:00
//else
// qDebug() << "Mouse was down, not adding to undo list.";
2014-07-08 03:11:14 -04:00
}
2019-06-02 12:35:56 -04:00
else if ( ! m_LastEditWasUndoRedo & &
m_UndoList . size ( ) & &
m_UndoIndex < m_UndoList . size ( ) - 1 ) //They were anywhere but the end of the undo list, then did a manual edit, so clear the undo list.
2014-07-08 03:11:14 -04:00
{
2014-11-28 04:37:51 -05:00
Ember < T > ember ( m_UndoList [ m_UndoIndex ] ) ;
2014-07-08 03:11:14 -04:00
ClearUndo ( ) ;
2014-11-28 04:37:51 -05:00
m_UndoList . push_back ( ember ) ;
2014-07-08 03:11:14 -04:00
m_UndoList . push_back ( m_Ember ) ;
2014-11-28 04:37:51 -05:00
m_UndoIndex = m_UndoList . size ( ) - 1 ;
m_Fractorium - > ui . ActionUndo - > setEnabled ( true ) ;
m_Fractorium - > ui . ActionRedo - > setEnabled ( false ) ;
2014-07-08 03:11:14 -04:00
}
m_LastEditWasUndoRedo = false ;
m_Fractorium - > UpdateHistogramBounds ( ) ; //Mostly of engineering interest.
2015-07-29 20:25:02 -04:00
FillSummary ( ) ; //Only update summary on render completion since it's not the type of thing the user needs real-time updates on.
2014-07-08 03:11:14 -04:00
}
2015-12-31 16:41:59 -05:00
2016-04-11 21:15:14 -04:00
//Update the GL window on start or continuous rendering because the output will be forced.
2014-07-08 03:11:14 -04:00
//Update it on finish because the rendering process is completely done.
2016-04-11 21:15:14 -04:00
if ( update | | ProcessState ( ) = = eProcessState : : ACCUM_DONE )
2014-07-08 03:11:14 -04:00
{
2018-04-29 01:28:05 -04:00
gl - > update ( ) ; //Queue update.
2015-12-31 16:41:59 -05:00
2016-04-11 21:15:14 -04:00
if ( ProcessState ( ) = = eProcessState : : ACCUM_DONE )
2016-04-13 23:59:57 -04:00
SaveCurrentToOpenedFile ( ) ; //Will not save if the previews are still rendering.
2016-04-11 21:15:14 -04:00
2014-07-08 03:11:14 -04:00
//Uncomment for debugging kernel build and execution errors.
//m_Fractorium->ui.InfoRenderingTextEdit->setText(QString::fromStdString(m_Fractorium->m_Wrapper.DumpInfo()));
2014-10-14 11:53:15 -04:00
//if (rendererCL)
2015-03-21 18:27:37 -04:00
//{
// string s = "OpenCL Kernels: \r\n" + rendererCL->IterKernel() + "\r\n" + rendererCL->DEKernel() + "\r\n" + rendererCL->FinalAccumKernel();
//
// QMetaObject::invokeMethod(m_Fractorium->ui.InfoRenderingTextEdit, "setText", Qt::QueuedConnection, Q_ARG(const QString&, QString::fromStdString(s)));
//}
2014-07-08 03:11:14 -04:00
}
}
2018-10-05 22:50:38 -04:00
else if ( result ! = eRenderStatus : : RENDER_ABORT ) //If error was returned, something went very wrong, show error report.
2014-07-08 03:11:14 -04:00
{
2016-02-12 00:38:21 -05:00
auto errors = m_Renderer - > ErrorReport ( ) ;
2014-07-08 03:11:14 -04:00
success = false ;
m_FailedRenders + + ;
m_Fractorium - > m_RenderStatusLabel - > setText ( " Rendering failed, see info tab. Try changing parameters. " ) ;
m_Fractorium - > ErrorReportToQTextEdit ( errors , m_Fractorium - > ui . InfoRenderingTextEdit ) ;
m_Renderer - > ClearErrorReport ( ) ;
2015-12-31 16:41:59 -05:00
2014-07-08 03:11:14 -04:00
if ( m_FailedRenders > = 3 )
{
m_Rendering = false ;
StopRenderTimer ( true ) ;
m_Fractorium - > m_RenderStatusLabel - > setText ( " Rendering failed 3 or more times, stopping all rendering, see info tab. Try changing renderer types. " ) ;
2015-03-21 18:27:37 -04:00
ClearFinalImages ( ) ;
m_GLController - > ClearWindow ( ) ;
2014-10-14 11:53:15 -04:00
if ( rendererCL )
2015-03-21 18:27:37 -04:00
{
//string s = "OpenCL Kernels: \r\n" + rendererCL->IterKernel() + "\r\n" + rendererCL->DEKernel() + "\r\n" + rendererCL->FinalAccumKernel();
rendererCL - > ClearFinal ( ) ;
//QMetaObject::invokeMethod(m_Fractorium->ui.InfoRenderingTextEdit, "setText", Qt::QueuedConnection, Q_ARG(const QString&, QString::fromStdString(s)));
}
2014-07-08 03:11:14 -04:00
}
}
}
2015-12-31 16:41:59 -05:00
2014-07-08 03:11:14 -04:00
//Upon finishing, or having nothing to do, rest.
2015-12-31 19:00:36 -05:00
if ( ProcessState ( ) = = eProcessState : : ACCUM_DONE )
2014-07-08 03:11:14 -04:00
QThread : : msleep ( 1 ) ;
m_Rendering = false ;
return success ;
}
/// <summary>
/// Stop rendering and initialize a new renderer, using the specified type.
/// Rendering will be left in a stopped state. The caller is responsible for restarting the render loop again.
/// </summary>
/// <param name="renderType">The type of render to create</param>
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
/// <param name="devices">The platform,device index pairs of the devices to use</param>
2017-07-22 16:43:35 -04:00
/// <param name="updatePreviews">True to re-render the library previews, else false.</param>
2014-07-08 03:11:14 -04:00
/// <param name="shared">True if shared with OpenGL, else false. Default: true.</param>
/// <returns>True if nothing went wrong, else false.</returns>
template < typename T >
2017-07-22 16:43:35 -04:00
bool FractoriumEmberController < T > : : CreateRenderer ( eRendererType renderType , const vector < pair < size_t , size_t > > & devices , bool updatePreviews , bool shared )
2014-07-08 03:11:14 -04:00
{
bool ok = true ;
2016-02-12 00:38:21 -05:00
auto s = m_Fractorium - > m_Settings ;
auto gl = m_Fractorium - > ui . GLDisplay ;
2014-07-08 03:11:14 -04:00
2018-04-29 01:28:05 -04:00
if ( ! m_Renderer . get ( ) | | ( m_Renderer - > RendererType ( ) ! = renderType ) | | ! Equal ( m_Devices , devices ) | | m_Renderer - > Shared ( ) ! = shared )
2014-07-08 03:11:14 -04:00
{
EmberReport emberReport ;
vector < string > errorReport ;
DeleteRenderer ( ) ; //Delete the renderer and refresh the textures.
2018-04-29 01:28:05 -04:00
//Before starting, must take care of allocations.
if ( gl - > Allocate ( true ) ) //Forcing a realloc of the texture is necessary on AMD, but not on nVidia.
2014-07-08 03:11:14 -04:00
{
2018-04-29 01:28:05 -04:00
m_Renderer = unique_ptr < EmberNs : : RendererBase > ( : : CreateRenderer < T > ( renderType , devices , shared , gl - > OutputTexID ( ) , emberReport ) ) ; //Always make bucket type float.
errorReport = emberReport . ErrorReport ( ) ;
if ( errorReport . empty ( ) )
{
m_Devices = devices ;
m_OutputTexID = gl - > OutputTexID ( ) ;
}
else
{
ok = false ;
m_Fractorium - > ShowCritical ( " Renderer Creation Error " , " Could not create requested renderer, fallback CPU renderer created. See info tab for details. " ) ;
m_Fractorium - > ErrorReportToQTextEdit ( errorReport , m_Fractorium - > ui . InfoRenderingTextEdit ) ;
}
2014-07-08 03:11:14 -04:00
}
else
{
ok = false ;
2018-04-29 01:28:05 -04:00
m_Fractorium - > ShowCritical ( " Renderer Creation Error " , " Could not create OpenGL texture, interactive rendering will be disabled. " ) ;
2014-07-08 03:11:14 -04:00
m_Fractorium - > ErrorReportToQTextEdit ( errorReport , m_Fractorium - > ui . InfoRenderingTextEdit ) ;
}
}
if ( m_Renderer . get ( ) )
{
m_RenderType = m_Renderer - > RendererType ( ) ;
2016-01-04 19:50:15 -05:00
if ( m_RenderType = = eRendererType : : OPENCL_RENDERER )
2014-11-28 04:37:51 -05:00
{
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
auto val = m_Fractorium - > m_Settings - > OpenClQuality ( ) * m_Fractorium - > m_Settings - > Devices ( ) . size ( ) ;
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
m_Fractorium - > m_QualitySpin - > DoubleClickZero ( val ) ;
m_Fractorium - > m_QualitySpin - > DoubleClickNonZero ( val ) ;
2014-11-28 04:37:51 -05:00
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
if ( m_Fractorium - > m_QualitySpin - > value ( ) < val )
m_Fractorium - > m_QualitySpin - > setValue ( val ) ;
--User changes:
-Show common folder locations such as documents, downloads, pictures in the sidebar in all file dialogs.
-Warning message about exceeding memory in final render dialog now suggests strips as the solution to the problem.
-Strips now has a tooltip explaining what it does.
-Allow more digits in the spinners on the color section the flame tab.
-Add manually adjustable size spinners in the final render dialog. Percentage scale and absolute size are fully synced.
-Default prefix in final render is now the filename when doing animations (coming from sequence section of the library tab).
-Changed the elliptic variation back to using a less precise version for float, and a more precise version for double. The last release had it always using double.
-New applied xaos table that shows a read-only view of actual weights by taking the base xform weights and multiplying them by the xaos values.
-New table in the xaos tab that gives a graphical representation of the probability that each xform is chosen, with and without xaos.
-Add button to transpose the xaos rows and columns.
-Add support for importing .chaos files from Chaotica.
--Pasting back to Chaotica will work for most, but not all, variations due to incompatible parameter names in some.
-Curves are now splines instead of Bezier. This adds compatibility with Chaotica, but breaks it for Apophysis. Xmls are still pastable, but the color curves will look different.
--The curve editor on the palette tab can now add points by clicking on the lines and remove points by clicking on the points themselves, just like Chaotica.
--Splines are saved in four new xml fields: overall_curve, red_curve, green_curve and blue_curve.
-Allow for specifying the percentage of a sub batch each thread should iterate through per kernel call when running with OpenCL. This gives a roughly 1% performance increase due to having to make less kernel calls while iterating.
--This field is present for interactive editing (where it's not very useful) and in the final render dialog.
--On the command line, this is specified as --sbpctth for EmberRender and EmberAnimate.
-Allow double clicking to toggle the supersample field in the flame tab between 1 and 2 for easily checking the effect of the field.
-When showing affine values as polar coordinates, show angles normalized to 360 to match Chaotica.
-Fuse Count spinner now toggles between 15 and 100 when double clicking for easily checking the effect of the field.
-Added field for limiting the range in the x and y direction that the initial points are chosen from.
-Added a field called K2 which is an alternative way to set brightness, ignored when zero.
--This has no effect for many variations, but hs a noticeable effect for some.
-Added new variations:
arcsech
arcsech2
arcsinh
arctanh
asteria
block
bwraps_rand
circlecrop2
coth_spiral
crackle2
depth_blur
depth_blur2
depth_gaussian
depth_gaussian2
depth_ngon
depth_ngon2
depth_sine
depth_sine2
dragonfire
dspherical
dust
excinis
exp2
flipx
flowerdb
foci_p
gaussian
glynnia2
glynnsim4
glynnsim5
henon
henon
hex_rand
hex_truchet
hypershift
lazyjess
lens
lozi
lozi
modulusx
modulusy
oscilloscope2
point_symmetry
pointsymmetry
projective
pulse
rotate
scry2
shift
smartshape
spher
squares
starblur2
swirl3
swirl3r
tanh_spiral
target0
target2
tile_hlp
truchet_glyph
truchet_inv
truchet_knot
unicorngaloshen
vibration
vibration2
--hex_truchet, hex_rand should always use double. They are extremely sensitive.
--Bug fixes:
-Bounds sign was flipped for x coordinate of world space when center was not zero.
-Right clicking and dragging spinner showed menu on mouse up, even if it was very far away.
-Text boxes for size in final render dialog were hard to type in. Same bug as xform weight used to be so fix the same way.
-Fix spelling to be plural in toggle color speed box.
-Stop using the blank user palette to generate flames. Either put colored palettes in it, or exclude it from randoms.
-Clicking the random palette button for a palette file with only one palette in it would freeze the program.
-Clicking none scale in final render did not re-render the preview.
-Use less precision on random xaos. No need for 12 decimal places.
-The term sub batch is overloaded in the options dialog. Change the naming and tooltip of those settings for cpu and opencl.
--Also made clear in the tooltip for the default opencl quality setting that the value is per device.
-The arrows spinner in palette editor appears like a read-only label. Made it look like a spinner.
-Fix border colors for various spin boxes and table headers in the style sheet. Requires reload.
-Fix a bug in the bwraps variation which would produce different results than Chaotica and Apophysis.
-Synth was allowed to be selected for random flame generation when using an Nvidia card but it shouldn't have been because Nvidia has a hard time compiling synth.
-A casting bug in the OpenCL kernels for log scaling and density filtering was preventing successful compilations on Intel iGPUs. Fixed even though we don't support anything other than AMD and Nvidia.
-Palette rotation (click and drag) position was not being reset when loading a new flame.
-When the xform circles were hidden, opening and closing the options dialog would improperly reshow them.
-Double click toggle was broken on integer spin boxes.
-Fixed tab order of some controls.
-Creating a palette from a jpg in the palette editor only produced a single color.
--Needed to package imageformats/qjpeg.dll with the Windows installer.
-The basic memory benchmark test flame was not really testing memory. Make it more spread out.
-Remove the temporal samples field from the flame tab, it was never used because it's only an animation parameter which is specified in the final render dialog or on the command line with EmberAnimate.
--Code changes:
-Add IsEmpty() to Palette to determine if a palette is all black.
-Attempt to avoid selecting a blank palette in PaletteList::GetRandomPalette().
-Add function ScanForChaosNodes() and some associated helper functions in XmlToEmber.
-Make variation param name correction be case insensitive in XmlToEmber.
-Report error when assigning a variation param value in XmlToEmber.
-Add SubBatchPercentPerThread() method to RendererCL.
-Override enterEvent() and leaveEvent() in DoubleSpinBox and SpinBox to prevent the context menu from showing up on right mouse up after already leaving the spinner.
-Filtering the mouse wheel event in TableWidget no longer appears to be needed. It was probably an old Qt bug that has been fixed.
-Gui/ember syncing code in the final render dialog needed to be reworked to accommodate absolute sizes.
2019-04-13 22:00:46 -04:00
if ( auto rendererCL = dynamic_cast < RendererCL < T , float > * > ( m_Renderer . get ( ) ) )
rendererCL - > SubBatchPercentPerThread ( float ( s - > OpenCLSubBatchPct ( ) ) ) ;
2014-11-28 04:37:51 -05:00
}
else
{
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
auto quality = m_Fractorium - > m_Settings - > CpuQuality ( ) ;
m_Fractorium - > m_QualitySpin - > DoubleClickZero ( quality ) ;
m_Fractorium - > m_QualitySpin - > DoubleClickNonZero ( quality ) ;
2014-11-28 04:37:51 -05:00
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
if ( m_Fractorium - > m_QualitySpin - > value ( ) > quality )
m_Fractorium - > m_QualitySpin - > setValue ( quality ) ;
2014-11-28 04:37:51 -05:00
}
2014-07-08 03:11:14 -04:00
m_Renderer - > Callback ( this ) ;
m_Renderer - > ReclaimOnResize ( true ) ;
2017-05-12 18:31:48 -04:00
//Give it an initial ember, will be updated many times later.
//Even though the bounds are computed when starting the next render. The OpenGL draw calls use these values, which might get called before the render starts.
m_Renderer - > SetEmber ( m_Ember , eProcessAction : : FULL_RENDER , true ) ;
2014-07-08 03:11:14 -04:00
m_Renderer - > EarlyClip ( s - > EarlyClip ( ) ) ;
2014-07-26 15:03:51 -04:00
m_Renderer - > YAxisUp ( s - > YAxisUp ( ) ) ;
2014-07-08 03:11:14 -04:00
m_Renderer - > ThreadCount ( s - > ThreadCount ( ) ) ;
2015-12-31 16:41:59 -05:00
2015-12-31 19:00:36 -05:00
if ( m_Renderer - > RendererType ( ) = = eRendererType : : CPU_RENDERER )
m_Renderer - > InteractiveFilter ( s - > CpuDEFilter ( ) ? eInteractiveFilter : : FILTER_DE : eInteractiveFilter : : FILTER_LOG ) ;
2014-07-08 03:11:14 -04:00
else
2015-12-31 19:00:36 -05:00
m_Renderer - > InteractiveFilter ( s - > OpenCLDEFilter ( ) ? eInteractiveFilter : : FILTER_DE : eInteractiveFilter : : FILTER_LOG ) ;
2014-07-08 03:11:14 -04:00
2017-07-22 16:43:35 -04:00
if ( updatePreviews )
2014-07-26 15:03:51 -04:00
{
2017-07-22 16:43:35 -04:00
m_LibraryPreviewRenderer = make_unique < TreePreviewRenderer < T > > ( this , m_Fractorium - > ui . LibraryTree , m_EmberFile ) ; //Will take the same settings as the main renderer.
2016-06-11 20:47:03 -04:00
RenderLibraryPreviews ( ) ;
2014-07-26 15:03:51 -04:00
}
2014-07-08 03:11:14 -04:00
m_FailedRenders = 0 ;
m_RenderElapsedTimer . Tic ( ) ;
//Leave rendering in a stopped state. The caller is responsible for restarting the render loop again.
}
else
{
ok = false ;
2014-10-14 11:53:15 -04:00
m_Fractorium - > ShowCritical ( " Renderer Creation Error " , " Creating a basic CPU renderer failed, something is catastrophically wrong. Exiting program. " ) ;
2014-07-08 03:11:14 -04:00
QApplication : : quit ( ) ;
}
return ok ;
}
--User changes
-Allow for pausing the renderer in the main window. This makes is more efficient when entering many parameters, such as when following a tutorial.
-Add support for new variations: erf, gamma, jac_cn, jac_dn, jac_sn, logDB, pressure_wave, pRose3D, splits3D, w, waves2b, x, xerf, y, z.
-Inform user of the start and stop of file parsing in EmberAnimate because the files could potentially be very large.
-Move the follwing fields to a new table called Animation: Interpolation, Affine Interpolation, Temporal Samples, Temporal Filter Width, Temporal Filter Type.
-These currently have no effect on the interactive renderer and instead are used when running flames through EmberGenome to generate sequences, and then animating them in Fractorium or EmberAnimate.
-Add new parameter overrides for EmberRender and EmberAnimate which directly assign values to all flames being rendered, rather than scale:
--quality
--demin
--demax
--Bug fixes
-Left pad instead of right pad names of sequence outputs from EmberGenome.
-Unique file naming was broken for files which already had an underscore in them.
-Properly report that png is the default format of EmberRender and EmberAnimate output instead of erroneously claiming it was jpg.
-Make command line programs search these folders in this order for the palette file:
./
~/.fractorium
~/.config/fractorium
/usr/share/fractorium
/usr/local/share/fractorium
-Fix possible bad values in hexes.
-Better assignment of Z variables.
-Fix boarders due to use of poorly implemented rint() function from flam3. Use std::rint() now.
-wedge_sph was completely wrong due to having accidentally swapped the mapping of two parameters.
-Make juliascope juliascope_power parameter be of type REAL_NONZERO since it's used as a denominator.
-Make Z assignment compatible with the originals in:
-arch, bcircle, bCollide, bent, bent2, bisplit, blob, blur_linear, blur_square, bMod, boarders, boarders2, bSwirl, bTransform, butterfly, cardioid, cell, circleblur, circlize, circlize2, circus, collideoscope, cos, cosine, cosh, coth, cpow, cpow2, crescents, cropn, csc, csch, curl, curve, dc_gridout, deltaa, diamond, disc2, eclipse, eCollide, edisc, eJulia, elliptic, eMod, eMotion, ennepers, epispiral, ePush, eRotate, eScale, eSwirl, ex, exp, expo, exponential, fan, fdisc, fibonacci, fibonacci2, fisheye, flipcircle, flipy, flower, flux, funnel, glynnia, GlynnSim1, GlynnSim2, GlynnSim3, gridout, handkerchief, heart, hole, idisc, julia, julian2, juliaNab, kaleidoscope, lazyTravis, Lissajous, mask, MobiusN, mobius_strip, modulus, murl, murl2, npolar, ortho, oscilloscope, parabola, perspective, petal, phoenix_julia, pie (was also inconsistent between cpu and gpu), poincare, popcorn, popcorn2, power, pow_block, rational3, rays, rblur, rings, rippled, roundspher, sec, secant2, sigmoid, sin, sineblur, sinh, sinusgrid, sphericaln, spiralwing, spirograph, split, squarize, squirrel, squish, sschecks, starblur, stripes, stwin, super_shape, tan, tancos, tangent, tanh, TwinTrian, twoface, unpolar, waves, wavesn, wedge_julia, whorl, xheart, zblur, zscale.
--Code changes
-Generalize Variation::PrecalcHelper() and rename to PrePostPrecalcHelper().
--Do the same for the OpenCL version and rename it PrePostPrecalcOpenCLString().
-Rename Variation::m_AssignType to m_PrePostAssignType since it's only relevant to pre/post variations.
2016-01-29 20:02:15 -05:00
/// <summary>
/// Enable or disable the controls related to changing the renderer.
/// Used when pausing and restarting the renderer.
/// </summary>
/// <param name="enable">True to enable, else false.</param>
void Fractorium : : EnableRenderControls ( bool enable )
{
ui . ActionCpu - > setEnabled ( enable ) ;
ui . ActionCL - > setEnabled ( enable ) ;
ui . ActionSP - > setEnabled ( enable ) ;
ui . ActionDP - > setEnabled ( enable ) ;
ui . ActionOptions - > setEnabled ( enable ) ;
}
2015-07-29 20:25:02 -04:00
/// <summary>
/// Wrapper to stop the timer, shutdown the controller and recreate, then restart the controller and renderer from the options.
/// </summary>
2017-07-22 16:43:35 -04:00
/// <param name="updatePreviews">True to re-render the library previews, else false.</param>
void Fractorium : : ShutdownAndRecreateFromOptions ( bool updatePreviews )
2015-07-29 20:25:02 -04:00
{
//First completely stop what the current rendering process is doing.
m_Controller - > Shutdown ( ) ;
2017-07-22 16:43:35 -04:00
StartRenderTimer ( updatePreviews ) ; //This will recreate the controller and/or the renderer from the options if necessary, then start the render timer.
2015-07-29 20:25:02 -04:00
m_Settings - > sync ( ) ;
}
2014-07-08 03:11:14 -04:00
/// <summary>
/// Create a new renderer from the options.
/// </summary>
2017-07-22 16:43:35 -04:00
/// <param name="updatePreviews">True to re-render the library previews, else false.</param>
2014-07-08 03:11:14 -04:00
/// <returns>True if nothing went wrong, else false.</returns>
2017-07-22 16:43:35 -04:00
bool Fractorium : : CreateRendererFromOptions ( bool updatePreviews )
2014-07-08 03:11:14 -04:00
{
bool ok = true ;
2015-12-31 16:41:59 -05:00
bool useOpenCL = m_Info - > Ok ( ) & & m_Settings - > OpenCL ( ) ;
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
auto v = Devices ( m_Settings - > Devices ( ) ) ;
2018-07-31 00:39:41 -04:00
bool doOpenCL = useOpenCL & & ! v . empty ( ) ;
ui . ActionCopyKernel - > setEnabled ( doOpenCL ) ;
2015-12-31 16:41:59 -05:00
2014-07-08 03:11:14 -04:00
//The most important option to process is what kind of renderer is desired, so do it first.
2018-07-31 00:39:41 -04:00
if ( ! m_Controller - > CreateRenderer ( doOpenCL ? eRendererType : : OPENCL_RENDERER : eRendererType : : CPU_RENDERER , v , updatePreviews , doOpenCL & & m_Settings - > SharedTexture ( ) ) )
2014-07-08 03:11:14 -04:00
{
//If using OpenCL, will only get here if creating RendererCL failed, but creating a backup CPU Renderer succeeded.
2014-10-14 11:53:15 -04:00
ShowCritical ( " Renderer Creation Error " , " Error creating renderer, most likely a GPU problem. Using CPU instead. " ) ;
2014-07-08 03:11:14 -04:00
m_Settings - > OpenCL ( false ) ;
2018-04-29 01:28:05 -04:00
m_Settings - > SharedTexture ( false ) ;
2016-12-05 22:04:33 -05:00
ui . ActionCpu - > setChecked ( true ) ;
ui . ActionCL - > setChecked ( false ) ;
2018-07-31 00:39:41 -04:00
ui . ActionCopyKernel - > setEnabled ( false ) ;
2014-07-08 03:11:14 -04:00
m_OptionsDialog - > ui . OpenCLCheckBox - > setChecked ( false ) ;
2018-04-29 01:28:05 -04:00
m_OptionsDialog - > ui . SharedTextureCheckBox - > setChecked ( false ) ;
2014-07-08 03:11:14 -04:00
m_FinalRenderDialog - > ui . FinalRenderOpenCLCheckBox - > setChecked ( false ) ;
ok = false ;
}
2018-07-31 00:39:41 -04:00
if ( auto rendererCL = dynamic_cast < RendererCLBase * > ( m_Controller - > Renderer ( ) ) )
{
2018-09-22 01:42:18 -04:00
rendererCL - > m_CompileBegun = [ & ] ( )
{
m_RenderStatusLabel - > setText ( " Compiling OpenCL kernel... " ) ;
m_RenderStatusLabel - > repaint ( ) ;
QApplication : : processEvents ( ) ;
} ;
}
2018-07-31 00:39:41 -04:00
2014-07-08 03:11:14 -04:00
return ok ;
}
/// <summary>
/// Create a new controller from the options.
/// This does not create the internal renderer or start the timers.
/// </summary>
/// <returns>True if successful, else false.</returns>
bool Fractorium : : CreateControllerFromOptions ( )
{
2014-12-11 00:50:15 -05:00
size_t elementSize =
2014-07-08 03:11:14 -04:00
# ifdef DO_DOUBLE
m_Settings - > Double ( ) ? sizeof ( double ) :
# endif
sizeof ( float ) ;
2015-12-31 16:41:59 -05:00
2014-12-11 00:50:15 -05:00
if ( ! m_Controller . get ( ) | | ( m_Controller - > SizeOfT ( ) ! = elementSize ) )
2014-07-08 03:11:14 -04:00
{
2016-02-13 20:24:51 -05:00
auto hue = m_PaletteHueSpin - > value ( ) ;
auto sat = m_PaletteSaturationSpin - > value ( ) ;
auto bright = m_PaletteBrightnessSpin - > value ( ) ;
auto con = m_PaletteContrastSpin - > value ( ) ;
auto blur = m_PaletteBlurSpin - > value ( ) ;
auto freq = m_PaletteFrequencySpin - > value ( ) ;
2019-05-20 18:44:46 -04:00
auto rot = m_PreviewPaletteRotation ;
2016-03-01 20:26:45 -05:00
double scale ;
2016-04-13 23:59:57 -04:00
uint current = 0 ;
2014-07-08 03:11:14 -04:00
# ifdef DO_DOUBLE
EmberFile < double > efd ;
Palette < double > tempPalette ;
# else
EmberFile < float > efd ;
Palette < float > tempPalette ;
# endif
QModelIndex index = ui . LibraryTree - > currentIndex ( ) ;
2017-03-02 23:04:47 -05:00
ui . LibraryTree - > clear ( ) ; //This must be here before FillLibraryTree() is called below, else a spurious EmberTreeItemChanged event will be called on a deleted object.
2014-07-08 03:11:14 -04:00
//First check if a controller has already been created, and if so, save its embers and gracefully shut it down.
if ( m_Controller . get ( ) )
{
2016-03-01 20:26:45 -05:00
scale = m_Controller - > LockedScale ( ) ;
2016-06-11 20:47:03 -04:00
m_Controller - > StopAllPreviewRenderers ( ) ; //Must stop any previews first, else changing controllers will crash the program and SaveCurrentToOpenedFile() will return 0.
2014-07-08 03:11:14 -04:00
m_Controller - > CopyTempPalette ( tempPalette ) ; //Convert float to double or save double verbatim;
2016-12-05 22:04:33 -05:00
current = m_Controller - > SaveCurrentToOpenedFile ( false ) ;
2015-01-19 11:39:50 -05:00
//Replace below with this once LLVM fixes a crash in their compiler with default lambda parameters.//TODO
//m_Controller->CopyEmberFile(efd);
2015-01-14 08:15:23 -05:00
# ifdef DO_DOUBLE
2016-06-11 20:47:03 -04:00
m_Controller - > CopyEmberFile ( efd , false , [ & ] ( Ember < double > & ember ) { } ) ;
2015-01-14 08:15:23 -05:00
# else
2016-06-11 20:47:03 -04:00
m_Controller - > CopyEmberFile ( efd , false , [ & ] ( Ember < float > & ember ) { } ) ;
2015-01-14 08:15:23 -05:00
# endif
2014-07-08 03:11:14 -04:00
m_Controller - > Shutdown ( ) ;
}
# ifdef DO_DOUBLE
2015-12-31 16:41:59 -05:00
2014-07-08 03:11:14 -04:00
if ( m_Settings - > Double ( ) )
2014-10-18 17:07:07 -04:00
m_Controller = unique_ptr < FractoriumEmberControllerBase > ( new FractoriumEmberController < double > ( this ) ) ;
2014-07-08 03:11:14 -04:00
else
# endif
2014-10-18 17:07:07 -04:00
m_Controller = unique_ptr < FractoriumEmberControllerBase > ( new FractoriumEmberController < float > ( this ) ) ;
2014-07-08 03:11:14 -04:00
//Restore the ember and ember file.
if ( m_Controller . get ( ) )
{
2016-12-05 22:04:33 -05:00
if ( auto prev = efd . Get ( current ) ) //Restore base temp palette. Adjustments will be then be applied and stored back in in m_Ember.m_Palette below.
prev - > m_Palette = tempPalette ;
2016-06-11 20:47:03 -04:00
m_Controller - > SetEmberFile ( efd , true ) ;
2017-03-02 23:04:47 -05:00
//Template specific palette table and variations tree setup in controller constructor, but
//must manually setup the library tree here because it's after the embers were assigned.
//Passing row re-selects the item that was previously selected.
//This will eventually call FillParamTablesAndPalette(), which in addition to filling in various fields,
//will apply the palette adjustments.
m_Controller - > FillLibraryTree ( index . row ( ) ) ;
2016-04-13 23:59:57 -04:00
m_Controller - > SetEmber ( current , true ) ;
2016-03-01 20:26:45 -05:00
m_Controller - > LockedScale ( scale ) ;
2015-08-10 23:10:23 -04:00
//Setting these and updating the GUI overwrites the work of clearing them done in SetEmber() above.
//It's a corner case, but doesn't seem to matter.
2014-07-08 03:11:14 -04:00
m_PaletteHueSpin - > SetValueStealth ( hue ) ;
m_PaletteSaturationSpin - > SetValueStealth ( sat ) ;
m_PaletteBrightnessSpin - > SetValueStealth ( bright ) ;
m_PaletteContrastSpin - > SetValueStealth ( con ) ;
m_PaletteBlurSpin - > SetValueStealth ( blur ) ;
m_PaletteFrequencySpin - > SetValueStealth ( freq ) ;
2019-05-20 18:44:46 -04:00
m_PreviewPaletteRotation = rot ;
2015-08-10 23:10:23 -04:00
m_Controller - > PaletteAdjust ( ) ; //Applies the adjustments to temp and saves in m_Ember.m_Palette, then fills in the palette preview widget.
2014-07-08 03:11:14 -04:00
}
2017-07-22 16:43:35 -04:00
return m_Controller . get ( ) ;
2014-07-08 03:11:14 -04:00
}
2017-07-22 16:43:35 -04:00
return false ;
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Start the render timer.
/// If a renderer has not been created yet, or differs form the options, it will first be created from the options.
/// </summary>
2017-07-22 16:43:35 -04:00
/// <param name="updatePreviews">True to re-render the library previews, else false.</param>
void Fractorium : : StartRenderTimer ( bool updatePreviews )
2014-07-08 03:11:14 -04:00
{
//Starting the render timer, either for the first time
//or from a paused state, such as resizing or applying new options.
2017-07-22 16:43:35 -04:00
bool newController = CreateControllerFromOptions ( ) ;
2014-07-08 03:11:14 -04:00
if ( m_Controller . get ( ) )
{
//On program startup, the renderer does not get initialized until now.
2017-07-22 16:43:35 -04:00
//If a new controller was created, then previews will have started, so only start the previews if a new controller
//was *not* created and updatePreviews is true.
CreateRendererFromOptions ( updatePreviews & & ! newController ) ;
2014-07-08 03:11:14 -04:00
if ( m_Controller - > Renderer ( ) )
m_Controller - > StartRenderTimer ( ) ;
}
}
/// <summary>
/// Idle timer event which calls the controller's Render() function.
/// </summary>
void Fractorium : : IdleTimer ( ) { m_Controller - > Render ( ) ; }
/// <summary>
/// Thin wrapper to determine if the controllers have been properly initialized.
/// </summary>
2015-01-02 18:11:36 -05:00
/// <returns>True if the ember controller and GL controllers are both not nullptr, else false.</returns>
2014-07-08 03:11:14 -04:00
bool Fractorium : : ControllersOk ( ) { return m_Controller . get ( ) & & m_Controller - > GLController ( ) ; }
2014-12-11 00:50:15 -05:00
template class FractoriumEmberController < float > ;
# ifdef DO_DOUBLE
2017-03-02 23:04:47 -05:00
template class FractoriumEmberController < double > ;
2014-12-11 00:50:15 -05:00
# endif