Fixed GLES3 shader patching.

This commit is contained in:
Branimir Karadžić 2014-03-31 23:17:05 -07:00
parent b4dc2d4ea1
commit c49656c473

View file

@ -1382,8 +1382,8 @@ namespace bgfx
} }
} }
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL >= 31) if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL >= 31) )
|| BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) // || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
{ {
s_textureFormat[TextureFormat::R8].m_internalFmt = GL_R8; s_textureFormat[TextureFormat::R8].m_internalFmt = GL_R8;
s_textureFormat[TextureFormat::R8].m_fmt = GL_RED; s_textureFormat[TextureFormat::R8].m_fmt = GL_RED;
@ -2641,8 +2641,18 @@ namespace bgfx
writeString(&writer, "#define texture2D texture\n"); writeString(&writer, "#define texture2D texture\n");
writeString(&writer, "#define texture2DLod textureLod\n"); writeString(&writer, "#define texture2DLod textureLod\n");
writeString(&writer, "#define texture2DProj textureProj\n"); writeString(&writer, "#define texture2DProj textureProj\n");
writeString(&writer, "#define shadow2D(_sampler, _coord) vec2(textureProj(_sampler, vec4(_coord, 1.0) ) )\n");
writeString(&writer, "#define shadow2DProj(_sampler, _coord) vec2(textureProj(_sampler, _coord) ) )\n"); if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
{
writeString(&writer, "#define shadow2D(_sampler, _coord) vec2(textureProj(_sampler, vec4(_coord, 1.0) ) )\n");
writeString(&writer, "#define shadow2DProj(_sampler, _coord) vec2(textureProj(_sampler, _coord) ) )\n");
}
else
{
writeString(&writer, "#define shadow2D(_sampler, _coord) (textureProj(_sampler, vec4(_coord, 1.0) ) )\n");
writeString(&writer, "#define shadow2DProj(_sampler, _coord) (textureProj(_sampler, _coord) ) )\n");
}
writeString(&writer, "#define texture3D texture\n"); writeString(&writer, "#define texture3D texture\n");
writeString(&writer, "#define texture3DLod textureLod\n"); writeString(&writer, "#define texture3DLod textureLod\n");
writeString(&writer, "#define textureCube texture\n"); writeString(&writer, "#define textureCube texture\n");