Permalink
Browse files

video-gliden64: more test fixes for nexus 6p this time focused on OpenGL

ES 3.1
  • Loading branch information...
fzurita committed Mar 9, 2016
1 parent ec7da6e commit 43e509d6bcecc1a3b8ab5b94dae11ade108eae6e
@@ -285,53 +285,80 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
char strCombiner[1024];
m_nInputs = compileCombiner(_color, _alpha, strCombiner);
- const bool bUseLod = usesLOD();
- const bool bUseHWLight = config.generalEmulation.enableHWLighting != 0 && GBI.isHWLSupported() && usesShadeColor();
-
- if (usesTexture ())
- {
- strFragmentShader.assign (fragment_shader_header_common_variables);
- strFragmentShader.append (fragment_shader_header_noise);
- strFragmentShader.append (fragment_shader_header_noise_dither);
-
- if (bUseLod)
- {
- strFragmentShader.append (fragment_shader_header_mipmap);
- }
- else
- {
- strFragmentShader.append (fragment_shader_header_readTex);
+ const bool bUseLod = usesLOD();
+ const bool bUseHWLight = config.generalEmulation.enableHWLighting != 0 && GBI.isHWLSupported() && usesShadeColor();
+
+ if (usesTexture ())
+ {
+ strFragmentShader.assign (fragment_shader_header_common_variables);
+
#ifdef GL_MULTISAMPLING_SUPPORT
- if (config.video.multisampling > 0)
- strFragmentShader.append(fragment_shader_header_readTexMS);
+ if (config.video.multisampling > 0)
+ {
+ if(usesTile(0) || usesTile(1))
+ {
+ strFragmentShader.append (fragment_shader_header_common_variables_ms_enabled);
+ }
+ if(usesTile(0))
+ {
+ strFragmentShader.append (fragment_shader_header_common_variables_ms_tex0);
+ }
+ if(usesTile(1))
+ {
+ strFragmentShader.append (fragment_shader_header_common_variables_ms_tex1);
+ }
+ }
#endif
- }
+
+ strFragmentShader.append (fragment_shader_header_noise);
+ strFragmentShader.append (fragment_shader_header_noise_dither);
+
+ if (bUseLod)
+ {
+ strFragmentShader.append (fragment_shader_header_mipmap);
+ }
+ else
+ {
+ strFragmentShader.append (fragment_shader_header_readTex);
+#ifdef GL_MULTISAMPLING_SUPPORT
+ if (config.video.multisampling > 0)
+ {
+ strFragmentShader.append(fragment_shader_header_readTexMS);
+ }
+
+#endif
+ }
#ifdef GL_IMAGE_TEXTURES_SUPPORT
- if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
- strFragmentShader.append(fragment_shader_header_depth_compare);
+ if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
+ {
+ strFragmentShader.append(fragment_shader_header_depth_compare);
+ }
+
#endif
- if (bUseHWLight)
- {
- strFragmentShader.append (fragment_shader_header_calc_light);
- }
- }
- else
- {
- strFragmentShader.assign (fragment_shader_header_common_variables_notex);
- strFragmentShader.append (fragment_shader_header_noise);
- strFragmentShader.append (fragment_shader_header_noise_dither);
+ if (bUseHWLight)
+ {
+ strFragmentShader.append (fragment_shader_header_calc_light);
+ }
+ }
+ else
+ {
+ strFragmentShader.assign (fragment_shader_header_common_variables_notex);
+ strFragmentShader.append (fragment_shader_header_noise);
+ strFragmentShader.append (fragment_shader_header_noise_dither);
#ifdef GL_IMAGE_TEXTURES_SUPPORT
- if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
- strFragmentShader.append(fragment_shader_header_depth_compare);
+ if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
+ {
+ strFragmentShader.append(fragment_shader_header_depth_compare);
+ }
#endif
- if (bUseHWLight)
- {
- strFragmentShader.append (fragment_shader_header_calc_light);
- }
- }
+ if (bUseHWLight)
+ {
+ strFragmentShader.append (fragment_shader_header_calc_light);
+ }
+ }
strFragmentShader.append(fragment_shader_header_main);
if (bUseLod) {
@@ -428,32 +455,27 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
const GLchar * strShaderData = strFragmentShader.data();
glShaderSource(fragmentShader, 1, &strShaderData, NULL);
glCompileShader(fragmentShader);
- if (!checkShaderCompileStatus(fragmentShader))
- {
- LOG(LOG_ERROR, "Error in fragment shader");
-
- int pos = 0;
- int max = 800;
-
- while(pos < strFragmentShader.length() )
- {
- if(strFragmentShader.length() - pos < max)
- {
- LOG(LOG_ERROR, "%s", strFragmentShader.substr(pos).data());
- }
- else
- {
- LOG(LOG_ERROR, "%s", strFragmentShader.substr(pos, max).data());
- }
-
- pos += max;
- }
- }
- else
- {
- LOG(LOG_ERROR, "NO Error in fragment shader");
-
- }
+ if (!checkShaderCompileStatus(fragmentShader));
+ {
+ LOG(LOG_ERROR, "Error in fragment shader");
+
+ int pos = 0;
+ int max = 800;
+
+ while(pos < strFragmentShader.length() )
+ {
+ if(strFragmentShader.length() - pos < max)
+ {
+ LOG(LOG_ERROR, "%s", strFragmentShader.substr(pos).data());
+ }
+ else
+ {
+ LOG(LOG_ERROR, "%s", strFragmentShader.substr(pos, max).data());
+ }
+
+ pos += max;
+ }
+ }
m_program = glCreateProgram();
_locate_attributes();
@@ -146,11 +146,6 @@ static const char* fragment_shader_header_common_variables =
MAIN_SHADER_VERSION
"uniform sampler2D uTex0; \n"
"uniform sampler2D uTex1; \n"
-#ifdef GL_MULTISAMPLING_SUPPORT
-"uniform lowp sampler2DMS uMSTex0; \n"
-"uniform lowp sampler2DMS uMSTex1; \n"
-"uniform lowp ivec2 uMSTexEnabled; \n"
-#endif
"layout (std140) uniform ColorsBlock {\n"
" lowp vec4 uFogColor; \n"
" lowp vec4 uCenterColor; \n"
@@ -185,6 +180,19 @@ MAIN_SHADER_VERSION
"out lowp vec4 fragColor; \n"
;
+#ifdef GL_MULTISAMPLING_SUPPORT
+static const char* fragment_shader_header_common_variables_ms_enabled =
+ "uniform lowp ivec2 uMSTexEnabled; \n";
+
+static const char* fragment_shader_header_common_variables_ms_tex0 =
+ "uniform lowp sampler2DMS uMSTex0; \n";
+
+static const char* fragment_shader_header_common_variables_ms_tex1 =
+ "uniform lowp sampler2DMS uMSTex1; \n";
+#endif
+
+
+
static const char* fragment_shader_header_common_variables_notex =
MAIN_SHADER_VERSION
"layout (std140) uniform ColorsBlock {\n"
@@ -217,59 +225,29 @@ MAIN_SHADER_VERSION
;
static const char* fragment_shader_header_noise =
- "lowp float snoise();\n";
+ "lowp float snoise();\n";
static const char* fragment_shader_header_calc_light =
- "void calc_light(in lowp float fLights, in lowp vec3 input_color, out lowp vec3 output_color);\n";
+ "void calc_light(in lowp float fLights, in lowp vec3 input_color, out lowp vec3 output_color);\n";
static const char* fragment_shader_header_mipmap =
- "mediump float mipmap(out lowp vec4 readtex0, out lowp vec4 readtex1);\n";
+ "mediump float mipmap(out lowp vec4 readtex0, out lowp vec4 readtex1);\n";
static const char* fragment_shader_header_readTex =
- "lowp vec4 readTex(in sampler2D tex, in mediump vec2 texCoord, in lowp int fbMonochrome, in bool fbFixedAlpha);\n";
+ "lowp vec4 readTex(in sampler2D tex, in mediump vec2 texCoord, in lowp int fbMonochrome, in bool fbFixedAlpha);\n";
#ifdef GL_MULTISAMPLING_SUPPORT
static const char* fragment_shader_header_readTexMS =
- "lowp vec4 readTexMS(in lowp sampler2DMS mstex, in mediump vec2 texCoord, in lowp int fbMonochrome, in bool fbFixedAlpha);\n";
+ "lowp vec4 readTexMS(in lowp sampler2DMS mstex, in mediump vec2 texCoord, in lowp int fbMonochrome, in bool fbFixedAlpha);\n";
#endif // GL_MULTISAMPLING_SUPPORT
#ifdef GL_IMAGE_TEXTURES_SUPPORT
static const char* fragment_shader_header_depth_compare =
- "bool depth_compare();\n";
+ "bool depth_compare();\n";
#endif // GL_IMAGE_TEXTURES_SUPPORT
static const char* fragment_shader_header_noise_dither =
- "void colorNoiseDither(in lowp float _noise, inout lowp vec3 _color);\n"
- "void alphaNoiseDither(in lowp float _noise, inout lowp float _alpha);\n";
+ "void colorNoiseDither(in lowp float _noise, inout lowp vec3 _color);\n"
+ "void alphaNoiseDither(in lowp float _noise, inout lowp float _alpha);\n";
#ifdef USE_TOONIFY
static const char* fragment_shader_header_alpha_noise_toonify =
- "void toonify(in mediump float intensity);\n"
+ "void toonify(in mediump float intensity);\n"
#endif
-/*
-static const char* fragment_shader_header_common_functions =
-" \n"
-"lowp float snoise(); \n"
-"void calc_light(in lowp float fLights, in lowp vec3 input_color, out lowp vec3 output_color);\n"
-"mediump float mipmap(out lowp vec4 readtex0, out lowp vec4 readtex1); \n"
-"lowp vec4 readTex(in sampler2D tex, in mediump vec2 texCoord, in lowp int fbMonochrome, in bool fbFixedAlpha); \n"
-#ifdef GL_MULTISAMPLING_SUPPORT
-"lowp vec4 readTexMS(in lowp sampler2DMS mstex, in mediump vec2 texCoord, in lowp int fbMonochrome, in bool fbFixedAlpha); \n"
-#endif // GL_MULTISAMPLING_SUPPORT
-#ifdef GL_IMAGE_TEXTURES_SUPPORT
-"bool depth_compare(); \n"
-#endif // GL_IMAGE_TEXTURES_SUPPORT
-"void colorNoiseDither(in lowp float _noise, inout lowp vec3 _color); \n"
-"void alphaNoiseDither(in lowp float _noise, inout lowp float _alpha);\n"
-#ifdef USE_TOONIFY
-"void toonify(in mediump float intensity); \n"
-#endif
-;
-static const char* fragment_shader_header_common_functions_notex =
-" \n"
-"lowp float snoise(); \n"
-"void calc_light(in lowp float fLights, in lowp vec3 input_color, out lowp vec3 output_color);\n"
-#ifdef GL_IMAGE_TEXTURES_SUPPORT
-"bool depth_compare(); \n"
-#endif // GL_IMAGE_TEXTURES_SUPPORT
-"void colorNoiseDither(in lowp float _noise, inout lowp vec3 _color); \n"
-"void alphaNoiseDither(in lowp float _noise, inout lowp float _alpha);\n"
-;
-*/
static const char* fragment_shader_calc_light =
AUXILIARY_SHADER_VERSION
"layout (std140) uniform LightBlock { \n"
@@ -261,4 +261,4 @@ int compileCombiner(Combiner & _color, Combiner & _alpha, char * _strShader)
else
strcat(_strShader, " color2 = color1; \n");
return nInputs;
-}
+}

0 comments on commit 43e509d

Please sign in to comment.