libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.83k stars 1.82k forks source link

GPU Vulkan renderer doesn't respect Landscape #11334

Open slouken opened 2 days ago

slouken commented 2 days ago

I'm not sure what the application expectation is when using the GPU API on Android, but prerotation is currently unimplemented, so all applications render in portrait mode on some devices, such as the Huawei P30, regardless of the actual orientation of the device.

This was an issue for the Vulkan renderer in https://github.com/libsdl-org/SDL/issues/10318 and @danginsburg fixed it in https://github.com/libsdl-org/SDL/commit/4f160d69a64bd5c7d444d333c744b167d0d347a0. I don't know if this needs to be a GPU implementation fix or a GPU render driver fix, but something similar needs to be done there.

slime73 commented 2 days ago

In larger apps, properly supporting prerotation puts a large burden on the app developer because they need to customize their shaders to work with it (any code that uses shader derivatives will need to have extra code to rotate the derivatives based on the current rotation, for example).

It'd be nice if automatic (but potentially slower on some devices) rotation was the default, and pre-rotation was opt-in via a SDL_GPU creation property - or vice versa I suppose, but I'm a fan of "works by default".

The automatic method might just need this one line change: https://github.com/libsdl-org/SDL/issues/10318#issuecomment-2427611891

rabbit-ecl commented 1 day ago

I agree that the does-what-you-expect behavior should be default. This might need an additional outparam in SDL_AcquireGPUSwapchainTexture as was done for the texture size.