fix billboards rendering upside down in macos
This commit is contained in:
parent
c27fa53236
commit
210c44f6c4
@ -556,7 +556,9 @@ vs_gbuffer_billboard_source_metal_macos := u8.[
|
|||||||
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> gsprite [[texture(0)]], sampler gspritesmp [[sampler(0)]])
|
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> gsprite [[texture(0)]], sampler gspritesmp [[sampler(0)]])
|
||||||
{
|
{
|
||||||
main0_out out = {};
|
main0_out out = {};
|
||||||
if (gsprite.sample(gspritesmp, in.uv_in).w < 0.00999999977648258209228515625)
|
float2 _12 = in.uv_in;
|
||||||
|
_12.y = 1.0 - _12.y;
|
||||||
|
if (gsprite.sample(gspritesmp, _12).w < 0.00999999977648258209228515625)
|
||||||
{
|
{
|
||||||
discard_fragment();
|
discard_fragment();
|
||||||
}
|
}
|
||||||
@ -596,24 +598,27 @@ fs_gbuffer_billboard_source_metal_macos := u8.[
|
|||||||
0x70,0x72,0x69,0x74,0x65,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,
|
0x70,0x72,0x69,0x74,0x65,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,
|
||||||
0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,
|
0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,
|
||||||
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,
|
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,
|
||||||
0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x67,0x73,0x70,0x72,0x69,
|
0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x5f,0x31,
|
||||||
0x74,0x65,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x67,0x73,0x70,0x72,0x69,0x74,
|
0x32,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x75,0x76,0x5f,0x69,0x6e,0x3b,0x0a,0x20,0x20,
|
||||||
0x65,0x73,0x6d,0x70,0x2c,0x20,0x69,0x6e,0x2e,0x75,0x76,0x5f,0x69,0x6e,0x29,0x2e,
|
0x20,0x20,0x5f,0x31,0x32,0x2e,0x79,0x20,0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,
|
||||||
0x77,0x20,0x3c,0x20,0x30,0x2e,0x30,0x30,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x37,
|
0x5f,0x31,0x32,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x67,
|
||||||
0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,0x30,0x39,0x32,0x32,0x38,0x35,0x31,0x35,
|
0x73,0x70,0x72,0x69,0x74,0x65,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x67,0x73,
|
||||||
0x36,0x32,0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
0x70,0x72,0x69,0x74,0x65,0x73,0x6d,0x70,0x2c,0x20,0x5f,0x31,0x32,0x29,0x2e,0x77,
|
||||||
0x20,0x20,0x20,0x64,0x69,0x73,0x63,0x61,0x72,0x64,0x5f,0x66,0x72,0x61,0x67,0x6d,
|
0x20,0x3c,0x20,0x30,0x2e,0x30,0x30,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x37,
|
||||||
0x65,0x6e,0x74,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,
|
0x36,0x34,0x38,0x32,0x35,0x38,0x32,0x30,0x39,0x32,0x32,0x38,0x35,0x31,0x35,0x36,
|
||||||
0x20,0x6f,0x75,0x74,0x2e,0x6f,0x75,0x74,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
0x32,0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||||
0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x76,0x69,
|
0x20,0x20,0x64,0x69,0x73,0x63,0x61,0x72,0x64,0x5f,0x66,0x72,0x61,0x67,0x6d,0x65,
|
||||||
0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,
|
0x6e,0x74,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,
|
||||||
0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x6f,0x75,0x74,0x5f,
|
0x6f,0x75,0x74,0x2e,0x6f,0x75,0x74,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
|
||||||
0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,
|
0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x76,0x69,0x65,
|
||||||
0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,
|
0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,
|
||||||
0x69,0x6e,0x2e,0x76,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,0x6e,0x6f,
|
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x6f,0x75,0x74,0x5f,0x6e,
|
||||||
0x72,0x6d,0x61,0x6c,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x66,
|
||||||
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,
|
0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x69,
|
||||||
0x00,
|
0x6e,0x2e,0x76,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,0x6e,0x6f,0x72,
|
||||||
|
0x6d,0x61,0x6c,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||||
|
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||||
|
|
||||||
];
|
];
|
||||||
gbuffer_billboard_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
gbuffer_billboard_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||||
desc: sg_shader_desc;
|
desc: sg_shader_desc;
|
||||||
|
|||||||
@ -47,9 +47,7 @@ layout(location=1) out vec4 out_normal;
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec2 uv = uv_in;
|
vec2 uv = uv_in;
|
||||||
#if SOKOL_GLSL
|
|
||||||
uv.y = 1.0 - uv.y;
|
uv.y = 1.0 - uv.y;
|
||||||
#endif
|
|
||||||
vec4 sampled = texture(sampler2D(gsprite, gspritesmp), uv);
|
vec4 sampled = texture(sampler2D(gsprite, gspritesmp), uv);
|
||||||
if(sampled.a < 0.01) discard;
|
if(sampled.a < 0.01) discard;
|
||||||
out_position = vec4(view_space_pos, 1.0);
|
out_position = vec4(view_space_pos, 1.0);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user