summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/graphics/android/BaseLayerAndroid.cpp8
-rw-r--r--WebCore/platform/graphics/android/ShaderProgram.cpp21
-rw-r--r--WebCore/platform/graphics/android/ShaderProgram.h1
3 files changed, 24 insertions, 6 deletions
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index fe918e6..49a7057 100644
--- a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -36,6 +36,8 @@
#include <wtf/CurrentTime.h>
#endif // USE(ACCELERATED_COMPOSITING)
+#define HARDWARE_ACCELERATION
+
#ifdef DEBUG
#include <cutils/log.h>
@@ -68,7 +70,7 @@ BaseLayerAndroid::BaseLayerAndroid()
BaseLayerAndroid::~BaseLayerAndroid()
{
-#if USE(ACCELERATED_COMPOSITING)
+#ifdef HARDWARE_ACCELERATION
TilesManager::instance()->removeOperationsForBaseLayer(this);
#endif
m_content.clear();
@@ -277,6 +279,10 @@ bool BaseLayerAndroid::drawGL(IntRect& viewRect, SkRect& visibleRect,
glViewport(left, top, width, height);
ShaderProgram* shader = TilesManager::instance()->shader();
+ if (shader->program() == -1) {
+ XLOG("Reinit shader");
+ shader->init();
+ }
glUseProgram(shader->program());
glUniform1i(shader->textureSampler(), 0);
shader->setViewRect(viewRect);
diff --git a/WebCore/platform/graphics/android/ShaderProgram.cpp b/WebCore/platform/graphics/android/ShaderProgram.cpp
index 103bb02..0237f03 100644
--- a/WebCore/platform/graphics/android/ShaderProgram.cpp
+++ b/WebCore/platform/graphics/android/ShaderProgram.cpp
@@ -97,12 +97,16 @@ GLuint ShaderProgram::loadShader(GLenum shaderType, const char* pSource)
GLuint ShaderProgram::createProgram(const char* pVertexSource, const char* pFragmentSource)
{
GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
- if (!vertexShader)
- return 0;
+ if (!vertexShader) {
+ XLOG("couldn't load the vertex shader!");
+ return -1;
+ }
GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
- if (!pixelShader)
- return 0;
+ if (!pixelShader) {
+ XLOG("couldn't load the pixel shader!");
+ return -1;
+ }
GLuint program = glCreateProgram();
if (program) {
@@ -125,7 +129,9 @@ GLuint ShaderProgram::createProgram(const char* pVertexSource, const char* pFrag
}
}
glDeleteProgram(program);
- program = 0;
+ program = -1;
+ } else {
+ XLOG("couldn't link the shader!");
}
}
return program;
@@ -133,6 +139,11 @@ GLuint ShaderProgram::createProgram(const char* pVertexSource, const char* pFrag
ShaderProgram::ShaderProgram()
{
+ init();
+}
+
+void ShaderProgram::init()
+{
m_program = createProgram(gVertexShader, gFragmentShader);
m_videoProgram = createProgram(gVertexShader, gVideoFragmentShader);
diff --git a/WebCore/platform/graphics/android/ShaderProgram.h b/WebCore/platform/graphics/android/ShaderProgram.h
index afc36f5..fcb093b 100644
--- a/WebCore/platform/graphics/android/ShaderProgram.h
+++ b/WebCore/platform/graphics/android/ShaderProgram.h
@@ -30,6 +30,7 @@ namespace WebCore {
class ShaderProgram {
public:
ShaderProgram();
+ void init();
int projectionMatrix() { return m_hProjectionMatrix; }
int alpha() { return m_hAlpha; }
int textureSampler() { return m_hTexSampler; }