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"; header += "#define DISABLE_GL42_image\n";
#endif #endif
#ifndef ENABLE_GLES // Stupid GL implementation (can't use GL_ES)
// Some driver define the MACRO to 0, others keep it undefined... // AMD/nvidia define it to 0
header += "#ifndef GL_ES\n"; // intel window don't define it
header += "#define GL_ES 0\n"; // intel linux refuse to define it
header += "#endif\n"; #ifdef ENABLE_GLES
header += "#define pGL_ES 1\n";
#else
header += "#define pGL_ES 0\n";
#endif #endif
// Allow to puts several shader in 1 files // Allow to puts several shader in 1 files

View File

@ -9,7 +9,7 @@ struct vertex_basic
#ifdef VERTEX_SHADER #ifdef VERTEX_SHADER
#if !GL_ES && __VERSION__ > 140 #if !pGL_ES && __VERSION__ > 140
out gl_PerVertex { out gl_PerVertex {
vec4 gl_Position; vec4 gl_Position;
float gl_PointSize; float gl_PointSize;
@ -28,7 +28,7 @@ layout(location = 1) in vec2 TEXCOORD0;
// smooth, the default, means to do perspective-correct interpolation. // 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. // 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 out SHADER
{ {
@ -64,7 +64,7 @@ void vs_main()
#ifdef FRAGMENT_SHADER #ifdef FRAGMENT_SHADER
#if !GL_ES && __VERSION__ > 140 #if !pGL_ES && __VERSION__ > 140
in SHADER in SHADER
{ {

View File

@ -34,7 +34,7 @@ static const char* convert_glsl =
"\n" "\n"
"#ifdef VERTEX_SHADER\n" "#ifdef VERTEX_SHADER\n"
"\n" "\n"
"#if !GL_ES && __VERSION__ > 140\n" "#if !pGL_ES && __VERSION__ > 140\n"
"out gl_PerVertex {\n" "out gl_PerVertex {\n"
" vec4 gl_Position;\n" " vec4 gl_Position;\n"
" float gl_PointSize;\n" " float gl_PointSize;\n"
@ -53,7 +53,7 @@ static const char* convert_glsl =
"// smooth, the default, means to do perspective-correct interpolation.\n" "// smooth, the default, means to do perspective-correct interpolation.\n"
"//\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" "// 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" "\n"
"out SHADER\n" "out SHADER\n"
"{\n" "{\n"
@ -89,7 +89,7 @@ static const char* convert_glsl =
"\n" "\n"
"#ifdef FRAGMENT_SHADER\n" "#ifdef FRAGMENT_SHADER\n"
"\n" "\n"
"#if !GL_ES && __VERSION__ > 140\n" "#if !pGL_ES && __VERSION__ > 140\n"
"\n" "\n"
"in SHADER\n" "in SHADER\n"
"{\n" "{\n"
@ -261,7 +261,7 @@ static const char* interlace_glsl =
" vec2 t;\n" " vec2 t;\n"
"};\n" "};\n"
"\n" "\n"
"#if !GL_ES && __VERSION__ > 140\n" "#if !pGL_ES && __VERSION__ > 140\n"
"\n" "\n"
"in SHADER\n" "in SHADER\n"
"{\n" "{\n"
@ -359,7 +359,7 @@ static const char* merge_glsl =
" vec2 t;\n" " vec2 t;\n"
"};\n" "};\n"
"\n" "\n"
"#if !GL_ES && __VERSION__ > 140\n" "#if !pGL_ES && __VERSION__ > 140\n"
"\n" "\n"
"in SHADER\n" "in SHADER\n"
"{\n" "{\n"
@ -441,7 +441,7 @@ static const char* shadeboost_glsl =
"\n" "\n"
"#ifdef FRAGMENT_SHADER\n" "#ifdef FRAGMENT_SHADER\n"
"\n" "\n"
"#if !GL_ES && __VERSION__ > 140\n" "#if !pGL_ES && __VERSION__ > 140\n"
"\n" "\n"
"in SHADER\n" "in SHADER\n"
"{\n" "{\n"
@ -582,7 +582,7 @@ static const char* tfx_glsl =
"layout(location = 5) in uvec2 i_uv;\n" "layout(location = 5) in uvec2 i_uv;\n"
"layout(location = 6) in vec4 i_f;\n" "layout(location = 6) in vec4 i_f;\n"
"\n" "\n"
"#if !GL_ES && __VERSION__ > 140\n" "#if !pGL_ES && __VERSION__ > 140\n"
"\n" "\n"
"out SHADER\n" "out SHADER\n"
"{\n" "{\n"
@ -612,7 +612,7 @@ static const char* tfx_glsl =
"\n" "\n"
"#endif\n" "#endif\n"
"\n" "\n"
"#if !GL_ES && __VERSION__ > 140\n" "#if !pGL_ES && __VERSION__ > 140\n"
"out gl_PerVertex {\n" "out gl_PerVertex {\n"
" invariant vec4 gl_Position;\n" " invariant vec4 gl_Position;\n"
" float gl_PointSize;\n" " float gl_PointSize;\n"
@ -819,7 +819,7 @@ static const char* tfx_glsl =
"\n" "\n"
"#ifdef FRAGMENT_SHADER\n" "#ifdef FRAGMENT_SHADER\n"
"\n" "\n"
"#if !GL_ES && __VERSION__ > 140\n" "#if !pGL_ES && __VERSION__ > 140\n"
"\n" "\n"
"in SHADER\n" "in SHADER\n"
"{\n" "{\n"
@ -850,7 +850,7 @@ static const char* tfx_glsl =
"#endif\n" "#endif\n"
"\n" "\n"
"// Same buffer but 2 colors for dual source blending\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" "layout(location = 0) out vec4 SV_Target0;\n"
"#else\n" "#else\n"
"layout(location = 0, index = 0) out vec4 SV_Target0;\n" "layout(location = 0, index = 0) out vec4 SV_Target0;\n"
@ -1562,7 +1562,7 @@ static const char* tfx_glsl =
" return c;\n" " return c;\n"
"}\n" "}\n"
"\n" "\n"
"#if GL_ES\n" "#if pGL_ES\n"
"void ps_main()\n" "void ps_main()\n"
"{\n" "{\n"
" vec4 c = ps_color();\n" " vec4 c = ps_color();\n"
@ -1571,7 +1571,7 @@ static const char* tfx_glsl =
"}\n" "}\n"
"#endif\n" "#endif\n"
"\n" "\n"
"#if !GL_ES\n" "#if !pGL_ES\n"
"void ps_main()\n" "void ps_main()\n"
"{\n" "{\n"
"#if PS_DATE == 3 && !defined(DISABLE_GL42_image)\n" "#if PS_DATE == 3 && !defined(DISABLE_GL42_image)\n"
@ -1626,7 +1626,7 @@ static const char* tfx_glsl =
"#endif\n" "#endif\n"
"\n" "\n"
"}\n" "}\n"
"#endif // !GL_ES\n" "#endif // !pGL_ES\n"
"\n" "\n"
"#endif\n" "#endif\n"
; ;
@ -1725,7 +1725,7 @@ static const char* fxaa_fx =
"#endif\n" "#endif\n"
"#endif\n" "#endif\n"
"\n" "\n"
"#if !GL_ES && __VERSION__ > 140\n" "#if !pGL_ES && __VERSION__ > 140\n"
"\n" "\n"
"in SHADER\n" "in SHADER\n"
"{\n" "{\n"

View File

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

View File

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

View File

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

View File

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