android: video_core: Enable HW shadows and texture barrier on GLES.

This commit is contained in:
bunnei 2019-10-14 22:30:27 -04:00 committed by SachinVin
parent e028eb91c0
commit 8a06463c97
2 changed files with 16 additions and 9 deletions

View file

@ -55,8 +55,8 @@ RasterizerOpenGL::RasterizerOpenGL()
texture_buffer(GL_TEXTURE_BUFFER, TEXTURE_BUFFER_SIZE, false), texture_buffer(GL_TEXTURE_BUFFER, TEXTURE_BUFFER_SIZE, false),
texture_lf_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 && allow_shadow = GLES || (GLAD_GL_ARB_shader_image_load_store && GLAD_GL_ARB_shader_image_size &&
GLAD_GL_ARB_framebuffer_no_attachments; GLAD_GL_ARB_framebuffer_no_attachments);
if (!allow_shadow) { if (!allow_shadow) {
LOG_WARNING(Render_OpenGL, LOG_WARNING(Render_OpenGL,
"Shadow might not be able to render because of unsupported OpenGL extensions."); "Shadow might not be able to render because of unsupported OpenGL extensions.");

View file

@ -1227,14 +1227,21 @@ float ProcTexNoiseCoef(vec2 x) {
ShaderDecompiler::ProgramResult GenerateFragmentShader(const PicaFSConfig& config, ShaderDecompiler::ProgramResult GenerateFragmentShader(const PicaFSConfig& config,
bool separable_shader) { bool separable_shader) {
const auto& state = config.state; 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_load_store : enable
#extension GL_ARB_shader_image_size : enable #extension GL_ARB_shader_image_size : enable
#define ALLOW_SHADOW (defined(GL_ARB_shader_image_load_store) && defined(GL_ARB_shader_image_size)) #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"; out += "#extension GL_ARB_separate_shader_objects : enable\n";
} }
@ -1612,7 +1619,7 @@ do {
ShaderDecompiler::ProgramResult GenerateTrivialVertexShader(bool separable_shader) { ShaderDecompiler::ProgramResult GenerateTrivialVertexShader(bool separable_shader) {
std::string out; std::string out;
if (separable_shader) { if (separable_shader && !GLES) {
out += "#extension GL_ARB_separate_shader_objects : enable\n"; out += "#extension GL_ARB_separate_shader_objects : enable\n";
} }
@ -1655,8 +1662,8 @@ void main() {
std::optional<ShaderDecompiler::ProgramResult> GenerateVertexShader( std::optional<ShaderDecompiler::ProgramResult> GenerateVertexShader(
const Pica::Shader::ShaderSetup& setup, const PicaVSConfig& config, bool separable_shader) { const Pica::Shader::ShaderSetup& setup, const PicaVSConfig& config, bool separable_shader) {
std::string out = ""; std::string out;
if (separable_shader) { if (separable_shader && !GLES) {
out += "#extension GL_ARB_separate_shader_objects : enable\n"; 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, ShaderDecompiler::ProgramResult GenerateFixedGeometryShader(const PicaFixedGSConfig& config,
bool separable_shader) { bool separable_shader) {
std::string out = ""; std::string out;
if (separable_shader) { if (separable_shader && !GLES) {
out += "#extension GL_ARB_separate_shader_objects : enable\n\n"; out += "#extension GL_ARB_separate_shader_objects : enable\n\n";
} }