Skip to content

Commit 97f0eb5

Browse files
authored
Merge branch 'master' into master
2 parents 98ca71f + 8f7f56d commit 97f0eb5

File tree

8 files changed

+34
-20
lines changed

8 files changed

+34
-20
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ if (WIN32)
8484
# only required in rare cases.
8585
if (DEFINED ENV{DXSDK_DIR} AND NOT (MINGW OR MSYS OR CYGWIN))
8686
include_directories ($ENV{DXSDK_DIR}/Include)
87+
include_directories ($ENV{WDK}/km)
8788
endif ()
8889
else ()
8990
# By default don't include OpenCL 3.0 symbol definitions (i.e. comment them
@@ -112,6 +113,7 @@ set_target_properties (OpenCL PROPERTIES VERSION "1.2" SOVERSION "1")
112113
target_include_directories(OpenCL SYSTEM PUBLIC ${OPENCL_ICD_LOADER_HEADERS_DIR})
113114

114115
if (WIN32)
116+
115117
target_link_libraries (OpenCL cfgmgr32.lib runtimeobject.lib)
116118

117119
option (OPENCL_ICD_LOADER_DISABLE_OPENCLON12 "Disable support for OpenCLOn12. Support for OpenCLOn12 should only be disabled when building an import lib to link with, and must be enabled when building an ICD loader for distribution!" OFF)

loader/icd.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ void khrIcdContextPropertiesGetPlatform(
122122
const cl_context_properties *properties,
123123
cl_platform_id *outPlatform);
124124

125+
// translate device type to platform
126+
void khrIcdDeviceTypeGetPlatform(
127+
cl_device_type device_type,
128+
cl_platform_id *outPlatform);
129+
125130
// internal tracing macros
126131
#if 0
127132
#include <stdio.h>

loader/windows/OpenCL.rc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@
3232
OPENCL_ICD_LOADER_TOSTRING(OPENCL_ICD_LOADER_VERSION_REV)
3333

3434
VS_VERSION_INFO VERSIONINFO
35+
<<<<<<< HEAD
36+
FILEVERSION 2,2,2,0
37+
PRODUCTVERSION 2,2,2,0
38+
=======
3539
FILEVERSION OPENCL_ICD_LOADER_VERSION_MAJOR,OPENCL_ICD_LOADER_VERSION_MINOR,OPENCL_ICD_LOADER_VERSION_REV,0
3640
PRODUCTVERSION OPENCL_ICD_LOADER_VERSION_MAJOR,OPENCL_ICD_LOADER_VERSION_MINOR,OPENCL_ICD_LOADER_VERSION_REV,0
41+
>>>>>>> KhronosGroup-master
3742
FILETYPE VFT_DLL
3843

3944
BEGIN

loader/windows/icd_windows.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "icd_windows_dxgk.h"
2323
#include "icd_windows_apppackage.h"
2424
#include <stdio.h>
25-
#include <windows.h>
2625
#include <winreg.h>
2726

2827
#include <initguid.h>
@@ -45,7 +44,7 @@ static WinAdapter* pWinAdapterCapacity = NULL;
4544

