Title: [109694] trunk/Source/WebCore
Revision
109694
Author
[email protected]
Date
2012-03-04 18:43:37 -0800 (Sun, 04 Mar 2012)

Log Message

[EFL] Implementation of missing functions in GraphicsContext3DPrivate
https://bugs.webkit.org/show_bug.cgi?id=79759

Patch by Hyowon Kim <[email protected]> on 2012-03-04
Reviewed by Noam Rosenthal.

The initial patch (Bug 62961) only contains implementations for simple functions
which call GL functions through Evas_GL_API.
This patch implements a little complicated functions such as getActiveAttrib(),
getShaderSource() and so on.

No new tests. No behavior change.

* platform/graphics/efl/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::getActiveAttrib):
(WebCore::GraphicsContext3DPrivate::getActiveUniform):
(WebCore::GraphicsContext3DPrivate::getError):
(WebCore::GraphicsContext3DPrivate::getIntegerv):
(WebCore::GraphicsContext3DPrivate::getProgramInfoLog):
(WebCore::GraphicsContext3DPrivate::getShaderInfoLog):
(WebCore::GraphicsContext3DPrivate::getShaderSource):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109693 => 109694)


--- trunk/Source/WebCore/ChangeLog	2012-03-05 02:33:21 UTC (rev 109693)
+++ trunk/Source/WebCore/ChangeLog	2012-03-05 02:43:37 UTC (rev 109694)
@@ -1,3 +1,26 @@
+2012-03-04  Hyowon Kim  <[email protected]>
+
+        [EFL] Implementation of missing functions in GraphicsContext3DPrivate
+        https://bugs.webkit.org/show_bug.cgi?id=79759
+
+        Reviewed by Noam Rosenthal.
+
+        The initial patch (Bug 62961) only contains implementations for simple functions
+        which call GL functions through Evas_GL_API.
+        This patch implements a little complicated functions such as getActiveAttrib(),
+        getShaderSource() and so on.
+
+        No new tests. No behavior change.
+
+        * platform/graphics/efl/GraphicsContext3DPrivate.cpp:
+        (WebCore::GraphicsContext3DPrivate::getActiveAttrib):
+        (WebCore::GraphicsContext3DPrivate::getActiveUniform):
+        (WebCore::GraphicsContext3DPrivate::getError):
+        (WebCore::GraphicsContext3DPrivate::getIntegerv):
+        (WebCore::GraphicsContext3DPrivate::getProgramInfoLog):
+        (WebCore::GraphicsContext3DPrivate::getShaderInfoLog):
+        (WebCore::GraphicsContext3DPrivate::getShaderSource):
+
 2012-03-04  Kentaro Hara  <[email protected]>
 
         Revert SVG-related APIs from DOMWindowSVG.idl back to DOMWindow.idl

Modified: trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp (109693 => 109694)


--- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp	2012-03-05 02:33:21 UTC (rev 109693)
+++ trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp	2012-03-05 02:43:37 UTC (rev 109694)
@@ -336,14 +336,68 @@
 
 bool GraphicsContext3DPrivate::getActiveAttrib(Platform3DObject program, GC3Duint index, ActiveInfo& info)
 {
-    notImplemented();
-    return false;
+    if (!program) {
+        synthesizeGLError(GL_INVALID_VALUE);
+        return false;
+    }
+
+    makeContextCurrent();
+
+    GLint maxNameLength = 0;
+    m_api->glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxNameLength);
+    if (!maxNameLength)
+        return false;
+
+    OwnArrayPtr<char> name = adoptArrayPtr(new char[maxNameLength]);
+    if (!name) {
+        synthesizeGLError(GL_OUT_OF_MEMORY);
+        return false;
+    }
+
+    GLsizei length = 0;
+    GLint size = 0;
+    GLenum type = 0;
+    m_api->glGetActiveAttrib(program, index, maxNameLength, &length, &size, &type, name.get());
+    if (!length)
+        return false;
+
+    info.name = String::fromUTF8(name.get(), length);
+    info.type = type;
+    info.size = size;
+    return true;
 }
 
 bool GraphicsContext3DPrivate::getActiveUniform(Platform3DObject program, GC3Duint index, ActiveInfo& info)
 {
-    notImplemented();
-    return false;
+    if (!program) {
+        synthesizeGLError(GL_INVALID_VALUE);
+        return false;
+    }
+
+    makeContextCurrent();
+
+    GLint maxNameLength = 0;
+    m_api->glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameLength);
+    if (!maxNameLength)
+        return false;
+
+    OwnArrayPtr<char> name = adoptArrayPtr(new char[maxNameLength]);
+    if (!name) {
+        synthesizeGLError(GL_OUT_OF_MEMORY);
+        return false;
+    }
+
+    GLsizei length = 0;
+    GLint size = 0;
+    GLenum type = 0;
+    m_api->glGetActiveUniform(program, index, maxNameLength, &length, &size, &type, name.get());
+    if (!length)
+        return false;
+
+    info.name = String::fromUTF8(name.get(), length);
+    info.type = type;
+    info.size = size;
+    return true;
 }
 
 void GraphicsContext3DPrivate::getAttachedShaders(Platform3DObject program, GC3Dsizei maxCount, GC3Dsizei* count, Platform3DObject* shaders)
