Skip to content

Commit

Permalink
[windows] Support win_debug_x86 compilation target in engine (flutter…
Browse files Browse the repository at this point in the history
  • Loading branch information
eggfly authored Mar 16, 2022
1 parent ce9eef7 commit 9f13454
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 29 deletions.
4 changes: 4 additions & 0 deletions shell/gpu/gpu_surface_gl_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ static bool IsProcResolverOpenGLES(
#define GPU_GL_VERSION 0x1F02
constexpr char kGLESVersionPrefix[] = "OpenGL ES";

#ifdef WIN32
using GLGetStringProc = const char*(__stdcall*)(uint32_t);
#else
using GLGetStringProc = const char* (*)(uint32_t);
#endif

GLGetStringProc gl_get_string =
reinterpret_cast<GLGetStringProc>(proc_resolver("glGetString"));
Expand Down
4 changes: 2 additions & 2 deletions shell/platform/windows/keyboard_win32_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ class MockKeyboardManagerWin32Delegate
forged_message_expectations_.front();
forged_message_expectations_.pop_front();
EXPECT_EQ(expectation.message.message, Msg);
EXPECT_EQ(expectation.message.wParam, wParam & 0xffffffff);
EXPECT_EQ(expectation.message.lParam, lParam & 0xffffffff);
EXPECT_EQ(expectation.message.wParam, wParam);
EXPECT_EQ(expectation.message.lParam, lParam);
if (expectation.message.expected_result != kWmResultDontCheck) {
EXPECT_EQ(expectation.message.expected_result,
handled ? kWmResultZero : kWmResultDefault);
Expand Down
32 changes: 16 additions & 16 deletions shell/platform/windows/testing/wm_builders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace flutter {
namespace testing {

Win32Message WmKeyDownInfo::Build(LRESULT expected_result) {
uint32_t lParam = (repeat_count << 0) | (scan_code << 16) | (extended << 24) |
(prev_state << 30);
LPARAM lParam = (repeat_count << 0) | (scan_code << 16) | (extended << 24) |
(prev_state << 30);
return Win32Message{
.message = WM_KEYDOWN,
.wParam = key,
Expand All @@ -19,9 +19,9 @@ Win32Message WmKeyDownInfo::Build(LRESULT expected_result) {
}

Win32Message WmKeyUpInfo::Build(LRESULT expected_result) {
uint32_t lParam = (1 /* repeat_count */ << 0) | (scan_code << 16) |
(extended << 24) | (!overwrite_prev_state_0 << 30) |
(1 /* transition */ << 31);
LPARAM lParam = (1 /* repeat_count */ << 0) | (scan_code << 16) |
(extended << 24) | (!overwrite_prev_state_0 << 30) |
(1 /* transition */ << 31);
return Win32Message{
.message = WM_KEYUP,
.wParam = key,
Expand All @@ -31,9 +31,9 @@ Win32Message WmKeyUpInfo::Build(LRESULT expected_result) {
}

Win32Message WmCharInfo::Build(LRESULT expected_result) {
uint32_t lParam = (repeat_count << 0) | (scan_code << 16) | (extended << 24) |
(bit25 << 25) | (context << 29) | (prev_state << 30) |
(transition << 31);
LPARAM lParam = (repeat_count << 0) | (scan_code << 16) | (extended << 24) |
(bit25 << 25) | (context << 29) | (prev_state << 30) |
(transition << 31);
return Win32Message{
.message = WM_CHAR,
.wParam = char_code,
Expand All @@ -43,9 +43,9 @@ Win32Message WmCharInfo::Build(LRESULT expected_result) {
}

Win32Message WmSysKeyDownInfo::Build(LRESULT expected_result) {
uint32_t lParam = (repeat_count << 0) | (scan_code << 16) | (extended << 24) |
(context << 29) | (prev_state << 30) |
(0 /* transition */ << 31);
LPARAM lParam = (repeat_count << 0) | (scan_code << 16) | (extended << 24) |
(context << 29) | (prev_state << 30) |
(0 /* transition */ << 31);
return Win32Message{
.message = WM_SYSKEYDOWN,
.wParam = key,
Expand All @@ -55,9 +55,9 @@ Win32Message WmSysKeyDownInfo::Build(LRESULT expected_result) {
}

Win32Message WmSysKeyUpInfo::Build(LRESULT expected_result) {
uint32_t lParam = (1 /* repeat_count */ << 0) | (scan_code << 16) |
(extended << 24) | (context << 29) |
(1 /* prev_state */ << 30) | (1 /* transition */ << 31);
LPARAM lParam = (1 /* repeat_count */ << 0) | (scan_code << 16) |
(extended << 24) | (context << 29) |
(1 /* prev_state */ << 30) | (1 /* transition */ << 31);
return Win32Message{
.message = WM_SYSKEYUP,
.wParam = key,
Expand All @@ -67,8 +67,8 @@ Win32Message WmSysKeyUpInfo::Build(LRESULT expected_result) {
}

Win32Message WmDeadCharInfo::Build(LRESULT expected_result) {
uint32_t lParam = (repeat_count << 0) | (scan_code << 16) | (extended << 24) |
(context << 30) | (prev_state << 30) | (transition << 31);
LPARAM lParam = (repeat_count << 0) | (scan_code << 16) | (extended << 24) |
(context << 30) | (prev_state << 30) | (transition << 31);
return Win32Message{
.message = WM_DEADCHAR,
.wParam = char_code,
Expand Down
4 changes: 4 additions & 0 deletions third_party/txt/src/utils/WindowsUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ inline unsigned int clz_win(unsigned int num) {

inline unsigned int clzl_win(unsigned long num) {
unsigned long r = 0;
#if defined(_WIN64)
_BitScanReverse64(&r, num);
#else
_BitScanReverse(&r, num);
#endif
return r;
}

Expand Down
7 changes: 4 additions & 3 deletions tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def to_command_line(gn_args):
return [merge(x, y) for x, y in gn_args.items()]

def cpu_for_target_arch(arch):
if arch in ['ia32', 'arm', 'armv6', 'armv5te', 'mips',
if arch in ['ia32', 'x86', 'arm', 'armv6', 'armv5te', 'mips',
'simarm', 'simarmv6', 'simarmv5te', 'simmips', 'simdbc',
'armsimdbc']:
return 'x86'
Expand Down Expand Up @@ -208,7 +208,7 @@ def to_gn_args(args):
if runtime_mode == 'debug':
gn_args['dart_runtime_mode'] = 'develop'
elif runtime_mode == 'jit_release':
gn_args['dart_runtime_mode'] = 'release';
gn_args['dart_runtime_mode'] = 'release'
else:
gn_args['dart_runtime_mode'] = runtime_mode

Expand Down Expand Up @@ -446,11 +446,12 @@ def parse_args(args):
parser.add_argument('--simulator', action='store_true', default=False)
parser.add_argument('--linux', dest='target_os', action='store_const', const='linux')
parser.add_argument('--fuchsia', dest='target_os', action='store_const', const='fuchsia')
parser.add_argument('--windows', dest='target_os', action='store_const', const='win')
parser.add_argument('--winuwp', dest='target_os', action='store_const', const='winuwp')

parser.add_argument('--linux-cpu', type=str, choices=['x64', 'x86', 'arm64', 'arm'])
parser.add_argument('--fuchsia-cpu', type=str, choices=['x64', 'arm64'], default = 'x64')
parser.add_argument('--windows-cpu', type=str, choices=['x64', 'arm64'], default = 'x64')
parser.add_argument('--windows-cpu', type=str, choices=['x64', 'arm64', 'x86'], default = 'x64')
parser.add_argument('--simulator-cpu', type=str, choices=['x64', 'arm64'], default = 'x64')
parser.add_argument('--arm-float-abi', type=str, choices=['hard', 'soft', 'softfp'])

Expand Down
19 changes: 11 additions & 8 deletions vulkan/vulkan_debug_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,17 @@ static const char* VkDebugReportObjectTypeEXTToString(
}

static VKAPI_ATTR VkBool32
OnVulkanDebugReportCallback(VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT object_type,
uint64_t object,
size_t location,
int32_t message_code,
const char* layer_prefix,
const char* message,
void* user_data) {
#ifdef WIN32
__stdcall
#endif
OnVulkanDebugReportCallback(VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT object_type,
uint64_t object,
size_t location,
int32_t message_code,
const char* layer_prefix,
const char* message,
void* user_data) {
std::vector<std::pair<std::string, std::string>> items;

items.emplace_back("Severity", VkDebugReportFlagsEXTToString(flags));
Expand Down

0 comments on commit 9f13454

Please sign in to comment.