4645
BOOL adapterAdd(const char* szName, LUID luid)
4746
{
48-
BOOL result = TRUE;
47+
BOOL result = TRUE;
4948
if (pWinAdapterEnd == pWinAdapterCapacity)
5049
{
5150
size_t oldCapacity = pWinAdapterCapacity - pWinAdapterBegin;
@@ -55,20 +54,15 @@ BOOL adapterAdd(const char* szName, LUID luid)
5554
newCapacity = 1;
5655
}
5756
else if(newCapacity < UINT_MAX/2)
58-
{
57+
{
5958
newCapacity *= 2;
6059
}
6160

62-
WinAdapter* pNewBegin = malloc(newCapacity * sizeof(*pWinAdapterBegin));
61+
WinAdapter* pNewBegin = realloc(pWinAdapterBegin, newCapacity * sizeof(*pWinAdapterBegin));
6362
if (!pNewBegin)
6463
result = FALSE;
6564
else
6665
{
67-
if (pWinAdapterBegin)
68-
{
69-
memcpy(pNewBegin, pWinAdapterBegin, oldCapacity * sizeof(*pWinAdapterBegin));
70-
free(pWinAdapterBegin);
71-
}
7266
pWinAdapterCapacity = pNewBegin + newCapacity;
7367
pWinAdapterEnd = pNewBegin + oldCapacity;
7468
pWinAdapterBegin = pNewBegin;
@@ -80,8 +74,8 @@ BOOL adapterAdd(const char* szName, LUID luid)
8074
pWinAdapterEnd->szName = malloc(nameLen);
8175
if (!pWinAdapterEnd->szName)
8276
result = FALSE;
83-
else
84-
{
77+
else
78+
{
8579
memcpy(pWinAdapterEnd->szName, szName, nameLen);
8680
pWinAdapterEnd->luid = luid;
8781
++pWinAdapterEnd;
@@ -94,6 +88,7 @@ void adapterFree(WinAdapter *pWinAdapter)
9488
{
9589
free(pWinAdapter->szName);
9690
pWinAdapter->szName = NULL;
91+
pWinAdapter->luid = ZeroLuid;
9792
}
9893

9994
/*
@@ -119,7 +114,7 @@ BOOL CALLBACK khrIcdOsVendorsEnumerate(PINIT_ONCE InitOnce, PVOID Parameter, PVO
119114
{
120115
KHR_ICD_TRACE("Failed to load via DXGK interface on RS4, continuing\n");
121116
status |= khrIcdOsVendorsEnumerateHKR();
122-
if (!status)
117+
if (!status)
123118
{
124119
KHR_ICD_TRACE("Failed to enumerate HKR entries, continuing\n");
125120
}
@@ -190,8 +185,8 @@ BOOL CALLBACK khrIcdOsVendorsEnumerate(PINIT_ONCE InitOnce, PVOID Parameter, PVO
190185
{
191186
IDXGIFactory* pFactory = NULL;
192187
PFN_CREATE_DXGI_FACTORY pCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY)GetProcAddress(hDXGI, "CreateDXGIFactory");
193-
if (pCreateDXGIFactory)
194-
{
188+
if (pCreateDXGIFactory)
189+
{
195190
HRESULT hr = pCreateDXGIFactory(&IID_IDXGIFactory, &pFactory);
196191
if (SUCCEEDED(hr))
197192
{
@@ -210,10 +205,11 @@ BOOL CALLBACK khrIcdOsVendorsEnumerate(PINIT_ONCE InitOnce, PVOID Parameter, PVO
210205
khrIcdVendorAdd(iterAdapter->szName);
211206
break;
212207
}
213-
}
208+
}
214209
}
215210

216211
pAdapter->lpVtbl->Release(pAdapter);
212+
pAdapter->lpVtbl->Release(pAdapter);
217213
}
218214
pFactory->lpVtbl->Release(pFactory);
219215
}

loader/windows/icd_windows_dxgk.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ bool khrIcdOsVendorsEnumerateDXGK(void)
3333
{
3434
bool ret = false;
3535
int result = 0;
36-
3736
// Get handle to GDI Runtime
3837
HMODULE h = LoadLibrary("gdi32.dll");
3938
if (h == NULL)
@@ -42,6 +41,7 @@ bool khrIcdOsVendorsEnumerateDXGK(void)
4241
if(GetProcAddress(h, "D3DKMTSubmitPresentBltToHwQueue")) // OS Version check
4342
{
4443
LoaderEnumAdapters2 EnumAdapters;
44+
4545
NTSTATUS status = STATUS_SUCCESS;
4646

4747
char cszLibraryName[MAX_PATH] = { 0 };
@@ -63,6 +63,7 @@ bool khrIcdOsVendorsEnumerateDXGK(void)
6363
{
6464
EnumAdapters.adapter_count = 0;
6565
EnumAdapters.adapters = NULL;
66+
6667
status = pEnumAdapters2(&EnumAdapters);
6768
if (status == STATUS_BUFFER_TOO_SMALL)
6869
{
@@ -82,6 +83,7 @@ bool khrIcdOsVendorsEnumerateDXGK(void)
8283
KHR_ICD_TRACE("Allocation failure for adapters buffer\n");
8384
goto out;
8485
}
86+
8587
status = pEnumAdapters2(&EnumAdapters);
8688
if (!NT_SUCCESS(status))
8789
{
@@ -90,7 +92,9 @@ bool khrIcdOsVendorsEnumerateDXGK(void)
9092
}
9193
const char* cszOpenCLRegKeyName = getOpenCLRegKeyName();
9294
const int szOpenCLRegKeyName = (int)(strlen(cszOpenCLRegKeyName) + 1)*sizeof(cszOpenCLRegKeyName[0]);
95+
9396
for (UINT AdapterIndex = 0; AdapterIndex < EnumAdapters.adapter_count; AdapterIndex++)
97+
9498
{
9599
LoaderQueryRegistryInfo queryArgs = {0};
96100
LoaderQueryRegistryInfo* pQueryArgs = &queryArgs;
@@ -132,6 +136,7 @@ bool khrIcdOsVendorsEnumerateDXGK(void)
132136
continue;
133137
}
134138
}
139+
135140
if (NT_SUCCESS(status) && pQueryArgs->status == LOADER_QUERY_REGISTRY_STATUS_BUFFER_OVERFLOW)
136141
{
137142
ULONG queryBufferSize = sizeof(LoaderQueryRegistryInfo) + queryArgs.output_value_size;

loader/windows/icd_windows_hkr.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818

1919
#include "icd.h"
20-
#include "icd_windows_hkr.h"
2120
#include <windows.h>
2221
#include "icd_windows_dxgk.h"
2322
#include <cfgmgr32.h>
@@ -129,7 +128,7 @@ static bool ReadOpenCLKey(DEVINST dnDevNode)
129128
goto out;
130129
}
131130

132-
if (REG_SZ != dwLibraryNameType)
131+
if (REG_MULTI_SZ != dwLibraryNameType)
133132
{
134133
if (REG_MULTI_SZ == dwLibraryNameType)
135134
{
@@ -174,6 +173,7 @@ static DeviceProbeResult ProbeDevice(DEVINST devnode)
174173
devnode,
175174
0);
176175

176+
// TODO: consider extracting warning messages out of this function
177177
if (CR_SUCCESS != ret)
178178
{
179179
KHR_ICD_TRACE(" WARNING: failed to probe the status of the device 0x%x\n", ret);
@@ -346,6 +346,8 @@ bool khrIcdOsVendorsEnumerateHKR(void)
346346
&szGuid,
347347
0);
348348

349+
KHR_ICD_ASSERT(devpropType == DEVPROP_TYPE_GUID);
350+
349351
if (CR_SUCCESS != ret ||
350352
!IsEqualGUID(&OCL_GUID_DEVCLASS_SOFTWARECOMPONENT, &guid))
351353
{

test/loader_test/test_buffer_object.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <stdlib.h>
2-
32
#include <CL/cl.h>
43
#include "param_struct.h"
54
#include <platform/icd_test_log.h>

test/loader_test/test_kernel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ int test_clEnqueueMigrateMemObjects(const struct clEnqueueMigrateMemObjects_st*
154154
&event);
155155

156156
ret_val=clEnqueueMigrateMemObjects(command_queue,
157-
data->num_mem_objects,
157+
(cl_uint)data->num_mem_objects,
158158
data->mem_objects,
159159
data->flags,
160160
data->num_events_in_wait_list,

0 commit comments

Comments
 (0)