Open k4G17eYWI opened 6 months ago
There's this code in GraphicsDevice.ActivateShaderProgram that flips the render target vertically for OpenGL:
//If we have a render target bound (rendering offscreen)
if (IsRenderTargetBound)
{
//flip vertically
_posFixup[1] *= -1.0f;
_posFixup[3] *= -1.0f;
}
Either this is not working for Android, or, for whatever reason, it's not needed in Android.
It looks like the posFixup parameter is not added to the shader code when compiling a shader for Android, so the flip code above doesn't even run.
Is it fixable?
That posFixup parameter gets inserted (or should get inserted) in MGFXC, so it should be fixable.
I pushed a fix for this to MonoGame.Effect.Compiler, but there are no updated Nugets yet.
Prerequisites
develop
branchMonoGame Version
3.8.3
Which MonoGame platform are you using?
MonoGame Android Application (mgandroid)
Operating System
WIndows, Android
Description
I'm drawing on a texture. After switching to 5_0 shaders from 3_0 my textures draws upside down but only on Android. On a desktop it draws as "normal" in without flipping vertically. I have same FX file for Android and Desktop without any platform definitions.
What could cauise such diffirecies in behaviuor and how to deal them? I could detect platform and flip Y optionaly but Y want to wind out the reason.
Steps to Reproduce
Set texture as a RenderTarget
Set transform
Load shader
AppAndroid.csproj:
AppDesktop.csproj:
Minimal Example Repo
No response
Expected Behavior
Texture Y axis should be same on Android and Desktop or we need a clarification how to deal with it.
Resulting Behavior
Texture Y axis should be same on Android and Desktop or we need a clarification how to deal with it.
Files
No response