We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5436 - MSVC 2019 ARM64 build fails to compile SDL_stretch.c
Summary: MSVC 2019 ARM64 build fails to compile SDL_stretch.c
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: ARM Windows 10
: P2 major
Assignee: Sylvain
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.16
Depends on:
Blocks:
 
Reported: 2021-01-02 18:18 UTC by Cameron Gutman
Modified: 2021-01-03 17:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron Gutman 2021-01-02 18:18:48 UTC
When using latest Hg (4e341e1fdf2ac5f3309a4b12d99ae281172958ab), my ARM64 build is failing in the NEON codepaths in SDL_stretch.c.

To reproduce:
1. Open VisualC\SDL.sln in Visual Studio 2019 (make sure ARM64 toolchain is installed - I don't think it is by default).
2. It will probably ask you to retarget the projects. If not, right click the solution in the Solution Explorer pane and click "Retarget Solution"
3. To add the ARM64 target, go to the Build menu and choose Configuration Manager
4. In the Active solution platform combobox, click New, select ARM64 for the new platform and copy settings from x64, then click OK.
5. Press F7 to build.

Full error list:
SDL\src\video\SDL_stretch.c(827,38): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(828,38): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(849,12): error C2440: 'type cast': cannot convert from 'uint8x8_t' to 'uint32x2_t'
SDL\src\video\SDL_stretch.c(849,12): error C2440: 'function': cannot convert from 'int' to '__n64'
SDL\src\video\SDL_stretch.c(849,12): warning C4024: 'neon_umov32': different types for formal and actual parameter 1
SDL\src\video\SDL_stretch.c(849,12): error C2168: 'neon_umov32': too few actual parameters for intrinsic function
SDL\src\video\SDL_stretch.c(914,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(915,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(916,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(917,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(918,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(919,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(920,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(921,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(973,18): error C2440: 'type cast': cannot convert from 'uint8x8_t' to 'uint32x2_t'
SDL\src\video\SDL_stretch.c(973,18): error C2168: 'neon_combine': too few actual parameters for intrinsic function
SDL\src\video\SDL_stretch.c(1012,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(1013,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(1014,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(1015,51): error C2440: 'type cast': cannot convert from '__n64' to 'uint8x8_t'
SDL\src\video\SDL_stretch.c(1046,13): error C2440: 'type cast': cannot convert from 'uint8x8_t' to 'uint32x2_t'
SDL\src\video\SDL_stretch.c(1046,13): error C2168: 'neon_st1m_32': too few actual parameters for intrinsic function
Comment 1 Sylvain 2021-01-02 21:33:25 UTC
There is a define to deactivate the ARM path:
I think it failed for me also when using Visual Studio 2017,

This should fix the issue:
https://hg.libsdl.org/SDL/rev/4cab0e41f54d
Comment 2 Cameron Gutman 2021-01-02 23:25:37 UTC
Yep, that fixes it.

It would be nice to make the NEON codepath compatible with MSVC, but at least the build isn't broken now.
Comment 3 Sylvain 2021-01-03 14:27:23 UTC
Thanks for the feedback.

I've pushed: https://hg.libsdl.org/SDL/rev/95db7a3671dc
now compilation works but I didn't try as I have no arm device for window.
it's only a matter of casting that visual studio doesn't like
Can you try it ? (which window device has NEON btw ?)
Comment 4 Cameron Gutman 2021-01-03 15:57:38 UTC
Sure, I can try it.

What should I test? Do you have a test app, or does one of the SDL tests exercise this functionality?

The device I have is the Surface Pro X, but there are a few other ARM64 Windows devices on the market too.
Comment 5 Sylvain 2021-01-03 16:41:22 UTC
Ok great, in short, you can use your app with:

window has the flag SDL_WINDOW_RESIZABLE

set the hint to use software renderer and "best" scale quality:

SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best");
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");

set a logical size to your window size,
SDL_RenderSetLogicalSize(renderer, w , h); 

and resize the window manually !
Comment 6 Cameron Gutman 2021-01-03 17:05:52 UTC
It seems to work fine. Not seeing any noticeable scaling artifacts or anything.

Thanks!
Comment 7 Sylvain 2021-01-03 17:16:04 UTC
ok great ! thanks !