VK_DEFINE_PLATFORM_TYPE(Win32SecurityAttributesPtr, const void*);
VK_DEFINE_PLATFORM_TYPE(AndroidHardwareBufferPtr, void*);
VK_DEFINE_PLATFORM_TYPE(Win32MonitorHandle, void*);
+VK_DEFINE_PLATFORM_TYPE(Win32LPCWSTR, const void*);
VK_DEFINE_PLATFORM_TYPE(RROutput, void*);
VK_DEFINE_PLATFORM_TYPE(zx_handle_t, deInt32);
VK_DEFINE_PLATFORM_TYPE(GgpFrameToken, deInt32);
return CharPtr(ptr);
}
+
+#if (DE_OS == DE_OS_WIN32)
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+struct WStr
+{
+ LPCWSTR wstr;
+
+ WStr (LPCWSTR wstr_) : wstr(wstr_) {}
+};
+
+std::ostream& operator<< (std::ostream& str, const WStr& wstr)
+{
+ int len = WideCharToMultiByte(CP_UTF8, 0, wstr.wstr, -1, NULL, 0, 0, 0);
+ if (len < 1)
+ return str << "(null)";
+
+ std::string result;
+ result.resize(len + 1);
+ WideCharToMultiByte(CP_UTF8, 0, wstr.wstr, -1, &result[0], len, 0, 0);
+
+ return str << '"' << result << '"';
+}
+
+inline WStr getWStr (pt::Win32LPCWSTR pt_wstr)
+{
+ return WStr(static_cast<LPCWSTR>(pt_wstr.internal));
+}
+
+#else
+
+inline CharPtr getWStr (pt::Win32LPCWSTR pt_wstr)
+{
+ return CharPtr(static_cast<const char*>(pt_wstr.internal));
+}
+
+#endif
+
+
#include "vkStrUtilImpl.inl"
} // vk
std::ostream& operator<< (std::ostream& s, Win32SecurityAttributesPtr v) { return s << tcu::toHex(v.internal); }
std::ostream& operator<< (std::ostream& s, AndroidHardwareBufferPtr v) { return s << tcu::toHex(v.internal); }
std::ostream& operator<< (std::ostream& s, Win32MonitorHandle v) { return s << tcu::toHex(v.internal); }
+std::ostream& operator<< (std::ostream& s, Win32LPCWSTR v) { return s << tcu::toHex(v.internal); }
std::ostream& operator<< (std::ostream& s, RROutput v) { return s << tcu::toHex(v.internal); }
std::ostream& operator<< (std::ostream& s, zx_handle_t v) { return s << tcu::toHex(v.internal); }
std::ostream& operator<< (std::ostream& s, GgpFrameToken v) { return s << tcu::toHex(v.internal); }
s << "\tpNext = " << value.pNext << '\n';
s << "\thandleType = " << value.handleType << '\n';
s << "\thandle = " << value.handle << '\n';
- s << "\tname = " << getCharPtrStr(value.name) << '\n';
+ s << "\tname = " << getWStr(value.name) << '\n';
s << '}';
return s;
}
s << "\tpNext = " << value.pNext << '\n';
s << "\tpAttributes = " << value.pAttributes << '\n';
s << "\tdwAccess = " << value.dwAccess << '\n';
- s << "\tname = " << getCharPtrStr(value.name) << '\n';
+ s << "\tname = " << getWStr(value.name) << '\n';
s << '}';
return s;
}
s << "\tflags = " << getSemaphoreImportFlagsStr(value.flags) << '\n';
s << "\thandleType = " << value.handleType << '\n';
s << "\thandle = " << value.handle << '\n';
- s << "\tname = " << getCharPtrStr(value.name) << '\n';
+ s << "\tname = " << getWStr(value.name) << '\n';
s << '}';
return s;
}
s << "\tpNext = " << value.pNext << '\n';
s << "\tpAttributes = " << value.pAttributes << '\n';
s << "\tdwAccess = " << value.dwAccess << '\n';
- s << "\tname = " << getCharPtrStr(value.name) << '\n';
+ s << "\tname = " << getWStr(value.name) << '\n';
s << '}';
return s;
}
s << "\tflags = " << getFenceImportFlagsStr(value.flags) << '\n';
s << "\thandleType = " << value.handleType << '\n';
s << "\thandle = " << value.handle << '\n';
- s << "\tname = " << getCharPtrStr(value.name) << '\n';
+ s << "\tname = " << getWStr(value.name) << '\n';
s << '}';
return s;
}
s << "\tpNext = " << value.pNext << '\n';
s << "\tpAttributes = " << value.pAttributes << '\n';
s << "\tdwAccess = " << value.dwAccess << '\n';
- s << "\tname = " << getCharPtrStr(value.name) << '\n';
+ s << "\tname = " << getWStr(value.name) << '\n';
s << '}';
return s;
}
const void* pNext;
VkExternalMemoryHandleTypeFlagBits handleType;
pt::Win32Handle handle;
- char* name;
+ pt::Win32LPCWSTR name;
};
struct VkExportMemoryWin32HandleInfoKHR
const void* pNext;
pt::Win32SecurityAttributesPtr pAttributes;
deUint32 dwAccess;
- char* name;
+ pt::Win32LPCWSTR name;
};
struct VkMemoryWin32HandlePropertiesKHR
VkSemaphoreImportFlags flags;
VkExternalSemaphoreHandleTypeFlagBits handleType;
pt::Win32Handle handle;
- char* name;
+ pt::Win32LPCWSTR name;
};
struct VkExportSemaphoreWin32HandleInfoKHR
const void* pNext;
pt::Win32SecurityAttributesPtr pAttributes;
deUint32 dwAccess;
- char* name;
+ pt::Win32LPCWSTR name;
};
struct VkD3D12FenceSubmitInfoKHR
VkFenceImportFlags flags;
VkExternalFenceHandleTypeFlagBits handleType;
pt::Win32Handle handle;
- char* name;
+ pt::Win32LPCWSTR name;
};
struct VkExportFenceWin32HandleInfoKHR
const void* pNext;
pt::Win32SecurityAttributesPtr pAttributes;
deUint32 dwAccess;
- char* name;
+ pt::Win32LPCWSTR name;
};
struct VkFenceGetWin32HandleInfoKHR
(vk::pt::Win32SecurityAttributesPtr)DE_NULL,
DXGI_SHARED_RESOURCE_READ | DXGI_SHARED_RESOURCE_WRITE,
- DE_NULL
+ (vk::pt::Win32LPCWSTR)DE_NULL
};
const vk::VkExportSemaphoreCreateInfo exportCreateInfo=
{
(vk::pt::Win32SecurityAttributesPtr)DE_NULL,
DXGI_SHARED_RESOURCE_READ | DXGI_SHARED_RESOURCE_WRITE,
- DE_NULL
+ (vk::pt::Win32LPCWSTR)DE_NULL
};
const vk::VkExportFenceCreateInfo exportCreateInfo=
{
(vk::pt::Win32SecurityAttributesPtr)DE_NULL,
DXGI_SHARED_RESOURCE_READ | DXGI_SHARED_RESOURCE_WRITE,
- DE_NULL
+ (vk::pt::Win32LPCWSTR)DE_NULL
};
const vk::VkExportMemoryAllocateInfo exportInfo =
{
(requiresDedicated) ? &dedicatedInfo : DE_NULL,
externalType,
handle.getWin32Handle(),
- NULL
+ (vk::pt::Win32LPCWSTR)NULL
};
deUint32 handleCompatibleMemoryTypeBits = ~0u;
flags,
externalType,
handle.getWin32Handle(),
- DE_NULL
+ (vk::pt::Win32LPCWSTR)DE_NULL
};
VK_CHECK(vkd.importFenceWin32HandleKHR(device, &importInfo));
flags,
externalType,
handle.getWin32Handle(),
- DE_NULL
+ (vk::pt::Win32LPCWSTR)DE_NULL
};
VK_CHECK(vkd.importSemaphoreWin32HandleKHR(device, &importInfo));
DE_NULL,
externalType,
handle.getWin32Handle(),
- DE_NULL
+ (vk::pt::Win32LPCWSTR)DE_NULL
};
const vk::VkMemoryDedicatedAllocateInfo dedicatedInfo =
{
(["const", "SECURITY_ATTRIBUTES", "*"], ["Win32SecurityAttributesPtr"], "const void*"),
(["AHardwareBuffer", "*"], ["AndroidHardwareBufferPtr"], "void*"),
(["HMONITOR"], ["Win32MonitorHandle"], "void*"),
+ (["LPCWSTR"], ["Win32LPCWSTR"], "const void*"),
# VK_EXT_acquire_xlib_display
(["RROutput"], ["RROutput"], "void*"),
# Platform-specific
("DWORD", "deUint32"),
("HANDLE*", PLATFORM_TYPE_NAMESPACE + "::" + "Win32Handle*"),
- ("LPCWSTR", "char*"),
]
EXTENSION_POSTFIXES = ["KHR", "EXT", "NV", "NVX", "KHX", "NN", "MVK", "FUCHSIA", "GGP", "AMD"]
valFmt = "get%sStr(value.%s)" % (member.getType()[2:], member.name)
elif member.getType() == "const char*" or member.getType() == "char*":
valFmt = "getCharPtrStr(value.%s)" % member.name
+ elif member.getType() == PLATFORM_TYPE_NAMESPACE + "::Win32LPCWSTR":
+ valFmt = "getWStr(value.%s)" % member.name
elif member.arraySize != '':
if member.name in ["extensionName", "deviceName", "layerName", "description"]:
valFmt = "(const char*)value.%s" % member.name