00001 #include "luxrays/kernels/kernels.h"
00002 std::string luxrays::KernelSource_Pixel_ClearFB =
00003 "/***************************************************************************\n"
00004 " * Copyright (C) 1998-2010 by authors (see AUTHORS.txt ) *\n"
00005 " * *\n"
00006 " * This file is part of LuxRays. *\n"
00007 " * *\n"
00008 " * LuxRays is free software; you can redistribute it and/or modify *\n"
00009 " * it under the terms of the GNU General Public License as published by *\n"
00010 " * the Free Software Foundation; either version 3 of the License, or *\n"
00011 " * (at your option) any later version. *\n"
00012 " * *\n"
00013 " * LuxRays is distributed in the hope that it will be useful, *\n"
00014 " * but WITHOUT ANY WARRANTY; without even the implied warranty of *\n"
00015 " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\n"
00016 " * GNU General Public License for more details. *\n"
00017 " * *\n"
00018 " * You should have received a copy of the GNU General Public License *\n"
00019 " * along with this program. If not, see <http://www.gnu.org/licenses/>. *\n"
00020 " * *\n"
00021 " * LuxRays website: http://www.luxrender.net *\n"
00022 " ***************************************************************************/\n"
00023 "\n"
00024 "typedef struct {\n"
00025 " float r, g, b;\n"
00026 "} Spectrum;\n"
00027 "\n"
00028 "typedef Spectrum Pixel;\n"
00029 "\n"
00030 "__kernel __attribute__((reqd_work_group_size(8, 8, 1))) void PixelClearFB(\n"
00031 " const unsigned int width,\n"
00032 " const unsigned int height,\n"
00033 " __global Pixel *frameBuffer) {\n"
00034 " const unsigned int px = get_global_id(0);\n"
00035 " if(px >= width)\n"
00036 " return;\n"
00037 " const unsigned int py = get_global_id(1);\n"
00038 " if(py >= height)\n"
00039 " return;\n"
00040 " const unsigned int offset = px + py * width;\n"
00041 "\n"
00042 " __global Pixel *p = &frameBuffer[offset];\n"
00043 " p->r = 0.f;\n"
00044 " p->g = 0.f;\n"
00045 " p->b = 0.f;\n"
00046 "}\n"
00047 ;