Skip to content

Commit 5f71ea6

Browse files
committed
Clean up unused code
Remove redundant state and helper abstractions. Remove device and window creation logic as it is not used anymore. Remove test stats tracking, use the harness instead. Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
1 parent c6c817a commit 5f71ea6

7 files changed

Lines changed: 8 additions & 251 deletions

File tree

test_conformance/d3d10/buffer.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void SubTestBuffer(
5858
cl_mem mem = NULL;
5959
cl_int result = CL_SUCCESS;
6060

61-
HarnessD3D10_TestBegin("Buffer: Size=%d, BindFlags=%s, Usage=%s, CPUAccess=%s",
61+
log_info("Buffer: Size=%d, BindFlags=%s, Usage=%s, CPUAccess=%s",
6262
props->ByteWidth,
6363
props->name_BindFlags,
6464
props->name_Usage,
@@ -288,8 +288,6 @@ void SubTestBuffer(
288288
{
289289
clReleaseMemObject(mem);
290290
}
291-
292-
HarnessD3D10_TestEnd();
293291
}
294292

295293

test_conformance/d3d10/harness.cpp

Lines changed: 0 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515
//
16-
#define INITGUID
1716
#include "harness.h"
18-
#include <vector>
19-
20-
#include <tchar.h>
2117

2218
/*
2319
* OpenCL state
@@ -45,126 +41,6 @@ HarnessD3D10_Initialize(cl_platform_id platform)
4541
INITPFN(clEnqueueReleaseD3D10ObjectsKHR);
4642
}
4743

48-
/*
49-
* Window management
50-
*/
51-
52-
static IDXGISwapChain* HarnessD3D10_pSwapChain = NULL;
53-
static ID3D10Device* HarnessD3D10_pDevice = NULL;
54-
static HWND HarnessD3D10_hWnd = NULL;
55-
56-
static LRESULT WINAPI HarnessD3D10_Proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
57-
{
58-
switch(msg)
59-
{
60-
case WM_KEYDOWN:
61-
return 0;
62-
break;
63-
case WM_DESTROY:
64-
HarnessD3D10_hWnd = NULL;
65-
PostQuitMessage(0);
66-
return 0;
67-
case WM_PAINT:
68-
ValidateRect(hWnd, NULL);
69-
return 0;
70-
}
71-
return DefWindowProc(hWnd, msg, wParam, lParam);
72-
}
73-
74-
static void HarnessD3D10_InteractiveLoop()
75-
{
76-
MSG msg;
77-
while(PeekMessage(&msg,HarnessD3D10_hWnd,0,0,PM_REMOVE))
78-
{
79-
TranslateMessage(&msg);
80-
DispatchMessage(&msg);
81-
}
82-
}
83-
84-
cl_int HarnessD3D10_CreateDevice(IDXGIAdapter* pAdapter, ID3D10Device **ppDevice)
85-
{
86-
HRESULT hr = S_OK;
87-
unsigned int cuStatus = 1;
88-
89-
*ppDevice = NULL;
90-
91-
// create window
92-
static WNDCLASSEX wc =
93-
{
94-
sizeof(WNDCLASSEX),
95-
CS_CLASSDC,
96-
HarnessD3D10_Proc,
97-
0L,
98-
0L,
99-
GetModuleHandle(NULL),
100-
NULL,
101-
NULL,
102-
NULL,
103-
NULL,
104-
_T( "cl_khr_d3d10_sharing_conformance" ),
105-
NULL
106-
};
107-
RegisterClassEx(&wc);
108-
HarnessD3D10_hWnd = CreateWindow(
109-
_T( "cl_khr_d3d10_sharing_conformance" ),
110-
_T( "cl_khr_d3d10_sharing_conformance" ),
111-
WS_OVERLAPPEDWINDOW,
112-
0, 0, 256, 256,
113-
NULL,
114-
NULL,
115-
wc.hInstance,
116-
NULL);
117-
NonTestRequire(0 != HarnessD3D10_hWnd, "Failed to create window");
118-
119-
ShowWindow(HarnessD3D10_hWnd,SW_SHOWDEFAULT);
120-
UpdateWindow(HarnessD3D10_hWnd);
121-
122-
RECT rc;
123-
GetClientRect(HarnessD3D10_hWnd, &rc);
124-
UINT width = rc.right - rc.left;
125-
UINT height = rc.bottom - rc.top;
126-
127-
// Create device and swapchain
128-
DXGI_SWAP_CHAIN_DESC sd;
129-
ZeroMemory(&sd, sizeof(sd));
130-
sd.BufferCount = 1;
131-
sd.BufferDesc.Width = width;
132-
sd.BufferDesc.Height = height;
133-
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
134-
sd.BufferDesc.RefreshRate.Numerator = 60;
135-
sd.BufferDesc.RefreshRate.Denominator = 1;
136-
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
137-
sd.OutputWindow = HarnessD3D10_hWnd;
138-
sd.SampleDesc.Count = 1;
139-
sd.SampleDesc.Quality = 0;
140-
sd.Windowed = TRUE;
141-
hr = D3D10CreateDeviceAndSwapChain(
142-
pAdapter,
143-
D3D10_DRIVER_TYPE_HARDWARE,
144-
NULL,
145-
0,
146-
D3D10_SDK_VERSION,
147-
&sd,
148-
&HarnessD3D10_pSwapChain,
149-
&HarnessD3D10_pDevice);
150-
151-
if (FAILED(hr) ) {
152-
return CL_DEVICE_NOT_FOUND;
153-
}
154-
155-
*ppDevice = HarnessD3D10_pDevice;
156-
return CL_SUCCESS;
157-
}
158-
159-
void HarnessD3D10_DestroyDevice()
160-
{
161-
HarnessD3D10_pSwapChain->Release();
162-
HarnessD3D10_pDevice->Release();
163-
164-
if (HarnessD3D10_hWnd) DestroyWindow(HarnessD3D10_hWnd);
165-
HarnessD3D10_hWnd = 0;
166-
}
167-
16844
/*
16945
*
17046
* texture formats
@@ -215,76 +91,6 @@ TextureFormat formats[] =
21591
};
21692
UINT formatCount = sizeof(formats)/sizeof(formats[0]);
21793

218-
/*
219-
*
220-
* Logging and error reporting
221-
*
222-
*/
223-
224-
static struct
225-
{
226-
cl_int testCount;
227-
cl_int passCount;
228-
229-
cl_int nonTestFailures;
230-
cl_int inTest;
231-
cl_int currentTestPass;
232-
233-
char currentTestName[1024];
234-
} HarnessD3D10_testStats = {0};
235-
236-
void HarnessD3D10_TestBegin(const char* fmt, ...)
237-
{
238-
va_list ap;
239-
240-
va_start(ap, fmt);
241-
vsprintf(HarnessD3D10_testStats.currentTestName, fmt, ap);
242-
va_end(ap);
243-
244-
TestPrint("[%s] ... ", HarnessD3D10_testStats.currentTestName);
245-
246-
HarnessD3D10_testStats.inTest = 1;
247-
HarnessD3D10_testStats.currentTestPass = 1;
248-
}
249-
250-
void HarnessD3D10_TestFail()
251-
{
252-
if (HarnessD3D10_testStats.inTest)
253-
{
254-
HarnessD3D10_testStats.currentTestPass = 0;
255-
}
256-
else
257-
{
258-
++HarnessD3D10_testStats.nonTestFailures;
259-
}
260-
}
261-
262-
void HarnessD3D10_TestEnd()
263-
{
264-
HarnessD3D10_testStats.inTest = 0;
265-
266-
HarnessD3D10_testStats.testCount += 1;
267-
HarnessD3D10_testStats.passCount += HarnessD3D10_testStats.currentTestPass;
268-
269-
TestPrint("%s\n",
270-
HarnessD3D10_testStats.currentTestPass ? "PASSED" : "FAILED");
271-
}
272-
273-
void HarnessD3D10_TestStats()
274-
{
275-
TestPrint("PASSED %d of %d tests.\n", HarnessD3D10_testStats.passCount, HarnessD3D10_testStats.testCount);
276-
if (HarnessD3D10_testStats.testCount > HarnessD3D10_testStats.passCount)
277-
{
278-
TestPrint("***FAILED***\n");
279-
exit(1);
280-
}
281-
else
282-
{
283-
TestPrint("&&&& cl_khr_d3d10_sharing test PASSED\n");
284-
}
285-
exit(0);
286-
}
287-
28894
/*
28995
*
29096
* Helper function

test_conformance/d3d10/harness.h

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,7 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515
//
16-
#ifndef HARNESS_H_
17-
#define HARNESS_H_
18-
19-
#define _CRT_SECURE_NO_WARNINGS
20-
21-
#if defined (__MINGW32__)
22-
#include <rpcsal.h>
23-
typedef unsigned char UINT8;
24-
#define __out
25-
#define __in
26-
#define __inout
27-
#define __out_bcount_opt(size)
28-
#define __in_opt
29-
#define __in_ecount(size)
30-
#define __in_ecount_opt(size)
31-
#define __out_opt
32-
#define __out_ecount(size)
33-
#define __out_ecount_opt(size)
34-
#define __in_bcount_opt(size)
35-
#define __inout_opt
36-
#endif
16+
#pragma once
3717

3818
#include "directx_wrapper.hpp"
3919

@@ -44,9 +24,6 @@ typedef unsigned char UINT8;
4424
#include "errorHelpers.h"
4525
#include "kernelHelpers.h"
4626

47-
// #define log_info(...) printf(__VA_ARGS__)
48-
// #define log_error(...) printf(__VA_ARGS__)
49-
5027
#define NonTestRequire(x, ...) \
5128
do \
5229
{ \
@@ -70,7 +47,6 @@ do \
7047
log_info("ERROR: "); \
7148
log_error(__VA_ARGS__); \
7249
log_info("\n"); \
73-
HarnessD3D10_TestFail(); \
7450
goto Cleanup; \
7551
} \
7652
} while (0)
@@ -144,14 +120,6 @@ struct Texture3DSize
144120
};
145121

146122
void HarnessD3D10_Initialize(cl_platform_id platform);
147-
cl_int HarnessD3D10_CreateDevice(IDXGIAdapter* pAdapter, ID3D10Device **ppDevice);
148-
void HarnessD3D10_DestroyDevice();
149-
150-
void HarnessD3D10_TestBegin(const char* fmt, ...);
151-
void HarnessD3D10_TestFail();
152-
void HarnessD3D10_TestEnd();
153-
void HarnessD3D10_TestStats();
154-
155123

156124
void TestAdapterEnumeration(
157125
cl_platform_id platform,
@@ -211,5 +179,3 @@ extern clCreateFromD3D10Texture2DKHR_fn clCreateFromD3D10Texture2DKHR;
211179
extern clCreateFromD3D10Texture3DKHR_fn clCreateFromD3D10Texture3DKHR;
212180
extern clEnqueueAcquireD3D10ObjectsKHR_fn clEnqueueAcquireD3D10ObjectsKHR;
213181
extern clEnqueueReleaseD3D10ObjectsKHR_fn clEnqueueReleaseD3D10ObjectsKHR;
214-
215-
#endif

test_conformance/d3d10/main.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ void TestAdapterEnumeration(cl_platform_id platform, IDXGIAdapter* pAdapter, ID3
262262

263263
cl_int result;
264264

265-
HarnessD3D10_TestBegin("cl_device_id Enumeration");
265+
log_info("cl_device_id Enumeration");
266266

267267
// get the cl_device_ids for the adapter
268268
{
@@ -365,8 +365,6 @@ void TestAdapterEnumeration(cl_platform_id platform, IDXGIAdapter* pAdapter, ID3
365365
}
366366

367367
*num_devices = num_device_devices;
368-
369-
HarnessD3D10_TestEnd();
370368
}
371369

372370
bool TestDeviceContextCreate(
@@ -383,7 +381,7 @@ bool TestDeviceContextCreate(
383381

384382
bool succeeded = false;
385383

386-
HarnessD3D10_TestBegin("Context creation");
384+
log_info("Context creation");
387385

388386
cl_context_properties properties[5];
389387

@@ -475,6 +473,5 @@ bool TestDeviceContextCreate(
475473
clReleaseCommandQueue(command_queue);
476474
}
477475
}
478-
HarnessD3D10_TestEnd();
479476
return succeeded;
480477
}

test_conformance/d3d10/misc.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void SubTestMiscMultipleCreates(
2626
cl_mem mem[5] = {NULL, NULL, NULL, NULL, NULL};
2727
cl_int result = CL_SUCCESS;
2828

29-
HarnessD3D10_TestBegin("Misc: Multiple Creates");
29+
log_info("Misc: Multiple Creates");
3030

3131
// create the D3D10 resources
3232
{
@@ -116,8 +116,6 @@ void SubTestMiscMultipleCreates(
116116
{
117117
pTexture->Release();
118118
}
119-
120-
HarnessD3D10_TestEnd();
121119
}
122120

123121
void SubTestMiscAcquireRelease(
@@ -132,7 +130,7 @@ void SubTestMiscAcquireRelease(
132130
cl_int result = CL_SUCCESS;
133131
cl_mem mem[2] = {NULL, NULL};
134132

135-
HarnessD3D10_TestBegin("Misc: Acquire Release");
133+
log_info("Misc: Acquire Release");
136134

137135
// create the D3D10 resources
138136
{
@@ -236,8 +234,6 @@ void SubTestMiscAcquireRelease(
236234
{
237235
pTexture->Release();
238236
}
239-
240-
HarnessD3D10_TestEnd();
241237
}
242238

243239
void TestDeviceMisc(

test_conformance/d3d10/texture2d.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515
//
16-
#define _CRT_SECURE_NO_WARNINGS
1716
#include "harness.h"
1817

1918
Texture2DSize texture2DSizes[] =
@@ -168,7 +167,7 @@ void SubTestTexture2D(
168167

169168
cl_int result = CL_SUCCESS;
170169

171-
HarnessD3D10_TestBegin("2D Texture: Format=%s, Width=%d, Height=%d, MipLevels=%d, ArraySize=%d",
170+
log_info("2D Texture: Format=%s, Width=%d, Height=%d, MipLevels=%d, ArraySize=%d",
172171
format->name_format,
173172
size->Width,
174173
size->Height,
@@ -617,8 +616,6 @@ void SubTestTexture2D(
617616
TestRequire(result == CL_SUCCESS, "clReleaseEvent for event failed.");
618617
}
619618
}
620-
621-
HarnessD3D10_TestEnd();
622619
}
623620

624621
void TestDeviceTexture2D(

0 commit comments

Comments
 (0)