Vulkan API (GetProcAddr only)
This patch contains an empty Vulkan shell with only GetProcAddr implemented
Initial version of the VulkanAPI, empty and unimplemented.
Successfully builds vk_swiftshader.dll for all platforms/configuration in Visual Studio.
To test using dEQP:
- Edit environment variables
- Define VK_ICD_FILENAMES to <SwiftShader's source directory>\src\Vulkan\vk_swiftshader_icd.json
- If the location of vk_swiftshader.dll you're using is different than the one specified in
src\Vulkan\vk_swiftshader_icd.json, modify it to point to the vk_swiftshader.dll file you want to use
Bug b/116336664
Change-Id: I560b53c3e4340b9c5ccd244a6693ff2f9f994a6f
Reviewed-on: https://swiftshader-review.googlesource.com/20788
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Vulkan/main.cpp b/src/Vulkan/main.cpp
new file mode 100644
index 0000000..cdcbf39
--- /dev/null
+++ b/src/Vulkan/main.cpp
@@ -0,0 +1,78 @@
+// Copyright 2018 The SwiftShader Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// main.cpp: DLL entry point.
+
+#include "resource.h"
+#include <windows.h>
+
+#if defined(_WIN32)
+#ifdef DEBUGGER_WAIT_DIALOG
+static INT_PTR CALLBACK DebuggerWaitDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ RECT rect;
+
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ GetWindowRect(GetDesktopWindow(), &rect);
+ SetWindowPos(hwnd, HWND_TOP, rect.right / 2, rect.bottom / 2, 0, 0, SWP_NOSIZE);
+ SetTimer(hwnd, 1, 100, NULL);
+ return TRUE;
+ case WM_COMMAND:
+ if(LOWORD(wParam) == IDCANCEL)
+ {
+ EndDialog(hwnd, 0);
+ }
+ break;
+ case WM_TIMER:
+ if(IsDebuggerPresent())
+ {
+ EndDialog(hwnd, 0);
+ }
+ }
+
+ return FALSE;
+}
+
+static void WaitForDebugger(HINSTANCE instance)
+{
+ if(!IsDebuggerPresent())
+ {
+ HRSRC dialog = FindResource(instance, MAKEINTRESOURCE(IDD_DIALOG1), RT_DIALOG);
+ DLGTEMPLATE *dialogTemplate = (DLGTEMPLATE*)LoadResource(instance, dialog);
+ DialogBoxIndirect(instance, dialogTemplate, NULL, DebuggerWaitDialogProc);
+ }
+}
+#endif
+
+extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
+{
+ switch(reason)
+ {
+ case DLL_PROCESS_ATTACH:
+#ifdef DEBUGGER_WAIT_DIALOG
+ WaitForDebugger(instance);
+#endif
+ break;
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ default:
+ break;
+ }
+
+ return TRUE;
+}
+#endif
\ No newline at end of file