Pierre Moreau <pierre.mor...@free.fr> writes:

> OpenCL 2.1, and cl_khr_il_program, gives the ability to query for a
> program’s IL, which is returned as a pointer.
>
> Signed-off-by: Pierre Moreau <pierre.mor...@free.fr>

I'm not convinced this is correct, but...  It seems fully unnecessary, I
think you should be using a property_vector<unsigned char> instead.

> ---
>  .../state_trackers/clover/core/property.hpp        | 39 
> ++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
>
> diff --git a/src/gallium/state_trackers/clover/core/property.hpp 
> b/src/gallium/state_trackers/clover/core/property.hpp
> index 7f8e17684d..5beac372e7 100644
> --- a/src/gallium/state_trackers/clover/core/property.hpp
> +++ b/src/gallium/state_trackers/clover/core/property.hpp
> @@ -23,6 +23,7 @@
>  #ifndef CLOVER_CORE_PROPERTY_HPP
>  #define CLOVER_CORE_PROPERTY_HPP
>  
> +#include <cstring>
>  #include <map>
>  
>  #include "util/range.hpp"
> @@ -84,6 +85,19 @@ namespace clover {
>        private:
>           property_buffer &buf;
>        };
> +
> +      template<typename T>
> +      class property_pointer {
> +      public:
> +         property_pointer(property_buffer &buf) : buf(buf) {
> +         }
> +
> +         inline property_pointer &
> +         operator=(const std::pair<const T *, size_t> &v);
> +
> +      private:
> +         property_buffer &buf;
> +      };
>     };
>  
>     ///
> @@ -118,6 +132,12 @@ namespace clover {
>           return { *this };
>        }
>  
> +      template<typename T>
> +      detail::property_pointer<T>
> +      as_pointer() {
> +         return { *this };
> +      }
> +
>        template<typename T>
>        iterator_range<T *>
>        allocate(size_t n) {
> @@ -133,6 +153,17 @@ namespace clover {
>              return { };
>        }
>  
> +      void
> +      allocate_raw(const void *v, size_t n) {
> +         if (r_buf && size < n)
> +            throw error(CL_INVALID_VALUE);
> +
> +         if (r_size)
> +            *r_size = n;
> +
> +         std::memcpy(r_buf, v, n);
> +      }
> +
>     private:
>        void *const r_buf;
>        const size_t size;
> @@ -178,6 +209,14 @@ namespace clover {
>           return *this;
>        }
>  
> +      template<typename T>
> +      inline property_pointer<T> &
> +      property_pointer<T>::operator=(const std::pair<const T *, size_t> &v) {
> +         buf.allocate_raw(v.first, v.second);
> +
> +         return *this;
> +      }
> +
>        inline property_string &
>        property_string::operator=(const std::string &v) {
>           auto r = buf.allocate<char>(v.size() + 1);
> -- 
> 2.16.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to