clover/api: Support MSVC
Three things: 1. MSVC dislikes mismatching declaration/definition of __declspec(dllexport). Since CL headers don't have the declspec, the implementations should't either. 2. An unnamed brace-initialization gets deduced as an initializer list, instead of a brace-constructed string. Just add the type name. 3. posix_memalign doesn't exist on Windows. Reviewed-by: Francisco Jerez <currojerez@riseup.net> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
This commit is contained in:
parent
f88347cd22
commit
474baa04ed
|
@ -511,6 +511,7 @@ clSVMAlloc(cl_context d_ctx,
|
|||
if (!alignment)
|
||||
alignment = 0x80; // sizeof(long16)
|
||||
|
||||
#if HAVE_POSIX_MEMALIGN
|
||||
bool can_emulate = all_of(std::mem_fn(&device::has_system_svm), ctx.devices());
|
||||
if (can_emulate) {
|
||||
// we can ignore all the flags as it's not required to honor them.
|
||||
|
@ -520,6 +521,7 @@ clSVMAlloc(cl_context d_ctx,
|
|||
posix_memalign(&ptr, alignment, size);
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
|
||||
return nullptr;
|
||||
|
|
|
@ -123,7 +123,7 @@ clCreateProgramWithBinary(cl_context d_ctx, cl_uint n,
|
|||
return { CL_INVALID_VALUE, {} };
|
||||
|
||||
try {
|
||||
std::stringbuf bin( { (char*)p, l } );
|
||||
std::stringbuf bin( std::string{ (char*)p, l } );
|
||||
std::istream s(&bin);
|
||||
|
||||
return { CL_SUCCESS, module::deserialize(s) };
|
||||
|
|
|
@ -29,8 +29,12 @@
|
|||
#include "core/error.hpp"
|
||||
#include "core/property.hpp"
|
||||
#include "util/algorithm.hpp"
|
||||
#include "util/detect_os.h"
|
||||
|
||||
#ifdef HAVE_CLOVER_ICD
|
||||
#if DETECT_OS_WINDOWS
|
||||
#define CLOVER_API
|
||||
#define CLOVER_ICD_API
|
||||
#elif HAVE_CLOVER_ICD
|
||||
#define CLOVER_API
|
||||
#define CLOVER_ICD_API PUBLIC
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue