diff options
author | Francisco Jerez <[email protected]> | 2013-09-16 21:13:47 -0700 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2013-10-21 10:47:03 -0700 |
commit | e5fc61fa3f4ef7e00d66003b7f0298f7e20b2cc3 (patch) | |
tree | 68c8a777b0e8ca499306ee76a333e553ef34764e /src/gallium/state_trackers/clover/api/context.cpp | |
parent | 04d0ab9f6456229df1a83b0b1c133e1c458aedd2 (diff) |
clover: Add property list helpers with a syntax consistent with other API objects.
Tested-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/clover/api/context.cpp')
-rw-r--r-- | src/gallium/state_trackers/clover/api/context.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/clover/api/context.cpp b/src/gallium/state_trackers/clover/api/context.cpp index ca05efc2d95..98bc2141e11 100644 --- a/src/gallium/state_trackers/clover/api/context.cpp +++ b/src/gallium/state_trackers/clover/api/context.cpp @@ -22,6 +22,7 @@ #include "api/util.hpp" #include "core/context.hpp" +#include "core/platform.hpp" using namespace clover; @@ -31,19 +32,21 @@ clCreateContext(const cl_context_properties *d_props, cl_uint num_devs, void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *), void *user_data, cl_int *r_errcode) try { - auto props = property_map(d_props); + auto props = obj<property_list_tag>(d_props); auto devs = objs(d_devs, num_devs); if (!pfn_notify && user_data) throw error(CL_INVALID_VALUE); - for (auto prop : props) { - if (prop.first != CL_CONTEXT_PLATFORM) + for (auto &prop : props) { + if (prop.first == CL_CONTEXT_PLATFORM) + obj(prop.second.as<cl_platform_id>()); + else throw error(CL_INVALID_PROPERTY); } ret_error(r_errcode, CL_SUCCESS); - return desc(new context(property_vector(props), devs)); + return desc(new context(props, devs)); } catch (error &e) { ret_error(r_errcode, e); @@ -116,7 +119,7 @@ clGetContextInfo(cl_context d_ctx, cl_context_info param, break; case CL_CONTEXT_PROPERTIES: - buf.as_vector<cl_context_properties>() = ctx.props(); + buf.as_vector<cl_context_properties>() = desc(ctx.props()); break; default: |