);
#if PLATFORM(WAYLAND)
+#define FRAGMENT_CONVERT_YUV \
+ gl_FragColor.r = y + 1.59602678 * v; \
+ gl_FragColor.g = y - 0.39176229 * u - 0.81296764 * v; \
+ gl_FragColor.b = y + 2.01723214 * u; \
+ gl_FragColor.a = 1.0;
+
static const char* fragmentShaderSourceMultiTex_Y_UV =
FRAGMENT_SHADER(
uniform sampler2D s_source;
float y = 1.16438356 * (texture2D(s_source, v_sourceTexCoord).x - 0.0625);
float u = texture2D(s_source1, v_sourceTexCoord).r - 0.5;
float v = texture2D(s_source1, v_sourceTexCoord).g - 0.5;
- gl_FragColor.r = y + 1.59602678 * v;
- gl_FragColor.g = y - 0.39176229 * u - 0.81296764 * v;
- gl_FragColor.b = y + 2.01723214 * u;
- gl_FragColor.a = 1.0;
+ FRAGMENT_CONVERT_YUV
+ }
+ );
+
+static const char* fragmentShaderSourceMultiTex_Y_U_V =
+ FRAGMENT_SHADER(
+ uniform sampler2D s_source;
+ uniform sampler2D s_source1;
+ uniform sampler2D s_source2;
+ varying highp vec2 v_sourceTexCoord;
+ void main(void)
+ {
+ float y = 1.16438356 * (texture2D(s_source, v_sourceTexCoord).x - 0.0625);
+ float u = texture2D(s_source1, v_sourceTexCoord).x - 0.5;
+ float v = texture2D(s_source2, v_sourceTexCoord).x - 0.5;
+ FRAGMENT_CONVERT_YUV
}
);
#endif
{
return static_pointer_cast<TextureMapperShaderProgramMultiTex_Y_UV>(getShaderProgram(MultiTex_Y_UV));
}
+PassRefPtr<TextureMapperShaderProgramMultiTex_Y_U_V> TextureMapperShaderManager::multiTex_Y_U_V_Program()
+{
+ return static_pointer_cast<TextureMapperShaderProgramMultiTex_Y_U_V>(getShaderProgram(MultiTex_Y_U_V));
+}
#endif
PassRefPtr<TextureMapperShaderProgram> TextureMapperShaderManager::getShaderProgram(ShaderType shaderType)
{
case MultiTex_Y_UV:
program = TextureMapperShaderProgramMultiTex_Y_UV::create();
break;
+ case MultiTex_Y_U_V:
+ program = TextureMapperShaderProgramMultiTex_Y_U_V::create();
+ break;
#endif
case Invalid:
ASSERT_NOT_REACHED();
getUniformLocation(m_sourceTextureLocation[1], "s_source1");
getUniformLocation(m_opacityLocation, "u_opacity");
}
+
+TextureMapperShaderProgramMultiTex_Y_U_V::TextureMapperShaderProgramMultiTex_Y_U_V()
+ : TextureMapperShaderProgram(vertexShaderSourceSimple, fragmentShaderSourceMultiTex_Y_U_V)
+{
+ initializeProgram();
+ getUniformLocation(m_flipLocation, "u_flip");
+ getUniformLocation(m_matrixLocation, "u_matrix");
+ getUniformLocation(m_sourceTextureLocation[0], "s_source");
+ getUniformLocation(m_sourceTextureLocation[1], "s_source1");
+ getUniformLocation(m_sourceTextureLocation[2], "s_source2");
+ getUniformLocation(m_opacityLocation, "u_opacity");
+}
#endif
TextureMapperShaderManager::TextureMapperShaderManager()
private:
TextureMapperShaderProgramMultiTex_Y_UV();
};
+
+class TextureMapperShaderProgramMultiTex_Y_U_V : public TextureMapperShaderProgram {
+public:
+ static PassRefPtr<TextureMapperShaderProgramMultiTex_Y_U_V> create()
+ {
+ return adoptRef(new TextureMapperShaderProgramMultiTex_Y_U_V());
+ }
+
+private:
+ TextureMapperShaderProgramMultiTex_Y_U_V();
+};
#endif
class TextureMapperShaderManager {
public:
SolidColor,
#if PLATFORM(WAYLAND)
MultiTex_Y_UV,
+ MultiTex_Y_U_V,
#endif
};
PassRefPtr<TextureMapperShaderProgramAntialiasingNoMask> antialiasingNoMaskProgram();
#if PLATFORM(WAYLAND)
PassRefPtr<TextureMapperShaderProgramMultiTex_Y_UV> multiTex_Y_UV_Program();
+ PassRefPtr<TextureMapperShaderProgramMultiTex_Y_U_V> multiTex_Y_U_V_Program();
#endif
private:
typedef HashMap<ShaderType, RefPtr<TextureMapperShaderProgram>, DefaultHash<int>::Hash, HashTraits<int> > TextureMapperShaderProgramMap;