Move Apple GL2.0 forcing to a common place.

This commit is contained in:
Unknown W. Brackets 2016-08-08 17:55:45 -07:00
parent 6088c7d5f5
commit 086dc9e0ed
4 changed files with 9 additions and 20 deletions

View File

@ -15,14 +15,6 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
// SDL 1.2 on Apple does not have support for OpenGL 3 and hence needs
// special treatment in the shader generator.
#if defined(__APPLE__)
const bool forceOpenGL2_0 = true;
#else
const bool forceOpenGL2_0 = false;
#endif
#include <cstdio>
#include <sstream>
@ -116,8 +108,7 @@ bool GenerateFragmentShader(const ShaderID &id, char *buffer) {
WRITE(p, "precision lowp float;\n");
} else {
// TODO: Handle this in VersionGEThan?
if (!forceOpenGL2_0 || gl_extensions.IsCoreContext) {
if (!gl_extensions.ForceGL2 || gl_extensions.IsCoreContext) {
if (gl_extensions.VersionGEThan(3, 3, 0)) {
fragColor0 = "fragColor0";
texture = "texture";

View File

@ -34,14 +34,6 @@
#include "GPU/Common/ShaderId.h"
#include "GPU/Common/VertexDecoderCommon.h"
// SDL 1.2 on Apple does not have support for OpenGL 3 and hence needs
// special treatment in the shader generator.
#if defined(__APPLE__)
const bool forceOpenGL2_0 = true;
#else
const bool forceOpenGL2_0 = false;
#endif
#undef WRITE
#define WRITE p+=sprintf
@ -130,8 +122,7 @@ void GenerateVertexShader(const ShaderID &id, char *buffer) {
highpFog = (gl_extensions.bugs & BUG_PVR_SHADER_PRECISION_BAD) ? true : false;
highpTexcoord = highpFog;
} else {
// TODO: Handle this in VersionGEThan?
if (!forceOpenGL2_0 || gl_extensions.IsCoreContext) {
if (!gl_extensions.ForceGL2 || gl_extensions.IsCoreContext) {
if (gl_extensions.VersionGEThan(3, 3, 0)) {
glslES30 = true;
WRITE(p, "#version 330\n");

View File

@ -379,6 +379,12 @@ void CheckGLExtensions() {
gl_extensions.ARB_vertex_array_object = true;
gl_extensions.ARB_framebuffer_object = true;
}
#ifdef __APPLE__
if (!gl_extensions.IsGLES && !gl_extensions.IsCoreContext) {
// Apple doesn't allow OpenGL 3.x+ in compatibility contexts.
gl_extensions.ForceGL2 = true;
}
#endif
ProcessGPUFeatures();

View File

@ -37,6 +37,7 @@ struct GLExtensions {
bool IsGLES;
bool IsCoreContext;
bool GLES3; // true if the full OpenGL ES 3.0 is supported
bool ForceGL2;
// OES
bool OES_depth24;