I was looking for some code and I find myself using data such as kernelglobals *kg
and shaderData *sd
and similar: i don’t know what these are but I’d like to learn, can someone teach how?
In a specific case:
I wanted to variate the sample in cmj and a kind developer helped me there, but now, for the sake of knowledge and learning, I’d like to see if what i was thinking about was correct:
I want to pass to kernel_bake_evaluate
the shaderData
to which i might apply camera_distance(kg,sd->P)
.
I thought that something like ccl_device void kernel_bake_evaluate( KernelGlobals *kg, shaderData *sd, ccl_global float *buffer, int sample, int x, int y, int offset, int stride )
should have worked together with kernel_bake_evaluate(kg, sd, buffer, sample, x, y, offset, stride );
in kernel_bake.cl
but builder says nope.
thanks to those who will help
Please notice: I don’t want to face other ways, i want to do this to see how this work
In other words just an engineer engineering…
===EDIT===
I wanto to pass in cmj_sample_2D
the distance between sampling pixel and first object in scene.
In order to do so I searched for the first calling function that has the coordinate of sampling pixel, so i found kernel_bake.h
to be the closest function callling it in kernel_bake_evaluate
.
so i wrote:
ccl_device void kernel_bake_evaluate(
KernelGlobals *kg, ccl_global float *buffer,const ShaderData *sd, int sample, int x, int y, int offset, int stride )
{
/* Setup render buffers. */
float distScene = camera_distance(kg,sd->P);
and in kernel_bake.cl i wrote
{
KernelGlobals kglobals, *kg = &kglobals;
SharedData sdata, *sd= &sdata;
...
if(x < sx + sw && y < sy + sh) {
#ifndef __NO_BAKING__
kernel_bake_evaluate(kg, buffer,sd, sample, x, y, offset, stride );
#endif
}
When i build i receive several of the following Error:
cycles_device.lib(device_cpu.obj) : error LNK2019: riferimento al simbolo esterno "void __cdecl ccl::kernel_cpu_path_tr
ace(struct ccl::KernelGlobals *,float *,int,int,int,int,int)" (?kernel_cpu_path_trace@ccl@@YAXPEAUKernelGlobals@1@PEAMH
HHHH@Z) non risolto nella funzione "public: __cdecl ccl::CPUDevice::CPUDevice(class ccl::DeviceInfo &,class ccl::Stats
&,class ccl::Profiler &,bool)" (??0CPUDevice@ccl@@QEAA@AEAVDeviceInfo@1@AEAVStats@1@AEAVProfiler@1@_N@Z) [C:\blender-gi
t\build_windows_x64_vc15_Release\source\creator\blender.vcxproj]
that should be translated as:
cycles_device.lib(device_cpu.obj) : error LNK2019: reference to external simbol "void __cdecl ccl::kernel_cpu_path_tr
ace(struct ccl::KernelGlobals *,float *,int,int,int,int,int)" (?kernel_cpu_path_trace@ccl@@YAXPEAUKernelGlobals@1@PEAMH
HHHH@Z) not resolved in function "public: __cdecl ccl::CPUDevice::CPUDevice(class ccl::DeviceInfo &,class ccl::Stats
&,class ccl::Profiler &,bool)" (??0CPUDevice@ccl@@QEAA@AEAVDeviceInfo@1@AEAVStats@1@AEAVProfiler@1@_N@Z) [C:\blender-gi
t\build_windows_x64_vc15_Release\source\creator\blender.vcxproj]