gsdx ogl: don't rely on GL_ES builtin (3 differents implementations...). Hopefully fix Linux Intel GPU.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5808 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2014-01-11 15:01:13 +00:00
parent b5cad8bd6a
commit f5257b2c3c
7 changed files with 35 additions and 32 deletions

View File

@ -406,11 +406,14 @@ std::string GSShaderOGL::GenGlslHeader(const std::string& entry, GLenum type, co
header += "#define DISABLE_GL42_image\n";
#endif
#ifndef ENABLE_GLES
// Some driver define the MACRO to 0, others keep it undefined...
header += "#ifndef GL_ES\n";
header += "#define GL_ES 0\n";
header += "#endif\n";
// Stupid GL implementation (can't use GL_ES)
// AMD/nvidia define it to 0
// intel window don't define it
// intel linux refuse to define it
#ifdef ENABLE_GLES
header += "#define pGL_ES 1\n";
#else
header += "#define pGL_ES 0\n";
#endif
// Allow to puts several shader in 1 files

View File

@ -9,7 +9,7 @@ struct vertex_basic
#ifdef VERTEX_SHADER
#if !GL_ES && __VERSION__ > 140
#if !pGL_ES && __VERSION__ > 140
out gl_PerVertex {
vec4 gl_Position;
float gl_PointSize;
@ -28,7 +28,7 @@ layout(location = 1) in vec2 TEXCOORD0;
// smooth, the default, means to do perspective-correct interpolation.
//
// The centroid qualifier only matters when multisampling. If this qualifier is not present, then the value is interpolated to the pixel's center, anywhere in the pixel, or to one of the pixel's samples. This sample may lie outside of the actual primitive being rendered, since a primitive can cover only part of a pixel's area. The centroid qualifier is used to prevent this; the interpolation point must fall within both the pixel's area and the primitive's area.
#if !GL_ES && __VERSION__ > 140
#if !pGL_ES && __VERSION__ > 140
out SHADER
{
@ -64,7 +64,7 @@ void vs_main()
#ifdef FRAGMENT_SHADER
#if !GL_ES && __VERSION__ > 140
#if !pGL_ES && __VERSION__ > 140
in SHADER
{

View File

@ -34,7 +34,7 @@ static const char* convert_glsl =
"\n"
"#ifdef VERTEX_SHADER\n"
"\n"
"#if !GL_ES && __VERSION__ > 140\n"
"#if !pGL_ES && __VERSION__ > 140\n"
"out gl_PerVertex {\n"
" vec4 gl_Position;\n"
" float gl_PointSize;\n"
@ -53,7 +53,7 @@ static const char* convert_glsl =
"// smooth, the default, means to do perspective-correct interpolation.\n"
"//\n"
"// The centroid qualifier only matters when multisampling. If this qualifier is not present, then the value is interpolated to the pixel's center, anywhere in the pixel, or to one of the pixel's samples. This sample may lie outside of the actual primitive being rendered, since a primitive can cover only part of a pixel's area. The centroid qualifier is used to prevent this; the interpolation point must fall within both the pixel's area and the primitive's area.\n"
"#if !GL_ES && __VERSION__ > 140\n"
"#if !pGL_ES && __VERSION__ > 140\n"
"\n"
"out SHADER\n"
"{\n"
@ -89,7 +89,7 @@ static const char* convert_glsl =
"\n"
"#ifdef FRAGMENT_SHADER\n"
"\n"
"#if !GL_ES && __VERSION__ > 140\n"
"#if !pGL_ES && __VERSION__ > 140\n"
"\n"
"in SHADER\n"
"{\n"
@ -261,7 +261,7 @@ static const char* interlace_glsl =
" vec2 t;\n"
"};\n"
"\n"
"#if !GL_ES && __VERSION__ > 140\n"
"#if !pGL_ES && __VERSION__ > 140\n"
"\n"
"in SHADER\n"
"{\n"
@ -359,7 +359,7 @@ static const char* merge_glsl =
" vec2 t;\n"
"};\n"
"\n"
"#if !GL_ES && __VERSION__ > 140\n"
"#if !pGL_ES && __VERSION__ > 140\n"
"\n"
"in SHADER\n"
"{\n"
@ -441,7 +441,7 @@ static const char* shadeboost_glsl =
"\n"
"#ifdef FRAGMENT_SHADER\n"
"\n"
"#if !GL_ES && __VERSION__ > 140\n"
"#if !pGL_ES && __VERSION__ > 140\n"
"\n"
"in SHADER\n"
"{\n"
@ -582,7 +582,7 @@ static const char* tfx_glsl =
"layout(location = 5) in uvec2 i_uv;\n"
"layout(location = 6) in vec4 i_f;\n"
"\n"
"#if !GL_ES && __VERSION__ > 140\n"
"#if !pGL_ES && __VERSION__ > 140\n"
"\n"
"out SHADER\n"
"{\n"
@ -612,7 +612,7 @@ static const char* tfx_glsl =
"\n"
"#endif\n"
"\n"
"#if !GL_ES && __VERSION__ > 140\n"
"#if !pGL_ES && __VERSION__ > 140\n"
"out gl_PerVertex {\n"
" invariant vec4 gl_Position;\n"
" float gl_PointSize;\n"
@ -819,7 +819,7 @@ static const char* tfx_glsl =
"\n"
"#ifdef FRAGMENT_SHADER\n"
"\n"
"#if !GL_ES && __VERSION__ > 140\n"
"#if !pGL_ES && __VERSION__ > 140\n"
"\n"
"in SHADER\n"
"{\n"
@ -850,7 +850,7 @@ static const char* tfx_glsl =
"#endif\n"
"\n"
"// Same buffer but 2 colors for dual source blending\n"
"#if GL_ES\n"
"#if pGL_ES\n"
"layout(location = 0) out vec4 SV_Target0;\n"
"#else\n"
"layout(location = 0, index = 0) out vec4 SV_Target0;\n"
@ -1562,7 +1562,7 @@ static const char* tfx_glsl =
" return c;\n"
"}\n"
"\n"
"#if GL_ES\n"
"#if pGL_ES\n"
"void ps_main()\n"
"{\n"
" vec4 c = ps_color();\n"
@ -1571,7 +1571,7 @@ static const char* tfx_glsl =
"}\n"
"#endif\n"
"\n"
"#if !GL_ES\n"
"#if !pGL_ES\n"
"void ps_main()\n"
"{\n"
"#if PS_DATE == 3 && !defined(DISABLE_GL42_image)\n"
@ -1626,7 +1626,7 @@ static const char* tfx_glsl =
"#endif\n"
"\n"
"}\n"
"#endif // !GL_ES\n"
"#endif // !pGL_ES\n"
"\n"
"#endif\n"
;
@ -1725,7 +1725,7 @@ static const char* fxaa_fx =
"#endif\n"
"#endif\n"
"\n"
"#if !GL_ES && __VERSION__ > 140\n"
"#if !pGL_ES && __VERSION__ > 140\n"
"\n"
"in SHADER\n"
"{\n"

View File

@ -6,7 +6,7 @@ struct vertex_basic
vec2 t;
};
#if !GL_ES && __VERSION__ > 140
#if !pGL_ES && __VERSION__ > 140
in SHADER
{

View File

@ -6,7 +6,7 @@ struct vertex_basic
vec2 t;
};
#if !GL_ES && __VERSION__ > 140
#if !pGL_ES && __VERSION__ > 140
in SHADER
{

View File

@ -14,7 +14,7 @@ struct vertex_basic
#ifdef FRAGMENT_SHADER
#if !GL_ES && __VERSION__ > 140
#if !pGL_ES && __VERSION__ > 140
in SHADER
{

View File

@ -56,7 +56,7 @@ layout(location = 4) in uint i_z;
layout(location = 5) in uvec2 i_uv;
layout(location = 6) in vec4 i_f;
#if !GL_ES && __VERSION__ > 140
#if !pGL_ES && __VERSION__ > 140
out SHADER
{
@ -86,7 +86,7 @@ flat layout(location = 2) out vec4 SHADERfc;
#endif
#if !GL_ES && __VERSION__ > 140
#if !pGL_ES && __VERSION__ > 140
out gl_PerVertex {
invariant vec4 gl_Position;
float gl_PointSize;
@ -293,7 +293,7 @@ void gs_main()
#ifdef FRAGMENT_SHADER
#if !GL_ES && __VERSION__ > 140
#if !pGL_ES && __VERSION__ > 140
in SHADER
{
@ -324,7 +324,7 @@ flat layout(location = 2) in vec4 SHADERfc;
#endif
// Same buffer but 2 colors for dual source blending
#if GL_ES
#if pGL_ES
layout(location = 0) out vec4 SV_Target0;
#else
layout(location = 0, index = 0) out vec4 SV_Target0;
@ -1036,7 +1036,7 @@ vec4 ps_color()
return c;
}
#if GL_ES
#if pGL_ES
void ps_main()
{
vec4 c = ps_color();
@ -1045,7 +1045,7 @@ void ps_main()
}
#endif
#if !GL_ES
#if !pGL_ES
void ps_main()
{
#if PS_DATE == 3 && !defined(DISABLE_GL42_image)
@ -1100,6 +1100,6 @@ void ps_main()
#endif
}
#endif // !GL_ES
#endif // !pGL_ES
#endif