SDL icon indicating copy to clipboard operation
SDL copied to clipboard

GPU Vulkan renderer doesn't respect Landscape

Open slouken opened this issue 1 year ago • 2 comments

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.

slouken avatar Oct 25 '24 21:10 slouken

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

slime73 avatar Oct 25 '24 22:10 slime73

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.

rabbit-ecl avatar Oct 27 '24 03:10 rabbit-ecl

This was fixed in SDL 3.2.6, in https://github.com/libsdl-org/SDL/commit/ea513fd47c6a28cd50e5e9f8f053c98127f8c883.

slouken avatar Mar 14 '25 06:03 slouken