|
13 | 13 | // See the License for the specific language governing permissions and |
14 | 14 | // limitations under the License. |
15 | 15 | // |
16 | | -#define INITGUID |
17 | 16 | #include "harness.h" |
18 | | -#include <vector> |
19 | | - |
20 | | -#include <tchar.h> |
21 | 17 |
|
22 | 18 | /* |
23 | 19 | * OpenCL state |
@@ -45,126 +41,6 @@ HarnessD3D10_Initialize(cl_platform_id platform) |
45 | 41 | INITPFN(clEnqueueReleaseD3D10ObjectsKHR); |
46 | 42 | } |
47 | 43 |
|
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 | | - |
168 | 44 | /* |
169 | 45 | * |
170 | 46 | * texture formats |
@@ -215,76 +91,6 @@ TextureFormat formats[] = |
215 | 91 | }; |
216 | 92 | UINT formatCount = sizeof(formats)/sizeof(formats[0]); |
217 | 93 |
|
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 | | - |
288 | 94 | /* |
289 | 95 | * |
290 | 96 | * Helper function |
|
0 commit comments