__global__ void kernel_compute_global_lighting(float* device_lenght_buff, CudaRenderWindow render_window, CudaRenderCamera camera, CudaRenderMap map, CudaRenderTextures textures, CudaRenderLight lights) {
int addr = threadIdx.x + blockIdx.x * blockDim.x;
render_window.device_rendered_window[addr].r = render_window.device_render_window[addr].r * lights.device_light_pointers[0]->r;
render_window.device_rendered_window[addr].g = render_window.device_render_window[addr].g * lights.device_light_pointers[0]->g;
render_window.device_rendered_window[addr].b = render_window.device_render_window[addr].b * lights.device_light_pointers[0]->b;
}
cudaDeviceSynchronize(); // Ожидание выполнения предыдущего кернела
end = clock(); // остановка таймера от предыдущего кернала итд.
cout << "Draw floor and roof-- " << ((double)end - start) / ((double)CLOCKS_PER_SEC) * 1000 << " , milliseconds." << endl;
start = clock(); // запускаю таймер для кернала о котором идёт речь, ну и дальше понятно.
kernel_compute_global_lighting << <grid, threads >> > (render_window->device_lenght_buff, *render_window, *render_window->camera, *render_window->map, *render_window->textures, *render_window->light);
cudaDeviceSynchronize();
end = clock();
cout << "Global light--- " << ((double)end - start) / ((double)CLOCKS_PER_SEC) * 1000 << " , milliseconds." << endl;