Khronos Public Bugzilla
View | Details | Raw Unified | Return to bug 254
Collapse All | Expand All

(-)a/cl.hpp (-7 / +31 lines)
 Lines 2386-2393   __GET_INFO_HELPER_WITH_RETAIN(cl::Kernel) Link Here 
2386
class Program : public detail::Wrapper<cl_program>
2386
class Program : public detail::Wrapper<cl_program>
2387
{
2387
{
2388
public:
2388
public:
2389
    typedef VECTOR_CLASS<std::pair<const void*, ::size_t> > Binaries;
2389
    template<typename T>
2390
    typedef VECTOR_CLASS<std::pair<const char*, ::size_t> > Sources;
2390
    class Container : public VECTOR_CLASS<VECTOR_CLASS<T> >
2391
    {
2392
    public:
2393
        typedef VECTOR_CLASS<T> Type;
2394
        typedef VECTOR_CLASS<Type> Base;
2395
2396
        Container(::size_t count, std::pair<const T*, ::size_t> value)
2397
        :   Base(count, Type(value.first, value.first + value.second + 1))
2398
        {
2399
        }
2400
2401
        Container(STRING_CLASS value)
2402
        :   Base(1, Type(value.begin(), value.end()))
2403
        {
2404
        }
2405
2406
        Container(VECTOR_CLASS<STRING_CLASS> values)
2407
        {
2408
            for (size_type i=0; i<values.size(); ++i) {
2409
                insert(end(), Type(values[i].begin(), values[i].end()));
2410
            }
2411
        }
2412
    };
2413
2414
    typedef Container<char> Sources;
2415
    typedef Container<unsigned char> Binaries;
2391
2416
2392
    Program(
2417
    Program(
2393
        const Context& context,
2418
        const Context& context,
 Lines 2401-2408   public: Link Here 
2401
        const char** strings = (const char**) alloca(n * sizeof(const char*));
2426
        const char** strings = (const char**) alloca(n * sizeof(const char*));
2402
2427
2403
        for (::size_t i = 0; i < n; ++i) {
2428
        for (::size_t i = 0; i < n; ++i) {
2404
            strings[i] = sources[(int)i].first;
2429
            strings[i] = &sources[(int)i].front();
2405
            lengths[i] = sources[(int)i].second;
2430
            lengths[i] = sources[(int)i].size();
2406
        }
2431
        }
2407
2432
2408
        object_ = ::clCreateProgramWithSource(
2433
        object_ = ::clCreateProgramWithSource(
 Lines 2427-2434   public: Link Here 
2427
        const unsigned char** images = (const unsigned char**) alloca(n * sizeof(const void*));
2452
        const unsigned char** images = (const unsigned char**) alloca(n * sizeof(const void*));
2428
2453
2429
        for (::size_t i = 0; i < n; ++i) {
2454
        for (::size_t i = 0; i < n; ++i) {
2430
            images[i] = (const unsigned char*)binaries[(int)i].first;
2455
            images[i] = &binaries[(int)i].front();
2431
            lengths[i] = binaries[(int)i].second;
2456
            lengths[i] = binaries[(int)i].size();
2432
        }
2457
        }
2433
2458
2434
        object_ = ::clCreateProgramWithBinary(
2459
        object_ = ::clCreateProgramWithBinary(
2435
- 

Return to bug 254