mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-04-02 10:30:07 -04:00
GLES3 fixes.
This commit is contained in:
parent
6afa55381a
commit
2701350b7f
3 changed files with 32 additions and 19 deletions
|
@ -69,7 +69,7 @@ namespace bgfx
|
|||
"<unknown>", // Unknown
|
||||
"R8", // R8
|
||||
"R16", // R16
|
||||
"R16F" // R16F
|
||||
"R16F", // R16F
|
||||
"BGRA8", // BGRA8
|
||||
"RGBA16", // RGBA16
|
||||
"RGBA16F", // RGBA16F
|
||||
|
|
|
@ -1373,13 +1373,14 @@ namespace bgfx
|
|||
}
|
||||
}
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_OPENGL
|
||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL >= 31) )
|
||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL >= 31)
|
||||
|| BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES3) )
|
||||
{
|
||||
s_textureFormat[TextureFormat::R8].m_internalFmt = GL_R8;
|
||||
s_textureFormat[TextureFormat::R8].m_fmt = GL_RED;
|
||||
}
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_OPENGL
|
||||
if (s_extension[Extension::ARB_debug_output].m_supported
|
||||
|| s_extension[Extension::KHR_debug].m_supported)
|
||||
{
|
||||
|
@ -2540,7 +2541,7 @@ namespace bgfx
|
|||
}
|
||||
}
|
||||
|
||||
writeString(&writer, "precision highp float;\n");
|
||||
writeString(&writer, "precision mediump float;\n");
|
||||
|
||||
bx::write(&writer, code, codeLen);
|
||||
bx::write(&writer, '\0');
|
||||
|
@ -2570,14 +2571,7 @@ namespace bgfx
|
|||
memcpy(insert + 2, "fx", 2);
|
||||
}
|
||||
}
|
||||
else if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES3) )
|
||||
{
|
||||
writeString(&writer, "precision highp float;\n");
|
||||
|
||||
bx::write(&writer, code, codeLen);
|
||||
bx::write(&writer, '\0');
|
||||
}
|
||||
else if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL <= 21) )
|
||||
else if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL != 0 && BGFX_CONFIG_RENDERER_OPENGL <= 21) )
|
||||
{
|
||||
bool usesTextureLod = s_extension[Extension::ARB_shader_texture_lod].m_supported
|
||||
&& bx::findIdentifierMatch(code, s_ARB_shader_texture_lod)
|
||||
|
@ -2601,9 +2595,21 @@ namespace bgfx
|
|||
bx::write(&writer, code, codeLen);
|
||||
bx::write(&writer, '\0');
|
||||
}
|
||||
else if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL >= 31) )
|
||||
else if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL >= 31)
|
||||
|| BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES3) )
|
||||
{
|
||||
writeString(&writer, "#version 140\n");
|
||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES3) )
|
||||
{
|
||||
writeString(&writer
|
||||
, "#version 300 es\n"
|
||||
"precision mediump float;\n"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeString(&writer, "#version 140\n");
|
||||
}
|
||||
|
||||
if (_type == GL_FRAGMENT_SHADER)
|
||||
{
|
||||
writeString(&writer, "#define varying in\n");
|
||||
|
@ -2625,11 +2631,14 @@ namespace bgfx
|
|||
writeString(&writer, "#define varying out\n");
|
||||
}
|
||||
|
||||
writeString(&writer
|
||||
, "#define lowp\n"
|
||||
"#define mediump\n"
|
||||
"#define highp\n"
|
||||
);
|
||||
if (!BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES3) )
|
||||
{
|
||||
writeString(&writer
|
||||
, "#define lowp\n"
|
||||
"#define mediump\n"
|
||||
"#define highp\n"
|
||||
);
|
||||
}
|
||||
|
||||
bx::write(&writer, code, codeLen);
|
||||
bx::write(&writer, '\0');
|
||||
|
|
|
@ -99,6 +99,10 @@ typedef uint64_t GLuint64;
|
|||
# define GL_BGRA_EXT 0x80E1
|
||||
#endif // GL_BGRA_EXT
|
||||
|
||||
#ifndef GL_R8
|
||||
# define GL_R8 0x8229
|
||||
#endif // GL_R8
|
||||
|
||||
#ifndef GL_R16
|
||||
# define GL_R16 0x822A
|
||||
#endif // GL_R16
|
||||
|
|
Loading…
Add table
Reference in a new issue