From c49656c4736bf89646bdb3565b6196669c890648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Mon, 31 Mar 2014 23:17:05 -0700 Subject: [PATCH] Fixed GLES3 shader patching. --- src/renderer_gl.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 4c57655f..e5a058e8 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -1382,8 +1382,8 @@ namespace bgfx } } - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL >= 31) - || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL >= 31) ) +// || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) { s_textureFormat[TextureFormat::R8].m_internalFmt = GL_R8; s_textureFormat[TextureFormat::R8].m_fmt = GL_RED; @@ -2641,8 +2641,18 @@ namespace bgfx writeString(&writer, "#define texture2D texture\n"); writeString(&writer, "#define texture2DLod textureLod\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 texture3DLod textureLod\n"); writeString(&writer, "#define textureCube texture\n");