def load_program(self):
        #Read all the lines of the cl file into one string (safely)
        with open("raytraced/Raytracer.cl", "r") as file:
            source = ''.join(file.readlines())

        #Create the opencl program
        program = Program(self.context, source)

        #make program options
        options = "-cl-mad-enable -cl-fast-relaxed-math -Werror -I %s" % os.path.dirname(os.path.abspath(__file__))

        #build program
        program.build(options=options)
        self.kernel = program.raytrace
        self.kernel.set_scalar_arg_dtypes([None, None, None,
                                           numpy.int32])

        #Match OpenCL Dtype. May not work everywhere
        cltypes.Vertex, c_decl = OpenCL.tools.match_dtype_to_c_struct(self.context.devices[0], 'Vertex', cltypes.Vertex)
Exemple #2
0
    def load_program(self):
        #Read all the lines of the cl file into one string (safely)
        with open("raytraced/Raytracer.cl", "r") as file:
            source = ''.join(file.readlines())

        #Create the opencl program
        program = Program(self.context, source)

        #make program options
        options = "-cl-mad-enable -cl-fast-relaxed-math -Werror -I %s" % os.path.dirname(
            os.path.abspath(__file__))

        #build program
        program.build(options=options)
        self.kernel = program.raytrace
        self.kernel.set_scalar_arg_dtypes([None, None, None, numpy.int32])

        #Match OpenCL Dtype. May not work everywhere
        cltypes.Vertex, c_decl = OpenCL.tools.match_dtype_to_c_struct(
            self.context.devices[0], 'Vertex', cltypes.Vertex)