Skip to content

Problem with shaders on iPad #2482

Answered by rh101
IcemarkUK asked this question in Q&A
Mar 27, 2025 · 3 comments · 9 replies
Discussion options

You must be logged in to vote

I'm not sure if this would have anything to do with the issue, but it looks like there may be a divide by zero, which leads to undefined behaviour:

    // convert to non-PMA
    fragRGB = saturate(fragRGB / c.a);
    
    if(c.a!=0.0)
    {
...

Moving that saturate call would fix it, but I'm not sure if it changes the behaviour of the shader, and if it does, then you would need to refactor the shader to get the correct output:

#version 310 es
precision highp float;
precision highp int;

layout(location = COLOR0) in vec4 v_color;
layout(location = TEXCOORD0) in vec2 v_texCoord;

layout(location = SV_Target0) out vec4 FragColor;

layout(binding = 0) uniform sampler2D u_tex0;

layout(std140…

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@IcemarkUK
Comment options

@IcemarkUK
Comment options

@rh101
Comment options

rh101 Mar 28, 2025
Collaborator

@IcemarkUK
Comment options

@IcemarkUK
Comment options

Comment options

You must be logged in to vote
2 replies
@IcemarkUK
Comment options

@rh101
Comment options

rh101 Mar 28, 2025
Collaborator

Answer selected by IcemarkUK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants