GLES: Cut down on use of USING_GLES2.

This commit is contained in:
Unknown W. Brackets 2018-06-17 20:51:34 -07:00
parent da5f0f7f2b
commit 03edd6129a
6 changed files with 18 additions and 32 deletions

View File

@ -25,15 +25,10 @@
#include "GPU/GLES/TextureCacheGLES.h"
#include "GPU/Common/DepalettizeShaderCommon.h"
#ifdef _WIN32
#define SHADERLOG
#endif
static const char *depalVShader100 =
#ifdef USING_GLES2
"#version 100\n"
"#ifdef GL_ES\n"
"precision highp float;\n"
#endif
"#endif\n"
"attribute vec4 a_position;\n"
"attribute vec2 a_texcoord0;\n"
"varying vec2 v_texcoord0;\n"
@ -43,12 +38,9 @@ static const char *depalVShader100 =
"}\n";
static const char *depalVShader300 =
#ifdef USING_GLES2
"#version 300 es\n"
"#ifdef GL_ES\n"
"precision highp float;\n"
#else
"#version 330\n"
#endif
"#endif\n"
"in vec4 a_position;\n"
"in vec2 a_texcoord0;\n"
"out vec2 v_texcoord0;\n"
@ -76,7 +68,13 @@ void DepalShaderCacheGLES::DeviceRestore(Draw::DrawContext *draw) {
bool DepalShaderCacheGLES::CreateVertexShader() {
std::string src(useGL3_ ? depalVShader300 : depalVShader100);
vertexShader_ = render_->CreateShader(GL_VERTEX_SHADER, src, "depal");
std::string prelude;
if (gl_extensions.IsGLES) {
prelude = useGL3_ ? "#version 300 es\n" : "#version 100\n";
} else if (useGL3_) {
prelude = "#version 330\n";
}
vertexShader_ = render_->CreateShader(GL_VERTEX_SHADER, prelude + src, "depal");
return true;
}

View File

@ -54,9 +54,9 @@ static const char tex_fs[] =
"#define gl_FragColor fragColor0\n"
"out vec4 fragColor0;\n"
"#endif\n"
#ifdef USING_GLES2
"#ifdef GL_ES\n"
"precision mediump float;\n"
#endif
"#endif\n"
"uniform sampler2D sampler0;\n"
"varying vec2 v_texcoord0;\n"
"void main() {\n"

View File

@ -55,9 +55,7 @@ static const char tex_fs[] =
"}\n";
static const char basic_vs[] =
#ifndef USING_GLES2
"#version 120\n"
#endif
"attribute vec4 a_position;\n"
"attribute vec2 a_texcoord0;\n"
"uniform mat4 u_viewproj;\n"

View File

@ -36,9 +36,7 @@ static const char preview_fs[] =
"}\n";
static const char preview_vs[] =
#ifndef USING_GLES2
"#version 120\n"
#endif
"attribute vec4 a_position;\n"
"uniform mat4 u_viewproj;\n"
"void main() {\n"

View File

@ -347,11 +347,10 @@ public:
return caps_;
}
uint32_t GetSupportedShaderLanguages() const override {
#if defined(USING_GLES2)
return (uint32_t)ShaderLanguage::GLSL_ES_200 | (uint32_t)ShaderLanguage::GLSL_ES_300;
#else
return (uint32_t)ShaderLanguage::GLSL_ES_200 | (uint32_t)ShaderLanguage::GLSL_410;
#endif
if (gl_extensions.IsGLES)
return (uint32_t)ShaderLanguage::GLSL_ES_200 | (uint32_t)ShaderLanguage::GLSL_ES_300;
else
return (uint32_t)ShaderLanguage::GLSL_ES_200 | (uint32_t)ShaderLanguage::GLSL_410;
}
uint32_t GetDataFormatSupport(DataFormat fmt) const override;
@ -1163,11 +1162,8 @@ uint32_t OpenGLContext::GetDataFormatSupport(DataFormat fmt) const {
case DataFormat::B4G4R4A4_UNORM_PACK16:
return FMT_RENDERTARGET | FMT_TEXTURE | FMT_AUTOGEN_MIPS; // native support
case DataFormat::A4R4G4B4_UNORM_PACK16:
#ifndef USING_GLES2
// Can support this if _REV formats are supported.
return FMT_TEXTURE;
#endif
return 0;
return gl_extensions.IsGLES ? 0 : FMT_TEXTURE;
case DataFormat::R8G8B8A8_UNORM:
return FMT_RENDERTARGET | FMT_TEXTURE | FMT_INPUTLAYOUT | FMT_AUTOGEN_MIPS;

View File

@ -350,11 +350,7 @@ int main(int argc, const char* argv[])
g_Config.bAutoSaveSymbolMap = false;
g_Config.iRenderingMode = 1;
g_Config.bHardwareTransform = true;
#ifdef USING_GLES2
g_Config.iAnisotropyLevel = 0;
#else
g_Config.iAnisotropyLevel = 0; // When testing mipmapping we really don't want this.
#endif
g_Config.bVertexCache = true;
g_Config.bTrueColor = true;
g_Config.iLanguage = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;