From d42cdfafe4e713889008cc78b90e0ae65c7a4b9e Mon Sep 17 00:00:00 2001 From: mfeemster Date: Tue, 9 Dec 2014 02:03:54 -0800 Subject: [PATCH] Followon commit --- Data/Version History.txt | 1 + Source/Ember/VariationsDC.h | 2 +- Source/EmberCL/RendererCL.cpp | 2 +- Source/EmberRender/EmberRender.cpp | 4 +++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Data/Version History.txt b/Data/Version History.txt index 9c6e1c7..b334a77 100644 --- a/Data/Version History.txt +++ b/Data/Version History.txt @@ -5,6 +5,7 @@ --Bug Fixes Fix bad values left in an ember when a render with strips > 1 fails in the final render dialog. + Fix incorrect calculation in dc_cube variation when using OpenCL. --Code Changes Break RendererBase::MemoryRequired() into two functions, it and HistMemRequired() and return a tuple. diff --git a/Source/Ember/VariationsDC.h b/Source/Ember/VariationsDC.h index 8308537..5627a90 100644 --- a/Source/Ember/VariationsDC.h +++ b/Source/Ember/VariationsDC.h @@ -255,7 +255,7 @@ public: << "\t\treal_t x, y, z;\n" << "\t\treal_t p = 2 * MwcNext01(mwc) - 1;\n" << "\t\treal_t q = 2 * MwcNext01(mwc) - 1;\n" - << "\t\tuint i = MwcNext(mwc) & 3;\n" + << "\t\tuint i = MwcNext(mwc) % 3;\n" << "\t\tuint j = MwcNext(mwc) & 1;\n" << "\n" << "\t\tswitch (i)\n" diff --git a/Source/EmberCL/RendererCL.cpp b/Source/EmberCL/RendererCL.cpp index 51fccc4..4fe07ca 100644 --- a/Source/EmberCL/RendererCL.cpp +++ b/Source/EmberCL/RendererCL.cpp @@ -336,7 +336,7 @@ bool RendererCL::ClearFinal() template size_t RendererCL::MemoryAvailable() { - return Ok() ? m_Wrapper.GetInfo(PlatformIndex(), DeviceIndex(), CL_DEVICE_GLOBAL_MEM_SIZE) : 0ULL; + return Ok() ? m_Wrapper.GlobalMemSize() : 0ULL; } /// diff --git a/Source/EmberRender/EmberRender.cpp b/Source/EmberRender/EmberRender.cpp index 5d12f9b..3d7f2bc 100644 --- a/Source/EmberRender/EmberRender.cpp +++ b/Source/EmberRender/EmberRender.cpp @@ -34,6 +34,7 @@ bool EmberRender(EmberOptions& opt) string filename; string inputPath = GetPath(opt.Input()); ostringstream os; + pair p; vector> embers; vector finalImage, vecRgb; EmberStats stats; @@ -201,7 +202,8 @@ bool EmberRender(EmberOptions& opt) } else { - strips = CalcStrips(double(renderer->MemoryRequired(1, true)), double(renderer->MemoryAvailable()), opt.UseMem()); + p = renderer->MemoryRequired(1, true); + strips = CalcStrips(double(p.second), double(renderer->MemoryAvailable()), opt.UseMem()); if (strips > 1) VerbosePrint("Setting strips to " << strips << " with specified memory usage of " << opt.UseMem());