webgl: Fix precision issues with default shaders

This commit is contained in:
rdb 2024-11-03 23:58:28 +01:00
parent f4d9a67888
commit 8ff71aeb15
1 changed files with 13 additions and 3 deletions

View File

@ -189,16 +189,22 @@ static const string default_vshader =
"in vec4 p3d_MultiTexCoord0;\n"
"out vec3 texcoord;\n"
"out vec4 color;\n"
"uniform mat4 p3d_ModelViewProjectionMatrix;\n"
#else
"#version 100\n"
"precision mediump float;\n"
"attribute vec4 p3d_Vertex;\n"
"attribute vec4 p3d_Color;\n"
"attribute vec4 p3d_MultiTexCoord0;\n"
"varying vec3 texcoord;\n"
"varying lowp vec4 color;\n"
#endif
"#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
"varying highp vec3 texcoord;\n"
"uniform highp mat4 p3d_ModelViewProjectionMatrix;\n"
"#else\n"
"varying mediump vec3 texcoord;\n"
"uniform mat4 p3d_ModelViewProjectionMatrix;\n"
"#endif\n"
#endif
"uniform mat4 p3d_TextureMatrix;\n"
"uniform vec4 p3d_ColorScale;\n"
"void main(void) {\n"
@ -266,7 +272,11 @@ static const string default_fshader =
#else
"#version 100\n"
"precision mediump float;\n"
"varying vec3 texcoord;\n"
"#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
"varying highp vec3 texcoord;\n"
"#else\n"
"varying mediump vec3 texcoord;\n"
"#endif\n"
"varying lowp vec4 color;\n"
"uniform lowp sampler2D p3d_Texture0;\n"
"uniform lowp vec4 p3d_TexAlphaOnly;\n"