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

(-)a/cl.hpp (-10 / +26 lines)
 Lines 425-430   typedef cl::string STRING_CLASS; Link Here 
425
#define __MAX_DEFAULT_VECTOR_SIZE 10
425
#define __MAX_DEFAULT_VECTOR_SIZE 10
426
#endif
426
#endif
427
427
428
typedef VECTOR_CLASS<STRING_CLASS> Sources;
429
typedef VECTOR_CLASS<VECTOR_CLASS<unsigned char> > Binaries;
430
428
/*! \class vector
431
/*! \class vector
429
 * \brief Fixed sized vector implementation that mirroring 
432
 * \brief Fixed sized vector implementation that mirroring 
430
 * std::vector functionality.
433
 * std::vector functionality.
 Lines 720-736   struct GetInfoHelper<Func, VECTOR_CLASS<T> > Link Here 
720
723
721
// Specialized for getInfo<CL_PROGRAM_BINARIES>
724
// Specialized for getInfo<CL_PROGRAM_BINARIES>
722
template <typename Func>
725
template <typename Func>
723
struct GetInfoHelper<Func, VECTOR_CLASS<char *> >
726
struct GetInfoHelper<Func, Binaries>
724
{
727
{
725
    static cl_int
728
    static cl_int
726
    get(Func f, cl_uint name, VECTOR_CLASS<char *>* param)
729
    get(Func f, cl_uint name, Binaries* param)
727
    {
730
    {
728
      cl_uint err = f(name, param->size() * sizeof(char *), &(*param)[0], NULL);
731
        VECTOR_CLASS< ::size_t> sizes;
729
      if (err != CL_SUCCESS) {
732
        cl_int err = GetInfoHelper<Func, VECTOR_CLASS< ::size_t> >::get(f, CL_PROGRAM_BINARY_SIZES, &sizes);
730
        return err;
733
        if (err != CL_SUCCESS) {
731
      }
734
            return err;
732
      
735
        }
733
      return CL_SUCCESS;
736
737
        param->resize(sizes.size());
738
739
        VECTOR_CLASS<unsigned char*> values(param->size());
740
        for (::size_t i = 0; i<param->size(); ++i) {
741
            (*param)[i].resize(sizes[i]);
742
            values[i]=&(*param)[i].front();
743
        }
744
745
        err = f(name, values.size() * sizeof(unsigned char *), &values[0], NULL);
746
        if (err != CL_SUCCESS) {
747
            return err;
748
        }
749
750
        return CL_SUCCESS;
734
    }
751
    }
735
};
752
};
736
753
 Lines 875-881   struct GetInfoHelper<Func, CPP_TYPE> \ Link Here 
875
    F(cl_program_info, CL_PROGRAM_DEVICES, VECTOR_CLASS<cl_device_id>) \
892
    F(cl_program_info, CL_PROGRAM_DEVICES, VECTOR_CLASS<cl_device_id>) \
876
    F(cl_program_info, CL_PROGRAM_SOURCE, STRING_CLASS) \
893
    F(cl_program_info, CL_PROGRAM_SOURCE, STRING_CLASS) \
877
    F(cl_program_info, CL_PROGRAM_BINARY_SIZES, VECTOR_CLASS< ::size_t>) \
894
    F(cl_program_info, CL_PROGRAM_BINARY_SIZES, VECTOR_CLASS< ::size_t>) \
878
    F(cl_program_info, CL_PROGRAM_BINARIES, VECTOR_CLASS<char *>) \
895
    F(cl_program_info, CL_PROGRAM_BINARIES, Binaries) \
879
    \
896
    \
880
    F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
897
    F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
881
    F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, STRING_CLASS) \
898
    F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, STRING_CLASS) \
882
- 

Return to bug 254