From 8a06463c970dc81704ba1099d5f48cd442557c8b Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 14 Oct 2019 22:30:27 -0400 Subject: [PATCH] android: video_core: Enable HW shadows and texture barrier on GLES. --- .../renderer_opengl/gl_rasterizer.cpp | 4 ++-- .../renderer_opengl/gl_shader_gen.cpp | 21 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index da6731cc04..7170f61c26 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -55,8 +55,8 @@ RasterizerOpenGL::RasterizerOpenGL() texture_buffer(GL_TEXTURE_BUFFER, TEXTURE_BUFFER_SIZE, false), texture_lf_buffer(GL_TEXTURE_BUFFER, TEXTURE_BUFFER_SIZE, false) { - allow_shadow = GLAD_GL_ARB_shader_image_load_store && GLAD_GL_ARB_shader_image_size && - GLAD_GL_ARB_framebuffer_no_attachments; + allow_shadow = GLES || (GLAD_GL_ARB_shader_image_load_store && GLAD_GL_ARB_shader_image_size && + GLAD_GL_ARB_framebuffer_no_attachments); if (!allow_shadow) { LOG_WARNING(Render_OpenGL, "Shadow might not be able to render because of unsupported OpenGL extensions."); diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 4e03922b86..a60d56c1b4 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -1227,14 +1227,21 @@ float ProcTexNoiseCoef(vec2 x) { ShaderDecompiler::ProgramResult GenerateFragmentShader(const PicaFSConfig& config, bool separable_shader) { const auto& state = config.state; + std::string out; - std::string out = R"( + if (GLES) { + out += R"( +#define ALLOW_SHADOW (defined(CITRA_GLES)) +)"; + } else { + out += R"( #extension GL_ARB_shader_image_load_store : enable #extension GL_ARB_shader_image_size : enable #define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) )"; + } - if (separable_shader) { + if (separable_shader && !GLES) { out += "#extension GL_ARB_separate_shader_objects : enable\n"; } @@ -1612,7 +1619,7 @@ do { ShaderDecompiler::ProgramResult GenerateTrivialVertexShader(bool separable_shader) { std::string out; - if (separable_shader) { + if (separable_shader && !GLES) { out += "#extension GL_ARB_separate_shader_objects : enable\n"; } @@ -1655,8 +1662,8 @@ void main() { std::optional GenerateVertexShader( const Pica::Shader::ShaderSetup& setup, const PicaVSConfig& config, bool separable_shader) { - std::string out = ""; - if (separable_shader) { + std::string out; + if (separable_shader && !GLES) { out += "#extension GL_ARB_separate_shader_objects : enable\n"; } @@ -1805,8 +1812,8 @@ void EmitPrim(Vertex vtx0, Vertex vtx1, Vertex vtx2) { ShaderDecompiler::ProgramResult GenerateFixedGeometryShader(const PicaFixedGSConfig& config, bool separable_shader) { - std::string out = ""; - if (separable_shader) { + std::string out; + if (separable_shader && !GLES) { out += "#extension GL_ARB_separate_shader_objects : enable\n\n"; }