clover: return CL_INVALID_PLATFORM properly.
If the platform isn't clover platform return an error, Fixes CTS api negative_get_platform_info Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12225>
This commit is contained in:
parent
3106a340a0
commit
773f046103
|
@ -40,7 +40,7 @@ clCreateContext(const cl_context_properties *d_props, cl_uint num_devs,
|
|||
|
||||
for (auto &prop : props) {
|
||||
if (prop.first == CL_CONTEXT_PLATFORM)
|
||||
obj(prop.second.as<cl_platform_id>());
|
||||
find_platform(prop.second.as<cl_platform_id>());
|
||||
else
|
||||
throw error(CL_INVALID_PROPERTY);
|
||||
}
|
||||
|
|
|
@ -49,12 +49,20 @@ clGetPlatformIDs(cl_uint num_entries, cl_platform_id *rd_platforms,
|
|||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
platform &clover::find_platform(cl_platform_id d_platform)
|
||||
{
|
||||
/* this error is only added in CL2.0 */
|
||||
if (d_platform != desc(_clover_platform))
|
||||
throw error(CL_INVALID_PLATFORM);
|
||||
return obj(d_platform);
|
||||
}
|
||||
|
||||
cl_int
|
||||
clover::GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param,
|
||||
size_t size, void *r_buf, size_t *r_size) try {
|
||||
property_buffer buf { r_buf, size, r_size };
|
||||
|
||||
auto &platform = obj(d_platform);
|
||||
auto &platform = find_platform(d_platform);
|
||||
|
||||
switch (param) {
|
||||
case CL_PLATFORM_PROFILE:
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "api/util.hpp"
|
||||
#include "core/program.hpp"
|
||||
#include "core/platform.hpp"
|
||||
#include "spirv/invocation.hpp"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
|
@ -466,8 +467,11 @@ clUnloadCompiler() {
|
|||
}
|
||||
|
||||
CLOVER_API cl_int
|
||||
clUnloadPlatformCompiler(cl_platform_id d_platform) {
|
||||
clUnloadPlatformCompiler(cl_platform_id d_platform) try {
|
||||
find_platform(d_platform);
|
||||
return CL_SUCCESS;
|
||||
} catch (error &e) {
|
||||
return e.get();
|
||||
}
|
||||
|
||||
CLOVER_API cl_int
|
||||
|
|
|
@ -50,6 +50,8 @@ namespace clover {
|
|||
cl_version version;
|
||||
std::vector<intrusive_ref<device>> devs;
|
||||
};
|
||||
|
||||
platform &find_platform(cl_platform_id d_platform);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue