OpenCL

Discussion related to the LuxCore functionality, implementations and API.
Post Reply
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

OpenCL

Post by B.Y.O.B. »

Some questions:
  • I have fixed what I believe was a copy-paste mistake in the subtract texture:
    https://github.com/LuxCoreRender/LuxCor ... 396ea99f28
    I noticed that the subtract and add textures are declared OPENCL_FORCE_INLINE, while the scale texture is declared OPENCL_FORCE_NOT_INLINE. Why is that? Aren't they all doing the same thing, just with different operators? Is there something I'm not seeing?
  • It seems like the OpenCL code clamps some colors implicitly, for example the matte material "kd". This creates a difference between CPU renders and OpenCL renders because this clamping does not happen in C++ code. See attached example image. Why the inconsistency?
Attachments
C++ on the left, OpenCL on the right
C++ on the left, OpenCL on the right
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: OpenCL

Post by Dade »

B.Y.O.B. wrote: Thu Oct 11, 2018 9:17 pm Some questions:
  • I have fixed what I believe was a copy-paste mistake in the subtract texture:
    https://github.com/LuxCoreRender/LuxCor ... 396ea99f28
    I noticed that the subtract and add textures are declared OPENCL_FORCE_INLINE, while the scale texture is declared OPENCL_FORCE_NOT_INLINE. Why is that? Aren't they all doing the same thing, just with different operators? Is there something I'm not seeing?
It is the work around to NVIDIA OpenCL compiler problems. It is more the result of Voodoo magic than some rational action. I would use OPENCL_FORCE_NOT_INLINE also for subtract and add (i.e. better safe than sorry).
B.Y.O.B. wrote: Thu Oct 11, 2018 9:17 pm
  • It seems like the OpenCL code clamps some colors implicitly, for example the matte material "kd". This creates a difference between CPU renders and OpenCL renders because this clamping does not happen in C++ code. See attached example image. Why the inconsistency?
Colors are clamped both in C++ and OpenCL. The problem arise from the different default values of Spectrum::Clamp(min, max), it is [0.f, 1.f] in OpenCL and [0.f, INFINITY] in C++. The C++ version is quite misleading but it comes from when the same code was used inside old Lux. I should have fixed all C++ Clamp() call now.
Support LuxCoreRender project with salts and bounties
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: OpenCL

Post by B.Y.O.B. »

Dade wrote: Fri Oct 12, 2018 10:45 am I would use OPENCL_FORCE_NOT_INLINE also for subtract and add (i.e. better safe than sorry).
Ok, should we implement this in the master branch or in my new_math_textures branch?
My plan was to implement OpenCL support for the Remap texture and the ObjectID textures, then apply for first merge of the new_math_textures branch into master. (More math textures can be implemented later)
If I do this in the next days, do you think we can include it in v2.1?
Post Reply