Prerequisites
MonoGame 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
var m = Matrix.CreateScale(
1f / texture.width * 2,
1f / texture.height * 2,
1
);
var t = Matrix.CreateTranslation(-1, -1, 0);
var s = Matrix.CreateScale(1, -1, 1);
SetTransform(m * t * s);
- Load shader
#define VS_SHADERMODEL vs_5_0
#define PS_SHADERMODEL ps_5_0
matrix Transform;
Texture2D MainTex; // primary texture.
SamplerState MySampler
{
magfilter = Point;
minfilter = Point;
mipfilter = Point;
AddressU = Clamp;
AddressV = Clamp;
};
struct VsInputQuad
{
float4 Position : POSITION0;
float4 Color : COLOR0;
float2 TexureCoordinateA : TEXCOORD0;
};
struct VsOutputQuad
{
float4 Position : SV_POSITION0;
float4 Color : COLOR0;
float2 TexureCoordinateA : TEXCOORD0;
};
struct PsOutputQuad
{
float4 Color : SV_TARGET;
};
// ____________________________
VsOutputQuad VertexShaderQuadDraw(VsInputQuad input)
{
VsOutputQuad output;
output.Position = mul(input.Position, Transform); // Transform by WorldViewProjection
output.Color = input.Color;
output.TexureCoordinateA = input.TexureCoordinateA;
return output;
}
PsOutputQuad PixelShaderQuadDraw(VsOutputQuad input)
{
PsOutputQuad output;
output.Color = MainTex.Sample(MySampler, input.TexureCoordinateA) * input.Color;
return output;
}
technique Draw
{
pass
{
VertexShader = compile VS_SHADERMODEL VertexShaderQuadDraw();
PixelShader = compile PS_SHADERMODEL PixelShaderQuadDraw();
}
}
- Draw some geometry on it on a desktop and Android platform and compare results. Resulting textures will be interflipped vertically.
AppAndroid.csproj:
<PackageReference Include="MonoGame.Framework.Compute.Android" Version="3.8.3" />
<PackageReference Include="MonoGame.Content.Builder.Task.Compute" Version="3.8.3" />
AppDesktop.csproj:
<PackageReference Include="MonoGame.Framework.Compute.DesktopGL" Version="3.8.3"/>
<PackageReference Include="MonoGame.Content.Builder.Task.Compute" Version="3.8.3"/>
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
Prerequisites
developbranchMonoGame 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
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