Skip to content

Commit 854c3d5

Browse files
committed
Migrate D3D10 suite to the new test registration framework
Replace the custom D3D10 main loop with `runTestHarnesWithCheck` and `REGISTER_TEST`. Add a suite state to initialise D3D once, and discover the adapter/device associated with the OpenCL device under test. Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
1 parent f207b52 commit 854c3d5

4 files changed

Lines changed: 218 additions & 228 deletions

File tree

test_conformance/d3d10/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set(${MODULE_NAME}_SOURCES
1010
harness.cpp
1111
)
1212

13-
list(APPEND CLConform_LIBRARIES d3d10 dxgi)
13+
list(APPEND CLConform_LIBRARIES directx_wrapper)
1414

1515
include(../CMakeCommon.txt)
1616
else()

test_conformance/d3d10/harness.cpp

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -33,69 +33,9 @@ clEnqueueReleaseD3D10ObjectsKHR_fn clEnqueueReleaseD3D10ObjectsKHR = NULL;
3333
#define INITPFN(x) \
3434
x = (x ## _fn)clGetExtensionFunctionAddressForPlatform(platform, #x); NonTestRequire(x, "Failed to get function pointer for %s", #x);
3535

36-
void
37-
HarnessD3D10_ExtensionCheck()
38-
{
39-
bool extensionPresent = false;
40-
cl_int result = CL_SUCCESS;
41-
cl_platform_id platform = NULL;
42-
size_t set_size;
43-
44-
HarnessD3D10_TestBegin("Extension query");
45-
46-
result = clGetPlatformIDs(1, &platform, NULL);
47-
NonTestRequire(result == CL_SUCCESS, "Failed to get any platforms.");
48-
result = clGetPlatformInfo(platform, CL_PLATFORM_EXTENSIONS, 0, NULL, &set_size);
49-
NonTestRequire(result == CL_SUCCESS, "Failed to get size of extensions string.");
50-
std::vector<char> extensions(set_size);
51-
result = clGetPlatformInfo(platform, CL_PLATFORM_EXTENSIONS, extensions.size(), extensions.data(), NULL);
52-
NonTestRequire(result == CL_SUCCESS, "Failed to list extensions.");
53-
extensionPresent = strstr(extensions.data(), "cl_khr_d3d10_sharing") ? true : false;
54-
55-
if (!extensionPresent) {
56-
// platform is required to report the extension only if all devices support it
57-
cl_uint devicesCount;
58-
result = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 0, NULL, &devicesCount);
59-
NonTestRequire(result == CL_SUCCESS, "Failed to get devices count.");
60-
std::vector<cl_device_id> devices(devicesCount);
61-
result = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, devicesCount, &devices[0], NULL);
62-
NonTestRequire(result == CL_SUCCESS, "Failed to get devices count.");
63-
64-
for (cl_uint i = 0; i < devicesCount; i++) {
65-
if (is_extension_available(devices[i], "cl_khr_d3d10_sharing")) {
66-
extensionPresent = true;
67-
break;
68-
}
69-
}
70-
}
71-
72-
OSVERSIONINFO osvi;
73-
osvi.dwOSVersionInfoSize = sizeof(osvi);
74-
GetVersionEx(&osvi);
75-
if (osvi.dwMajorVersion <= 5)
76-
{
77-
TestRequire(!extensionPresent, "Extension should not be exported on Windows < 6");
78-
}
79-
else
80-
{
81-
TestRequire(extensionPresent, "Extension should be exported on Windows >= 6");
82-
}
83-
84-
Cleanup:
85-
HarnessD3D10_TestEnd();
86-
87-
// early-out of the extension is not present
88-
if (!extensionPresent)
89-
{
90-
HarnessD3D10_TestStats();
91-
}
92-
}
93-
9436
void
9537
HarnessD3D10_Initialize(cl_platform_id platform)
9638
{
97-
HarnessD3D10_ExtensionCheck();
98-
9939
// extract function pointers for exported functions
10040
INITPFN(clGetDeviceIDsFromD3D10KHR);
10141
INITPFN(clCreateFromD3D10BufferKHR);

test_conformance/d3d10/harness.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ typedef unsigned char UINT8;
3535
#define __inout_opt
3636
#endif
3737

38+
#include "directx_wrapper.hpp"
39+
3840
#include <CL/cl.h>
3941
#include <CL/cl_platform.h>
4042
#include <CL/cl_d3d10.h>

0 commit comments

Comments
 (0)