@@ -377,8 +431,14 @@
 
 GC3Denum GraphicsContext3DPrivate::getError()
 {
-    notImplemented();
-    return 0;
+    if (!m_syntheticErrors.isEmpty()) {
+        GC3Denum error = m_syntheticErrors.first();
+        m_syntheticErrors.remove(m_syntheticErrors.begin());
+        return error;
+    }
+
+    makeContextCurrent();
+    return m_api->glGetError();
 }
 
 void GraphicsContext3DPrivate::getFloatv(GC3Denum paramName, GC3Dfloat* value)
@@ -395,7 +455,8 @@
 
 void GraphicsContext3DPrivate::getIntegerv(GC3Denum paramName, GC3Dint* value)
 {
-    notImplemented();
+    makeContextCurrent();
+    m_api->glGetIntegerv(paramName, value);
 }
 
 void GraphicsContext3DPrivate::getProgramiv(Platform3DObject program, GC3Denum paramName, GC3Dint* value)
@@ -406,8 +467,23 @@
 
 String GraphicsContext3DPrivate::getProgramInfoLog(Platform3DObject program)
 {
-    notImplemented();
-    return String();
+    makeContextCurrent();
+
+    GLint logLength = 0;
+    m_api->glGetProgramiv(program, GraphicsContext3D::INFO_LOG_LENGTH, &logLength);
+    if (!logLength)
+        return String();
+
+    OwnArrayPtr<char> log = adoptArrayPtr(new char[logLength]);
+    if (!log)
+        return String();
+
+    GLint returnedLogLength = 0;
+    m_api->glGetProgramInfoLog(program, logLength, &returnedLogLength, log.get());
+    ASSERT(logLength == returnedLogLength + 1);
+
+    String result = String::fromUTF8(log.get(), returnedLogLength);
+    return result;
 }
 
 void GraphicsContext3DPrivate::getRenderbufferParameteriv(GC3Denum target, GC3Denum paramName, GC3Dint* value)
@@ -424,14 +500,44 @@
 
 String GraphicsContext3DPrivate::getShaderInfoLog(Platform3DObject shader)
 {
-    notImplemented();
-    return String();
+    makeContextCurrent();
+
+    GLint logLength = 0;
+    m_api->glGetShaderiv(shader, GraphicsContext3D::INFO_LOG_LENGTH, &logLength);
+    if (logLength <= 1)
+        return String();
+
+    OwnArrayPtr<char> log = adoptArrayPtr(new char[logLength]);
+    if (!log)
+        return String();
+
+    GLint returnedLogLength = 0;
+    m_api->glGetShaderInfoLog(shader, logLength, &returnedLogLength, log.get());
+    ASSERT(logLength == returnedLogLength + 1);
+
+    String result = String::fromUTF8(log.get(), returnedLogLength);
+    return result;
 }
 
 String GraphicsContext3DPrivate::getShaderSource(Platform3DObject shader)
 {
-    notImplemented();
-    return String();
+    makeContextCurrent();
+
+    GLint logLength = 0;
+    m_api->glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &logLength);
+    if (logLength <= 1)
+        return String();
+
+    OwnArrayPtr<char> log = adoptArrayPtr(new char[logLength]);
+    if (!log)
+        return String();
+
+    GLint returnedLogLength = 0;
+    m_api->glGetShaderSource(shader, logLength, &returnedLogLength, log.get());
+    ASSERT(logLength == returnedLogLength + 1);
+
+    String result = String::fromUTF8(log.get(), returnedLogLength);
+    return result;
 }
 
 String GraphicsContext3DPrivate::getString(GC3Denum name)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to