Merge lp:~compiz-linaro-team/compiz/gles2 into lp:compiz/0.9.8

Proposed by Daniel van Vugt
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3378
Merged at revision: 3320
Proposed branch: lp:~compiz-linaro-team/compiz/gles2
Merge into: lp:compiz/0.9.8
Diff against target: 16838 lines (+7498/-4718)
104 files modified
cmake/CMakeLists.txt (+2/-0)
cmake/CompizCommon.cmake (+12/-0)
cmake/CompizPlugin.cmake (+14/-10)
cmake/FindCompiz.cmake (+1/-1)
cmake/FindOpenGLES2.cmake (+51/-0)
cmake/base.cmake (+3/-0)
cmake/plugin_extensions/CompizOpenGLFixups.cmake (+22/-0)
include/core/wrapsystem.h (+8/-0)
plugins/CMakeLists.txt (+30/-0)
plugins/animation/CMakeLists.txt (+3/-5)
plugins/animation/include/animation/animation.h (+1/-1)
plugins/animation/include/animation/animeffect.h (+3/-3)
plugins/animation/include/animation/grid.h (+0/-2)
plugins/animation/src/animation.cpp (+85/-27)
plugins/animation/src/grid.cpp (+25/-258)
plugins/animation/src/private.h (+3/-3)
plugins/annotate/src/annotate.cpp (+149/-71)
plugins/blur/CMakeLists.txt (+12/-12)
plugins/clone/src/clone.cpp (+0/-5)
plugins/compiztoolbox/src/compiztoolbox.cpp (+5/-18)
plugins/copytex/src/copytex.cpp (+9/-0)
plugins/cube/include/cube/cube.h (+9/-6)
plugins/cube/src/cube.cpp (+85/-80)
plugins/decor/src/decor.cpp (+29/-27)
plugins/decor/src/decor.h (+2/-2)
plugins/expo/CMakeLists.txt (+4/-8)
plugins/expo/src/expo.cpp (+256/-111)
plugins/expo/src/expo.h (+3/-4)
plugins/ezoom/src/ezoom.cpp (+118/-52)
plugins/grid/src/grid.cpp (+108/-53)
plugins/imgsvg/src/imgsvg.cpp (+9/-6)
plugins/imgsvg/src/imgsvg.h (+2/-1)
plugins/kdecompat/src/kdecompat.cpp (+7/-22)
plugins/mag/src/mag.cpp (+102/-73)
plugins/mag/src/mag.h (+2/-0)
plugins/neg/src/neg.cpp (+33/-106)
plugins/neg/src/neg.h (+3/-6)
plugins/obs/src/obs.cpp (+8/-7)
plugins/obs/src/obs.h (+1/-1)
plugins/opengl/CMakeLists.txt (+14/-4)
plugins/opengl/compiz-opengl.pc.in (+1/-1)
plugins/opengl/include/opengl/doublebuffer.h (+39/-0)
plugins/opengl/include/opengl/fragment.h (+0/-125)
plugins/opengl/include/opengl/framebufferobject.h (+104/-0)
plugins/opengl/include/opengl/matrix.h (+2/-0)
plugins/opengl/include/opengl/opengl.h (+441/-73)
plugins/opengl/include/opengl/program.h (+75/-0)
plugins/opengl/include/opengl/programcache.h (+51/-0)
plugins/opengl/include/opengl/shadercache.h (+100/-0)
plugins/opengl/include/opengl/texture.h (+5/-0)
plugins/opengl/include/opengl/vector.h (+3/-3)
plugins/opengl/include/opengl/vertexbuffer.h (+130/-0)
plugins/opengl/opengl.xml.in (+15/-0)
plugins/opengl/src/doublebuffer/CMakeLists.txt (+31/-0)
plugins/opengl/src/doublebuffer/src/double-buffer.cpp (+76/-0)
plugins/opengl/src/doublebuffer/tests/CMakeLists.txt (+24/-0)
plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp (+98/-0)
plugins/opengl/src/fragment.cpp (+0/-1146)
plugins/opengl/src/framebufferobject.cpp (+221/-0)
plugins/opengl/src/matrix.cpp (+54/-0)
plugins/opengl/src/paint.cpp (+472/-443)
plugins/opengl/src/privatefragment.h (+0/-54)
plugins/opengl/src/privates.h (+101/-13)
plugins/opengl/src/privatetexture.h (+32/-0)
plugins/opengl/src/privatevertexbuffer.h (+149/-0)
plugins/opengl/src/program.cpp (+262/-0)
plugins/opengl/src/programcache.cpp (+175/-0)
plugins/opengl/src/screen.cpp (+938/-154)
plugins/opengl/src/shadercache.cpp (+246/-0)
plugins/opengl/src/texture.cpp (+152/-22)
plugins/opengl/src/vector.cpp (+2/-2)
plugins/opengl/src/vertexbuffer.cpp (+634/-0)
plugins/opengl/src/window.cpp (+65/-83)
plugins/resize/src/resize.cpp (+84/-31)
plugins/resizeinfo/src/resizeinfo.cpp (+45/-27)
plugins/resizeinfo/src/resizeinfo.h (+2/-1)
plugins/ring/src/ring.cpp (+19/-37)
plugins/ring/src/ring.h (+1/-1)
plugins/scale/src/scale.cpp (+10/-17)
plugins/scaleaddon/src/scaleaddon.cpp (+51/-21)
plugins/scaleaddon/src/scaleaddon.h (+2/-2)
plugins/scalefilter/src/scalefilter.cpp (+1/-6)
plugins/screenshot/src/screenshot.cpp (+47/-20)
plugins/shift/src/shift.cpp (+95/-98)
plugins/shift/src/shift.h (+1/-1)
plugins/staticswitcher/src/staticswitcher.cpp (+156/-64)
plugins/staticswitcher/src/staticswitcher.h (+5/-3)
plugins/switcher/src/switcher.cpp (+45/-42)
plugins/text/include/text/text.h (+2/-1)
plugins/text/src/text.cpp (+53/-24)
plugins/thumbnail/src/thumbnail.cpp (+301/-118)
plugins/thumbnail/src/thumbnail.h (+3/-1)
plugins/wall/src/wall.cpp (+60/-46)
plugins/wall/src/wall.h (+1/-1)
plugins/water/src/shaders.h (+200/-0)
plugins/water/src/water.cpp (+281/-801)
plugins/water/src/water.h (+33/-63)
plugins/water/water.xml.in (+26/-2)
plugins/wobbly/src/wobbly.cpp (+20/-176)
plugins/wobbly/src/wobbly.h (+0/-1)
plugins/workarounds/src/workarounds.cpp (+14/-0)
plugins/workarounds/src/workarounds.h (+4/-0)
plugins/workspacenames/src/workspacenames.cpp (+4/-8)
plugins/workspacenames/src/workspacenames.h (+1/-1)
To merge this branch: bzr merge lp:~compiz-linaro-team/compiz/gles2
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Sam Spilsbury Approve
Tim Penhey Pending
Alan Griffiths Pending
jenkins continuous-integration Pending
Review via email: mp+120361@code.launchpad.net

This proposal supersedes a proposal from 2012-08-10.

Commit message

This branch contains the code to make compiz work on GLES. This includes
several changes to the compiz API.

* GLVertexBuffer class added for managing vertices, normals, texture
  coordinates, and colors
* GLProgram class added for managing GLSL programs
* GLProgramCache class added for managing per-plugin GLSL programs
  efficiently, uses an LRU cache to avoid recompiling recently used GLSL
  programs all the time
* GLShaderCache class added for managing dynamically created shader source
  code.
* GLFragment class removed as fragment programs are no longer used (replaced
  with GLSL programs)
* EGL context setup added
* EglTexture class added to use EGL_image extension instead of
  GLX_EXT_texture_from_pixmap for GLES

Description of the change

WARNING: The Preview diff is incomplete due to Launchpad limitations. Please click Download diff to get the whole thing.

BUGS: Yes, there a quite a few still but I think they're acceptable now. The full list of known bugs in this branch is: https://bugs.launchpad.net/compiz/+bugs?field.tag=gles
and the bugs it causes in Unity:
https://bugs.launchpad.net/unity/+bugs?field.tag=gles

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal
Download full text (17.9 KiB)

The diff is quite large, however it should be possible still to do a code review:

+static bool
+unproject (float winx, float winy, float winz,
+ const GLMatrix &modelview,
+ const GLMatrix &projection,
+ const GLint viewport[4],
+ float *objx, float *objy, float *objz)
+{
+ GLMatrix finalMatrix = projection * modelview;
+ float in[4], out[4];
+
+ if (!finalMatrix.invert ())
+ return false;
+
+ in[0] = winx;
+ in[1] = winy;
+ in[2] = winz;
+ in[3] = 1.0;
+
+ /* Map x and y from window coordinates */
+ in[0] = (in[0] - viewport[0]) / viewport[2];
+ in[1] = (in[1] - viewport[1]) / viewport[3];
+
+ /* Map to range -1 to 1 */
+ in[0] = in[0] * 2 - 1;
+ in[1] = in[1] * 2 - 1;
+ in[2] = in[2] * 2 - 1;
+
+ for (int i = 0; i < 4; i++)
+ {
+ out[i] = in[0] * finalMatrix[i] +
+ in[1] * finalMatrix[4 + i] +
+ in[2] * finalMatrix[8 + i] +
+ in[3] * finalMatrix[12 + i];
+ }
+
+ if (out[3] == 0.0)
+ return false;
+
+ out[0] /= out[3];
+ out[1] /= out[3];
+ out[2] /= out[3];
+
+ *objx = out[0];
+ *objy = out[1];
+ *objz = out[2];
+
+ return true;
+}
+

+static bool
+project (float objx, float objy, float objz,
+ const float modelview[16], const float projection[16],
+ const GLint viewport[4],
+ float *winx, float *winy, float *winz)
+{
+ unsigned int i;
+ float in[4];
+ float out[4];
+
+ in[0] = objx;
+ in[1] = objy;
+ in[2] = objz;
+ in[3] = 1.0;
+
+ for (i = 0; i < 4; i++) {
+ out[i] =
+ in[0] * modelview[i] +
+ in[1] * modelview[4 + i] +
+ in[2] * modelview[8 + i] +
+ in[3] * modelview[12 + i];
+ }
+
+ for (i = 0; i < 4; i++) {
+ in[i] =
+ out[0] * projection[i] +
+ out[1] * projection[4 + i] +
+ out[2] * projection[8 + i] +
+ out[3] * projection[12 + i];
+ }
+
+ if (in[3] == 0.0)
+ return false;
+
+ in[0] /= in[3];
+ in[1] /= in[3];
+ in[2] /= in[3];
+ /* Map x, y and z to range 0-1 */
+ in[0] = in[0] * 0.5 + 0.5;
+ in[1] = in[1] * 0.5 + 0.5;
+ in[2] = in[2] * 0.5 + 0.5;
+
+ /* Map x,y to viewport */
+ in[0] = in[0] * viewport[2] + viewport[0];
+ in[1] = in[1] * viewport[3] + viewport[1];
+
+ *winx = in[0];
+ *winy = in[1];
+ *winz = in[2];
+ return true;
+}

This is re-usable in cube and should be put somewhere. GLMatrix?

=== added file 'cmake/FindOpenGLES2.cmake'
--- cmake/FindOpenGLES2.cmake 1970-01-01 00:00:00 +0000
+++ cmake/FindOpenGLES2.cmake 2012-08-10 08:27:48 +0000
@@ -0,0 +1,51 @@
+# - Try to find OpenGLES
+# Once done this will define
+#
+# OPENGLES2_FOUND - system has OpenGLES
+# OPENGLES2_INCLUDE_DIR - the GLES include directory
+# OPENGLES2_LIBRARY - the GLES library
+# OPENGLES2_LIBRARIES - Link this to use OpenGLES
+#
+
+FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
+ /usr/openwin/share/include
+ /opt/graphics/OpenGL/include /usr/X11R6/include
+ /usr/include
+)
+
+FIND_LIBRARY(OPENGLES2_LIBRARY
+ NAMES GLESv2
+ PATHS /opt/graphics/OpenGL/lib
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ /usr/lib
+)
+
+FIND_L...

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Thanks Sam. Please try to keep your comments a manageable size. Or make each point in a new comment.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Initially I thought *project should go in GLMatrix too. However then I cleaned up project() and realized it should not be using GLMatrix. It looks like unproject similarly should not be using GLMatrix. Though *project() should probably live somewhere in the opengl plugin, I agree.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Set to work in progress again.

We cannot realistically consider merging this until the incompatibilities with Unity are also fixed:
https://bugs.launchpad.net/unity/+bugs?field.tag=gles

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

> 2. It's ugly, bad design. Member data should not be repeatedly passed as
     a parameter. I know there is a limitation in the current wrapping/
     interface design that makes it impossible to access vertexBuffer as a
     member, but that's no excuse for making the code worse than it already
     was.

Can you clarify this please? It didn't come up in the original review and I'm suprised you've put it as a reason for reverting it now.

While passing member data through function arguments is not great, it at least restricts the scope in which that data can be accessed, which is the correct thing to do.

I can understand reverting it in the meantime because unity is difficult to port with ifdefs, but if you're going to do so please consult with the person who wrote it (who happens to live in the same timezone as you, so its really not an issue to do so) for advice on how to handle it rather than taking the unilateral approach of just reverting code.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

I was extremely frustrated yesterday and just wanted the code to build. I wasn't feeling like consulting.

Sorry, I thought it did come up in the original review. I was thinking it all along but (as usual) failed to articulate all of my thoughts into words.

It's foreseeable that I will approve the changes again. But not until Unity has been updated to support them first. That would be enclosed in "#if COMPIZ_OPENGL_ABI >= 6", I imagine.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

> I was extremely frustrated yesterday and just wanted the code to build. I
> wasn't feeling like consulting.
>
> Sorry, I thought it did come up in the original review. I was thinking it all
> along but (as usual) failed to articulate all of my thoughts into words.
>
> It's foreseeable that I will approve the changes again. But not until Unity
> has been updated to support them first. That would be enclosed in "#if
> COMPIZ_OPENGL_ABI >= 6", I imagine.

Okay, thanks. Noted, will re-propose the unrevert of those changes at an appropriate time.

Cheers,

Sam

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, I /think/ the worst of the Unity regressions are now fixed, or at least with fixes proposed:
https://bugs.launchpad.net/unity/+bugs?field.tag=gles

Let's open this for review again. But be aware I may not action some of the optional cleanups (already mentioned) before this branch lands.

Revision history for this message
Omer Akram (om26er) wrote :

Nice work btw, working through all those regression along the way :-)

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Tested on nouveau, intel and ongoing testing was done on ARM/PowerVR too.

I'm happy enough for this to go in as-is, obviously it isn't yet release quality, however we need to put it in before feature freeze.

Things I would like to see actioned during the rest of the release period.

1. Tests. Tests. Tests
 a. Specifically on the behaviour of GLVertexBuffer, GLFramebufferObject and GLShaderCache
 b. No need for test coverage on areas where the API changed
2. GLVertexBuffer begin/end - that's bad design we need to fix it
3. Need to remove direct access to GLVertexBuffer in GLWindow
4. Sort out the mipmapping story on mesa drivers (add a driver workaround?)
5. project/unproject need to go somewhere common
6. Port/Drop blur
7. Port the rest of mag.
8. compiz-opengl-impl.h
9. Remove spurious ifdefs
10. Remove the options to control rendering features.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

A couple of new blockers were found/introduced today :(

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
Daniel van Vugt (vanvugt) :
review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-compiz-core/66/console reported an error when processing this lp:~compiz-linaro-team/compiz/gles2 branch.
Not merging it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake/CMakeLists.txt'
2--- cmake/CMakeLists.txt 2012-07-29 03:23:28 +0000
3+++ cmake/CMakeLists.txt 2012-08-22 06:16:22 +0000
4@@ -17,6 +17,8 @@
5 plugin_extensions/CompizGenInstallData.cmake)
6 list (APPEND _PluginExtensionFiles
7 plugin_extensions/CompizGenInstallImages.cmake)
8+list (APPEND _PluginExtensionFiles
9+ plugin_extensions/CompizOpenGLFixups.cmake)
10
11 if (USE_GCONF)
12 list (APPEND _files CompizGconf.cmake)
13
14=== modified file 'cmake/CompizCommon.cmake'
15--- cmake/CompizCommon.cmake 2012-08-16 03:24:02 +0000
16+++ cmake/CompizCommon.cmake 2012-08-22 06:16:22 +0000
17@@ -18,6 +18,7 @@
18
19 set (CMAKE_SKIP_RPATH FALSE)
20
21+option (BUILD_GLES "Build against GLESv2 instead of GL" OFF)
22 option (COMPIZ_BUILD_WITH_RPATH "Leave as ON unless building packages" ON)
23 option (COMPIZ_RUN_LDCONFIG "Leave OFF unless you need to run ldconfig after install")
24 option (COMPIZ_PACKAGING_ENABLED "Enable to manually set prefix, exec_prefix, libdir, includedir, datadir" OFF)
25@@ -70,6 +71,17 @@
26 set(IS_BZR_REPO 0)
27 endif (IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.bzr)
28
29+set (USE_GLES ${BUILD_GLES})
30+
31+if (USE_GLES)
32+ find_package(OpenGLES2)
33+
34+ if (NOT OPENGLES2_FOUND)
35+ set (USE_GLES 0)
36+ message (SEND_ERROR "OpenGLESv2 not found")
37+ endif (NOT OPENGLES2_FOUND)
38+endif (USE_GLES)
39+
40 # Parse arguments passed to a function into several lists separated by
41 # upper-case identifiers and options that do not have an associated list e.g.:
42 #
43
44=== modified file 'cmake/CompizPlugin.cmake'
45--- cmake/CompizPlugin.cmake 2012-05-24 00:55:17 +0000
46+++ cmake/CompizPlugin.cmake 2012-08-22 06:16:22 +0000
47@@ -257,6 +257,16 @@
48 NO_DEFAULT_PATH
49 )
50
51+ set (COMPIZ_CURRENT_PLUGIN ${plugin})
52+ set (COMPIZ_CURRENT_XML_FILE ${_translated_xml})
53+
54+ # find extension files
55+ file (GLOB _extension_files "${COMPIZ_CMAKE_MODULE_PATH}/plugin_extensions/*.cmake")
56+
57+ foreach (_file ${_extension_files})
58+ include (${_file})
59+ endforeach ()
60+
61 # generate pkgconfig file and install it and the plugin header file
62 if (_${plugin}_pkg AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin})
63 if ("${PLUGIN_BUILDTYPE}" STREQUAL "local")
64@@ -269,11 +279,15 @@
65 set (VERSION 0.0.1-git)
66 endif (NOT VERSION)
67
68+ #add CFLAGSADD so pkg-config file has correct flags
69+ set (COMPIZ_CFLAGS ${COMPIZ_CFLAGS} ${${_PLUGIN}_CFLAGSADD})
70+
71 compiz_configure_file (
72 ${_${plugin}_pkg}
73 ${CMAKE_BINARY_DIR}/generated/compiz-${plugin}.pc
74 COMPIZ_REQUIRES
75 COMPIZ_CFLAGS
76+ PKGCONFIG_LIBS
77 )
78
79 install (
80@@ -287,16 +301,6 @@
81 endif ()
82 endif ()
83
84- set (COMPIZ_CURRENT_PLUGIN ${plugin})
85- set (COMPIZ_CURRENT_XML_FILE ${_translated_xml})
86-
87- # find extension files
88- file (GLOB _extension_files "${COMPIZ_CMAKE_MODULE_PATH}/plugin_extensions/*.cmake")
89-
90- foreach (_file ${_extension_files})
91- include (${_file})
92- endforeach ()
93-
94 # find files for build
95 file (GLOB _h_files "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h")
96 file (GLOB _h_ins_files "${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}/*.h")
97
98=== modified file 'cmake/FindCompiz.cmake'
99--- cmake/FindCompiz.cmake 2012-07-29 03:23:28 +0000
100+++ cmake/FindCompiz.cmake 2012-08-22 06:16:22 +0000
101@@ -89,7 +89,7 @@
102 if (COMPIZ_FOUND AND _compiz_def_macro)
103 # everything found. Set module path and include defaults module
104 set (COMPIZ_CMAKE_MODULE_PATH ${COMPIZ_PREFIX}/share/compiz/cmake)
105- set (CMAKE_MODULE_PATH ${COMPIZ_CMAKE_MODULE_PATH})
106+ set (CMAKE_MODULE_PATH ${COMPIZ_CMAKE_MODULE_PATH} ${CMAKE_MODULE_PATH})
107 include (CompizDefaults)
108 else ()
109 set (COMPIZ_FOUND 0)
110
111=== added file 'cmake/FindOpenGLES2.cmake'
112--- cmake/FindOpenGLES2.cmake 1970-01-01 00:00:00 +0000
113+++ cmake/FindOpenGLES2.cmake 2012-08-22 06:16:22 +0000
114@@ -0,0 +1,51 @@
115+# - Try to find OpenGLES
116+# Once done this will define
117+#
118+# OPENGLES2_FOUND - system has OpenGLES
119+# OPENGLES2_INCLUDE_DIR - the GLES include directory
120+# OPENGLES2_LIBRARY - the GLES library
121+# OPENGLES2_LIBRARIES - Link this to use OpenGLES
122+#
123+
124+FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
125+ /usr/openwin/share/include
126+ /opt/graphics/OpenGL/include /usr/X11R6/include
127+ /usr/include
128+)
129+
130+FIND_LIBRARY(OPENGLES2_LIBRARY
131+ NAMES GLESv2
132+ PATHS /opt/graphics/OpenGL/lib
133+ /usr/openwin/lib
134+ /usr/shlib /usr/X11R6/lib
135+ /usr/lib
136+)
137+
138+FIND_LIBRARY(OPENGLES2_EGL_LIBRARY
139+ NAMES EGL
140+ PATHS /usr/shlib /usr/X11R6/lib
141+ /usr/lib
142+)
143+
144+# On Unix OpenGL most certainly always requires X11.
145+# Feel free to tighten up these conditions if you don't
146+# think this is always true.
147+# It's not true on OSX.
148+
149+IF (OPENGLES2_LIBRARY)
150+ IF(NOT X11_FOUND)
151+ INCLUDE(FindX11)
152+ ENDIF(NOT X11_FOUND)
153+ IF (X11_FOUND)
154+ IF (NOT APPLE)
155+ SET (OPENGLES2_LIBRARIES ${X11_LIBRARIES})
156+ ENDIF (NOT APPLE)
157+ ENDIF (X11_FOUND)
158+ENDIF(OPENGLES2_LIBRARY)
159+
160+SET( OPENGLES2_FOUND "NO" )
161+IF(OPENGLES2_LIBRARY AND OPENGLES2_EGL_LIBRARY)
162+ SET( OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY} ${OPENGLES2_EGL_LIBRARY} ${OPENGLES2_LIBRARIES})
163+ SET( OPENGLES2_FOUND "YES" )
164+ENDIF(OPENGLES2_LIBRARY AND OPENGLES2_EGL_LIBRARY)
165+
166
167=== modified file 'cmake/base.cmake'
168--- cmake/base.cmake 2012-05-24 00:55:17 +0000
169+++ cmake/base.cmake 2012-08-22 06:16:22 +0000
170@@ -24,6 +24,7 @@
171 compiz_print_configure_header ("Compiz")
172 compiz_color_message ("\n${_escape}[4mOptional features:${_escape}[0m\n")
173
174+ compiz_print_result_message ("GLESv2" USE_GLES)
175 compiz_print_result_message ("gtk window decorator" USE_GTK)
176 compiz_print_result_message ("metacity theme support" USE_METACITY)
177 compiz_print_result_message ("gconf schemas" USE_GCONF)
178@@ -50,11 +51,13 @@
179 endif ()
180 install (FILES
181 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCompiz.cmake
182+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindOpenGLES2.cmake
183 DESTINATION
184 ${CMAKE_INSTALL_PREFIX}/share/cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/)
185 add_custom_target (findcompiz_install
186 ${CMAKE_COMMAND} -E make_directory ${CMAKE_ROOT}/Modules &&
187 ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindCompiz.cmake ${CMAKE_ROOT}/Modules
188+ ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindOpenGLES2.cmake ${CMAKE_ROOT}/Modules
189 )
190 find_file (_find_compizconfig FindCompizConfig.cmake PATHS ${CMAKE_ROOT}/Modules ${ARGN})
191 if (NOT _find_compizconfig)
192
193=== added file 'cmake/plugin_extensions/CompizOpenGLFixups.cmake'
194--- cmake/plugin_extensions/CompizOpenGLFixups.cmake 1970-01-01 00:00:00 +0000
195+++ cmake/plugin_extensions/CompizOpenGLFixups.cmake 2012-08-22 06:16:22 +0000
196@@ -0,0 +1,22 @@
197+
198+# modify pkg-config libs for opengl based on if we found GLES or not
199+if (${COMPIZ_CURRENT_PLUGIN} STREQUAL "opengl")
200+ if (USE_GLES)
201+ set (PKGCONFIG_LIBS "-lGLESv2 -lEGL")
202+ else (USE_GLES)
203+ set (PKGCONFIG_LIBS "-lGL")
204+ endif (USE_GLES)
205+endif (${COMPIZ_CURRENT_PLUGIN} STREQUAL "opengl")
206+
207+# if plugin is using opengl plugin check for GLES library and set correct define
208+if (NOT "${${_PLUGIN}_PLUGINDEPS}" STREQUAL "")
209+ string (REGEX MATCH "opengl" opengl_found ${${_PLUGIN}_PLUGINDEPS})
210+
211+ if (opengl_found STREQUAL "opengl")
212+ if (USE_GLES)
213+ set (${_PLUGIN}_CFLAGSADD ${${_PLUGIN}_CFLAGSADD} " -DUSE_GLES")
214+ string (REPLACE ";" " " ${_PLUGIN}_CFLAGSADD ${${_PLUGIN}_CFLAGSADD})
215+ endif (USE_GLES)
216+ endif (opengl_found STREQUAL "opengl")
217+endif (NOT "${${_PLUGIN}_PLUGINDEPS}" STREQUAL "")
218+
219
220=== modified file 'include/core/wrapsystem.h'
221--- include/core/wrapsystem.h 2012-05-14 16:55:59 +0000
222+++ include/core/wrapsystem.h 2012-08-22 06:16:22 +0000
223@@ -52,6 +52,10 @@
224 } \
225 enum { func ## Index = num };
226
227+// For compatability ignore num and forward
228+#define WRAPABLE_HND_FUNC(num, func, ...) \
229+ WRAPABLE_HND_FUNCTN(func, __VA_ARGS__)
230+
231 // New macro that doesn't need magic number
232 #define WRAPABLE_HND_FUNCTN(func, ...) \
233 { \
234@@ -69,6 +73,10 @@
235 mCurrFunction[num] = curr; \
236 }
237
238+// For compatability ignore num and forward
239+#define WRAPABLE_HND_FUNC_RETURN(num, rtype, func, ...) \
240+ WRAPABLE_HND_FUNCTN_RETURN(rtype, func, __VA_ARGS__)
241+
242 // New macro that doesn't need magic number
243 #define WRAPABLE_HND_FUNCTN_RETURN(rtype, func, ...) \
244 { \
245
246=== modified file 'plugins/CMakeLists.txt'
247--- plugins/CMakeLists.txt 2012-06-24 09:00:27 +0000
248+++ plugins/CMakeLists.txt 2012-08-22 06:16:22 +0000
249@@ -25,4 +25,34 @@
250 ${CMAKE_CURRENT_SOURCE_DIR}/../logmessage/include
251 )
252
253+# temporarily disable plugins that aren't ported yed
254+set (COMPIZ_DISABLE_PLUGIN_ANIMATIONADDON ON)
255+set (COMPIZ_DISABLE_PLUGIN_BICUBIC ON)
256+set (COMPIZ_DISABLE_PLUGIN_BLUR ON)
257+set (COMPIZ_DISABLE_PLUGIN_COLORFILTER ON)
258+set (COMPIZ_DISABLE_PLUGIN_CUBEADDON ON)
259+set (COMPIZ_DISABLE_PLUGIN_GEARS ON)
260+set (COMPIZ_DISABLE_PLUGIN_GROUP ON)
261+set (COMPIZ_DISABLE_PLUGIN_LOGINOUT ON)
262+set (COMPIZ_DISABLE_PLUGIN_REFLEX ON)
263+set (COMPIZ_DISABLE_PLUGIN_THUMBNAIL ON)
264+set (COMPIZ_DISABLE_PLUGIN_STACKSWITCH ON)
265+set (COMPIZ_DISABLE_PLUGIN_WALLPAPER ON)
266+set (COMPIZ_DISABLE_PLUGIN_TRIP ON)
267+
268+# disable plugins which won't work on ES2 builds
269+if (BUILD_GLES)
270+
271+ set (COMPIZ_DISABLE_PLUGIN_TD ON)
272+ set (COMPIZ_DISABLE_PLUGIN_COLORFILTER ON)
273+ set (COMPIZ_DISABLE_PLUGIN_MBLUR ON)
274+ set (COMPIZ_DISABLE_PLUGIN_BENCH ON)
275+ set (COMPIZ_DISABLE_PLUGIN_FIREPAINT ON)
276+ set (COMPIZ_DISABLE_PLUGIN_SHOWREPAINT ON)
277+ set (COMPIZ_DISABLE_PLUGIN_WIDGET ON)
278+ set (COMPIZ_DISABLE_PLUGIN_SHOWMOUSE ON)
279+ set (COMPIZ_DISABLE_PLUGIN_SPLASH ON)
280+
281+endif (BUILD_GLES)
282+
283 compiz_add_plugins_in_folder (${CMAKE_CURRENT_SOURCE_DIR})
284
285=== modified file 'plugins/animation/CMakeLists.txt'
286--- plugins/animation/CMakeLists.txt 2012-05-16 17:40:41 +0000
287+++ plugins/animation/CMakeLists.txt 2012-08-22 06:16:22 +0000
288@@ -1,7 +1,5 @@
289 find_package (Compiz REQUIRED)
290 include (CompizPlugin)
291-include (FindOpenGL)
292-
293-if (OPENGL_GLU_FOUND)
294- compiz_plugin (animation PLUGINDEPS composite opengl LIBRARIES ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
295-endif (OPENGL_GLU_FOUND)
296+
297+compiz_plugin (animation PLUGINDEPS composite opengl)
298+
299
300=== modified file 'plugins/animation/include/animation/animation.h'
301--- plugins/animation/include/animation/animation.h 2012-08-16 09:47:15 +0000
302+++ plugins/animation/include/animation/animation.h 2012-08-22 06:16:22 +0000
303@@ -3,8 +3,8 @@
304
305 #define ANIMATION_ABI 20091205
306
307+#include <core/core.h>
308 #include <core/pluginclasshandler.h>
309-#include <opengl/fragment.h>
310
311 typedef enum
312 {
313
314=== modified file 'plugins/animation/include/animation/animeffect.h'
315--- plugins/animation/include/animation/animeffect.h 2012-08-20 14:24:34 +0000
316+++ plugins/animation/include/animation/animeffect.h 2012-08-22 06:16:22 +0000
317@@ -88,7 +88,7 @@
318
319 int mOverrideProgressDir; ///< 0: default dir, 1: forward, 2: backward
320
321- GLFragment::Attrib mCurPaintAttrib;
322+ GLWindowPaintAttrib mCurPaintAttrib;
323 GLushort mStoredOpacity;
324 WindowEvent mCurWindowEvent;
325 bool mInitialized; ///< whether the animation is initialized (in preparePaint)
326@@ -195,7 +195,7 @@
327 virtual ExtensionPluginInfo *getExtensionPluginInfo ();
328
329 void drawTexture (GLTexture *texture,
330- GLFragment::Attrib &attrib,
331+ const GLWindowPaintAttrib &attrib,
332 unsigned int mask);
333
334 // Utility methods
335@@ -221,7 +221,7 @@
336 GLMatrix &transform);
337 void setInitialized () { mInitialized = true; }
338 inline bool initialized () { return mInitialized; }
339- inline void setCurPaintAttrib (GLFragment::Attrib &newAttrib)
340+ inline void setCurPaintAttrib (const GLWindowPaintAttrib &newAttrib)
341 { mCurPaintAttrib = newAttrib; }
342 };
343 #endif
344
345=== modified file 'plugins/animation/include/animation/grid.h'
346--- plugins/animation/include/animation/grid.h 2012-04-10 06:13:37 +0000
347+++ plugins/animation/include/animation/grid.h 2012-08-22 06:16:22 +0000
348@@ -78,8 +78,6 @@
349 /// ( http://www.r3.nu/~cass/qcoord/ )
350 bool mUseQTexCoord;
351
352- GLWindow::Geometry mGeometry; ///< geometry for grid mesh
353-
354 virtual bool using3D () { return false; }
355
356 virtual bool requiresTransformedWindow () const { return true; }
357
358=== modified file 'plugins/animation/src/animation.cpp'
359--- plugins/animation/src/animation.cpp 2012-08-20 14:24:34 +0000
360+++ plugins/animation/src/animation.cpp 2012-08-22 06:16:22 +0000
361@@ -26,6 +26,10 @@
362 * Particle system added by : (C) 2006 Dennis Kasprzyk
363 * E-mail : onestone@beryl-project.org
364 *
365+ * Ported to GLES by : Travis Watkins
366+ * (C) 2011 Linaro Limited
367+ * E-mail : travis.watkins@linaro.org
368+ *
369 * This program is free software; you can redistribute it and/or
370 * modify it under the terms of the GNU General Public License
371 * as published by the Free Software Foundation; either version 2
372@@ -80,8 +84,9 @@
373 *
374 */
375
376-#include <GL/glu.h>
377 #include <core/atoms.h>
378+#include <core/core.h>
379+#include <opengl/opengl.h>
380 #include <sys/time.h>
381 #include <assert.h>
382 #include "private.h"
383@@ -807,6 +812,58 @@
384 coordsTransformed[GLVector::y]);
385 }
386
387+static bool
388+project (float objx, float objy, float objz,
389+ const float modelview[16], const float projection[16],
390+ const GLint viewport[4],
391+ float *winx, float *winy, float *winz)
392+{
393+ unsigned int i;
394+ float in[4];
395+ float out[4];
396+
397+ in[0] = objx;
398+ in[1] = objy;
399+ in[2] = objz;
400+ in[3] = 1.0;
401+
402+ for (i = 0; i < 4; i++) {
403+ out[i] =
404+ in[0] * modelview[i] +
405+ in[1] * modelview[4 + i] +
406+ in[2] * modelview[8 + i] +
407+ in[3] * modelview[12 + i];
408+ }
409+
410+ for (i = 0; i < 4; i++) {
411+ in[i] =
412+ out[0] * projection[i] +
413+ out[1] * projection[4 + i] +
414+ out[2] * projection[8 + i] +
415+ out[3] * projection[12 + i];
416+ }
417+
418+ if (in[3] == 0.0)
419+ return false;
420+
421+ in[0] /= in[3];
422+ in[1] /= in[3];
423+ in[2] /= in[3];
424+ /* Map x, y and z to range 0-1 */
425+ in[0] = in[0] * 0.5 + 0.5;
426+ in[1] = in[1] * 0.5 + 0.5;
427+ in[2] = in[2] * 0.5 + 0.5;
428+
429+ /* Map x,y to viewport */
430+ in[0] = in[0] * viewport[2] + viewport[0];
431+ in[1] = in[1] * viewport[3] + viewport[1];
432+
433+ *winx = in[0];
434+ *winy = in[1];
435+ *winz = in[2];
436+ return true;
437+}
438+
439 /// Either points or objects should be non-0.
440 bool
441 AnimWindow::expandBBWithPoints3DTransform (CompOutput &output,
442@@ -815,27 +872,24 @@
443 GridAnim::GridModel::GridObject *objects,
444 unsigned int nPoints)
445 {
446- GLdouble dModel[16];
447- GLdouble dProjection[16];
448- GLdouble x, y, z;
449- for (unsigned int i = 0; i < 16; i++)
450- {
451- dModel[i] = transform[i];
452- dProjection[i] = GLScreen::get (::screen)->projectionMatrix ()[i];
453- }
454+ GLfloat x, y, z;
455 GLint viewport[4] =
456 {output.region ()->extents.x1,
457 output.region ()->extents.y1,
458 output.width (),
459 output.height ()};
460
461+ const float *projection =
462+ GLScreen::get (::screen)->projectionMatrix ()->getMatrix ();
463+
464 if (points) // use points
465 {
466 for (; nPoints; nPoints--, points += 3)
467 {
468- if (!gluProject (points[0], points[1], points[2],
469- dModel, dProjection, viewport,
470- &x, &y, &z))
471+ if (!project (points[0], points[1], points[2],
472+ transform.getMatrix (), projection,
473+ viewport,
474+ &x, &y, &z))
475 return false;
476
477 expandBBWithPoint (x + 0.5, (::screen->height () - y) + 0.5);
478@@ -846,11 +900,12 @@
479 GridAnim::GridModel::GridObject *object = objects;
480 for (; nPoints; nPoints--, object++)
481 {
482- if (!gluProject (object->position ().x (),
483- object->position ().y (),
484- object->position ().z (),
485- dModel, dProjection, viewport,
486- &x, &y, &z))
487+ if (!project (object->position ().x (),
488+ object->position ().y (),
489+ object->position ().z (),
490+ transform.getMatrix (), projection,
491+ viewport,
492+ &x, &y, &z))
493 return false;
494
495 expandBBWithPoint (x + 0.5, (::screen->height () - y) + 0.5);
496@@ -906,15 +961,10 @@
497 void
498 PrivateAnimWindow::damageThisAndLastStepRegion ()
499 {
500-#ifdef COMPIZ_OPENGL_SWAPBUFFERS_ALWAYS // when LP: #901097 is fixed
501 // Find union of the regions for this step and last step
502 CompRegion totalRegionToDamage (mStepRegion + mLastStepRegion);
503
504 mPAScreen->cScreen->damageRegion (totalRegionToDamage);
505-#else
506- // Ugly fix for LP: #930192 while LP: #901097 is not resolved
507- mPAScreen->cScreen->damageScreen ();
508-#endif
509 }
510
511 CompOutput &
512@@ -1435,7 +1485,7 @@
513 {
514 gWindow->glPaintSetEnabled (this, enabling);
515 gWindow->glAddGeometrySetEnabled (this, enabling);
516- gWindow->glDrawGeometrySetEnabled (this, enabling);
517+ //gWindow->glDrawGeometrySetEnabled (this, enabling);
518 gWindow->glDrawTextureSetEnabled (this, enabling);
519 }
520
521@@ -1509,7 +1559,8 @@
522
523 void
524 PrivateAnimWindow::glDrawTexture (GLTexture *texture,
525- GLFragment::Attrib &attrib,
526+ const GLMatrix &transform,
527+ const GLWindowPaintAttrib &attrib,
528 unsigned int mask)
529 {
530 if (mCurAnimation)
531@@ -1517,9 +1568,10 @@
532 mCurAnimation->setCurPaintAttrib (attrib);
533 }
534
535- gWindow->glDrawTexture (texture, attrib, mask);
536+ gWindow->glDrawTexture (texture, transform, attrib, mask);
537 }
538
539+#if 0 // Not ported yet
540 void
541 PrivateAnimWindow::glDrawGeometry ()
542 {
543@@ -1533,10 +1585,11 @@
544 gWindow->glDrawGeometry ();
545 }
546 }
547+#endif
548
549 void
550 Animation::drawTexture (GLTexture *texture,
551- GLFragment::Attrib &attrib,
552+ const GLWindowPaintAttrib &attrib,
553 unsigned int mask)
554 {
555 mCurPaintAttrib = attrib;
556@@ -1545,7 +1598,9 @@
557 void
558 Animation::drawGeometry ()
559 {
560+#if 0 // Not ported yet
561 mAWindow->priv->gWindow->glDrawGeometry ();
562+#endif
563 }
564
565 bool
566@@ -1614,13 +1669,16 @@
567
568 if (mCurAnimation->postPaintWindowUsed ())
569 {
570+#if 0 // Not ported yet
571 // Transform to make post-paint coincide with the window
572 glPushMatrix ();
573 glLoadMatrixf (wTransform.getMatrix ());
574-
575+#endif
576 mCurAnimation->postPaintWindow ();
577
578+#if 0 // Not ported yet
579 glPopMatrix ();
580+#endif
581 }
582
583 return status;
584
585=== modified file 'plugins/animation/src/grid.cpp'
586--- plugins/animation/src/grid.cpp 2010-10-23 15:41:33 +0000
587+++ plugins/animation/src/grid.cpp 2012-08-22 06:16:22 +0000
588@@ -19,6 +19,8 @@
589 * Hexagon tessellator added by : Mike Slegeir
590 * E-mail : mikeslegeir@mail.utexas.edu>
591 *
592+ * Ported to GLVertexBuffer by: Daniel van Vugt <daniel.van.vugt@canonical.com>
593+ *
594 * This program is free software; you can redistribute it and/or
595 * modify it under the terms of the GNU General Public License
596 * as published by the Free Software Foundation; either version 2
597@@ -217,34 +219,19 @@
598 unsigned int maxGridWidth,
599 unsigned int maxGridHeight)
600 {
601- unsigned int nMatrix = matrix.size ();
602- int nVertices, nIndices;
603- GLushort *i;
604- GLfloat *v;
605- int x1, y1, x2, y2;
606+
607+ GLfloat *v, *vMax;
608+ int y1, x2, y2;
609 float winContentsY, winContentsHeight;
610 float deformedX, deformedY;
611 float deformedZ = 0;
612- int nVertX, nVertY;
613 int vSize;
614 float gridW, gridH;
615- bool rect = true;
616 bool notUsing3dCoords = !using3D ();
617
618 if (region.isEmpty ()) // nothing to do
619 return;
620
621- GLWindow::Geometry &geometry = GLWindow::get (mWindow)->geometry ();
622-
623- for (unsigned int it = 0; it < nMatrix; it++)
624- {
625- if (matrix[it].xy != 0.0f || matrix[it].yx != 0.0f)
626- {
627- rect = false;
628- break;
629- }
630- }
631-
632 CompRect outRect (mAWindow->savedRectsValid () ?
633 mAWindow->savedOutRect () :
634 mWindow->outputRect ());
635@@ -262,30 +249,15 @@
636 winContentsY = oy + outExtents.top;
637 winContentsHeight = oheight - outExtents.top - outExtents.bottom;
638
639- geometry.texUnits = (int)nMatrix;
640-
641- if (geometry.vCount == 0)
642- {
643- // reset
644- geometry.indexCount = 0;
645- geometry.texCoordSize = 4;
646- }
647- geometry.vertexStride = 3 + geometry.texUnits * geometry.texCoordSize;
648- vSize = geometry.vertexStride;
649-
650- nVertices = geometry.vCount;
651- nIndices = geometry.indexCount;
652-
653- v = geometry.vertices + (nVertices * vSize);
654- i = geometry.indices + nIndices;
655-
656- // For each clip passed to this function
657- foreach (const CompRect &pClip, region.rects ())
658- {
659- x1 = pClip.x1 ();
660- y1 = pClip.y1 ();
661- x2 = pClip.x2 ();
662- y2 = pClip.y2 ();
663+ GLWindow *gWindow = GLWindow::get (mWindow);
664+ GLVertexBuffer *vertexBuffer = gWindow->vertexBuffer ();
665+ vSize = vertexBuffer->getVertexStride ();
666+
667+ // Indentation kept to provide a clean diff with the old code, for now...
668+ {
669+ y1 = outRect.y1 ();
670+ x2 = outRect.x2 ();
671+ y2 = outRect.y2 ();
672
673 gridW = (float)owidth / (mGridWidth - 1);
674
675@@ -310,64 +282,22 @@
676 else
677 gridH = (float)oheight / (mGridHeight - 1);
678
679- // nVertX, nVertY: number of vertices for this clip in x and y dimensions
680- // + 2 to avoid running short of vertices in some cases
681- nVertX = ceil ((x2 - x1) / gridW) + 2;
682- nVertY = (gridH ? ceil ((y2 - y1) / gridH) : 0) + 2;
683-
684- // Allocate 4 indices for each quad
685- int newIndexSize = nIndices + ((nVertX - 1) * (nVertY - 1) * 4);
686-
687- if (newIndexSize > geometry.indexSize)
688- {
689- if (!geometry.moreIndices (newIndexSize))
690- return;
691-
692- i = geometry.indices + nIndices;
693- }
694- // Assign quad vertices to indices
695- for (int jy = 0; jy < nVertY - 1; jy++)
696- {
697- for (int jx = 0; jx < nVertX - 1; jx++)
698- {
699- *i++ = nVertices + nVertX * (2 * jy + 1) + jx;
700- *i++ = nVertices + nVertX * (2 * jy + 1) + jx + 1;
701- *i++ = nVertices + nVertX * 2 * jy + jx + 1;
702- *i++ = nVertices + nVertX * 2 * jy + jx;
703-
704- nIndices += 4;
705- }
706- }
707-
708- // Allocate vertices
709- int newVertexSize =
710- (nVertices + nVertX * (2 * nVertY - 2)) * vSize;
711- if (newVertexSize > geometry.vertexSize)
712- {
713- if (!geometry.moreVertices (newVertexSize))
714- return;
715-
716- v = geometry.vertices + (nVertices * vSize);
717- }
718-
719- float rowTexCoordQ = 1;
720- float prevRowCellWidth = 0; // this initial value won't be used
721- float rowCellWidth = 0;
722- int clipRowSize = nVertX * vSize;
723-
724+ int oldCount = vertexBuffer->countVertices ();
725+ gWindow->glAddGeometry (matrix, region, clip, gridW, gridH);
726+ int newCount = vertexBuffer->countVertices ();
727+ v = vertexBuffer->getVertices () + (oldCount * vSize);
728+ vMax = vertexBuffer->getVertices () + (newCount * vSize);
729+
730 // For each vertex
731- float y = y1;
732- for (int jy = 0; jy < nVertY; jy++)
733+ for (; v < vMax; v += vSize)
734 {
735+ float x = v[0];
736+ float y = v[1];
737 float topiyFloat;
738- bool applyOffsets = true;
739
740 if (y > y2)
741 y = y2;
742
743- // Do calculations for y here to avoid repeating
744- // them unnecessarily in the x loop
745-
746 if (mCurWindowEvent == WindowEventShade ||
747 mCurWindowEvent == WindowEventUnshade)
748 {
749@@ -375,7 +305,6 @@
750 {
751 topiyFloat = (y - oy) / mDecorTopHeight;
752 topiyFloat = MIN (topiyFloat, 0.999); // avoid 1.0
753- applyOffsets = false;
754 }
755 else if (y2 > winContentsY + winContentsHeight) // if at bottom
756 {
757@@ -383,7 +312,6 @@
758 (mDecorBottomHeight ? (y - winContentsY -
759 winContentsHeight) /
760 mDecorBottomHeight : 0);
761- applyOffsets = false;
762 }
763 else // in window contents (only in Y coords)
764 {
765@@ -406,8 +334,7 @@
766
767 // End of calculations for y
768
769- float x = x1;
770- for (int jx = 0; jx < nVertX; jx++)
771+ // Indentation kept to provide a clean diff with the old code...
772 {
773 if (x > x2)
774 x = x2;
775@@ -461,179 +388,19 @@
776 deformedY = inyRest * hor1y + iny * hor2y;
777 deformedZ = inyRest * hor1z + iny * hor2z;
778
779- // Texture coordinates (s, t, r, q)
780-
781- if (mUseQTexCoord)
782- {
783- if (jx == 1)
784- rowCellWidth = deformedX - v[-3];
785-
786- // do only once per row for all rows except row 0
787- if (jy > 0 && jx == 1)
788- {
789- rowTexCoordQ = (rowCellWidth / prevRowCellWidth);
790-
791- for (unsigned int it = 0; it < nMatrix; it++, v += 4)
792- {
793- // update first column
794- // (since we didn't know rowTexCoordQ before)
795- v[-vSize] *= rowTexCoordQ; // multiply s & t by q
796- v[-vSize + 1] *= rowTexCoordQ;
797- v[-vSize + 3] = rowTexCoordQ; // copy q
798- }
799- v -= nMatrix * 4;
800- }
801- }
802-
803- // Loop for each texture element
804- // (4 texture coordinates for each one)
805- for (unsigned int it = 0; it < nMatrix; it++, v += 4)
806- {
807- float offsetY = 0;
808-
809- if (rect)
810- {
811- if (applyOffsets && y < y2)
812- offsetY = objToTopLeft->mOffsetTexCoordForQuadAfter.y ();
813- v[0] = COMP_TEX_COORD_X (matrix[it], x); // s
814- v[1] = COMP_TEX_COORD_Y (matrix[it], y + offsetY); // t
815- }
816- else
817- {
818- if (applyOffsets && y < y2)
819- // FIXME:
820- // The correct y offset below produces wrong
821- // texture coordinates for some reason.
822- offsetY = 0;
823- // offsetY = objToTopLeft->offsetTexCoordForQuadAfter.y;
824- v[0] = COMP_TEX_COORD_XY (matrix[it], x, y + offsetY); // s
825- v[1] = COMP_TEX_COORD_YX (matrix[it], x, y + offsetY); // t
826- }
827- v[2] = 0; // r
828-
829- if (0 < jy && jy < nVertY - 1)
830- {
831- // copy s, t, r to duplicate row
832- memcpy (v + clipRowSize, v, 3 * sizeof (GLfloat));
833- v[3 + clipRowSize] = 1; // q
834- }
835-
836- if (applyOffsets &&
837- objToTopLeft->mOffsetTexCoordForQuadBefore.y () != 0)
838- {
839- // After copying to next row, update texture y coord
840- // by following object's offset
841- offsetY = objToTopLeft->mOffsetTexCoordForQuadBefore.y ();
842- if (rect)
843- {
844- v[1] = COMP_TEX_COORD_Y (matrix[it], y + offsetY);
845- }
846- else
847- {
848- v[0] = COMP_TEX_COORD_XY (matrix[it],
849- x, y + offsetY);
850- v[1] = COMP_TEX_COORD_YX (matrix[it],
851- x, y + offsetY);
852- }
853- }
854- if (mUseQTexCoord)
855- {
856- v[3] = rowTexCoordQ; // q
857-
858- if (jx > 0) // since column 0 is updated when jx == 1
859- {
860- // multiply s & t by q
861- v[0] *= rowTexCoordQ;
862- v[1] *= rowTexCoordQ;
863- }
864- }
865- else
866- {
867- v[3] = 1; // q
868- }
869- }
870-
871 v[0] = deformedX;
872 v[1] = deformedY;
873 v[2] = deformedZ;
874
875- // Copy vertex coordinates to duplicate row
876- if (0 < jy && jy < nVertY - 1)
877- memcpy (v + clipRowSize, v, 3 * sizeof (GLfloat));
878-
879- nVertices++;
880-
881- // increment x properly (so that coordinates fall on grid intersections)
882- x = rightix * gridW + ox;
883-
884- v += 3; // move on to next vertex
885- }
886- if (mUseQTexCoord)
887- prevRowCellWidth = rowCellWidth;
888-
889- if (0 < jy && jy < nVertY - 1)
890- {
891- v += clipRowSize; // skip the duplicate row
892- nVertices += nVertX;
893- }
894- // increment y properly (so that coordinates fall on grid intersections)
895- if (mCurWindowEvent == WindowEventShade ||
896- mCurWindowEvent == WindowEventUnshade)
897- {
898- y += gridH;
899- }
900- else
901- {
902- y = bottomiy * gridH + oy;
903 }
904 }
905 }
906- geometry.vCount = nVertices;
907- geometry.indexCount = nIndices;
908 }
909
910 void
911 GridAnim::drawGeometry ()
912 {
913- GLWindow::Geometry &geometry = GLWindow::get (mWindow)->geometry ();
914-
915- int texUnit = geometry.texUnits;
916- int currentTexUnit = 0;
917- int stride = geometry.vertexStride;
918- GLfloat *vertices = geometry.vertices + (stride - 3);
919-
920- stride *= (int) sizeof (GLfloat);
921-
922- glVertexPointer (3, GL_FLOAT, stride, vertices);
923-
924- while (texUnit--)
925- {
926- if (texUnit != currentTexUnit)
927- {
928- (*GL::clientActiveTexture) ((GLenum)(GL_TEXTURE0_ARB + texUnit));
929- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
930- currentTexUnit = texUnit;
931- }
932- vertices -= geometry.texCoordSize;
933- glTexCoordPointer (geometry.texCoordSize,
934- GL_FLOAT, stride, vertices);
935- }
936-
937- glDrawElements (GL_QUADS, geometry.indexCount,
938- GL_UNSIGNED_SHORT, geometry.indices);
939-
940- // disable all texture coordinate arrays except 0
941- texUnit = geometry.texUnits;
942- if (texUnit > 1)
943- {
944- while (--texUnit)
945- {
946- (*GL::clientActiveTexture) ((GLenum)(GL_TEXTURE0_ARB + texUnit));
947- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
948- }
949-
950- (*GL::clientActiveTexture) (GL_TEXTURE0_ARB);
951- }
952+ // Deprecated
953 }
954
955 GridTransformAnim::GridTransformAnim (CompWindow *w,
956
957=== modified file 'plugins/animation/src/private.h'
958--- plugins/animation/src/private.h 2012-05-27 04:32:55 +0000
959+++ plugins/animation/src/private.h 2012-08-22 06:16:22 +0000
960@@ -407,9 +407,9 @@
961 void glAddGeometry (const GLTexture::MatrixList &,
962 const CompRegion &, const CompRegion &,
963 unsigned int = MAXSHORT, unsigned int = MAXSHORT);
964- void glDrawTexture (GLTexture *texture, GLFragment::Attrib &,
965- unsigned int);
966- void glDrawGeometry ();
967+ void glDrawTexture (GLTexture *texture, const GLMatrix &,
968+ const GLWindowPaintAttrib &, unsigned int);
969+ //void glDrawGeometry ();
970 };
971
972 class RollUpAnim :
973
974=== modified file 'plugins/annotate/src/annotate.cpp'
975--- plugins/annotate/src/annotate.cpp 2012-07-30 09:20:41 +0000
976+++ plugins/annotate/src/annotate.cpp 2012-08-22 06:16:22 +0000
977@@ -629,11 +629,14 @@
978
979 if (status)
980 {
981+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
982+ GLfloat vertexData[18];
983+ GLfloat textureData[12];
984 CompRect rect;
985 GLMatrix sTransform = transform;
986 int numRect;
987 int pos = 0;
988- float vectorX, vectorY, offset;
989+ float offset;
990 int angle;
991
992 offset = optionGetStrokeWidth () / 2;
993@@ -641,10 +644,6 @@
994 /* This replaced prepareXCoords (s, output, -DEFAULT_Z_CAMERA) */
995 sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
996
997- glPushMatrix ();
998- glLoadMatrixf (sTransform.getMatrix ());
999-
1000- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
1001 glEnable (GL_BLEND);
1002
1003 if (content && !region.isEmpty ())
1004@@ -656,34 +655,66 @@
1005
1006 tex->enable (GLTexture::Fast);
1007
1008- glBegin (GL_QUADS);
1009+ streamingBuffer->begin (GL_TRIANGLES);
1010
1011 while (numRect--)
1012 {
1013- glTexCoord2f (
1014- COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x1 ()),
1015- COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y2 ()));
1016- glVertex2i (rect.at (pos).x1 (), rect.at (pos).y2 ());
1017-
1018- glTexCoord2f (
1019- COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x2 ()),
1020- COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y2 ()));
1021- glVertex2i (rect.at (pos).x2 (), rect.at (pos).y2 ());
1022-
1023- glTexCoord2f (
1024- COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x2 ()),
1025- COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y1 ()));
1026- glVertex2i (rect.at (pos).x2 (), rect.at (pos).y1 ());
1027-
1028- glTexCoord2f (
1029- COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x1 ()),
1030- COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y1 ()));
1031- glVertex2i (rect.at (pos).x1 (), rect.at (pos).y1 ());
1032-
1033+ GLfloat tx1 = COMP_TEX_COORD_X (tex->matrix (),
1034+ rect.at (pos).x1 ());
1035+ GLfloat tx2 = COMP_TEX_COORD_X (tex->matrix (),
1036+ rect.at (pos).x2 ());
1037+ GLfloat ty1 = COMP_TEX_COORD_Y (tex->matrix (),
1038+ rect.at (pos).y1 ());
1039+ GLfloat ty2 = COMP_TEX_COORD_Y (tex->matrix (),
1040+ rect.at (pos).y2 ());
1041+
1042+ vertexData[0] = rect.at (pos).x1 ();
1043+ vertexData[1] = rect.at (pos).y1 ();
1044+ vertexData[2] = 0.0f;
1045+ vertexData[3] = rect.at (pos).x1 ();
1046+ vertexData[4] = rect.at (pos).y2 ();
1047+ vertexData[5] = 0.0f;
1048+ vertexData[6] = rect.at (pos).x2 ();
1049+ vertexData[7] = rect.at (pos).y1 ();
1050+ vertexData[8] = 0.0f;
1051+ vertexData[9] = rect.at (pos).x1 ();
1052+ vertexData[10] = rect.at (pos).y2 ();
1053+ vertexData[11] = 0.0f;
1054+
1055+ vertexData[12] = rect.at (pos).x2 ();
1056+ vertexData[13] = rect.at (pos).y2 ();
1057+ vertexData[14] = 0.0f;
1058+
1059+ vertexData[15] = rect.at (pos).x2 ();
1060+ vertexData[16] = rect.at (pos).y1 ();
1061+ vertexData[17] = 0.0f;
1062+
1063+ textureData[0] = tx1;
1064+ textureData[1] = ty1;
1065+
1066+ textureData[2] = tx1;
1067+ textureData[3] = ty2;
1068+
1069+ textureData[4] = tx2;
1070+ textureData[5] = ty1;
1071+
1072+ textureData[6] = tx1;
1073+ textureData[7] = ty2;
1074+
1075+ textureData[8] = tx2;
1076+ textureData[9] = ty2;
1077+
1078+ textureData[10] = tx2;
1079+ textureData[11] = ty1;
1080+
1081+ streamingBuffer->addVertices (6, vertexData);
1082+ streamingBuffer->addTexCoords (0, 6, textureData);
1083 pos++;
1084 }
1085
1086- glEnd ();
1087+ streamingBuffer->end ();
1088+ streamingBuffer->render (sTransform);
1089+
1090 tex->disable ();
1091 }
1092 }
1093@@ -691,85 +722,132 @@
1094 switch (drawMode)
1095 {
1096 case LineMode:
1097- glColor4usv (optionGetStrokeColor ());
1098 glLineWidth (optionGetStrokeWidth ());
1099- glBegin (GL_LINES);
1100- glVertex2i (initialPointerX, initialPointerY);
1101- glVertex2i (lineVector.x (), lineVector.y ());
1102- glEnd ();
1103+
1104+ streamingBuffer->begin (GL_LINES);
1105+
1106+ streamingBuffer->addColors (1, optionGetStrokeColor ());
1107+
1108+ vertexData[0] = initialPointerX;
1109+ vertexData[1] = initialPointerY;
1110+ vertexData[2] = 0.0f;
1111+ vertexData[3] = lineVector.x ();
1112+ vertexData[4] = lineVector.y ();
1113+ vertexData[5] = 0.0f;
1114+ streamingBuffer->addVertices (2, vertexData);
1115+
1116+ streamingBuffer->end ();
1117+ streamingBuffer->render (sTransform);
1118 break;
1119
1120 case RectangleMode:
1121+ vertexData[0] = rectangle.x1 ();
1122+ vertexData[1] = rectangle.y1 ();
1123+ vertexData[2] = 0.0f;
1124+ vertexData[3] = rectangle.x1 ();
1125+ vertexData[4] = rectangle.y2 ();
1126+ vertexData[5] = 0.0f;
1127+ vertexData[6] = rectangle.x2 ();
1128+ vertexData[7] = rectangle.y1 ();
1129+ vertexData[8] = 0.0f;
1130+ vertexData[9] = rectangle.x2 ();
1131+ vertexData[10] = rectangle.y2 ();
1132+ vertexData[11] = 0.0f;
1133+
1134 /* fill rectangle */
1135- glColor4usv (optionGetFillColor ());
1136- glRecti (rectangle.x1 (), rectangle.y2 (),
1137- rectangle.x2 (), rectangle.y1 ());
1138+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
1139+
1140+ streamingBuffer->addColors (1, optionGetFillColor ());
1141+ streamingBuffer->addVertices (4, vertexData);
1142+
1143+ streamingBuffer->end ();
1144+ streamingBuffer->render (sTransform);
1145
1146 /* draw rectangle outline */
1147- glColor4usv (optionGetStrokeColor ());
1148- glRecti (rectangle.x1 () - offset, rectangle.y2 (),
1149- rectangle.x1 () + offset, rectangle.y1 ());
1150+/* streamingBuffer->begin ();
1151+
1152+ streamingBuffer->addColors (1, optionGetStrokeColor ());
1153+
1154+ vertexData[0] = rectangle.x1 () - offset;
1155+ vertexData[3] = rectangle.x1 () - offset;
1156+ streamingBuffer->addVertices (4, vertexData);
1157+
1158 glRecti (rectangle.x2 () - offset, rectangle.y2 (),
1159 rectangle.x2 () + offset, rectangle.y1 ());
1160 glRecti (rectangle.x1 () - offset, rectangle.y1 () + offset,
1161 rectangle.x2 () + offset, rectangle.y1 () - offset);
1162 glRecti (rectangle.x1 () - offset, rectangle.y2 () + offset,
1163- rectangle.x2 () + offset, rectangle.y2 () - offset);
1164+ rectangle.x2 () + offset, rectangle.y2 () - offset);*/
1165 break;
1166
1167 case EllipseMode:
1168 /* fill ellipse */
1169- glColor4usv (optionGetFillColor ());
1170-
1171- glBegin (GL_TRIANGLE_FAN);
1172- glVertex2d (ellipse.center.x (), ellipse.center.y ());
1173+ streamingBuffer->begin (GL_TRIANGLE_FAN);
1174+
1175+ streamingBuffer->addColors (1, optionGetFillColor ());
1176+
1177+ vertexData[0] = ellipse.center.x ();
1178+ vertexData[1] = ellipse.center.y ();
1179+ vertexData[2] = 0.0f;
1180+ streamingBuffer->addVertices (1, vertexData);
1181+
1182 for (angle = 0; angle <= 360; angle += 1)
1183 {
1184- vectorX = ellipse.center.x () +
1185+ vertexData[0] = ellipse.center.x () +
1186 (ellipse.radiusX * sinf (angle * DEG2RAD));
1187- vectorY = ellipse.center.y () +
1188+ vertexData[1] = ellipse.center.y () +
1189 (ellipse.radiusY * cosf (angle * DEG2RAD));
1190- glVertex2d (vectorX, vectorY);
1191+ streamingBuffer->addVertices (1, vertexData);
1192 }
1193- glVertex2d (ellipse.center.x (), ellipse.center.y () +
1194- ellipse.radiusY);
1195- glEnd();
1196+
1197+ vertexData[0] = ellipse.center.x ();
1198+ vertexData[1] = ellipse.center.y () + ellipse.radiusY;
1199+ streamingBuffer->addVertices (1, vertexData);
1200+
1201+ streamingBuffer->end ();
1202+ streamingBuffer->render (sTransform);
1203
1204 /* draw ellipse outline */
1205- glColor4usv (optionGetStrokeColor ());
1206 glLineWidth (optionGetStrokeWidth ());
1207
1208- glBegin (GL_TRIANGLE_STRIP);
1209- glVertex2d (ellipse.center.x (), ellipse.center.y () +
1210- ellipse.radiusY - offset);
1211+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
1212+
1213+ streamingBuffer->addColors (1, optionGetStrokeColor ());
1214+
1215+
1216+ vertexData[0] = ellipse.center.x ();
1217+ vertexData[1] = ellipse.center.y () + ellipse.radiusY - offset;
1218+ vertexData[2] = 0.0f;
1219+ streamingBuffer->addVertices (1, vertexData);
1220+
1221 for (angle = 360; angle >= 0; angle -= 1)
1222 {
1223- vectorX = ellipse.center.x () + ((ellipse.radiusX -
1224- offset) * sinf (angle * DEG2RAD));
1225- vectorY = ellipse.center.y () + ((ellipse.radiusY -
1226- offset) * cosf (angle * DEG2RAD));
1227- glVertex2d (vectorX, vectorY);
1228- vectorX = ellipse.center.x () + ((ellipse.radiusX +
1229- offset) * sinf (angle * DEG2RAD));
1230- vectorY = ellipse.center.y () + ((ellipse.radiusY +
1231- offset) * cosf (angle * DEG2RAD));
1232- glVertex2d (vectorX, vectorY);
1233+ vertexData[0] = ellipse.center.x () + ((ellipse.radiusX -
1234+ offset) * sinf (angle * DEG2RAD));
1235+ vertexData[1] = ellipse.center.y () + ((ellipse.radiusY -
1236+ offset) * cosf (angle * DEG2RAD));
1237+ vertexData[2] = 0.0f;
1238+ vertexData[3] = ellipse.center.x () + ((ellipse.radiusX +
1239+ offset) * sinf (angle * DEG2RAD));
1240+ vertexData[4] = ellipse.center.y () + ((ellipse.radiusY +
1241+ offset) * cosf (angle * DEG2RAD));
1242+ vertexData[5] = 0.0f;
1243+ streamingBuffer->addVertices (2, vertexData);
1244 }
1245- glVertex2d (ellipse.center.x (), ellipse.center.y () +
1246- ellipse.radiusY + offset);
1247- glEnd();
1248+
1249+ vertexData[0] = ellipse.center.x ();
1250+ vertexData[1] = ellipse.center.y () + ellipse.radiusY + offset;
1251+ streamingBuffer->addVertices (1, vertexData);
1252+
1253+ streamingBuffer->end ();
1254+ streamingBuffer->render (sTransform);
1255 break;
1256
1257 default:
1258 break;
1259 }
1260
1261- /* clean up */
1262- glColor4usv (defaultColor);
1263 glDisable (GL_BLEND);
1264- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
1265-
1266- glPopMatrix ();
1267 }
1268
1269 return status;
1270
1271=== modified file 'plugins/blur/CMakeLists.txt'
1272--- plugins/blur/CMakeLists.txt 2011-01-24 06:28:52 +0000
1273+++ plugins/blur/CMakeLists.txt 2012-08-22 06:16:22 +0000
1274@@ -2,15 +2,15 @@
1275
1276 include (CompizPlugin)
1277
1278-find_package (OpenGL)
1279-
1280-if (OPENGL_GLU_FOUND)
1281- compiz_plugin(blur PLUGINDEPS composite opengl LIBRARIES decoration ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
1282-
1283- if (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR)
1284- set_target_properties (
1285- blur PROPERTIES
1286- INSTALL_RPATH "${COMPIZ_LIBDIR}"
1287- )
1288- endif (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR)
1289-endif ()
1290+#find_package (OpenGL)
1291+
1292+#if (OPENGL_GLU_FOUND)
1293+# compiz_plugin(blur PLUGINDEPS composite opengl LIBRARIES decoration ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
1294+
1295+# if (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR)
1296+# set_target_properties (
1297+# blur PROPERTIES
1298+# INSTALL_RPATH "${COMPIZ_LIBDIR}"
1299+# )
1300+# endif (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR)
1301+#endif ()
1302
1303=== modified file 'plugins/clone/src/clone.cpp'
1304--- plugins/clone/src/clone.cpp 2012-07-30 09:20:41 +0000
1305+++ plugins/clone/src/clone.cpp 2012-08-22 06:16:22 +0000
1306@@ -295,9 +295,6 @@
1307 0.0f);
1308 sTransform.scale (zoomX, zoomY, 1.0f);
1309
1310- glPushMatrix ();
1311- glLoadMatrixf (sTransform.getMatrix ());
1312-
1313 filter = gScreen->textureFilter ();
1314
1315 if (offset == 0.0f)
1316@@ -325,8 +322,6 @@
1317 }
1318
1319 gScreen->setTextureFilter (filter);
1320-
1321- glPopMatrix ();
1322 }
1323
1324 return status;
1325
1326=== modified file 'plugins/compiztoolbox/src/compiztoolbox.cpp'
1327--- plugins/compiztoolbox/src/compiztoolbox.cpp 2012-07-30 11:20:17 +0000
1328+++ plugins/compiztoolbox/src/compiztoolbox.cpp 2012-08-22 06:16:22 +0000
1329@@ -465,9 +465,7 @@
1330 sAttrib.yTranslate = wy - g.y () +
1331 window->border ().top * sAttrib.yScale;
1332
1333- GLFragment::Attrib fragment (sAttrib);
1334-
1335- if (window->alpha () || fragment.getOpacity () != OPAQUE)
1336+ if (window->alpha () || sAttrib.opacity != OPAQUE)
1337 mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
1338
1339 wTransform.translate (g.x (), g.y (), 0.0f);
1340@@ -476,9 +474,6 @@
1341 sAttrib.yTranslate / sAttrib.yScale - g.y (),
1342 0.0f);
1343
1344- glPushMatrix ();
1345- glLoadMatrixf (wTransform.getMatrix ());
1346-
1347 filter = gScreen->textureFilter ();
1348
1349 if (baseScreen->getMipmap ())
1350@@ -488,13 +483,11 @@
1351 very ugly but necessary until the vertex stage has been made
1352 fully pluggable. */
1353 gWindow->glAddGeometrySetCurrentIndex (MAXSHORT);
1354- gWindow->glDraw (wTransform, fragment, infiniteRegion, mask);
1355+ gWindow->glDraw (wTransform, sAttrib, infiniteRegion, mask);
1356 gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex);
1357
1358 gScreen->setTextureFilter (filter);
1359
1360- glPopMatrix ();
1361-
1362 if (iconMode != HideIcon)
1363 {
1364 icon = gWindow->getIcon (MAX_ICON_SIZE, MAX_ICON_SIZE);
1365@@ -535,15 +528,14 @@
1366 sAttrib.xTranslate = wx - g.x ();
1367 sAttrib.yTranslate = wy - g.y ();
1368
1369- gWindow->geometry ().reset ();
1370+ gWindow->vertexBuffer ()->begin ();
1371
1372 gWindow->glAddGeometrySetCurrentIndex (MAXSHORT);
1373 gWindow->glAddGeometry (matrix, iconReg, infiniteRegion);
1374 gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex);
1375
1376- if (gWindow->geometry ().vCount)
1377+ if (gWindow->vertexBuffer ()->end ())
1378 {
1379- GLFragment::Attrib fragment (sAttrib);
1380 GLMatrix wTransform (transform);
1381
1382 wTransform.translate (g.x (), g.y (), 0.0f);
1383@@ -552,12 +544,7 @@
1384 sAttrib.yTranslate / sAttrib.yScale - g.y (),
1385 0.0f);
1386
1387- glPushMatrix ();
1388- glLoadMatrixf (wTransform.getMatrix ());
1389-
1390- gWindow->glDrawTexture (icon, fragment, mask);
1391-
1392- glPopMatrix ();
1393+ gWindow->glDrawTexture (icon, wTransform, sAttrib, mask);
1394 }
1395 }
1396 }
1397
1398=== modified file 'plugins/copytex/src/copytex.cpp'
1399--- plugins/copytex/src/copytex.cpp 2012-06-24 10:12:15 +0000
1400+++ plugins/copytex/src/copytex.cpp 2012-08-22 06:16:22 +0000
1401@@ -112,6 +112,14 @@
1402 GLenum target;
1403 GLTexture::Matrix matrix = _identity_matrix;
1404
1405+#ifdef USE_GLES
1406+ target = GL_TEXTURE_2D;
1407+ matrix.xx = 1.0f / dim.width ();
1408+ matrix.yy = 1.0f / dim.height ();
1409+ matrix.x0 = -dim.x () * matrix.xx;
1410+ matrix.y0 = -dim.y () * matrix.yy;
1411+#else
1412+
1413 if (GL::textureNonPowerOfTwo ||
1414 (POWER_OF_TWO (dim.width ()) && POWER_OF_TWO (dim.height ())))
1415 {
1416@@ -129,6 +137,7 @@
1417 matrix.x0 = -dim.x ();
1418 matrix.y0 = -dim.y ();
1419 }
1420+#endif
1421
1422 setData (target, matrix, false);
1423 setGeometry (dim.x1 (), dim.y1 (), dim.x2 () - dim.x1 (), dim.y2 () - dim.y1 ());
1424
1425=== modified file 'plugins/cube/include/cube/cube.h'
1426--- plugins/cube/include/cube/cube.h 2012-01-18 16:26:45 +0000
1427+++ plugins/cube/include/cube/cube.h 2012-08-22 06:16:22 +0000
1428@@ -62,15 +62,18 @@
1429 virtual void cubePaintTop (const GLScreenPaintAttrib &sAttrib,
1430 const GLMatrix &transform,
1431 CompOutput *output,
1432- int size);
1433+ int size,
1434+ const GLVector &normal);
1435 virtual void cubePaintBottom (const GLScreenPaintAttrib &sAttrib,
1436 const GLMatrix &transform,
1437 CompOutput *output,
1438- int size);
1439+ int size,
1440+ const GLVector &normal);
1441 virtual void cubePaintInside (const GLScreenPaintAttrib &sAttrib,
1442 const GLMatrix &transform,
1443 CompOutput *output,
1444- int size);
1445+ int size,
1446+ const GLVector &normal);
1447 virtual bool cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib,
1448 const GLMatrix &transform,
1449 CompOutput *output,
1450@@ -120,13 +123,13 @@
1451 float, float);
1452 WRAPABLE_HND (2, CubeScreenInterface, void, cubePaintTop,
1453 const GLScreenPaintAttrib &, const GLMatrix &,
1454- CompOutput *, int);
1455+ CompOutput *, int, const GLVector &);
1456 WRAPABLE_HND (3, CubeScreenInterface, void, cubePaintBottom,
1457 const GLScreenPaintAttrib &, const GLMatrix &,
1458- CompOutput *, int);
1459+ CompOutput *, int, const GLVector &);
1460 WRAPABLE_HND (4, CubeScreenInterface, void, cubePaintInside,
1461 const GLScreenPaintAttrib &, const GLMatrix &,
1462- CompOutput *, int);
1463+ CompOutput *, int, const GLVector &);
1464 WRAPABLE_HND (5, CubeScreenInterface, bool, cubeCheckOrientation,
1465 const GLScreenPaintAttrib &, const GLMatrix &,
1466 CompOutput *, std::vector<GLVector> &);
1467
1468=== modified file 'plugins/cube/src/cube.cpp'
1469--- plugins/cube/src/cube.cpp 2012-01-16 09:50:28 +0000
1470+++ plugins/cube/src/cube.cpp 2012-08-22 06:16:22 +0000
1471@@ -55,22 +55,25 @@
1472 CubeScreenInterface::cubePaintTop (const GLScreenPaintAttrib &sAttrib,
1473 const GLMatrix &transform,
1474 CompOutput *output,
1475- int size)
1476- WRAPABLE_DEF (cubePaintTop, sAttrib, transform, output, size)
1477+ int size,
1478+ const GLVector &normal)
1479+ WRAPABLE_DEF (cubePaintTop, sAttrib, transform, output, size, normal)
1480
1481 void
1482 CubeScreenInterface::cubePaintBottom (const GLScreenPaintAttrib &sAttrib,
1483 const GLMatrix &transform,
1484 CompOutput *output,
1485- int size)
1486- WRAPABLE_DEF (cubePaintBottom, sAttrib, transform, output, size)
1487+ int size,
1488+ const GLVector &normal)
1489+ WRAPABLE_DEF (cubePaintBottom, sAttrib, transform, output, size, normal)
1490
1491 void
1492 CubeScreenInterface::cubePaintInside (const GLScreenPaintAttrib &sAttrib,
1493 const GLMatrix &transform,
1494 CompOutput *output,
1495- int size)
1496- WRAPABLE_DEF (cubePaintInside, sAttrib, transform, output, size)
1497+ int size,
1498+ const GLVector &normal)
1499+ WRAPABLE_DEF (cubePaintInside, sAttrib, transform, output, size, normal)
1500
1501 bool
1502 CubeScreenInterface::cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib,
1503@@ -433,6 +436,7 @@
1504 }
1505 }
1506
1507+#ifndef USE_GLES
1508 static bool
1509 fillCircleTable (GLfloat **ppSint,
1510 GLfloat **ppCost,
1511@@ -467,10 +471,12 @@
1512
1513 return true;
1514 }
1515+#endif
1516
1517 void
1518 PrivateCubeScreen::updateSkydomeList (GLfloat fRadius)
1519 {
1520+#ifndef USE_GLES
1521 GLint iSlices = 128;
1522 GLint iStacks = 64;
1523 GLfloat afTexCoordX[4];
1524@@ -532,6 +538,7 @@
1525 afTexCoordX[3] = 1.0f;
1526 afTexCoordY[3] = 1.0f;
1527
1528+
1529 if (!mSkyListId)
1530 mSkyListId = glGenLists (1);
1531
1532@@ -616,6 +623,8 @@
1533 free (cost1);
1534 free (sint2);
1535 free (cost2);
1536+
1537+#endif
1538 }
1539
1540 bool
1541@@ -818,7 +827,7 @@
1542 {
1543 WRAPABLE_HND_FUNCTN_RETURN (bool, cubeCheckOrientation, sAttrib, transform, output, points)
1544 GLMatrix sTransform = transform;
1545- GLMatrix mvp, pm (priv->gScreen->projectionMatrix ());
1546+ GLMatrix mvp, pm (priv->gScreen->projectionMatrix ()->getMatrix ());
1547 GLVector pntA, pntB, pntC;
1548 GLVector vecA, vecB, ortho;
1549 bool rv = false;
1550@@ -1063,7 +1072,7 @@
1551 if (priv->mSky.size () > 0)
1552 {
1553 priv->gScreen->setLighting (false);
1554-
1555+#ifndef USE_GLES
1556 glPushMatrix ();
1557
1558 if (priv->optionGetSkydomeAnimated () &&
1559@@ -1079,6 +1088,7 @@
1560
1561 glCallList (priv->mSkyListId);
1562 glPopMatrix ();
1563+#endif
1564 }
1565 else
1566 {
1567@@ -1090,9 +1100,10 @@
1568 CubeScreen::cubePaintTop (const GLScreenPaintAttrib &sAttrib,
1569 const GLMatrix &transform,
1570 CompOutput *output,
1571- int size)
1572+ int size,
1573+ const GLVector &normal)
1574 {
1575- WRAPABLE_HND_FUNCTN (cubePaintTop, sAttrib, transform, output, size)
1576+ WRAPABLE_HND_FUNCTN (cubePaintTop, sAttrib, transform, output, size, normal)
1577
1578 GLScreenPaintAttrib sa = sAttrib;
1579 GLMatrix sTransform = transform;
1580@@ -1105,51 +1116,49 @@
1581 color = priv->optionGetTopColor ();
1582 opacity = priv->mDesktopOpacity * color[3] / 0xffff;
1583
1584- glColor4us (color[0] * opacity / 0xffff,
1585- color[1] * opacity / 0xffff,
1586- color[2] * opacity / 0xffff,
1587- opacity);
1588+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
1589+ std::vector <GLushort> colorData;
1590
1591- glPushMatrix ();
1592+ colorData.push_back (color[0] * opacity / 0xffff);
1593+ colorData.push_back (color[1] * opacity / 0xffff);
1594+ colorData.push_back (color[2] * opacity / 0xffff);
1595+ colorData.push_back (opacity);
1596
1597 sa.yRotate += (360.0f / size) * (priv->mXRotations + 1);
1598
1599 priv->gScreen->glApplyTransform (sa, output, &sTransform);
1600
1601- glLoadMatrixf (sTransform.getMatrix ());
1602- glTranslatef (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f);
1603- glScalef (priv->mOutputXScale, priv->mOutputYScale, 1.0f);
1604+ sTransform.translate (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f);
1605+ sTransform.scale (priv->mOutputXScale, priv->mOutputYScale, 1.0f);
1606
1607 if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE))
1608 {
1609+#ifndef USE_GLES
1610 priv->gScreen->setTexEnvMode (GL_MODULATE);
1611- glEnable (GL_BLEND);
1612+#endif
1613 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1614 }
1615
1616- glVertexPointer (3, GL_FLOAT, 0, priv->mVertices);
1617+ bool withTexture = priv->mInvert == 1 && size == 4 && priv->mTexture.size ();
1618
1619- if (priv->mInvert == 1 && size == 4 && priv->mTexture.size ())
1620- {
1621+ if (withTexture)
1622 priv->mTexture[0]->enable (GLTexture::Good);
1623- glTexCoordPointer (2, GL_FLOAT, 0, priv->mTc);
1624- glDrawArrays (GL_TRIANGLE_FAN, 0, priv->mNVertices >> 1);
1625+
1626+ streamingBuffer->begin (GL_TRIANGLE_FAN);
1627+ streamingBuffer->addColors (1, &(colorData[0]));
1628+ streamingBuffer->addVertices (priv->mNVertices >> 1, priv->mVertices);
1629+ streamingBuffer->addNormals (1, const_cast <GLfloat *> (&normal[0]));
1630+
1631+ if (withTexture)
1632+ streamingBuffer->addTexCoords (0, 2, priv->mTc);
1633+
1634+ streamingBuffer->end ();
1635+ streamingBuffer->render (sTransform);
1636+
1637+ if (withTexture)
1638 priv->mTexture[0]->disable ();
1639- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
1640- }
1641- else
1642- {
1643- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
1644- glDrawArrays (GL_TRIANGLE_FAN, 0, priv->mNVertices >> 1);
1645- }
1646-
1647- glPopMatrix ();
1648-
1649- glColor4usv (defaultColor);
1650- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
1651
1652 priv->gScreen->setTexEnvMode (GL_REPLACE);
1653- glDisable (GL_BLEND);
1654 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1655 }
1656
1657@@ -1157,9 +1166,10 @@
1658 CubeScreen::cubePaintBottom (const GLScreenPaintAttrib &sAttrib,
1659 const GLMatrix &transform,
1660 CompOutput *output,
1661- int size)
1662+ int size,
1663+ const GLVector &normal)
1664 {
1665- WRAPABLE_HND_FUNCTN (cubePaintBottom, sAttrib, transform, output, size)
1666+ WRAPABLE_HND_FUNCTN (cubePaintBottom, sAttrib, transform, output, size, normal)
1667
1668 GLScreenPaintAttrib sa = sAttrib;
1669 GLMatrix sTransform = transform;
1670@@ -1172,41 +1182,40 @@
1671 color = priv->optionGetBottomColor ();
1672 opacity = priv->mDesktopOpacity * color[3] / 0xffff;
1673
1674- glColor4us (color[0] * opacity / 0xffff,
1675- color[1] * opacity / 0xffff,
1676- color[2] * opacity / 0xffff,
1677- opacity);
1678+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
1679+ std::vector <GLushort> colorData;
1680
1681- glPushMatrix ();
1682+ colorData.push_back (color[0] * opacity / 0xffff);
1683+ colorData.push_back (color[1] * opacity / 0xffff);
1684+ colorData.push_back (color[2] * opacity / 0xffff);
1685+ colorData.push_back (opacity);
1686
1687 sa.yRotate += (360.0f / size) * (priv->mXRotations + 1);
1688
1689 priv->gScreen->glApplyTransform (sa, output, &sTransform);
1690
1691- glLoadMatrixf (sTransform.getMatrix ());
1692- glTranslatef (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f);
1693- glScalef (priv->mOutputXScale, priv->mOutputYScale, 1.0f);
1694+ sTransform.translate (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f);
1695+ sTransform.scale (priv->mOutputXScale, priv->mOutputYScale, 1.0f);
1696
1697 if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE))
1698 {
1699+#ifndef USE_GLES
1700 priv->gScreen->setTexEnvMode (GL_MODULATE);
1701- glEnable (GL_BLEND);
1702+#endif
1703 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1704 }
1705
1706- glVertexPointer (3, GL_FLOAT, 0, priv->mVertices);
1707-
1708-
1709- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
1710- glDrawArrays (GL_TRIANGLE_FAN, priv->mNVertices >> 1, priv->mNVertices >> 1);
1711-
1712- glPopMatrix ();
1713-
1714- glColor4usv (defaultColor);
1715- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
1716+ streamingBuffer->begin (GL_TRIANGLE_FAN);
1717+ streamingBuffer->addColors (1, &(colorData[0]));
1718+ streamingBuffer->addVertices (priv->mNVertices, priv->mVertices);
1719+ streamingBuffer->addNormals (1, const_cast <GLfloat *> (&normal[0]));
1720+ streamingBuffer->setVertexOffset (priv->mNVertices >> 1);
1721+ streamingBuffer->setMaxVertices (priv->mNVertices >> 1);
1722+
1723+ streamingBuffer->end ();
1724+ streamingBuffer->render (sTransform);
1725
1726 priv->gScreen->setTexEnvMode (GL_REPLACE);
1727- glDisable (GL_BLEND);
1728 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1729 }
1730
1731@@ -1214,9 +1223,10 @@
1732 CubeScreen::cubePaintInside (const GLScreenPaintAttrib &sAttrib,
1733 const GLMatrix &transform,
1734 CompOutput *output,
1735- int size)
1736+ int size,
1737+ const GLVector &normal)
1738 {
1739- WRAPABLE_HND_FUNCTN (cubePaintInside, sAttrib, transform, output, size)
1740+ WRAPABLE_HND_FUNCTN (cubePaintInside, sAttrib, transform, output, size, normal)
1741 }
1742
1743 void
1744@@ -1226,6 +1236,8 @@
1745 {
1746 if (mRotationState != CubeScreen::RotationNone)
1747 {
1748+ /* FIXME: No output clipping in OpenGL|ES yet */
1749+ #ifndef USE_GLES
1750 glPushMatrix ();
1751 glLoadMatrixf (transform.getMatrix ());
1752 glTranslatef (mOutputXOffset, -mOutputYOffset, 0.0f);
1753@@ -1260,6 +1272,7 @@
1754 glEnable (GL_CLIP_PLANE3);
1755
1756 glPopMatrix ();
1757+ #endif
1758 }
1759 else
1760 gScreen->glEnableOutputClipping (transform, region, output);
1761@@ -1447,38 +1460,28 @@
1762
1763 if (topDir && bottomDir)
1764 {
1765- glNormal3f (0.0f, -1.0f, 0.0f);
1766 if (allCaps)
1767 {
1768- cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize);
1769- glNormal3f (0.0f, 0.0f, -1.0f);
1770- cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize);
1771- glNormal3f (0.0f, -1.0f, 0.0f);
1772+ cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f));
1773+ cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize, GLVector (0.0f, 0.0f, -1.0f, 1.0f));
1774 }
1775- cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize);
1776+ cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f));
1777 }
1778 else if (!topDir && !bottomDir)
1779 {
1780- glNormal3f (0.0f, 1.0f, 0.0f);
1781 if (allCaps)
1782 {
1783- cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize);
1784- glNormal3f (0.0f, 0.0f, -1.0f);
1785- cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize);
1786- glNormal3f (0.0f, 1.0f, 0.0f);
1787+ cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize, GLVector (0.0f, 1.0f, 0.0f, 1.0f));
1788+ cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize, GLVector (0.0f, 0.0f, -1.0f, 1.0f));
1789 }
1790- cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize);
1791+ cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f));
1792 }
1793 else if (allCaps)
1794 {
1795- glNormal3f (0.0f, 1.0f, 0.0f);
1796- cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize);
1797- glNormal3f (0.0f, -1.0f, 0.0f);
1798- cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize);
1799- glNormal3f (0.0f, 0.0f, -1.0f);
1800- cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize);
1801+ cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize, GLVector (0.0f, 1.0f, 0.0f, 1.0f));
1802+ cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f));
1803+ cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize, GLVector (0.0f, 0.0f, -1.0f, 1.0f));
1804 }
1805- glNormal3f (0.0f, 0.0f, -1.0f);
1806 }
1807
1808 if (wasCulled)
1809@@ -1705,8 +1708,10 @@
1810 if (mVertices)
1811 free (mVertices);
1812
1813+#ifndef USE_GLES
1814 if (mSkyListId)
1815 glDeleteLists (mSkyListId, 1);
1816+#endif
1817 }
1818
1819
1820
1821=== modified file 'plugins/decor/src/decor.cpp'
1822--- plugins/decor/src/decor.cpp 2012-08-03 10:12:25 +0000
1823+++ plugins/decor/src/decor.cpp 2012-08-22 06:16:22 +0000
1824@@ -153,14 +153,12 @@
1825
1826 bool
1827 DecorWindow::glDraw (const GLMatrix &transform,
1828- GLFragment::Attrib &attrib,
1829+ const GLWindowPaintAttrib &attrib,
1830 const CompRegion &region,
1831 unsigned int mask)
1832 {
1833 bool status;
1834
1835- status = gWindow->glDraw (transform, attrib, region, mask);
1836-
1837 /* Don't render dock decorations (shadows) on just any old window */
1838 if (!(window->type () & CompWindowTypeDockMask))
1839 {
1840@@ -188,25 +186,26 @@
1841 */
1842 pmask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
1843
1844- if (d->gWindow->glPaint (d->gWindow->paintAttrib (),
1845+ const GLWindowPaintAttrib &pAttrib (d->gWindow->paintAttrib ());
1846+
1847+ if (d->gWindow->glPaint (pAttrib,
1848 transform,
1849 region,
1850 pmask))
1851- {
1852- GLFragment::Attrib fa (d->gWindow->paintAttrib ());
1853- d->glDecorate (transform, fa, region, mask);
1854- }
1855+ d->glDecorate (transform, pAttrib, region, mask);
1856 }
1857 }
1858 }
1859 }
1860
1861+ status = gWindow->glDraw (transform, attrib, region, mask);
1862+
1863 return status;
1864 }
1865
1866 void
1867 DecorWindow::glDecorate (const GLMatrix &transform,
1868- GLFragment::Attrib &attrib,
1869+ const GLWindowPaintAttrib &attrib,
1870 const CompRegion &region,
1871 unsigned int mask)
1872 {
1873@@ -217,6 +216,7 @@
1874 GLTexture::MatrixList ml (1);
1875 mask |= PAINT_WINDOW_BLEND_MASK;
1876
1877+ gWindow->vertexBuffer ()->begin ();
1878 const CompRegion *preg = NULL;
1879
1880 if ((mask & (PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK |
1881@@ -228,11 +228,8 @@
1882 {
1883 tmpRegion = mOutputRegion;
1884 tmpRegion &= region;
1885-
1886- if (tmpRegion.isEmpty ())
1887- preg = &region;
1888- else
1889- preg = &shadowRegion;
1890+ tmpRegion &= shadowRegion;
1891+ preg = &tmpRegion;
1892 }
1893 else
1894 preg = &region;
1895@@ -243,8 +240,6 @@
1896
1897 const CompRegion &reg (*preg);
1898
1899- gWindow->geometry ().reset ();
1900-
1901 if (updateMatrix)
1902 updateDecorationScale ();
1903
1904@@ -263,9 +258,13 @@
1905 }
1906 }
1907
1908- if (gWindow->geometry ().vCount)
1909- gWindow->glDrawTexture (wd->decor->texture->textures[0],
1910+ if (gWindow->vertexBuffer ()->end ())
1911+ {
1912+ glEnable (GL_BLEND);
1913+ gWindow->glDrawTexture (wd->decor->texture->textures[0], transform,
1914 attrib, mask);
1915+ glDisable (GL_BLEND);
1916+ }
1917 }
1918 else if (wd && wd->decor->type == WINDOW_DECORATION_TYPE_WINDOW)
1919 {
1920@@ -279,14 +278,16 @@
1921 if (updateMatrix)
1922 updateDecorationScale ();
1923
1924+ glEnable (GL_BLEND);
1925+
1926 if (gWindow->textures ().size () == 1)
1927 {
1928 ml[0] = gWindow->matrices ()[0];
1929- gWindow->geometry ().reset ();
1930+ gWindow->vertexBuffer ()->begin ();
1931 gWindow->glAddGeometry (ml, window->frameRegion (), region);
1932-
1933- if (gWindow->geometry ().vCount)
1934- gWindow->glDrawTexture (gWindow->textures ()[0], attrib, mask);
1935+ if (gWindow->vertexBuffer ()->end ())
1936+ gWindow->glDrawTexture (gWindow->textures ()[0], transform,
1937+ attrib, mask);
1938 }
1939 else
1940 {
1941@@ -295,14 +296,15 @@
1942 for (unsigned int i = 0; i < gWindow->textures ().size (); i++)
1943 {
1944 ml[0] = gWindow->matrices ()[i];
1945- gWindow->geometry ().reset ();
1946+ gWindow->vertexBuffer ()->begin ();
1947 gWindow->glAddGeometry (ml, regions[i], region);
1948-
1949- if (gWindow->geometry ().vCount)
1950- gWindow->glDrawTexture (gWindow->textures ()[i], attrib,
1951- mask);
1952+ if (gWindow->vertexBuffer ()->end ())
1953+ gWindow->glDrawTexture (gWindow->textures ()[i], transform,
1954+ attrib, mask);
1955 }
1956 }
1957+
1958+ glDisable (GL_BLEND);
1959 }
1960 }
1961
1962
1963=== modified file 'plugins/decor/src/decor.h'
1964--- plugins/decor/src/decor.h 2012-05-10 15:40:25 +0000
1965+++ plugins/decor/src/decor.h 2012-08-22 06:16:22 +0000
1966@@ -276,9 +276,9 @@
1967
1968 bool damageRect (bool, const CompRect &);
1969
1970- bool glDraw (const GLMatrix &, GLFragment::Attrib &,
1971+ bool glDraw (const GLMatrix &, const GLWindowPaintAttrib &,
1972 const CompRegion &, unsigned int);
1973- void glDecorate (const GLMatrix &, GLFragment::Attrib &,
1974+ void glDecorate (const GLMatrix &, const GLWindowPaintAttrib &,
1975 const CompRegion &, unsigned int);
1976
1977 void windowNotify (CompWindowNotify n);
1978
1979=== modified file 'plugins/expo/CMakeLists.txt'
1980--- plugins/expo/CMakeLists.txt 2012-08-09 20:14:36 +0000
1981+++ plugins/expo/CMakeLists.txt 2012-08-22 06:16:22 +0000
1982@@ -1,11 +1,7 @@
1983 find_package (Compiz REQUIRED)
1984-include (FindOpenGL)
1985 include (CompizPlugin)
1986
1987-if (OPENGL_GLU_FOUND)
1988- add_subdirectory (src/click_threshold)
1989- include_directories (src/click_threshold/include)
1990-
1991- compiz_plugin (expo PLUGINDEPS composite opengl LIBRARIES ${OPENGL_glu_LIBRARY} compiz_expo_click_threshold INCDIRS ${OPENGL_INCLUDE_DIR})
1992-endif (OPENGL_GLU_FOUND)
1993-
1994+add_subdirectory (src/click_threshold)
1995+include_directories (src/click_threshold/include)
1996+
1997+compiz_plugin (expo PLUGINDEPS composite opengl LIBRARIES compiz_expo_click_threshold)
1998
1999=== modified file 'plugins/expo/src/expo.cpp'
2000--- plugins/expo/src/expo.cpp 2012-08-16 17:00:05 +0000
2001+++ plugins/expo/src/expo.cpp 2012-08-22 06:16:22 +0000
2002@@ -4,12 +4,14 @@
2003 *
2004 * expo.c
2005 *
2006+ * Copyright (c) 2011 Linaro Limited
2007 * Copyright (c) 2008 Dennis Kasprzyk <racarr@opencompositing.org>
2008 * Copyright (c) 2006 Robert Carr <racarr@beryl-project.org>
2009 *
2010 * Authors:
2011 * Robert Carr <racarr@beryl-project.org>
2012 * Dennis Kasprzyk <onestone@opencompositing.org>
2013+ * Travis Watkins <travis.watkins@linaro.org>
2014 *
2015 * This program is free software; you can redistribute it and/or
2016 * modify it under the terms of the GNU General Public License
2017@@ -26,7 +28,9 @@
2018 #include "expo.h"
2019 #include "click-threshold.h"
2020 #include <math.h>
2021+#ifndef USE_GLES
2022 #include <GL/glu.h>
2023+#endif
2024 #include <X11/cursorfont.h>
2025
2026 COMPIZ_PLUGIN_20090315 (expo, ExpoPluginVTable);
2027@@ -641,6 +645,55 @@
2028 }
2029 }
2030
2031+static bool
2032+unproject (float winx, float winy, float winz,
2033+ const GLMatrix &modelview,
2034+ const GLMatrix &projection,
2035+ const GLint viewport[4],
2036+ float *objx, float *objy, float *objz)
2037+{
2038+ GLMatrix finalMatrix = projection * modelview;
2039+ float in[4], out[4];
2040+
2041+ if (!finalMatrix.invert ())
2042+ return false;
2043+
2044+ in[0] = winx;
2045+ in[1] = winy;
2046+ in[2] = winz;
2047+ in[3] = 1.0;
2048+
2049+ /* Map x and y from window coordinates */
2050+ in[0] = (in[0] - viewport[0]) / viewport[2];
2051+ in[1] = (in[1] - viewport[1]) / viewport[3];
2052+
2053+ /* Map to range -1 to 1 */
2054+ in[0] = in[0] * 2 - 1;
2055+ in[1] = in[1] * 2 - 1;
2056+ in[2] = in[2] * 2 - 1;
2057+
2058+ for (int i = 0; i < 4; i++)
2059+ {
2060+ out[i] = in[0] * finalMatrix[i] +
2061+ in[1] * finalMatrix[4 + i] +
2062+ in[2] * finalMatrix[8 + i] +
2063+ in[3] * finalMatrix[12 + i];
2064+ }
2065+
2066+ if (out[3] == 0.0)
2067+ return false;
2068+
2069+ out[0] /= out[3];
2070+ out[1] /= out[3];
2071+ out[2] /= out[3];
2072+
2073+ *objx = out[0];
2074+ *objy = out[1];
2075+ *objz = out[2];
2076+
2077+ return true;
2078+}
2079+
2080 void
2081 ExpoScreen::invertTransformedVertex (const GLScreenPaintAttrib& attrib,
2082 const GLMatrix& transform,
2083@@ -648,8 +701,7 @@
2084 int vertex[2])
2085 {
2086 GLMatrix sTransform (transform);
2087- GLdouble p1[3], p2[3], v[3], alpha;
2088- GLdouble mvm[16], pm[16];
2089+ float p1[3], p2[3], v[3], alpha;
2090 GLint viewport[4];
2091 int i;
2092
2093@@ -657,16 +709,13 @@
2094 sTransform.toScreenSpace (output, -attrib.zTranslate);
2095
2096 glGetIntegerv (GL_VIEWPORT, viewport);
2097- for (i = 0; i < 16; i++)
2098- {
2099- mvm[i] = sTransform[i];
2100- pm[i] = gScreen->projectionMatrix ()[i];
2101- }
2102
2103- gluUnProject (vertex[0], screen->height () - vertex[1], 0, mvm, pm,
2104- viewport, &p1[0], &p1[1], &p1[2]);
2105- gluUnProject (vertex[0], screen->height () - vertex[1], -1.0, mvm, pm,
2106- viewport, &p2[0], &p2[1], &p2[2]);
2107+ unproject (vertex[0], screen->height () - vertex[1], 0,
2108+ sTransform, *gScreen->projectionMatrix (), viewport,
2109+ &p1[0], &p1[1], &p1[2]);
2110+ unproject (vertex[0], screen->height () - vertex[1], -1.0,
2111+ sTransform, *gScreen->projectionMatrix (), viewport,
2112+ &p2[0], &p2[1], &p2[2]);
2113
2114 for (i = 0; i < 3; i++)
2115 v[i] = p1[i] - p2[i];
2116@@ -720,6 +769,8 @@
2117 unsigned int mask,
2118 bool reflection)
2119 {
2120+ GLfloat vertexData[12];
2121+ GLushort colorData[16];
2122 GLMatrix sTransformW, sTransform (transform);
2123 int i, j, vp;
2124 GLenum oldFilter = gScreen->textureFilter ();
2125@@ -740,6 +791,8 @@
2126 int glPaintTransformedOutputIndex =
2127 gScreen->glPaintTransformedOutputGetCurrentIndex ();
2128
2129+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
2130+
2131 // Make sure that the base glPaintTransformedOutput function is called
2132 gScreen->glPaintTransformedOutputSetCurrentIndex (MAXSHORT);
2133
2134@@ -832,7 +885,7 @@
2135 /* zoom out */
2136 oScale = DEFAULT_Z_CAMERA / (cam[GLVector::z] + DEFAULT_Z_CAMERA);
2137 sTransform.scale (oScale, oScale, oScale);
2138- glNormal3f (0.0, 0.0, -oScale);
2139+// glNormal3f (0.0, 0.0, -oScale);
2140 sTransform.translate (-cam[GLVector::x], -cam[GLVector::y],
2141 -cam[GLVector::z] - DEFAULT_Z_CAMERA);
2142
2143@@ -967,73 +1020,169 @@
2144 sTransform.translate (0.0, -(sy + gapY), 0.0f);
2145 }
2146
2147- glNormal3f (0.0, 0.0, -1.0);
2148+// glNormal3f (0.0, 0.0, -1.0);
2149
2150 if (reflection)
2151 {
2152 glEnable (GL_BLEND);
2153 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2154
2155- glPushMatrix ();
2156-
2157 if (optionGetDeform () != DeformCurve)
2158 {
2159- glLoadMatrixf (sTransformW.getMatrix ());
2160-
2161- glBegin (GL_QUADS);
2162- glColor4f (0.0, 0.0, 0.0, 1.0);
2163- glVertex2f (0.0, 0.0);
2164- glColor4f (0.0, 0.0, 0.0, 0.5);
2165- glVertex2f (0.0, -vpSize.y () * (sy + gapY));
2166- glVertex2f (vpSize.x () * sx * (1.0 + gapX),
2167- -vpSize.y () * sy * (1.0 + gapY));
2168- glColor4f (0.0, 0.0, 0.0, 1.0);
2169- glVertex2f (vpSize.x () * sx * (1.0 + gapX), 0.0);
2170- glEnd ();
2171+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
2172+
2173+ colorData[0] = 0;
2174+ colorData[1] = 0;
2175+ colorData[2] = 0;
2176+ colorData[3] = 65535;
2177+ colorData[4] = 0;
2178+ colorData[5] = 0;
2179+ colorData[6] = 0;
2180+ colorData[7] = 32768;
2181+ colorData[8] = 0;
2182+ colorData[9] = 0;
2183+ colorData[10] = 0;
2184+ colorData[11] = 65535;
2185+ colorData[12] = 0;
2186+ colorData[13] = 0;
2187+ colorData[14] = 0;
2188+ colorData[15] = 32768;
2189+
2190+ vertexData[0] = 0;
2191+ vertexData[1] = 0;
2192+ vertexData[2] = 0;
2193+ vertexData[3] = 0;
2194+ vertexData[4] = -vpSize.y () * (sy + gapY);
2195+ vertexData[5] = 0;
2196+ vertexData[6] = vpSize.x () * sx * (1.0 + gapX);
2197+ vertexData[7] = 0;
2198+ vertexData[8] = 0;
2199+ vertexData[9] = vpSize.x () * sx * (1.0 + gapX);
2200+ vertexData[10] = -vpSize.y () * sy * (1.0 + gapY);
2201+ vertexData[11] = 0;
2202+
2203+ streamingBuffer->addColors (4, colorData);
2204+ streamingBuffer->addVertices (4, vertexData);
2205+
2206+ streamingBuffer->end ();
2207+ streamingBuffer->render (sTransformW);
2208 }
2209 else
2210 {
2211+ GLMatrix cTransform;
2212+ cTransform.translate (0.0, 0.0, -DEFAULT_Z_CAMERA);
2213+
2214 glCullFace (GL_BACK);
2215- glLoadIdentity ();
2216- glTranslatef (0.0, 0.0, -DEFAULT_Z_CAMERA);
2217-
2218- glBegin (GL_QUADS);
2219- glColor4f (0.0, 0.0, 0.0, 1.0 * expoCam);
2220- glVertex2f (-0.5, -0.5);
2221- glVertex2f (0.5, -0.5);
2222- glColor4f (0.0, 0.0, 0.0, 0.5 * expoCam);
2223- glVertex2f (0.5, 0.0);
2224- glVertex2f (-0.5, 0.0);
2225- glColor4f (0.0, 0.0, 0.0, 0.5 * expoCam);
2226- glVertex2f (-0.5, 0.0);
2227- glVertex2f (0.5, 0.0);
2228- glColor4f (0.0, 0.0, 0.0, 0.0);
2229- glVertex2f (0.5, 0.5);
2230- glVertex2f (-0.5, 0.5);
2231- glEnd ();
2232+
2233+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
2234+
2235+ colorData[0] = 0;
2236+ colorData[1] = 0;
2237+ colorData[2] = 0;
2238+ colorData[3] = (1.0 * expoCam) * 65535;
2239+ colorData[4] = 0;
2240+ colorData[5] = 0;
2241+ colorData[6] = 0;
2242+ colorData[7] = (1.0 * expoCam) * 65535;
2243+ colorData[8] = 0;
2244+ colorData[9] = 0;
2245+ colorData[10] = 0;
2246+ colorData[11] = (0.5 * expoCam) * 65535;
2247+ colorData[12] = 0;
2248+ colorData[13] = 0;
2249+ colorData[14] = 0;
2250+ colorData[15] = (0.5 * expoCam) * 65535;
2251+
2252+ vertexData[0] = -0.5;
2253+ vertexData[1] = -0.5;
2254+ vertexData[2] = 0;
2255+ vertexData[3] = 0.5;
2256+ vertexData[4] = -0.5;
2257+ vertexData[5] = 0;
2258+ vertexData[6] = -0.5;
2259+ vertexData[7] = 0;
2260+ vertexData[8] = 0;
2261+ vertexData[9] = 0.5;
2262+ vertexData[10] = 0;
2263+ vertexData[11] = 0;
2264+
2265+ streamingBuffer->addColors (4, colorData);
2266+ streamingBuffer->addVertices (4, vertexData);
2267+
2268+ streamingBuffer->end ();
2269+ streamingBuffer->render (cTransform);
2270+
2271+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
2272+
2273+ colorData[0] = 0;
2274+ colorData[1] = 0;
2275+ colorData[2] = 0;
2276+ colorData[3] = (0.5 * expoCam) * 65535;
2277+ colorData[4] = 0;
2278+ colorData[5] = 0;
2279+ colorData[6] = 0;
2280+ colorData[7] = (0.5 * expoCam) * 65535;
2281+ colorData[8] = 0;
2282+ colorData[9] = 0;
2283+ colorData[10] = 0;
2284+ colorData[11] = 0;
2285+ colorData[12] = 0;
2286+ colorData[13] = 0;
2287+ colorData[14] = 0;
2288+ colorData[15] = 0;
2289+
2290+ vertexData[0] = -0.5;
2291+ vertexData[1] = 0;
2292+ vertexData[2] = 0;
2293+ vertexData[3] = 0.5;
2294+ vertexData[4] = 0;
2295+ vertexData[5] = 0;
2296+ vertexData[6] = -0.5;
2297+ vertexData[7] = 0.5;
2298+ vertexData[8] = 0;
2299+ vertexData[9] = 0.5;
2300+ vertexData[10] = 0.5;
2301+ vertexData[11] = 0;
2302+
2303+ streamingBuffer->addColors (4, colorData);
2304+ streamingBuffer->addVertices (4, vertexData);
2305+
2306+ streamingBuffer->end ();
2307+ streamingBuffer->render (cTransform);
2308 }
2309 glCullFace (GL_BACK);
2310
2311- glLoadIdentity ();
2312- glTranslatef (0.0, 0.0, -DEFAULT_Z_CAMERA);
2313-
2314 if (optionGetGroundSize () > 0.0)
2315 {
2316- glBegin (GL_QUADS);
2317- glColor4usv (optionGetGroundColor1 ());
2318- glVertex2f (-0.5, -0.5);
2319- glVertex2f (0.5, -0.5);
2320- glColor4usv (optionGetGroundColor2 ());
2321- glVertex2f (0.5, -0.5 + optionGetGroundSize ());
2322- glVertex2f (-0.5, -0.5 + optionGetGroundSize ());
2323- glEnd ();
2324+ GLMatrix gTransform;
2325+ gTransform.translate (0.0, 0.0, -DEFAULT_Z_CAMERA);
2326+
2327+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
2328+
2329+ vertexData[0] = -0.5;
2330+ vertexData[1] = -0.5;
2331+ vertexData[2] = 0;
2332+ vertexData[3] = 0.5;
2333+ vertexData[4] = -0.5;
2334+ vertexData[5] = 0;
2335+ vertexData[6] = -0.5;
2336+ vertexData[7] = -0.5 + optionGetGroundSize ();
2337+ vertexData[8] = 0;
2338+ vertexData[9] = 0.5;
2339+ vertexData[10] = -0.5 + optionGetGroundSize ();
2340+ vertexData[11] = 0;
2341+
2342+ streamingBuffer->addColors (1, optionGetGroundColor1 ());
2343+ streamingBuffer->addColors (1, optionGetGroundColor1 ());
2344+ streamingBuffer->addColors (1, optionGetGroundColor2 ());
2345+ streamingBuffer->addColors (1, optionGetGroundColor2 ());
2346+ streamingBuffer->addVertices (4, vertexData);
2347+
2348+ streamingBuffer->end ();
2349+ streamingBuffer->render (gTransform);
2350 }
2351-
2352- glColor4usv (defaultColor);
2353-
2354 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
2355 glDisable (GL_BLEND);
2356- glPopMatrix ();
2357 }
2358
2359 expoActive = false;
2360@@ -1094,14 +1243,14 @@
2361
2362 bool
2363 ExpoWindow::glDraw (const GLMatrix& transform,
2364- GLFragment::Attrib& fragment,
2365+ const GLWindowPaintAttrib &attrib,
2366 const CompRegion& region,
2367 unsigned int mask)
2368 {
2369 if (eScreen->expoCam == 0.0f)
2370- return gWindow->glDraw (transform, fragment, region, mask);
2371+ return gWindow->glDraw (transform, attrib, region, mask);
2372
2373- GLFragment::Attrib fA (fragment);
2374+ GLWindowPaintAttrib eAttrib (attrib);
2375 int expoAnimation;
2376
2377 expoAnimation = eScreen->optionGetExpoAnimation ();
2378@@ -1109,7 +1258,7 @@
2379 if (eScreen->expoActive)
2380 {
2381 if (expoAnimation != ExpoScreen::ExpoAnimationZoom)
2382- fA.setOpacity (fragment.getOpacity () * eScreen->expoCam);
2383+ eAttrib.opacity = attrib.opacity * eScreen->expoCam;
2384
2385 if (window->wmType () & CompWindowTypeDockMask &&
2386 eScreen->optionGetHideDocks ())
2387@@ -1117,28 +1266,28 @@
2388 if (expoAnimation == ExpoScreen::ExpoAnimationZoom &&
2389 eScreen->paintingVp == eScreen->selectedVp)
2390 {
2391- fA.setOpacity (fragment.getOpacity () *
2392- (1 - sigmoidProgress (eScreen->expoCam)));
2393+ eAttrib.opacity = attrib.opacity *
2394+ (1 - sigmoidProgress (eScreen->expoCam));
2395 }
2396 else
2397 {
2398- fA.setOpacity (0);
2399+ eAttrib.opacity = 0;
2400 }
2401 }
2402
2403- fA.setBrightness (fragment.getBrightness () * eScreen->vpBrightness);
2404- fA.setSaturation (fragment.getSaturation () * eScreen->vpSaturation);
2405+ eAttrib.brightness = attrib.brightness * eScreen->vpBrightness;
2406+ eAttrib.saturation = attrib.saturation * eScreen->vpSaturation;
2407 }
2408 else
2409 {
2410 if (expoAnimation == ExpoScreen::ExpoAnimationZoom)
2411- fA.setBrightness (0);
2412+ eAttrib.brightness = 0;
2413 else
2414- fA.setBrightness (fragment.getBrightness () *
2415- (1 - sigmoidProgress (eScreen->expoCam)));
2416+ eAttrib.brightness = attrib.brightness *
2417+ (1 - sigmoidProgress (eScreen->expoCam));
2418 }
2419
2420- return gWindow->glDraw (transform, fA, region, mask);
2421+ return gWindow->glDraw (transform, eAttrib, region, mask);
2422 }
2423
2424 #define EXPO_GRID_SIZE 100
2425@@ -1154,7 +1303,7 @@
2426 screen->desktopWindowCount () &&
2427 eScreen->optionGetDeform () == ExpoScreen::DeformCurve)
2428 {
2429- int i, oldVCount = gWindow->geometry ().vCount;
2430+ int i, oldVCount = gWindow->vertexBuffer ()->countVertices ();
2431 GLfloat *v;
2432 CompPoint offset;
2433 float lastX, lastZ = 0.0;
2434@@ -1165,9 +1314,10 @@
2435 MIN(maxGridWidth , EXPO_GRID_SIZE),
2436 maxGridHeight);
2437
2438- v = gWindow->geometry ().vertices;
2439- v += gWindow->geometry ().vertexStride - 3;
2440- v += gWindow->geometry ().vertexStride * oldVCount;
2441+ int stride = gWindow->vertexBuffer ()->getVertexStride ();
2442+ v = gWindow->vertexBuffer ()->getVertices ();
2443+ v += stride - 3;
2444+ v += stride * oldVCount;
2445
2446 if (!window->onAllViewports ())
2447 {
2448@@ -1177,7 +1327,7 @@
2449
2450 lastX = -1000000000.0;
2451
2452- for (i = oldVCount; i < gWindow->geometry ().vCount; i++)
2453+ for (i = oldVCount; i < gWindow->vertexBuffer ()->countVertices (); i++)
2454 {
2455 if (v[0] == lastX)
2456 {
2457@@ -1198,7 +1348,7 @@
2458 lastX = v[0];
2459 lastZ = v[2];
2460
2461- v += gWindow->geometry ().vertexStride;
2462+ v += stride;
2463 }
2464 }
2465 else
2466@@ -1209,7 +1359,8 @@
2467
2468 void
2469 ExpoWindow::glDrawTexture (GLTexture *texture,
2470- GLFragment::Attrib& attrib,
2471+ const GLMatrix &transform,
2472+ const GLWindowPaintAttrib &attrib,
2473 unsigned int mask)
2474 {
2475 if (eScreen->expoCam > 0.0 &&
2476@@ -1217,15 +1368,9 @@
2477 eScreen->gScreen->lighting () &&
2478 screen->desktopWindowCount ())
2479 {
2480- unsigned int i, idx, vCount;
2481 CompPoint offset;
2482- float x;
2483 GLfloat *v;
2484-
2485- vCount = gWindow->geometry ().vCount;
2486-
2487- if (eScreen->winNormals.size () < vCount * 3)
2488- eScreen->winNormals.resize (vCount * 3);
2489+ GLVertexBuffer *vb = gWindow->vertexBuffer ();
2490
2491 if (!window->onAllViewports ())
2492 {
2493@@ -1233,44 +1378,44 @@
2494 offset = window->getMovementForOffset (offset);
2495 }
2496
2497- v = gWindow->geometry ().vertices +
2498- (gWindow->geometry ().vertexStride - 3);
2499+ int stride = vb->getVertexStride ();
2500+ v = vb->getVertices () + stride - 3;
2501
2502- for (i = 0; i < vCount; i++)
2503+ for (int i = 0; i < vb->countVertices (); i++)
2504 {
2505- x = (float) (v[0] + offset.x () - screen->width () / 2) *
2506- eScreen->curveAngle / screen->width ();
2507+ float x = (v[0] + offset.x () - screen->width () / 2) *
2508+ eScreen->curveAngle / screen->width ();
2509
2510 while (x < 0)
2511 x += 360.0;
2512
2513- idx = floor (x);
2514-
2515- eScreen->winNormals[i * 3] = -eScreen->vpNormals[idx * 3];
2516- eScreen->winNormals[(i * 3) + 1] =
2517- eScreen->vpNormals[(idx * 3) + 1];
2518- eScreen->winNormals[(i * 3) + 2] =
2519- eScreen->vpNormals[(idx * 3) + 2];
2520-
2521- v += gWindow->geometry ().vertexStride;
2522+ int idx = floor (x);
2523+
2524+ GLfloat normal[3];
2525+ normal[0] = -eScreen->vpNormals[idx * 3];
2526+ normal[1] = eScreen->vpNormals[(idx * 3) + 1];
2527+ normal[2] = eScreen->vpNormals[(idx * 3) + 2];
2528+ vb->addNormals (1, normal);
2529+
2530+ v += stride;
2531 }
2532
2533+/* I am not entirely certain if these ifdefs are necessary
2534+ * since we should be doing normalization in the shader,
2535+ * however I have them here for now */
2536+#ifndef USE_GLES
2537 glEnable (GL_NORMALIZE);
2538- glNormalPointer (GL_FLOAT,0, &eScreen->winNormals.at (0));
2539-
2540- glEnableClientState (GL_NORMAL_ARRAY);
2541-
2542- gWindow->glDrawTexture (texture, attrib, mask);
2543-
2544+#endif
2545+ gWindow->glDrawTexture (texture, transform, attrib, mask);
2546+#ifndef USE_GLES
2547 glDisable (GL_NORMALIZE);
2548- glDisableClientState (GL_NORMAL_ARRAY);
2549- glNormal3f (0.0, 0.0, -1.0);
2550+#endif
2551 }
2552 else
2553 {
2554- glEnable (GL_NORMALIZE);
2555- gWindow->glDrawTexture (texture, attrib, mask);
2556- glDisable (GL_NORMALIZE);
2557+// glEnable (GL_NORMALIZE);
2558+ gWindow->glDrawTexture (texture, transform, attrib, mask);
2559+// glDisable (GL_NORMALIZE);
2560 }
2561 }
2562
2563
2564=== modified file 'plugins/expo/src/expo.h'
2565--- plugins/expo/src/expo.h 2012-08-09 14:42:56 +0000
2566+++ plugins/expo/src/expo.h 2012-08-22 06:16:22 +0000
2567@@ -110,7 +110,6 @@
2568 float curveRadius;
2569
2570 std::vector<GLfloat> vpNormals;
2571- std::vector<GLfloat> winNormals;
2572
2573 CompScreen::GrabHandle grabIndex;
2574
2575@@ -142,15 +141,15 @@
2576
2577 bool damageRect (bool, const CompRect&);
2578
2579- bool glDraw (const GLMatrix&, GLFragment::Attrib&,
2580+ bool glDraw (const GLMatrix&, const GLWindowPaintAttrib&,
2581 const CompRegion&, unsigned int);
2582 bool glPaint (const GLWindowPaintAttrib&, const GLMatrix&,
2583 const CompRegion&, unsigned int);
2584 void glAddGeometry (const GLTexture::MatrixList&,
2585 const CompRegion&, const CompRegion&,
2586 unsigned int, unsigned int);
2587- void glDrawTexture (GLTexture *, GLFragment::Attrib& attrib,
2588- unsigned int);
2589+ void glDrawTexture (GLTexture*, const GLMatrix&,
2590+ const GLWindowPaintAttrib&, unsigned int);
2591
2592 CompWindow *window;
2593 CompositeWindow *cWindow;
2594
2595=== modified file 'plugins/ezoom/src/ezoom.cpp'
2596--- plugins/ezoom/src/ezoom.cpp 2012-07-29 19:54:31 +0000
2597+++ plugins/ezoom/src/ezoom.cpp 2012-08-22 06:16:22 +0000
2598@@ -381,10 +381,13 @@
2599 CompOutput *output,
2600 CompRect box)
2601 {
2602- GLMatrix zTransform = transform;
2603+ GLMatrix zTransform (transform);
2604 int x1,x2,y1,y2;
2605 int inx1, inx2, iny1, iny2;
2606 int out = output->id ();
2607+ GLushort colorData[4];
2608+ GLfloat vertexData[12];
2609+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
2610
2611 zTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
2612 convertToZoomed (out, box.x1 (), box.y1 (), &inx1, &iny1);
2613@@ -394,23 +397,61 @@
2614 y1 = MIN (iny1, iny2);
2615 x2 = MAX (inx1, inx2);
2616 y2 = MAX (iny1, iny2);
2617- glPushMatrix ();
2618- glLoadMatrixf (zTransform.getMatrix ());
2619- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
2620- glEnable (GL_BLEND);
2621- glColor4us (0x2fff, 0x2fff, 0x4fff, 0x4fff);
2622- glRecti (x1,y2,x2,y1);
2623- glColor4us (0x2fff, 0x2fff, 0x4fff, 0x9fff);
2624- glBegin (GL_LINE_LOOP);
2625- glVertex2i (x1, y1);
2626- glVertex2i (x2, y1);
2627- glVertex2i (x2, y2);
2628- glVertex2i (x1, y2);
2629- glEnd ();
2630- glColor4usv (defaultColor);
2631- glDisable (GL_BLEND);
2632- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
2633- glPopMatrix ();
2634+
2635+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
2636+
2637+ colorData[0] = 0x2fff;
2638+ colorData[1] = 0x2fff;
2639+ colorData[2] = 0x2fff;
2640+ colorData[3] = 0x4fff;
2641+
2642+ streamingBuffer->addColors (1, colorData);
2643+
2644+ vertexData[0] = x1;
2645+ vertexData[1] = y1;
2646+ vertexData[2] = 0.0f;
2647+ vertexData[3] = x1;
2648+ vertexData[4] = y2;
2649+ vertexData[5] = 0.0f;
2650+ vertexData[6] = x2;
2651+ vertexData[7] = y1;
2652+ vertexData[8] = 0.0f;
2653+ vertexData[9] = x2;
2654+ vertexData[10] = y2;
2655+ vertexData[11] = 0.0f;
2656+
2657+ streamingBuffer->addVertices (4, vertexData);
2658+
2659+ streamingBuffer->end ();
2660+ streamingBuffer->render (zTransform);
2661+
2662+
2663+ streamingBuffer->begin (GL_LINE_LOOP);
2664+
2665+ colorData[0] = 0x2fff;
2666+ colorData[1] = 0x2fff;
2667+ colorData[2] = 0x4fff;
2668+ colorData[3] = 0x9fff;
2669+
2670+ streamingBuffer->addColors (1, colorData);
2671+
2672+ vertexData[0] = x1;
2673+ vertexData[1] = y1;
2674+ vertexData[2] = 0.0f;
2675+ vertexData[3] = x2;
2676+ vertexData[4] = y1;
2677+ vertexData[5] = 0.0f;
2678+ vertexData[6] = x2;
2679+ vertexData[7] = y2;
2680+ vertexData[8] = 0.0f;
2681+ vertexData[9] = x1;
2682+ vertexData[10] = y2;
2683+ vertexData[11] = 0.0f;
2684+
2685+ streamingBuffer->addVertices (4, vertexData);
2686+
2687+ streamingBuffer->end ();
2688+ streamingBuffer->render (zTransform);
2689 }
2690 /* Apply the zoom if we are grabbed.
2691 * Make sure to use the correct filter.
2692@@ -1060,6 +1101,9 @@
2693 GLMatrix sTransform = transform;
2694 float scaleFactor;
2695 int ax, ay, x, y;
2696+ GLfloat textureData[8];
2697+ GLfloat vertexData[12];
2698+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
2699
2700 /*
2701 * XXX: expo knows how to handle mouse when zoomed, so we back off
2702@@ -1073,37 +1117,55 @@
2703
2704 sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
2705 convertToZoomed (out, mouse.x (), mouse.y (), &ax, &ay);
2706- glPushMatrix ();
2707- glLoadMatrixf (sTransform.getMatrix ());
2708- glTranslatef ((float) ax, (float) ay, 0.0f);
2709+ sTransform.translate ((float) ax, (float) ay, 0.0f);
2710+
2711 if (optionGetScaleMouseDynamic ())
2712 scaleFactor = 1.0f / zooms.at (out).currentZoom;
2713 else
2714 scaleFactor = 1.0f / optionGetScaleMouseStatic ();
2715- glScalef (scaleFactor,
2716- scaleFactor,
2717- 1.0f);
2718+
2719+ sTransform.scale (scaleFactor, scaleFactor, 1.0f);
2720 x = -cursor.hotX;
2721 y = -cursor.hotY;
2722
2723 glEnable (GL_BLEND);
2724- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, cursor.texture);
2725- glEnable (GL_TEXTURE_RECTANGLE_ARB);
2726-
2727- glBegin (GL_QUADS);
2728- glTexCoord2d (0, 0);
2729- glVertex2f (x, y);
2730- glTexCoord2d (0, cursor.height);
2731- glVertex2f (x, y + cursor.height);
2732- glTexCoord2d (cursor.width, cursor.height);
2733- glVertex2f (x + cursor.width, y + cursor.height);
2734- glTexCoord2d (cursor.width, 0);
2735- glVertex2f (x + cursor.width, y);
2736- glEnd ();
2737+ glEnable (GL_TEXTURE_2D);
2738+ glBindTexture (GL_TEXTURE_2D, cursor.texture);
2739+
2740+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
2741+
2742+ vertexData[0] = x;
2743+ vertexData[1] = y;
2744+ vertexData[2] = 0.0f;
2745+ vertexData[3] = x;
2746+ vertexData[4] = y + cursor.height;
2747+ vertexData[5] = 0.0f;
2748+ vertexData[6] = x + cursor.width;
2749+ vertexData[7] = y;
2750+ vertexData[8] = 0.0f;
2751+ vertexData[9] = x + cursor.width;
2752+ vertexData[10] = y + cursor.height;
2753+ vertexData[11] = 0.0f;
2754+
2755+ streamingBuffer->addVertices (4, vertexData);
2756+
2757+ textureData[0] = 0;
2758+ textureData[1] = 0;
2759+ textureData[2] = 0;
2760+ textureData[3] = 1;
2761+ textureData[4] = 1;
2762+ textureData[5] = 0;
2763+ textureData[6] = 1;
2764+ textureData[7] = 1;
2765+
2766+ streamingBuffer->addTexCoords (0, 4, textureData);
2767+
2768+ streamingBuffer->end ();
2769+ streamingBuffer->render (sTransform);
2770+
2771+ glBindTexture (GL_TEXTURE_2D, 0);
2772+ glDisable (GL_TEXTURE_2D);
2773 glDisable (GL_BLEND);
2774- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
2775- glDisable (GL_TEXTURE_RECTANGLE_ARB);
2776- glPopMatrix ();
2777 }
2778 }
2779
2780@@ -1120,16 +1182,20 @@
2781 {
2782 cursor->isSet = true;
2783 cursor->screen = screen;
2784- glEnable (GL_TEXTURE_RECTANGLE_ARB);
2785+
2786+ glEnable (GL_TEXTURE_2D);
2787 glGenTextures (1, &cursor->texture);
2788- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, cursor->texture);
2789+ glBindTexture (GL_TEXTURE_2D, cursor->texture);
2790
2791- glTexParameteri (GL_TEXTURE_RECTANGLE_ARB,
2792- GL_TEXTURE_WRAP_S, GL_CLAMP);
2793- glTexParameteri (GL_TEXTURE_RECTANGLE_ARB,
2794- GL_TEXTURE_WRAP_T, GL_CLAMP);
2795- } else {
2796- glEnable (GL_TEXTURE_RECTANGLE_ARB);
2797+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
2798+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
2799+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
2800+ gScreen->textureFilter ());
2801+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
2802+ gScreen->textureFilter ());
2803+ }
2804+ else {
2805+ glEnable (GL_TEXTURE_2D);
2806 }
2807
2808 XFixesCursorImage *ci = XFixesGetCursorImage (dpy);
2809@@ -1185,11 +1251,11 @@
2810 compLogMessage ("ezoom", CompLogLevelWarn, "unable to get system cursor image!");
2811 }
2812
2813- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, cursor->texture);
2814- glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, cursor->width,
2815+ glBindTexture (GL_TEXTURE_2D, cursor->texture);
2816+ glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, cursor->width,
2817 cursor->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
2818- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
2819- glDisable (GL_TEXTURE_RECTANGLE_ARB);
2820+ glBindTexture (GL_TEXTURE_2D, 0);
2821+ glDisable (GL_TEXTURE_2D);
2822
2823 free (pixels);
2824 }
2825
2826=== modified file 'plugins/grid/src/grid.cpp'
2827--- plugins/grid/src/grid.cpp 2012-08-03 10:12:25 +0000
2828+++ plugins/grid/src/grid.cpp 2012-08-22 06:16:22 +0000
2829@@ -432,35 +432,52 @@
2830 CompRect rect;
2831 GLMatrix sTransform (transform);
2832 std::vector<Animation>::iterator iter;
2833+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
2834+ GLfloat vertexData[12];
2835+ GLushort colorData[4];
2836+ GLushort *color;
2837+ GLboolean isBlendingEnabled;
2838
2839 getPaintRectangle (rect);
2840
2841 for (unsigned int i = 0; i < animations.size (); i++)
2842 setCurrentRect (animations.at (i));
2843
2844- glPushMatrix ();
2845-
2846 sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
2847
2848- glLoadMatrixf (sTransform.getMatrix ());
2849-
2850- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
2851+ glGetBooleanv (GL_BLEND, &isBlendingEnabled);
2852 glEnable (GL_BLEND);
2853
2854 for (iter = animations.begin (); iter != animations.end () && animating; ++iter)
2855 {
2856 Animation& anim = *iter;
2857 float alpha = ((float) optionGetFillColorAlpha () / 65535.0f) * anim.opacity;
2858-
2859- /* fill rectangle */
2860- glColor4f (((float) optionGetFillColorRed () / 65535.0f) * alpha,
2861- ((float) optionGetFillColorGreen () / 65535.0f) * alpha,
2862- ((float) optionGetFillColorBlue () / 65535.0f) * alpha,
2863- alpha);
2864-
2865- /* fill rectangle */
2866- glRecti (anim.currentRect.x1 (), anim.currentRect.y2 (),
2867- anim.currentRect.x2 (), anim.currentRect.y1 ());
2868+ color = optionGetFillColor ();
2869+
2870+ colorData[0] = alpha * color[0];
2871+ colorData[1] = alpha * color[1];
2872+ colorData[2] = alpha * color[2];
2873+ colorData[3] = alpha * 65535.0f;
2874+
2875+ vertexData[0] = anim.currentRect.x1 ();
2876+ vertexData[1] = anim.currentRect.y1 ();
2877+ vertexData[2] = 0.0f;
2878+ vertexData[3] = anim.currentRect.x1 ();
2879+ vertexData[4] = anim.currentRect.y2 ();
2880+ vertexData[5] = 0.0f;
2881+ vertexData[6] = anim.currentRect.x2 ();
2882+ vertexData[7] = anim.currentRect.y1 ();
2883+ vertexData[8] = 0.0f;
2884+ vertexData[9] = anim.currentRect.x2 ();
2885+ vertexData[10] = anim.currentRect.y2 ();
2886+ vertexData[11] = 0.0f;
2887+
2888+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
2889+ streamingBuffer->addColors (1, colorData);
2890+ streamingBuffer->addVertices (4, vertexData);
2891+
2892+ streamingBuffer->end ();
2893+ streamingBuffer->render (sTransform);
2894
2895 /* Set outline rect smaller to avoid damage issues */
2896 anim.currentRect.setGeometry (anim.currentRect.x () + 1,
2897@@ -468,63 +485,101 @@
2898 anim.currentRect.width () - 2,
2899 anim.currentRect.height () - 2);
2900
2901- alpha = (float) (optionGetOutlineColorAlpha () / 65535.0f) * anim.opacity;
2902-
2903 /* draw outline */
2904- glColor4f (((float) optionGetOutlineColorRed () / 65535.0f) * alpha,
2905- ((float) optionGetOutlineColorGreen () / 65535.0f) * alpha,
2906- ((float) optionGetOutlineColorBlue () / 65535.0f) * alpha,
2907- alpha);
2908+ alpha = ((float) optionGetOutlineColorAlpha () / 65535.0f) * anim.opacity;
2909+ color = optionGetOutlineColor ();
2910+
2911+ colorData[0] = alpha * color[0];
2912+ colorData[1] = alpha * color[1];
2913+ colorData[2] = alpha * color[2];
2914+ colorData[3] = alpha * 65535.0f;
2915+
2916+ vertexData[0] = anim.currentRect.x1 ();
2917+ vertexData[1] = anim.currentRect.y1 ();
2918+ vertexData[3] = anim.currentRect.x1 ();
2919+ vertexData[4] = anim.currentRect.y2 ();
2920+ vertexData[6] = anim.currentRect.x2 ();
2921+ vertexData[7] = anim.currentRect.y2 ();
2922+ vertexData[9] = anim.currentRect.x2 ();
2923+ vertexData[10] = anim.currentRect.y1 ();
2924
2925 glLineWidth (2.0);
2926
2927- glBegin (GL_LINE_LOOP);
2928- glVertex2i (anim.currentRect.x1 (), anim.currentRect.y1 ());
2929- glVertex2i (anim.currentRect.x2 (), anim.currentRect.y1 ());
2930- glVertex2i (anim.currentRect.x2 (), anim.currentRect.y2 ());
2931- glVertex2i (anim.currentRect.x1 (), anim.currentRect.y2 ());
2932- glEnd ();
2933+ streamingBuffer->begin (GL_LINE_LOOP);
2934+ streamingBuffer->addColors (1, colorData);
2935+ streamingBuffer->addVertices (4, vertexData);
2936+
2937+ streamingBuffer->end ();
2938+ streamingBuffer->render (sTransform);
2939 }
2940
2941 if (!animating)
2942 {
2943- /* fill rectangle */
2944+ /* draw filled rectangle */
2945 float alpha = (float) optionGetFillColorAlpha () / 65535.0f;
2946-
2947- /* fill rectangle */
2948- glColor4f (((float) optionGetFillColorRed () / 65535.0f) * alpha,
2949- ((float) optionGetFillColorGreen () / 65535.0f) * alpha,
2950- ((float) optionGetFillColorBlue () / 65535.0f) * alpha,
2951- alpha);
2952- glRecti (rect.x1 (), rect.y2 (), rect.x2 (), rect.y1 ());
2953+ color = optionGetFillColor ();
2954+
2955+ colorData[0] = alpha * color[0];
2956+ colorData[1] = alpha * color[1];
2957+ colorData[2] = alpha * color[2];
2958+ colorData[3] = alpha * 65535.0f;
2959+
2960+ vertexData[0] = rect.x1 ();
2961+ vertexData[1] = rect.y1 ();
2962+ vertexData[2] = 0.0f;
2963+ vertexData[3] = rect.x1 ();
2964+ vertexData[4] = rect.y2 ();
2965+ vertexData[5] = 0.0f;
2966+ vertexData[6] = rect.x2 ();
2967+ vertexData[7] = rect.y1 ();
2968+ vertexData[8] = 0.0f;
2969+ vertexData[9] = rect.x2 ();
2970+ vertexData[10] = rect.y2 ();
2971+ vertexData[11] = 0.0f;
2972+
2973+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
2974+ streamingBuffer->addColors (1, colorData);
2975+ streamingBuffer->addVertices (4, vertexData);
2976+
2977+ streamingBuffer->end ();
2978+ streamingBuffer->render (sTransform);
2979
2980 /* Set outline rect smaller to avoid damage issues */
2981- rect.setGeometry (rect.x () + 1, rect.y () + 1,
2982- rect.width () - 2, rect.height () - 2);
2983+ rect.setGeometry (rect.x () + 1,
2984+ rect.y () + 1,
2985+ rect.width () - 2,
2986+ rect.height () - 2);
2987
2988 /* draw outline */
2989 alpha = (float) optionGetOutlineColorAlpha () / 65535.0f;
2990-
2991- /* draw outline */
2992- glColor4f (((float) optionGetOutlineColorRed () / 65535.0f) * alpha,
2993- ((float) optionGetOutlineColorGreen () / 65535.0f) * alpha,
2994- ((float) optionGetOutlineColorBlue () / 65535.0f) * alpha,
2995- alpha);
2996+ color = optionGetOutlineColor ();
2997+
2998+ colorData[0] = alpha * color[0];
2999+ colorData[1] = alpha * color[1];
3000+ colorData[2] = alpha * color[2];
3001+ colorData[3] = alpha * 65535.0f;
3002+
3003+ vertexData[0] = rect.x1 ();
3004+ vertexData[1] = rect.y1 ();
3005+ vertexData[3] = rect.x1 ();
3006+ vertexData[4] = rect.y2 ();
3007+ vertexData[6] = rect.x2 ();
3008+ vertexData[7] = rect.y2 ();
3009+ vertexData[9] = rect.x2 ();
3010+ vertexData[10] = rect.y1 ();
3011
3012 glLineWidth (2.0);
3013- glBegin (GL_LINE_LOOP);
3014- glVertex2i (rect.x1 (), rect.y1 ());
3015- glVertex2i (rect.x2 (), rect.y1 ());
3016- glVertex2i (rect.x2 (), rect.y2 ());
3017- glVertex2i (rect.x1 (), rect.y2 ());
3018- glEnd ();
3019+
3020+ streamingBuffer->begin (GL_LINE_LOOP);
3021+ streamingBuffer->addColors (1, colorData);
3022+ streamingBuffer->addVertices (4, vertexData);
3023+
3024+ streamingBuffer->end ();
3025+ streamingBuffer->render (sTransform);
3026 }
3027
3028- /* clean up */
3029- glColor4usv (defaultColor);
3030+ if (!isBlendingEnabled)
3031 glDisable (GL_BLEND);
3032- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
3033- glPopMatrix ();
3034 }
3035
3036 bool
3037
3038=== modified file 'plugins/imgsvg/src/imgsvg.cpp'
3039--- plugins/imgsvg/src/imgsvg.cpp 2012-01-18 16:26:45 +0000
3040+++ plugins/imgsvg/src/imgsvg.cpp 2012-08-22 06:16:22 +0000
3041@@ -221,11 +221,11 @@
3042
3043 bool
3044 SvgWindow::glDraw (const GLMatrix &transform,
3045- GLFragment::Attrib &fragment,
3046+ const GLWindowPaintAttrib &attrib,
3047 const CompRegion &region,
3048 unsigned int mask)
3049 {
3050- bool status = gWindow->glDraw (transform, fragment, region, mask);
3051+ bool status = gWindow->glDraw (transform, attrib, region, mask);
3052
3053 if (!status)
3054 return status;
3055@@ -251,13 +251,15 @@
3056 {
3057 matrix[0] = context->texture[0].matrices[i];
3058
3059- gWindow->geometry ().reset ();
3060+ gWindow->vertexBuffer ()->begin ();
3061 gWindow->glAddGeometry (matrix, context->box, reg);
3062+ gWindow->vertexBuffer ()->end ();
3063
3064 if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
3065 mask |= PAINT_WINDOW_BLEND_MASK;
3066
3067- gWindow->glDrawTexture (context->texture[0].textures[i], fragment, mask);
3068+ gWindow->glDrawTexture (context->texture[0].textures[i], transform,
3069+ attrib, mask);
3070
3071 if (rect.width () > 0 && rect.height () > 0)
3072 {
3073@@ -321,11 +323,12 @@
3074 saveFilter = gScreen->filter (SCREEN_TRANS_FILTER);
3075 gScreen->setFilter (SCREEN_TRANS_FILTER, GLTexture::Good);
3076
3077- gWindow->geometry ().reset ();
3078+ gWindow->vertexBuffer ()->begin ();
3079 gWindow->glAddGeometry (matrix, r, reg);
3080+ gWindow->vertexBuffer ()->end ();
3081
3082 gWindow->glDrawTexture (context->texture[1].textures[j],
3083- fragment, mask);
3084+ transform, attrib, mask);
3085
3086 gScreen->setFilter (SCREEN_TRANS_FILTER, saveFilter);
3087 }
3088
3089=== modified file 'plugins/imgsvg/src/imgsvg.h'
3090--- plugins/imgsvg/src/imgsvg.h 2012-08-22 05:05:13 +0000
3091+++ plugins/imgsvg/src/imgsvg.h 2012-08-22 06:16:22 +0000
3092@@ -81,7 +81,8 @@
3093 SvgWindow (CompWindow *window);
3094 ~SvgWindow ();
3095
3096- bool glDraw (const GLMatrix &transform, GLFragment::Attrib &fragment,
3097+ bool glDraw (const GLMatrix &transform,
3098+ const GLWindowPaintAttrib &attrib,
3099 const CompRegion &region, unsigned int mask);
3100 void moveNotify (int dx, int dy, bool immediate);
3101 void resizeNotify (int dx, int dy, int dwidth, int dheight);
3102
3103=== modified file 'plugins/kdecompat/src/kdecompat.cpp'
3104--- plugins/kdecompat/src/kdecompat.cpp 2012-05-27 04:32:55 +0000
3105+++ plugins/kdecompat/src/kdecompat.cpp 2012-08-22 06:16:22 +0000
3106@@ -204,7 +204,6 @@
3107
3108 if (mSlideData && mSlideData->remaining)
3109 {
3110- GLFragment::Attrib fragment (gWindow->paintAttrib ());
3111 GLMatrix wTransform = transform;
3112 SlideData *data = mSlideData;
3113 float xTranslate = 0, yTranslate = 0, remainder;
3114@@ -241,26 +240,20 @@
3115 status = gWindow->glPaint (attrib, transform, region, mask |
3116 PAINT_WINDOW_NO_CORE_INSTANCE_MASK);
3117
3118- if (window->alpha () || fragment.getOpacity () != OPAQUE)
3119+ if (window->alpha () || attrib.opacity != OPAQUE)
3120 mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
3121
3122 wTransform.translate (xTranslate, yTranslate, 0.0f);
3123
3124- glPushMatrix ();
3125- glLoadMatrixf (wTransform.getMatrix ());
3126-
3127- glPushAttrib (GL_SCISSOR_BIT);
3128 glEnable (GL_SCISSOR_TEST);
3129
3130 glScissor (clipBox.x1 (), screen->height () - clipBox.y2 (),
3131 clipBox.width (), clipBox.height ());
3132
3133- status = gWindow->glDraw (wTransform, fragment, region,
3134+ status = gWindow->glDraw (wTransform, attrib, region,
3135 mask | PAINT_WINDOW_TRANSFORMED_MASK);
3136
3137 glDisable (GL_SCISSOR_TEST);
3138- glPopAttrib ();
3139- glPopMatrix ();
3140 }
3141
3142 foreach (const Thumb& thumb, mPreviews)
3143@@ -329,20 +322,17 @@
3144 matrices[0].x0 -= (tw->x () * icon->matrix ().xx);
3145 matrices[0].y0 -= (tw->y () * icon->matrix ().yy);
3146
3147- gtw->geometry ().reset ();
3148+ gtw->vertexBuffer ()->begin ();
3149 gtw->glAddGeometry (matrices, tw->geometry (), infiniteRegion);
3150-
3151- if (!gtw->geometry ().vertices)
3152- icon = NULL;
3153+ gtw->vertexBuffer ()->end ();
3154 }
3155 }
3156
3157 if (!gtw->textures ().empty () || icon)
3158 {
3159- GLFragment::Attrib fragment (attrib);
3160 GLMatrix wTransform (transform);
3161
3162- if (tw->alpha () || fragment.getOpacity () != OPAQUE)
3163+ if (tw->alpha () || attrib.opacity != OPAQUE)
3164 paintMask |= PAINT_WINDOW_TRANSLUCENT_MASK;
3165
3166 wTransform.translate (tw->x (), tw->y (), 0.0f);
3167@@ -351,16 +341,11 @@
3168 yTranslate / yScale - tw->y (),
3169 0.0f);
3170
3171- glPushMatrix ();
3172- glLoadMatrixf (wTransform.getMatrix ());
3173-
3174 if (!gtw->textures ().empty ())
3175- gtw->glDraw (wTransform, fragment,
3176+ gtw->glDraw (wTransform, attrib,
3177 infiniteRegion, paintMask);
3178 else if (icon)
3179- gtw->glDrawTexture (icon, fragment, paintMask);
3180-
3181- glPopMatrix ();
3182+ gtw->glDrawTexture (icon, wTransform, attrib, paintMask);
3183 }
3184 }
3185
3186
3187=== modified file 'plugins/mag/src/mag.cpp'
3188--- plugins/mag/src/mag.cpp 2012-05-27 04:32:55 +0000
3189+++ plugins/mag/src/mag.cpp 2012-08-22 06:16:22 +0000
3190@@ -38,7 +38,9 @@
3191
3192 if (program)
3193 {
3194+#if 0
3195 GL::deletePrograms (1, &program);
3196+#endif
3197 program = 0;
3198 }
3199 }
3200@@ -46,6 +48,7 @@
3201 bool
3202 MagScreen::loadFragmentProgram ()
3203 {
3204+#if 0
3205 char buffer[1024];
3206 GLsizei bufSize;
3207 GLint errorPos;
3208@@ -85,11 +88,14 @@
3209 GL::bindProgram (GL_FRAGMENT_PROGRAM_ARB, 0);
3210
3211 return true;
3212+#endif
3213+ return false;
3214 }
3215
3216 bool
3217 MagScreen::loadImages ()
3218 {
3219+#if 0
3220 CompString overlay_s = optionGetOverlay ();
3221 CompString mask_s = optionGetMask ();
3222 CompString pname ("mag");
3223@@ -130,6 +136,8 @@
3224 }
3225
3226 return true;
3227+#endif
3228+ return false;
3229 }
3230
3231 void
3232@@ -317,8 +325,6 @@
3233
3234 if (!adjust && zoom == 1.0 && (width || height))
3235 {
3236- glEnable (target);
3237-
3238 glBindTexture (target, texture);
3239
3240 glTexImage2D (target, 0, GL_RGB, 0, 0, 0,
3241@@ -328,8 +334,6 @@
3242 height = 0;
3243
3244 glBindTexture (target, 0);
3245-
3246- glDisable (target);
3247 }
3248
3249 if (zoom == 1.0 && !adjust)
3250@@ -357,6 +361,10 @@
3251 bool kScreen;
3252 unsigned short *color;
3253 float tmp;
3254+ GLMatrix projection;
3255+ GLMatrix modelview;
3256+ GLVertexBuffer *vb = GLVertexBuffer::streamingBuffer ();
3257+ const GLWindowPaintAttrib attrib = { OPAQUE, BRIGHT, COLOR, 0, 0, 0, 0 };
3258
3259 w = optionGetBoxWidth ();
3260 h = optionGetBoxHeight ();
3261@@ -393,8 +401,6 @@
3262 ch = h;
3263 }
3264
3265- glEnable (target);
3266-
3267 glBindTexture (target, texture);
3268
3269 if (width != w || height != h)
3270@@ -419,13 +425,6 @@
3271 ph = 1.0;
3272 }
3273
3274- glMatrixMode (GL_PROJECTION);
3275- glPushMatrix ();
3276- glLoadIdentity ();
3277- glMatrixMode (GL_MODELVIEW);
3278- glPushMatrix ();
3279- glLoadIdentity ();
3280-
3281 vc[0] = ((x1 * 2.0) / screen->width ()) - 1.0;
3282 vc[1] = ((x2 * 2.0) / screen->width ()) - 1.0;
3283 vc[2] = ((y1 * -2.0) / screen->height ()) + 1.0;
3284@@ -436,41 +435,63 @@
3285 tc[2] = h * ph;
3286 tc[3] = 0.0;
3287
3288- glColor4usv (defaultColor);
3289-
3290- glPushMatrix ();
3291-
3292- glTranslatef ((float)(posX - (screen->width () / 2)) * 2 / screen->width (),
3293+ /* Draw zoom box contents */
3294+ glScissor (x1, screen->height () - y2, w, h);
3295+
3296+ glEnable (GL_SCISSOR_TEST);
3297+
3298+ modelview.translate ((float)(posX - (screen->width () / 2)) * 2 / screen->width (),
3299 (float)(posY - (screen->height () / 2)) * 2 / -screen->height (), 0.0);
3300
3301- glScalef (zoom, zoom, 1.0);
3302+ modelview.scale (zoom, zoom, 1.0);
3303
3304- glTranslatef ((float)((screen->width () / 2) - posX) * 2 / screen->width (),
3305+ modelview.translate ((float)((screen->width () / 2) - posX) * 2 / screen->width (),
3306 (float)((screen->height () / 2) - posY) * 2 / -screen->height (), 0.0);
3307
3308- glScissor (x1, screen->height () - y2, w, h);
3309-
3310- glEnable (GL_SCISSOR_TEST);
3311-
3312- glBegin (GL_QUADS);
3313- glTexCoord2f (tc[0], tc[2]);
3314- glVertex2f (vc[0], vc[2]);
3315- glTexCoord2f (tc[0], tc[3]);
3316- glVertex2f (vc[0], vc[3]);
3317- glTexCoord2f (tc[1], tc[3]);
3318- glVertex2f (vc[1], vc[3]);
3319- glTexCoord2f (tc[1], tc[2]);
3320- glVertex2f (vc[1], vc[2]);
3321- glEnd ();
3322+ GLfloat vertices[] = {
3323+ vc[0], vc[2], 0,
3324+ vc[0], vc[3], 0,
3325+ vc[1], vc[2], 0,
3326+ vc[1], vc[3], 0,
3327+ };
3328+
3329+ GLfloat texcoords[] = {
3330+ tc[0], tc[2],
3331+ tc[0], tc[3],
3332+ tc[1], tc[2],
3333+ tc[1], tc[3],
3334+ };
3335+
3336+ vb->begin (GL_TRIANGLE_STRIP);
3337+ vb->colorDefault ();
3338+ vb->addVertices (4, vertices);
3339+ vb->addTexCoords (0, 4, texcoords);
3340+ vb->end ();
3341+
3342+ vb->render (projection, modelview, attrib);
3343
3344 glDisable (GL_SCISSOR_TEST);
3345-
3346- glPopMatrix ();
3347-
3348+ modelview.reset ();
3349 glBindTexture (target, 0);
3350
3351- glDisable (target);
3352-
3353+ /* Save blending state */
3354+#if USE_GLES
3355+ GLboolean isBlendingEnabled = GL_TRUE;
3356+ GLint blendSrcRGB = GL_ONE;
3357+ GLint blendSrcAlpha = GL_ONE;
3358+ GLint blendDstRGB = GL_ZERO;
3359+ GLint blendDstAlpha = GL_ZERO;
3360+
3361+ glGetBooleanv (GL_BLEND, &isBlendingEnabled);
3362+ glGetIntegerv (GL_BLEND_SRC_RGB, &blendSrcRGB);
3363+ glGetIntegerv (GL_BLEND_DST_RGB, &blendDstRGB);
3364+ glGetIntegerv (GL_BLEND_SRC_ALPHA, &blendSrcAlpha);
3365+ glGetIntegerv (GL_BLEND_DST_ALPHA, &blendDstAlpha);
3366+#else
3367+ glPushAttrib (GL_COLOR_BUFFER_BIT);
3368+#endif
3369+
3370+ /* Draw zoom box border */
3371 glEnable (GL_BLEND);
3372 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
3373
3374@@ -488,40 +509,43 @@
3375
3376 color = optionGetBoxColor ();
3377
3378- glColor4us (color[0], color[1], color[2], color[3] * tmp);
3379-
3380- glBegin (GL_QUADS);
3381- glVertex2f (vc[0] - bw, vc[2] + bh);
3382- glVertex2f (vc[0] - bw, vc[2]);
3383- glVertex2f (vc[1] + bw, vc[2]);
3384- glVertex2f (vc[1] + bw, vc[2] + bh);
3385- glVertex2f (vc[0] - bw, vc[3]);
3386- glVertex2f (vc[0] - bw, vc[3] - bh);
3387- glVertex2f (vc[1] + bw, vc[3] - bh);
3388- glVertex2f (vc[1] + bw, vc[3]);
3389- glVertex2f (vc[0] - bw, vc[2]);
3390- glVertex2f (vc[0] - bw, vc[3]);
3391- glVertex2f (vc[0], vc[3]);
3392- glVertex2f (vc[0], vc[2]);
3393- glVertex2f (vc[1], vc[2]);
3394- glVertex2f (vc[1], vc[3]);
3395- glVertex2f (vc[1] + bw, vc[3]);
3396- glVertex2f (vc[1] + bw, vc[2]);
3397- glEnd();
3398-
3399- glColor4usv (defaultColor);
3400+ GLfloat verticesBorder[] = {
3401+ vc[0] - bw, vc[2] + bh, 0,
3402+ vc[0], vc[2], 0,
3403+ vc[1] + bw, vc[2] + bh, 0,
3404+ vc[1], vc[2], 0,
3405+ vc[1] + bw, vc[3] - bh, 0,
3406+ vc[1], vc[3], 0,
3407+ vc[0] - bw, vc[3] - bh, 0,
3408+ vc[0], vc[3], 0,
3409+ vc[0] - bw, vc[2] + bh, 0,
3410+ vc[0], vc[2], 0,
3411+ };
3412+
3413+ vb->begin (GL_TRIANGLE_STRIP);
3414+ vb->color4f (color[0] / 65535.0, color[1] / 65535.0,
3415+ color[2] / 65535.0, color[3] * tmp / 65535.0);
3416+ vb->addVertices (10, verticesBorder);
3417+ vb->end ();
3418+
3419+ vb->render (projection, modelview, attrib);
3420+
3421+ vb->colorDefault ();
3422+
3423+ /* Restore blending state */
3424+#if USE_GLES
3425+ if (!isBlendingEnabled)
3426 glDisable (GL_BLEND);
3427- glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
3428-
3429- glPopMatrix();
3430- glMatrixMode (GL_PROJECTION);
3431- glPopMatrix ();
3432- glMatrixMode (GL_MODELVIEW);
3433+ glBlendFuncSeparate (blendSrcRGB, blendDstRGB, blendSrcAlpha, blendDstAlpha);
3434+#else
3435+ glPopAttrib ();
3436+#endif
3437 }
3438
3439 void
3440 MagScreen::paintImage ()
3441 {
3442+#if 0
3443 float pw, ph;
3444 int x1, x2, y1, y2;
3445 float vc[4];
3446@@ -680,12 +704,14 @@
3447 glMatrixMode (GL_MODELVIEW);
3448
3449 glPopAttrib ();
3450+#endif
3451
3452 }
3453
3454 void
3455 MagScreen::paintFisheye ()
3456 {
3457+#if 0
3458 float pw, ph;
3459 float radius, fZoom, base; // fZoom is the local zoom variable
3460 int x1, x2, y1, y2;
3461@@ -786,6 +812,7 @@
3462 glBindTexture (target, 0);
3463
3464 glDisable (target);
3465+#endif
3466 }
3467
3468
3469@@ -939,12 +966,14 @@
3470
3471 glGenTextures (1, &texture);
3472
3473+#ifdef USE_GLES
3474+ target = GL_TEXTURE_2D;
3475+#else
3476 if (GL::textureNonPowerOfTwo)
3477 target = GL_TEXTURE_2D;
3478 else
3479 target = GL_TEXTURE_RECTANGLE_ARB;
3480-
3481- glEnable (target);
3482+#endif
3483
3484 /* Bind the texture */
3485 glBindTexture (target, texture);
3486@@ -952,8 +981,8 @@
3487 /* Load the parameters */
3488 glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
3489 glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
3490- glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP);
3491- glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP);
3492+ glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
3493+ glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
3494
3495 glTexImage2D (target, 0, GL_RGB, 0, 0, 0,
3496 GL_RGB, GL_UNSIGNED_BYTE, NULL);
3497@@ -963,8 +992,6 @@
3498
3499 glBindTexture (target, 0);
3500
3501- glDisable (target);
3502-
3503 #define optionNotify(name) \
3504 optionSet##name##Notify (boost::bind (&MagScreen::optionChanged, \
3505 this, _1, _2))
3506@@ -1004,10 +1031,12 @@
3507 mode = MagOptions::ModeSimple;
3508 }
3509
3510+#if 0
3511 if (!GL::fragmentProgram)
3512 compLogMessage ("mag", CompLogLevelWarn,
3513 "GL_ARB_fragment_program not supported. "
3514 "Fisheye mode will not work.");
3515+#endif
3516 }
3517
3518 MagScreen::~MagScreen ()
3519
3520=== modified file 'plugins/mag/src/mag.h'
3521--- plugins/mag/src/mag.h 2012-05-27 04:32:55 +0000
3522+++ plugins/mag/src/mag.h 2012-08-22 06:16:22 +0000
3523@@ -161,6 +161,7 @@
3524 bool init ();
3525 };
3526
3527+#if 0
3528 static const char *fisheyeFpString =
3529 "!!ARBfp1.0"
3530
3531@@ -190,3 +191,4 @@
3532 "TEX result.color, t1, texture[0], %s;"
3533
3534 "END";
3535+#endif
3536
3537=== modified file 'plugins/neg/src/neg.cpp'
3538--- plugins/neg/src/neg.cpp 2011-05-18 01:06:37 +0000
3539+++ plugins/neg/src/neg.cpp 2012-08-22 06:16:22 +0000
3540@@ -22,7 +22,12 @@
3541
3542 #include "neg.h"
3543
3544-using namespace GLFragment;
3545+static std::string fragment_function = " \n\
3546+void neg_fragment () { \n\
3547+ vec3 color = vec3(1.0, 1.0, 1.0) - gl_FragColor.rgb; \n\
3548+ gl_FragColor = vec4(color, gl_FragColor.a); \n\
3549+} \n\
3550+";
3551
3552 COMPIZ_PLUGIN_20090315 (neg, NegPluginVTable);
3553
3554@@ -74,65 +79,12 @@
3555 return true;
3556 }
3557
3558-int
3559-NegScreen::getFragmentFunction (GLTexture *texture,
3560- bool alpha)
3561-{
3562- int handle = 0;
3563-
3564- if (alpha && negAlphaFunction)
3565- handle = negAlphaFunction;
3566- else if (!alpha && negFunction)
3567- handle = negFunction;
3568-
3569- if (!handle)
3570- {
3571- FunctionData data;
3572- int target;
3573-
3574- if (alpha)
3575- data.addTempHeaderOp ("neg");
3576-
3577- if (texture->target () == GL_TEXTURE_2D)
3578- target = COMP_FETCH_TARGET_2D;
3579- else
3580- target = COMP_FETCH_TARGET_RECT;
3581-
3582- data.addFetchOp ("output", NULL, target);
3583-
3584- if (alpha)
3585- {
3586- data.addDataOp ("RCP neg.a, output.a;");
3587- data.addDataOp ("MAD output.rgb, -neg.a, output, 1.0;");
3588- }
3589- else
3590- data.addDataOp ("SUB output.rgb, 1.0, output;");
3591-
3592- if (alpha)
3593- data.addDataOp ("MUL output.rgb, output.a, output;");
3594-
3595- data.addColorOp ("output", "output");
3596-
3597- if (!data.status ())
3598- return 0;
3599-
3600- handle = data.createFragmentFunction ("neg");
3601-
3602- if (alpha)
3603- negAlphaFunction = handle;
3604- else
3605- negFunction = handle;
3606- }
3607-
3608- return handle;
3609-}
3610-
3611 void
3612 NegWindow::glDrawTexture (GLTexture *texture,
3613- GLFragment::Attrib &attrib,
3614+ const GLMatrix &transform,
3615+ const GLWindowPaintAttrib &attrib,
3616 unsigned int mask)
3617 {
3618- GLTexture::Filter filter;
3619 bool doNeg = false;
3620 GLTexture *tex = NULL;
3621
3622@@ -160,24 +112,16 @@
3623
3624 if (doNeg && tex)
3625 {
3626- /* Fragment program negation */
3627- if (GL::fragmentProgram)
3628+ /* shader program negation */
3629+ if (true)
3630 {
3631- GLFragment::Attrib fa = attrib;
3632- int function;
3633- bool alpha = true;
3634-
3635- if (texture->name () == tex->name ()) /* Not a decoration */
3636- alpha = window->alpha ();
3637-
3638- function = ns->getFragmentFunction (texture, alpha);
3639- if (function)
3640- fa.addFunction (function);
3641-
3642- gWindow->glDrawTexture (texture, fa, mask);
3643+ gWindow->addShaders ("neg", "", fragment_function);
3644+ gWindow->glDrawTexture (texture, transform, attrib, mask);
3645 }
3646 else /* Texture manipulation negation */
3647 {
3648+#ifndef USE_GLES
3649+ GLTexture::Filter filter;
3650 /* this is for the most part taken from paint.c */
3651
3652 if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
3653@@ -188,14 +132,10 @@
3654 filter = ns->gScreen->filter (NOTHING_TRANS_FILTER);
3655
3656 /* if we can adjust saturation, even if it's just on and off */
3657- if (GL::canDoSaturated && attrib.getSaturation () != COLOR)
3658+ if (GL::canDoSaturated && attrib.saturation != COLOR)
3659 {
3660 GLfloat constant[4];
3661
3662- /* if the paint mask has this set we want to blend */
3663- if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
3664- glEnable (GL_BLEND);
3665-
3666 /* enable the texture */
3667 texture->enable (filter);
3668
3669@@ -233,7 +173,7 @@
3670 glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
3671
3672 /* if we can do saturation that is in between min and max */
3673- if (GL::canDoSlightlySaturated && attrib.getSaturation () > 0)
3674+ if (GL::canDoSlightlySaturated && attrib.saturation > 0)
3675 {
3676 glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
3677 glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
3678@@ -270,13 +210,13 @@
3679 glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
3680
3681 /* color constant */
3682- constant[3] = attrib.getSaturation () / 65535.0f;
3683+ constant[3] = attrib.saturation / 65535.0f;
3684
3685 glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
3686
3687 /* if we are not opaque or not fully bright */
3688- if (attrib.getOpacity () < OPAQUE ||
3689- attrib.getBrightness () != BRIGHT)
3690+ if (attrib.opacity < OPAQUE ||
3691+ attrib.brightness != BRIGHT)
3692 {
3693 /* make another texture active */
3694 GL::activeTexture (GL_TEXTURE3_ARB);
3695@@ -285,9 +225,9 @@
3696 texture->enable (filter);
3697
3698 /* color constant */
3699- constant[3] = attrib.getOpacity () / 65535.0f;
3700+ constant[3] = attrib.opacity / 65535.0f;
3701 constant[0] = constant[1] = constant[2] =
3702- constant[3] * attrib.getBrightness () / 65535.0f;
3703+ constant[3] * attrib.brightness / 65535.0f;
3704
3705 glTexEnvfv(GL_TEXTURE_ENV,
3706 GL_TEXTURE_ENV_COLOR, constant);
3707@@ -314,8 +254,7 @@
3708 glTexEnvf(GL_TEXTURE_ENV,
3709 GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
3710
3711- /* draw the window geometry */
3712- gWindow->glDrawGeometry ();
3713+ gWindow->glDrawTexture (texture, transform, attrib, mask);
3714
3715 /* disable the current texture */
3716 texture->disable ();
3717@@ -331,8 +270,7 @@
3718 {
3719 /* fully opaque and bright */
3720
3721- /* draw the window geometry */
3722- gWindow->glDrawGeometry ();
3723+ gWindow->glDrawTexture (texture, transform, attrib, mask);
3724 }
3725
3726 /* disable the current texture */
3727@@ -355,9 +293,9 @@
3728 glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
3729
3730 /* color constant */
3731- constant[3] = attrib.getOpacity () / 65535.0f;
3732+ constant[3] = attrib.opacity / 65535.0f;
3733 constant[0] = constant[1] = constant[2] =
3734- constant[3] * attrib.getBrightness () / 65535.0f;
3735+ constant[3] * attrib.brightness / 65535.0f;
3736
3737 constant[0] =
3738 0.5f + 0.5f * RED_SATURATION_WEIGHT * constant[0];
3739@@ -368,8 +306,7 @@
3740
3741 glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
3742
3743- /* draw the window geometry */
3744- gWindow->glDrawGeometry ();
3745+ gWindow->glDrawTexture (texture, transform, attrib, mask);
3746 }
3747
3748 /* disable the current texture */
3749@@ -390,9 +327,6 @@
3750 /* set screens texture mode back to replace */
3751 ns->gScreen->setTexEnvMode (GL_REPLACE);
3752
3753- /* if it's a translucent window, disable blending */
3754- if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
3755- glDisable (GL_BLEND);
3756 }
3757 else
3758 {
3759@@ -411,17 +345,14 @@
3760
3761 /* we are not opaque or fully bright */
3762 if ((mask & PAINT_WINDOW_TRANSLUCENT_MASK) ||
3763- attrib.getBrightness () != BRIGHT)
3764+ attrib.brightness != BRIGHT)
3765 {
3766 GLfloat constant[4];
3767
3768- /* enable blending */
3769- glEnable (GL_BLEND);
3770-
3771 /* color constant */
3772- constant[3] = attrib.getOpacity () / 65535.0f;
3773+ constant[3] = attrib.opacity / 65535.0f;
3774 constant[0] = constant[1] = constant[2] =
3775- constant[3] * attrib.getBrightness () / 65535.0f;
3776+ constant[3] * attrib.brightness / 65535.0f;
3777
3778 glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
3779 glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
3780@@ -441,18 +372,13 @@
3781 glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
3782 glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
3783
3784- /* draw the window geometry */
3785- gWindow->glDrawGeometry ();
3786-
3787- /* disable blending */
3788- glDisable (GL_BLEND);
3789+ gWindow->glDrawTexture (texture, transform, attrib, mask);
3790 }
3791 else
3792 {
3793 /* no adjustments to saturation, brightness or opacity */
3794
3795- /* draw the window geometry */
3796- gWindow->glDrawGeometry ();
3797+ gWindow->glDrawTexture (texture, transform, attrib, mask);
3798 }
3799
3800 /* disable the current texture */
3801@@ -461,12 +387,13 @@
3802 /* set the screens texture mode back to replace */
3803 ns->gScreen->setTexEnvMode (GL_REPLACE);
3804 }
3805+#endif
3806 }
3807 }
3808 else
3809 {
3810 /* not negative */
3811- gWindow->glDrawTexture (texture, attrib, mask);
3812+ gWindow->glDrawTexture (texture, transform, attrib, mask);
3813 }
3814 }
3815
3816
3817=== modified file 'plugins/neg/src/neg.h'
3818--- plugins/neg/src/neg.h 2011-05-27 08:32:06 +0000
3819+++ plugins/neg/src/neg.h 2012-08-22 06:16:22 +0000
3820@@ -57,10 +57,6 @@
3821 CompOption::Vector opt,
3822 bool all);
3823
3824- int
3825- getFragmentFunction (GLTexture *texture,
3826- bool alpha);
3827-
3828 GLScreen *gScreen;
3829 };
3830
3831@@ -89,8 +85,9 @@
3832 bool isNeg;
3833
3834 void
3835- glDrawTexture(GLTexture *texture,
3836- GLFragment::Attrib &attrib,
3837+ glDrawTexture (GLTexture *texture,
3838+ const GLMatrix &transform,
3839+ const GLWindowPaintAttrib &attrib,
3840 unsigned int mask);
3841
3842 void toggle ();
3843
3844=== modified file 'plugins/obs/src/obs.cpp'
3845--- plugins/obs/src/obs.cpp 2010-07-02 02:49:24 +0000
3846+++ plugins/obs/src/obs.cpp 2012-08-22 06:16:22 +0000
3847@@ -151,29 +151,30 @@
3848 we wrap into glDrawWindow here */
3849
3850 bool
3851-ObsWindow::glDraw (const GLMatrix& transform,
3852- GLFragment::Attrib& attrib,
3853- const CompRegion& region,
3854+ObsWindow::glDraw (const GLMatrix &transform,
3855+ const GLWindowPaintAttrib &attrib,
3856+ const CompRegion &region,
3857 unsigned int mask)
3858 {
3859+ GLWindowPaintAttrib wAttrib (attrib);
3860 int factor;
3861
3862 factor = customFactor[MODIFIER_OPACITY];
3863 if (factor != 100)
3864 {
3865- attrib.setOpacity (factor * attrib.getOpacity () / 100);
3866+ wAttrib.opacity = factor * wAttrib.opacity / 100;
3867 mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
3868 }
3869
3870 factor = customFactor[MODIFIER_BRIGHTNESS];
3871 if (factor != 100)
3872- attrib.setBrightness (factor * attrib.getBrightness () / 100);
3873+ wAttrib.brightness = factor * wAttrib.brightness / 100;
3874
3875 factor = customFactor[MODIFIER_SATURATION];
3876 if (factor != 100)
3877- attrib.setSaturation (factor * attrib.getSaturation () / 100);
3878+ wAttrib.saturation = factor * wAttrib.saturation / 100;
3879
3880- return gWindow->glDraw (transform, attrib, region, mask);
3881+ return gWindow->glDraw (transform, wAttrib, region, mask);
3882 }
3883
3884 void
3885
3886=== modified file 'plugins/obs/src/obs.h'
3887--- plugins/obs/src/obs.h 2012-01-18 16:26:45 +0000
3888+++ plugins/obs/src/obs.h 2012-08-22 06:16:22 +0000
3889@@ -66,7 +66,7 @@
3890
3891 bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
3892 const CompRegion &, unsigned int);
3893- bool glDraw (const GLMatrix &, GLFragment::Attrib &,
3894+ bool glDraw (const GLMatrix &, const GLWindowPaintAttrib &,
3895 const CompRegion &, unsigned int);
3896
3897 void changePaintModifier (unsigned int, int);
3898
3899=== modified file 'plugins/opengl/CMakeLists.txt'
3900--- plugins/opengl/CMakeLists.txt 2009-03-15 05:09:18 +0000
3901+++ plugins/opengl/CMakeLists.txt 2012-08-22 06:16:22 +0000
3902@@ -2,7 +2,17 @@
3903
3904 include (CompizPlugin)
3905
3906-find_package (OpenGL)
3907-if (OPENGL_FOUND)
3908- compiz_plugin(opengl PLUGINDEPS composite LIBRARIES ${OPENGL_gl_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
3909-endif ()
3910\ No newline at end of file
3911+set (INTERNAL_LIBRARIES
3912+ compiz_opengl_double_buffer)
3913+
3914+add_subdirectory (src/doublebuffer)
3915+
3916+if (USE_GLES)
3917+ compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD "-DUSE_GLES -std=c++0x" LIBRARIES ${OPENGLES2_LIBRARIES} ${INTERNAL_LIBRARIES} INCDIRS ${OPENGLES2_INCLUDE_DIR})
3918+else (USE_GLES)
3919+ find_package (OpenGL)
3920+ if (OPENGL_FOUND)
3921+ compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD -std=c++0x LIBRARIES ${OPENGL_gl_LIBRARY} ${INTERNAL_LIBRARIES} INCDIRS ${OPENGL_INCLUDE_DIR})
3922+ endif (OPENGL_FOUND)
3923+endif (USE_GLES)
3924+
3925
3926=== modified file 'plugins/opengl/compiz-opengl.pc.in'
3927--- plugins/opengl/compiz-opengl.pc.in 2009-03-15 05:09:18 +0000
3928+++ plugins/opengl/compiz-opengl.pc.in 2012-08-22 06:16:22 +0000
3929@@ -8,5 +8,5 @@
3930 Version: @VERSION@
3931
3932 Requires: compiz compiz-composite
3933-Libs: -lGL -L${libdir} -lopengl
3934+Libs: @PKGCONFIG_LIBS@ -L${libdir} -lopengl
3935 Cflags: @COMPIZ_CFLAGS@ -I${includedir}/compiz
3936\ No newline at end of file
3937
3938=== added file 'plugins/opengl/include/opengl/doublebuffer.h'
3939--- plugins/opengl/include/opengl/doublebuffer.h 1970-01-01 00:00:00 +0000
3940+++ plugins/opengl/include/opengl/doublebuffer.h 2012-08-22 06:16:22 +0000
3941@@ -0,0 +1,39 @@
3942+#ifndef _COMPIZ_OPENGL_BUFFERBLIT_H
3943+#define _COMPIZ_OPENGL_BUFFERBLIT_H
3944+
3945+#include <core/region.h>
3946+
3947+namespace compiz
3948+{
3949+namespace opengl
3950+{
3951+
3952+class DoubleBuffer
3953+{
3954+ public:
3955+ DoubleBuffer ();
3956+ virtual ~DoubleBuffer ();
3957+
3958+ virtual void swap () const = 0;
3959+ virtual bool blitAvailable () const = 0;
3960+ virtual void blit (const CompRegion &region) const = 0;
3961+ virtual bool fallbackBlitAvailable () const = 0;
3962+ virtual void fallbackBlit (const CompRegion &region) const = 0;
3963+
3964+ typedef enum
3965+ {
3966+ VSYNC,
3967+ PERSISTENT_BACK_BUFFER,
3968+ _NSETTINGS
3969+ } Setting;
3970+
3971+ void set (Setting name, bool value);
3972+ void render (const CompRegion &region, bool fullscreen);
3973+
3974+ protected:
3975+ bool setting[_NSETTINGS];
3976+};
3977+
3978+}
3979+}
3980+#endif
3981
3982=== removed file 'plugins/opengl/include/opengl/fragment.h'
3983--- plugins/opengl/include/opengl/fragment.h 2012-01-18 16:26:45 +0000
3984+++ plugins/opengl/include/opengl/fragment.h 1970-01-01 00:00:00 +0000
3985@@ -1,125 +0,0 @@
3986-/*
3987- * Copyright © 2008 Dennis Kasprzyk
3988- * Copyright © 2007 Novell, Inc.
3989- *
3990- * Permission to use, copy, modify, distribute, and sell this software
3991- * and its documentation for any purpose is hereby granted without
3992- * fee, provided that the above copyright notice appear in all copies
3993- * and that both that copyright notice and this permission notice
3994- * appear in supporting documentation, and that the name of
3995- * Dennis Kasprzyk not be used in advertising or publicity pertaining to
3996- * distribution of the software without specific, written prior permission.
3997- * Dennis Kasprzyk makes no representations about the suitability of this
3998- * software for any purpose. It is provided "as is" without express or
3999- * implied warranty.
4000- *
4001- * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
4002- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
4003- * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
4004- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
4005- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
4006- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
4007- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4008- *
4009- * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
4010- * David Reveman <davidr@novell.com>
4011- */
4012-
4013-#ifndef _GLFRAGMENT_H
4014-#define _GLFRAGMENT_H
4015-
4016-#define MAX_FRAGMENT_FUNCTIONS 16
4017-
4018-#define COMP_FETCH_TARGET_2D 0
4019-#define COMP_FETCH_TARGET_RECT 1
4020-#define COMP_FETCH_TARGET_NUM 2
4021-
4022-struct GLWindowPaintAttrib;
4023-class GLScreen;
4024-class GLTexture;
4025-
4026-/**
4027- * Describes a texture modification fragment program
4028- * for a texture
4029- */
4030-namespace GLFragment {
4031-
4032- class Storage;
4033-
4034- typedef unsigned int FunctionId;
4035-
4036- class PrivateFunctionData;
4037- class PrivateAttrib;
4038-
4039- class FunctionData {
4040- public:
4041- FunctionData ();
4042- ~FunctionData ();
4043-
4044- /**
4045- * Returns the status of this fragment program
4046- * (valid or invalid)
4047- */
4048- bool status ();
4049-
4050- void addTempHeaderOp (const char *name);
4051-
4052- void addParamHeaderOp (const char *name);
4053-
4054- void addAttribHeaderOp (const char *name);
4055-
4056-
4057- void addFetchOp (const char *dst, const char *offset, int target);
4058-
4059- void addColorOp (const char *dst, const char *src);
4060-
4061- void addDataOp (const char *str, ...);
4062-
4063- void addBlendOp (const char *str, ...);
4064-
4065- FunctionId createFragmentFunction (const char *name);
4066-
4067- private:
4068- PrivateFunctionData *priv;
4069- };
4070-
4071- class Attrib {
4072- public:
4073- Attrib (const GLWindowPaintAttrib &paint);
4074- Attrib (const Attrib&);
4075- ~Attrib ();
4076-
4077- Attrib &operator= (const Attrib &rhs);
4078-
4079- unsigned int allocTextureUnits (unsigned int nTexture);
4080-
4081- unsigned int allocParameters (unsigned int nParam);
4082-
4083- void addFunction (FunctionId function);
4084-
4085- bool enable (bool *blending);
4086- void disable ();
4087-
4088- unsigned short getSaturation ();
4089- unsigned short getBrightness ();
4090- unsigned short getOpacity ();
4091-
4092- void setSaturation (unsigned short);
4093- void setBrightness (unsigned short);
4094- void setOpacity (unsigned short);
4095-
4096- bool hasFunctions ();
4097-
4098- private:
4099- PrivateAttrib *priv;
4100- };
4101-
4102- void destroyFragmentFunction (FunctionId id);
4103-
4104- FunctionId getSaturateFragmentFunction (GLTexture *texture,
4105- int param);
4106-};
4107-
4108-
4109-
4110-#endif
4111
4112=== added file 'plugins/opengl/include/opengl/framebufferobject.h'
4113--- plugins/opengl/include/opengl/framebufferobject.h 1970-01-01 00:00:00 +0000
4114+++ plugins/opengl/include/opengl/framebufferobject.h 2012-08-22 06:16:22 +0000
4115@@ -0,0 +1,104 @@
4116+/*
4117+ * Copyright (c) 2011 Collabora, Ltd.
4118+ *
4119+ * Permission to use, copy, modify, distribute, and sell this software
4120+ * and its documentation for any purpose is hereby granted without
4121+ * fee, provided that the above copyright notice appear in all copies
4122+ * and that both that copyright notice and this permission notice
4123+ * appear in supporting documentation, and that the name of
4124+ * Collabora Ltd. not be used in advertising or publicity pertaining to
4125+ * distribution of the software without specific, written prior permission.
4126+ * Collabora Ltd. makes no representations about the suitability of this
4127+ * software for any purpose. It is provided "as is" without express or
4128+ * implied warranty.
4129+ *
4130+ * COLLABORA LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
4131+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
4132+ * NO EVENT SHALL COLLABORA LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
4133+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
4134+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
4135+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
4136+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4137+ *
4138+ * Authors: Pekka Paalanen <ppaalanen@gmail.com>
4139+ */
4140+
4141+#ifndef _COMPIZ_GLFRAMEBUFFEROBJECT_H
4142+#define _COMPIZ_GLFRAMEBUFFEROBJECT_H
4143+
4144+#include <opengl/opengl.h>
4145+
4146+struct PrivateGLFramebufferObject;
4147+
4148+/**
4149+ * Class representing a framebuffer object in GL, supporting only one
4150+ * color attachment as per GLES 2 spec. The color attachment is referred
4151+ * to as the texture (of the FBO).
4152+ *
4153+ * Usage:
4154+ * 1. create a GLFramebufferObject (requires a GL context)
4155+ * 2. call allocate (size), and check status ()
4156+ * 3. old = bind ()
4157+ * 4. do your rendering
4158+ * 5. rebind (old)
4159+ * 6. use the rendered texture via tex ()
4160+ * 7. go to 2 or 3, or delete to quit (requires a GL context)
4161+ */
4162+class GLFramebufferObject
4163+{
4164+ public:
4165+ GLFramebufferObject ();
4166+ ~GLFramebufferObject ();
4167+
4168+ /**
4169+ * Ensure the texture is of the given size, recreating it if needed,
4170+ * and replace the FBO color attachment with it. The texture contents
4171+ * become undefined, unless specified in the 'image' argument.
4172+ * When specifying 'image', it's also possible to pass-in the
4173+ * desired image's 'format' and 'type'.
4174+ *
4175+ * Returns true on success, and false on texture allocation failure.
4176+ */
4177+ bool allocate (const CompSize &size,
4178+ const char *image = NULL,
4179+ GLenum format = GL_RGBA,
4180+ GLenum type = GL_UNSIGNED_BYTE);
4181+
4182+ /**
4183+ * Bind this as the current FBO, previous binding in GL context is
4184+ * undone. GL rendering is now targeted to this FBO.
4185+ * Returns a pointer to the previously bound FBO, or NULL if
4186+ * the previous binding was zero (the window system provided
4187+ * framebuffer).
4188+ *
4189+ * The previous FBO is no longer bound, so you can use its
4190+ * texture. To restore the previous FBO, call rebind (FBO) with
4191+ * the returned pointer as the argument.
4192+ */
4193+ GLFramebufferObject *bind ();
4194+
4195+ /**
4196+ * Bind the given FBO as the current FBO, without looking up the
4197+ * previous binding. The argument can be NULL, in which case the
4198+ * window system provided framebuffer gets bound (FBO is unbound).
4199+ */
4200+ static void rebind (GLFramebufferObject *fbo);
4201+
4202+ /**
4203+ * Check the FBO completeness. Returns true on complete.
4204+ * Otherwise returns false and reports the error to log.
4205+ */
4206+ bool checkStatus ();
4207+
4208+ /**
4209+ * Return a pointer to the texture that is the color attachment.
4210+ * This will return NULL, if allocate () has not been called, or
4211+ * the last allocate () call failed.
4212+ */
4213+ GLTexture *tex ();
4214+
4215+ private:
4216+ PrivateGLFramebufferObject *priv;
4217+};
4218+
4219+#endif // _COMPIZ_GLFRAMEBUFFEROBJECT_H
4220
4221=== modified file 'plugins/opengl/include/opengl/matrix.h'
4222--- plugins/opengl/include/opengl/matrix.h 2009-03-15 05:09:18 +0000
4223+++ plugins/opengl/include/opengl/matrix.h 2012-08-22 06:16:22 +0000
4224@@ -44,6 +44,8 @@
4225 void reset ();
4226 void toScreenSpace (const CompOutput *output, float z);
4227
4228+ bool invert ();
4229+
4230 void rotate (const float angle, const float x,
4231 const float y, const float z);
4232 void rotate (const float angle, const GLVector& vector);
4233
4234=== modified file 'plugins/opengl/include/opengl/opengl.h'
4235--- plugins/opengl/include/opengl/opengl.h 2012-01-20 09:05:56 +0000
4236+++ plugins/opengl/include/opengl/opengl.h 2012-08-22 06:16:22 +0000
4237@@ -28,16 +28,52 @@
4238 #ifndef _COMPIZ_OPENGL_H
4239 #define _COMPIZ_OPENGL_H
4240
4241+#ifdef USE_GLES
4242+#define SUPPORT_X11
4243+#include <GLES2/gl2.h>
4244+#include <GLES2/gl2ext.h>
4245+#include <EGL/egl.h>
4246+#include <EGL/eglext.h>
4247+#else
4248 #include <GL/gl.h>
4249 #include <GL/glx.h>
4250+#endif
4251+
4252+#include <core/size.h>
4253+#include <core/pluginclasshandler.h>
4254
4255 #include <opengl/matrix.h>
4256 #include <opengl/texture.h>
4257-#include <opengl/fragment.h>
4258-
4259-#define COMPIZ_OPENGL_ABI 4
4260-
4261-#include <core/pluginclasshandler.h>
4262+#include <opengl/framebufferobject.h>
4263+#include <opengl/vertexbuffer.h>
4264+#include <opengl/program.h>
4265+#include <opengl/programcache.h>
4266+#include <opengl/shadercache.h>
4267+
4268+#define COMPIZ_OPENGL_ABI 5
4269+
4270+/*
4271+ * Some plugins check for #ifdef USE_MODERN_COMPIZ_GL. Support it for now, but
4272+ * but the offending code should be changed to: #if COMPIZ_OPENGL_ABI >= 5
4273+ * Or the preprocessor checks should be removed altogether.
4274+ */
4275+#define USE_MODERN_COMPIZ_GL 1
4276+
4277+#if !defined(GL_BGRA)
4278+ #if !defined(GL_BGRA_EXT)
4279+ #error GL_BGRA support is required
4280+ #else
4281+ #define GL_BGRA GL_BGRA_EXT
4282+ #endif
4283+#endif
4284+
4285+#if !defined(GL_BGRA)
4286+ #if !defined(GL_BGRA_EXT)
4287+ #error GL_BGRA support is required
4288+ #else
4289+ #define GL_BGRA GL_BGRA_EXT
4290+ #endif
4291+#endif
4292
4293 /**
4294 * camera distance from screen, 0.5 * tan (FOV)
4295@@ -75,8 +111,26 @@
4296 #endif
4297
4298 namespace GL {
4299-
4300+ #ifdef USE_GLES
4301+ typedef EGLImageKHR (*EGLCreateImageKHRProc) (EGLDisplay dpy,
4302+ EGLContext ctx,
4303+ EGLenum target,
4304+ EGLClientBuffer buffer,
4305+ const EGLint *attrib_list);
4306+ typedef EGLBoolean (*EGLDestroyImageKHRProc) (EGLDisplay dpy,
4307+ EGLImageKHR image);
4308+
4309+ typedef void (*GLEGLImageTargetTexture2DOESProc) (GLenum target,
4310+ GLeglImageOES image);
4311+
4312+ typedef EGLBoolean (*EGLPostSubBufferNVProc) (EGLDisplay dpy,
4313+ EGLSurface surface,
4314+ EGLint x, EGLint y,
4315+ EGLint width, EGLint height);
4316+
4317+ #else
4318 typedef void (*FuncPtr) (void);
4319+
4320 typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName);
4321
4322 typedef void (*GLXBindTexImageProc) (Display *display,
4323@@ -122,11 +176,6 @@
4324 const int *attribList);
4325 typedef void (*GLXDestroyPixmapProc) (Display *display,
4326 GLXPixmap pixmap);
4327-
4328- typedef void (*GLActiveTextureProc) (GLenum texture);
4329- typedef void (*GLClientActiveTextureProc) (GLenum texture);
4330- typedef void (*GLMultiTexCoord2fProc) (GLenum, GLfloat, GLfloat);
4331-
4332 typedef void (*GLGenProgramsProc) (GLsizei n,
4333 GLuint *programs);
4334 typedef void (*GLDeleteProgramsProc) (GLsizei n,
4335@@ -146,11 +195,16 @@
4336 typedef void (*GLGetProgramivProc) (GLenum target,
4337 GLenum pname,
4338 int *params);
4339+ #endif
4340+
4341+ typedef void (*GLActiveTextureProc) (GLenum texture);
4342+ typedef void (*GLClientActiveTextureProc) (GLenum texture);
4343+ typedef void (*GLMultiTexCoord2fProc) (GLenum, GLfloat, GLfloat);
4344
4345 typedef void (*GLGenFramebuffersProc) (GLsizei n,
4346 GLuint *framebuffers);
4347 typedef void (*GLDeleteFramebuffersProc) (GLsizei n,
4348- GLuint *framebuffers);
4349+ const GLuint *framebuffers);
4350 typedef void (*GLBindFramebufferProc) (GLenum target,
4351 GLuint framebuffer);
4352 typedef GLenum (*GLCheckFramebufferStatusProc) (GLenum target);
4353@@ -161,6 +215,136 @@
4354 GLint level);
4355 typedef void (*GLGenerateMipmapProc) (GLenum target);
4356
4357+ typedef void (*GLBindBufferProc) (GLenum target,
4358+ GLuint buffer);
4359+ typedef void (*GLDeleteBuffersProc) (GLsizei n,
4360+ const GLuint *buffers);
4361+ typedef void (*GLGenBuffersProc) (GLsizei n,
4362+ GLuint *buffers);
4363+ typedef void (*GLBufferDataProc) (GLenum target,
4364+ GLsizeiptr size,
4365+ const GLvoid *data,
4366+ GLenum usage);
4367+ typedef void (*GLBufferSubDataProc) (GLenum target,
4368+ GLintptr offset,
4369+ GLsizeiptr size,
4370+ const GLvoid *data);
4371+
4372+ typedef void (*GLGetShaderivProc) (GLuint shader,
4373+ GLenum pname,
4374+ GLint *params);
4375+ typedef void (*GLGetShaderInfoLogProc) (GLuint shader,
4376+ GLsizei bufsize,
4377+ GLsizei *length,
4378+ GLchar *infoLog);
4379+ typedef void (*GLGetProgramivProc) (GLuint program,
4380+ GLenum pname,
4381+ GLint* params);
4382+ typedef void (*GLGetProgramInfoLogProc) (GLuint program,
4383+ GLsizei bufsize,
4384+ GLsizei *length,
4385+ GLchar *infoLog);
4386+ typedef GLuint (*GLCreateShaderProc) (GLenum type);
4387+ typedef void (*GLShaderSourceProc) (GLuint shader,
4388+ GLsizei count,
4389+ const GLchar **string,
4390+ const GLint* length);
4391+ typedef void (*GLCompileShaderProc) (GLuint shader);
4392+ typedef GLuint (*GLCreateProgramProc) ();
4393+ typedef void (*GLAttachShaderProc) (GLuint program,
4394+ GLuint shader);
4395+ typedef void (*GLLinkProgramProc) (GLuint program);
4396+ typedef void (*GLValidateProgramProc) (GLuint program);
4397+ typedef void (*GLDeleteShaderProc) (GLuint shader);
4398+ typedef void (*GLDeleteProgramProc) (GLuint program);
4399+ typedef void (*GLUseProgramProc) (GLuint program);
4400+ typedef int (*GLGetUniformLocationProc) (GLuint program,
4401+ const GLchar* name);
4402+ typedef void (*GLUniform1fProc) (GLint location, GLfloat x);
4403+ typedef void (*GLUniform1iProc) (GLint location, GLint x);
4404+ typedef void (*GLUniform2fProc) (GLint location, GLfloat x, GLfloat y);
4405+ typedef void (*GLUniform3fProc) (GLint location,
4406+ GLfloat x,
4407+ GLfloat y,
4408+ GLfloat z);
4409+ typedef void (*GLUniform4fProc) (GLint location,
4410+ GLfloat x,
4411+ GLfloat y,
4412+ GLfloat z,
4413+ GLfloat w);
4414+ typedef void (*GLUniform2iProc) (GLint location, GLint x, GLint y);
4415+ typedef void (*GLUniform3iProc) (GLint location,
4416+ GLint x,
4417+ GLint y,
4418+ GLint z);
4419+ typedef void (*GLUniform4iProc) (GLint location,
4420+ GLint x,
4421+ GLint y,
4422+ GLint z,
4423+ GLint w);
4424+ typedef void (*GLUniformMatrix4fvProc) (GLint location,
4425+ GLsizei count,
4426+ GLboolean transpose,
4427+ const GLfloat *value);
4428+ typedef int (*GLGetAttribLocationProc) (GLuint program,
4429+ const GLchar *name);
4430+
4431+ typedef void (*GLEnableVertexAttribArrayProc) (GLuint index);
4432+ typedef void (*GLDisableVertexAttribArrayProc) (GLuint index);
4433+ typedef void (*GLVertexAttribPointerProc) (GLuint index,
4434+ GLint size,
4435+ GLenum type,
4436+ GLboolean normalized,
4437+ GLsizei stride,
4438+ const GLvoid *ptr);
4439+
4440+ typedef void (*GLGenRenderbuffersProc) (GLsizei n,
4441+ GLuint *rb);
4442+ typedef void (*GLDeleteRenderbuffersProc) (GLsizei n,
4443+ const GLuint *rb);
4444+ typedef void (*GLBindRenderbufferProc) (GLenum target,
4445+ GLuint renderbuffer);
4446+ typedef void (*GLFramebufferRenderbufferProc) (GLenum target,
4447+ GLenum attachment,
4448+ GLenum renderbuffertarget,
4449+ GLuint renderbuffer);
4450+ typedef void (*GLRenderbufferStorageProc) (GLenum target,
4451+ GLenum internalformat,
4452+ GLsizei width,
4453+ GLsizei height);
4454+
4455+
4456+ /* GL_ARB_shader_objects */
4457+ #ifndef USE_GLES
4458+ typedef GLhandleARB (*GLCreateShaderObjectARBProc) (GLenum type);
4459+ typedef GLhandleARB (*GLCreateProgramObjectARBProc) ();
4460+ typedef void (*GLShaderSourceARBProc) (GLhandleARB shader,
4461+ GLsizei count,
4462+ const GLchar **string,
4463+ const GLint* length);
4464+ typedef void (*GLCompileShaderARBProc) (GLhandleARB shader);
4465+ typedef void (*GLValidateProgramARBProc) (GLhandleARB program);
4466+ typedef void (*GLDeleteObjectARBProc) (GLhandleARB object);
4467+ typedef void (*GLAttachObjectARBProc) (GLhandleARB program,
4468+ GLhandleARB shader);
4469+ typedef void (*GLLinkProgramARBProc) (GLhandleARB program);
4470+ typedef void (*GLUseProgramObjectARBProc) (GLhandleARB program);
4471+ typedef int (*GLGetUniformLocationARBProc) (GLhandleARB program,
4472+ const GLchar* name);
4473+ typedef int (*GLGetAttribLocationARBProc) (GLhandleARB program,
4474+ const GLchar *name);
4475+
4476+ typedef void (*GLGetObjectParameterivProc) (GLhandleARB object, GLenum type, int *param);
4477+ typedef void (*GLGetInfoLogProc) (GLhandleARB object, int maxLen, int *len, char *log);
4478+ #endif
4479+
4480+ #ifdef USE_GLES
4481+ extern EGLCreateImageKHRProc createImage;
4482+ extern EGLDestroyImageKHRProc destroyImage;
4483+
4484+ extern GLEGLImageTargetTexture2DOESProc eglImageTargetTexture;
4485+
4486+ #else
4487 extern GLXBindTexImageProc bindTexImage;
4488 extern GLXReleaseTexImageProc releaseTexImage;
4489 extern GLXQueryDrawableProc queryDrawable;
4490@@ -172,11 +356,6 @@
4491 extern GLXGetFBConfigAttribProc getFBConfigAttrib;
4492 extern GLXCreatePixmapProc createPixmap;
4493 extern GLXDestroyPixmapProc destroyPixmap;
4494-
4495- extern GLActiveTextureProc activeTexture;
4496- extern GLClientActiveTextureProc clientActiveTexture;
4497- extern GLMultiTexCoord2fProc multiTexCoord2f;
4498-
4499 extern GLGenProgramsProc genPrograms;
4500 extern GLDeleteProgramsProc deletePrograms;
4501 extern GLBindProgramProc bindProgram;
4502@@ -184,6 +363,11 @@
4503 extern GLProgramParameter4fProc programEnvParameter4f;
4504 extern GLProgramParameter4fProc programLocalParameter4f;
4505 extern GLGetProgramivProc getProgramiv;
4506+ #endif
4507+
4508+ extern GLActiveTextureProc activeTexture;
4509+ extern GLClientActiveTextureProc clientActiveTexture;
4510+ extern GLMultiTexCoord2fProc multiTexCoord2f;
4511
4512 extern GLGenFramebuffersProc genFramebuffers;
4513 extern GLDeleteFramebuffersProc deleteFramebuffers;
4514@@ -192,20 +376,177 @@
4515 extern GLFramebufferTexture2DProc framebufferTexture2D;
4516 extern GLGenerateMipmapProc generateMipmap;
4517
4518+ extern GLBindBufferProc bindBuffer;
4519+ extern GLDeleteBuffersProc deleteBuffers;
4520+ extern GLGenBuffersProc genBuffers;
4521+ extern GLBufferDataProc bufferData;
4522+ extern GLBufferSubDataProc bufferSubData;
4523+
4524+
4525+ extern GLGetShaderivProc getShaderiv;
4526+ extern GLGetShaderInfoLogProc getShaderInfoLog;
4527+ extern GLGetProgramivProc getProgramiv;
4528+ extern GLGetProgramInfoLogProc getProgramInfoLog;
4529+ extern GLCreateShaderProc createShader;
4530+ extern GLShaderSourceProc shaderSource;
4531+ extern GLCompileShaderProc compileShader;
4532+ extern GLCreateProgramProc createProgram;
4533+ extern GLAttachShaderProc attachShader;
4534+ extern GLLinkProgramProc linkProgram;
4535+ extern GLValidateProgramProc validateProgram;
4536+ extern GLDeleteShaderProc deleteShader;
4537+ extern GLDeleteProgramProc deleteProgram;
4538+ extern GLUseProgramProc useProgram;
4539+ extern GLGetUniformLocationProc getUniformLocation;
4540+ extern GLUniform1fProc uniform1f;
4541+ extern GLUniform1iProc uniform1i;
4542+ extern GLUniform2fProc uniform2f;
4543+ extern GLUniform2iProc uniform2i;
4544+ extern GLUniform3fProc uniform3f;
4545+ extern GLUniform3iProc uniform3i;
4546+ extern GLUniform4fProc uniform4f;
4547+ extern GLUniform4iProc uniform4i;
4548+ extern GLUniformMatrix4fvProc uniformMatrix4fv;
4549+ extern GLGetAttribLocationProc getAttribLocation;
4550+
4551+ extern GLEnableVertexAttribArrayProc enableVertexAttribArray;
4552+ extern GLDisableVertexAttribArrayProc disableVertexAttribArray;
4553+ extern GLVertexAttribPointerProc vertexAttribPointer;
4554+
4555+ extern GLGenRenderbuffersProc genRenderbuffers;
4556+ extern GLDeleteRenderbuffersProc deleteRenderbuffers;
4557+ extern GLBindRenderbufferProc bindRenderbuffer;
4558+ extern GLFramebufferRenderbufferProc framebufferRenderbuffer;
4559+ extern GLRenderbufferStorageProc renderbufferStorage;
4560+
4561+ #ifndef USE_GLES
4562+ extern GLCreateShaderObjectARBProc createShaderObjectARB;
4563+ extern GLCreateProgramObjectARBProc createProgramObjectARB;
4564+ extern GLShaderSourceARBProc shaderSourceARB;
4565+ extern GLCompileShaderARBProc compileShaderARB;
4566+ extern GLValidateProgramARBProc validateProgramARB;
4567+ extern GLDeleteObjectARBProc deleteObjectARB;
4568+ extern GLAttachObjectARBProc attachObjectARB;
4569+ extern GLLinkProgramARBProc linkProgramARB;
4570+ extern GLUseProgramObjectARBProc useProgramObjectARB;
4571+ extern GLGetUniformLocationARBProc getUniformLocationARB;
4572+ extern GLGetAttribLocationARBProc getAttribLocationARB;
4573+
4574+ extern GLGetObjectParameterivProc getObjectParameteriv;
4575+ extern GLGetInfoLogProc getInfoLog;
4576+ #endif
4577+
4578+#ifdef USE_GLES
4579+
4580+ static const GLenum FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING;
4581+ static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER;
4582+ static const GLenum RENDERBUFFER = GL_RENDERBUFFER;
4583+ static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0;
4584+ static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT;
4585+ static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT;
4586+ static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_OES;
4587+
4588+ /* OpenGL|ES does not support different draw/read framebuffers */
4589+ static const GLenum DRAW_FRAMEBUFFER = GL_FRAMEBUFFER;
4590+ static const GLenum READ_FRAMEBUFFER = GL_FRAMEBUFFER;
4591+
4592+ static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE;
4593+ static const GLenum FRAMEBUFFER_UNDEFINED = 0;
4594+ static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
4595+ static const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
4596+ static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0;
4597+ static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0;
4598+ static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED;
4599+ static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0;
4600+ static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0;
4601+ static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
4602+
4603+ static const GLenum ARRAY_BUFFER = GL_ARRAY_BUFFER;
4604+ static const GLenum STATIC_DRAW = GL_STATIC_DRAW;
4605+ static const GLenum STREAM_DRAW = GL_STREAM_DRAW;
4606+ static const GLenum DYNAMIC_DRAW = GL_DYNAMIC_DRAW;
4607+
4608+ static const GLenum INFO_LOG_LENGTH = GL_INFO_LOG_LENGTH;
4609+ static const GLenum COMPILE_STATUS = GL_COMPILE_STATUS;
4610+ static const GLenum LINK_STATUS = GL_LINK_STATUS;
4611+ static const GLenum FRAGMENT_SHADER = GL_FRAGMENT_SHADER;
4612+ static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER;
4613+
4614+#else
4615+
4616+ static const GLenum FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING_EXT;
4617+ static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER_EXT;
4618+ static const GLenum RENDERBUFFER = GL_RENDERBUFFER;
4619+ static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0_EXT;
4620+ static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT_EXT;
4621+ static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT_EXT;
4622+ static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_EXT;
4623+
4624+ static const GLenum DRAW_FRAMEBUFFER = GL_DRAW_FRAMEBUFFER_EXT;
4625+ static const GLenum READ_FRAMEBUFFER = GL_READ_FRAMEBUFFER_EXT;
4626+ static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE_EXT;
4627+ static const GLenum FRAMEBUFFER_UNDEFINED = GL_FRAMEBUFFER_UNDEFINED;
4628+ static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
4629+ static const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
4630+ static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT;
4631+ static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT;
4632+ static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
4633+ static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT;
4634+ static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT;
4635+ static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0;
4636+
4637+ static const GLenum ARRAY_BUFFER = GL_ARRAY_BUFFER_ARB;
4638+ static const GLenum STATIC_DRAW = GL_STATIC_DRAW_ARB;
4639+ static const GLenum STREAM_DRAW = GL_STREAM_DRAW_ARB;
4640+ static const GLenum DYNAMIC_DRAW = GL_DYNAMIC_DRAW_ARB;
4641+
4642+ static const GLenum INFO_LOG_LENGTH = GL_OBJECT_INFO_LOG_LENGTH_ARB;
4643+ static const GLenum COMPILE_STATUS = GL_OBJECT_COMPILE_STATUS_ARB;
4644+ static const GLenum LINK_STATUS = GL_OBJECT_LINK_STATUS_ARB;
4645+ static const GLenum FRAGMENT_SHADER = GL_FRAGMENT_SHADER_ARB;
4646+ static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER_ARB;
4647+
4648+#endif
4649+
4650 extern bool textureFromPixmap;
4651 extern bool textureRectangle;
4652 extern bool textureNonPowerOfTwo;
4653+ extern bool textureNonPowerOfTwoMipmap;
4654 extern bool textureEnvCombine;
4655 extern bool textureEnvCrossbar;
4656 extern bool textureBorderClamp;
4657 extern bool textureCompression;
4658 extern GLint maxTextureSize;
4659- extern bool fbo;
4660- extern bool fragmentProgram;
4661+ extern bool fboSupported;
4662+ extern bool fboStencilSupported;
4663+ extern bool fboEnabled;
4664+ extern bool vboSupported;
4665+ extern bool vboEnabled;
4666+ extern bool shaders;
4667+ extern bool stencilBuffer;
4668 extern GLint maxTextureUnits;
4669
4670 extern bool canDoSaturated;
4671 extern bool canDoSlightlySaturated;
4672+
4673+#ifndef USE_GLES
4674+ void getProgramInfoLogARBWrapper (GLuint object, int maxLen, int *len, char *log);
4675+ void getShaderInfoLogARBWrapper (GLuint object, int maxLen, int *len, char *log);
4676+ void getShaderivARBWrapper (GLuint object, GLenum type, int *param);
4677+ void getProgramivARBWrapper (GLuint object, GLenum type, int *param);
4678+ GLuint createShaderARBWrapper (GLenum type);
4679+ GLuint createProgramARBWrapper (GLenum type);
4680+ void shaderSourceARBWrapper (GLuint shader, GLsizei count, const GLchar **string, const GLint *length);
4681+ void compileShaderARBWrapper (GLuint shader);
4682+ void validateProgramARBWrapper (GLuint program);
4683+ void deleteShaderARBWrapper (GLuint shader);
4684+ void deleteProgramARBWrapper (GLuint program);
4685+ void attachShaderARBWrapper (GLuint program, GLuint shader);
4686+ void linkProgramARBWrapper (GLuint program);
4687+ void useProgramARBWrapper (GLuint program);
4688+ int getUniformLocationARBWrapper (GLuint program, const GLchar *name);
4689+ int getAttribLocationARBWrapper (GLuint program, const GLchar *name);
4690+#endif
4691 };
4692
4693 struct GLScreenPaintAttrib {
4694@@ -220,6 +561,7 @@
4695
4696 #define MAX_DEPTH 32
4697
4698+#ifndef USE_GLES
4699 struct GLFBConfig {
4700 GLXFBConfig fbConfig;
4701 int yInverted;
4702@@ -227,6 +569,7 @@
4703 int textureFormat;
4704 int textureTargets;
4705 };
4706+#endif
4707
4708 #define NOTHING_TRANS_FILTER 0
4709 #define SCREEN_TRANS_FILTER 1
4710@@ -236,6 +579,7 @@
4711 extern GLScreenPaintAttrib defaultScreenPaintAttrib;
4712
4713 class GLScreen;
4714+class GLFramebufferObject;
4715
4716 class GLScreenInterface :
4717 public WrapableInterface<GLScreen, GLScreenInterface>
4718@@ -302,11 +646,32 @@
4719 CompOutput *);
4720 virtual void glDisableOutputClipping ();
4721
4722+ virtual GLMatrix *projectionMatrix ();
4723+
4724+ /**
4725+ * Hookable function used by plugins to shade the final composited
4726+ * Output.
4727+ *
4728+ * @param tmpRegion Describes the final composited output region
4729+ * @param scratchFbo Describes the final composited FBO that is
4730+ * to be rendered.
4731+ */
4732+ virtual void glPaintCompositedOutput (const CompRegion &region,
4733+ GLFramebufferObject *fbo,
4734+ unsigned int mask);
4735+
4736+ /**
4737+ * Hookable function used by plugins to determine stenciling mask
4738+ */
4739+ virtual void glBufferStencil (const GLMatrix &matrix,
4740+ GLVertexBuffer &vertexBuffer,
4741+ CompOutput *output);
4742+
4743 };
4744
4745
4746 class GLScreen :
4747- public WrapableHandler<GLScreenInterface, 6>,
4748+ public WrapableHandler<GLScreenInterface, 8>,
4749 public PluginClassHandler<GLScreen, CompScreen, COMPIZ_OPENGL_ABI>,
4750 public CompOption::Class
4751 {
4752@@ -332,7 +697,9 @@
4753 /**
4754 * Gets the libGL address of a particular openGL functor
4755 */
4756+ #ifndef USE_GLES
4757 GL::FuncPtr getProcAddress (const char *name);
4758+ #endif
4759
4760 void updateBackground ();
4761
4762@@ -346,8 +713,6 @@
4763 */
4764 void setFilter (int, GLTexture::Filter);
4765
4766- GLFragment::Storage * fragmentStorage ();
4767-
4768 /**
4769 * Sets a new compiz-wid openGL texture environment mode
4770 */
4771@@ -356,7 +721,6 @@
4772 /**
4773 * Turns lighting on and off
4774 */
4775-
4776 void setLighting (bool lighting);
4777
4778 /**
4779@@ -371,7 +735,28 @@
4780 GLTexture::BindPixmapHandle registerBindPixmap (GLTexture::BindPixmapProc);
4781 void unregisterBindPixmap (GLTexture::BindPixmapHandle);
4782
4783+ #ifndef USE_GLES
4784 GLFBConfig * glxPixmapFBConfig (unsigned int depth);
4785+ #endif
4786+
4787+ #ifdef USE_GLES
4788+ EGLContext getEGLContext ();
4789+ #endif
4790+
4791+ /**
4792+ * Returns a GLProgram from the cache or creates one and caches it
4793+ */
4794+ GLProgram *getProgram (std::list<const GLShaderData*>);
4795+
4796+ /**
4797+ * Returns a GLShaderData from the cache or creates one and caches it
4798+ */
4799+ const GLShaderData *getShaderData (GLShaderParameters &params);
4800+
4801+ /**
4802+ * Returns the FBO compiz is using for the screen
4803+ */
4804+ GLFramebufferObject *fbo ();
4805
4806 /**
4807 * Returns a default icon texture
4808@@ -380,12 +765,6 @@
4809
4810 void resetRasterPos ();
4811
4812- /**
4813- * Returns a 4x4 const float array which
4814- * represents the current projection matrix
4815- */
4816- const float * projectionMatrix ();
4817-
4818 bool glInitContext (XVisualInfo *);
4819
4820 WRAPABLE_HND (0, GLScreenInterface, bool, glPaintOutput,
4821@@ -402,7 +781,16 @@
4822 const GLMatrix &, const CompRegion &, CompOutput *);
4823 WRAPABLE_HND (4, GLScreenInterface, void, glDisableOutputClipping);
4824
4825+ WRAPABLE_HND (5, GLScreenInterface, GLMatrix *, projectionMatrix);
4826+ WRAPABLE_HND (6, GLScreenInterface, void, glPaintCompositedOutput,
4827+ const CompRegion &, GLFramebufferObject *, unsigned int);
4828+
4829+ WRAPABLE_HND (7, GLScreenInterface, void, glBufferStencil, const GLMatrix &,
4830+ GLVertexBuffer &,
4831+ CompOutput *);
4832+
4833 friend class GLTexture;
4834+ friend class GLWindow;
4835
4836 private:
4837 PrivateGLScreen *priv;
4838@@ -454,7 +842,7 @@
4839 * @param mask Bitmask which describes how this window is drawn
4840 */
4841 virtual bool glDraw (const GLMatrix &matrix,
4842- GLFragment::Attrib &attrib,
4843+ const GLWindowPaintAttrib &attrib,
4844 const CompRegion &region,
4845 unsigned int mask);
4846
4847@@ -479,51 +867,18 @@
4848 const CompRegion &clipRegion,
4849 unsigned int min = MAXSHORT,
4850 unsigned int max = MAXSHORT);
4851- virtual void glDrawTexture (GLTexture *texture, GLFragment::Attrib &,
4852- unsigned int);
4853- virtual void glDrawGeometry ();
4854+ virtual void glDrawTexture (GLTexture *texture, const GLMatrix &,
4855+ const GLWindowPaintAttrib &, unsigned int);
4856 };
4857
4858 class GLWindow :
4859- public WrapableHandler<GLWindowInterface, 5>,
4860+ public WrapableHandler<GLWindowInterface, 4>,
4861 public PluginClassHandler<GLWindow, CompWindow, COMPIZ_OPENGL_ABI>
4862 {
4863 public:
4864
4865- /**
4866- * Class which describes the texture geometry and transformation points
4867- * of a window
4868- */
4869- class Geometry {
4870- public:
4871- Geometry ();
4872- ~Geometry ();
4873-
4874- void reset ();
4875-
4876- /**
4877- * Set the number of vertices in the texture geometry
4878- */
4879- bool moreVertices (int newSize);
4880-
4881- /**
4882- * Set the number of indices in the texture geometry
4883- */
4884- bool moreIndices (int newSize);
4885-
4886- public:
4887- GLfloat *vertices;
4888- int vertexSize;
4889- int vertexStride;
4890- GLushort *indices;
4891- int indexSize;
4892- int vCount;
4893- int texUnits;
4894- int texCoordSize;
4895- int indexCount;
4896- };
4897-
4898 static GLWindowPaintAttrib defaultPaintAttrib;
4899+
4900 public:
4901
4902 GLWindow (CompWindow *w);
4903@@ -566,9 +921,20 @@
4904 void updatePaintAttribs ();
4905
4906 /**
4907- * Returns the window texture geometry
4908- */
4909- Geometry & geometry ();
4910+ * Returns the window vertex buffer object
4911+ */
4912+ GLVertexBuffer * vertexBuffer ();
4913+
4914+ /**
4915+ * Add a vertex and/or fragment shader function to the pipeline.
4916+ *
4917+ * @param name Name of the plugin adding the functions
4918+ * @param vertex_shader Function to add to the vertex shader
4919+ * @param fragment_shader Function to add to the fragment shader
4920+ */
4921+ void addShaders (std::string name,
4922+ std::string vertex_shader,
4923+ std::string fragment_shader);
4924
4925 GLTexture *getIcon (int width, int height);
4926
4927@@ -576,14 +942,15 @@
4928 const GLWindowPaintAttrib &, const GLMatrix &,
4929 const CompRegion &, unsigned int);
4930 WRAPABLE_HND (1, GLWindowInterface, bool, glDraw, const GLMatrix &,
4931- GLFragment::Attrib &, const CompRegion &, unsigned int);
4932+ const GLWindowPaintAttrib &, const CompRegion &,
4933+ unsigned int);
4934 WRAPABLE_HND (2, GLWindowInterface, void, glAddGeometry,
4935 const GLTexture::MatrixList &, const CompRegion &,
4936 const CompRegion &,
4937 unsigned int = MAXSHORT, unsigned int = MAXSHORT);
4938 WRAPABLE_HND (3, GLWindowInterface, void, glDrawTexture,
4939- GLTexture *texture, GLFragment::Attrib &, unsigned int);
4940- WRAPABLE_HND (4, GLWindowInterface, void, glDrawGeometry);
4941+ GLTexture *texture, const GLMatrix &,
4942+ const GLWindowPaintAttrib &, unsigned int);
4943
4944 friend class GLScreen;
4945 friend class PrivateGLScreen;
4946@@ -593,3 +960,4 @@
4947 };
4948
4949 #endif
4950+
4951
4952=== added file 'plugins/opengl/include/opengl/program.h'
4953--- plugins/opengl/include/opengl/program.h 1970-01-01 00:00:00 +0000
4954+++ plugins/opengl/include/opengl/program.h 2012-08-22 06:16:22 +0000
4955@@ -0,0 +1,75 @@
4956+/*
4957+ * Copyright © 2011 Linaro Ltd.
4958+ *
4959+ * Permission to use, copy, modify, distribute, and sell this software
4960+ * and its documentation for any purpose is hereby granted without
4961+ * fee, provided that the above copyright notice appear in all copies
4962+ * and that both that copyright notice and this permission notice
4963+ * appear in supporting documentation, and that the name of
4964+ * Linaro Ltd. not be used in advertising or publicity pertaining to
4965+ * distribution of the software without specific, written prior permission.
4966+ * Linaro Ltd. makes no representations about the suitability of this
4967+ * software for any purpose. It is provided "as is" without express or
4968+ * implied warranty.
4969+ *
4970+ * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
4971+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
4972+ * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
4973+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
4974+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
4975+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
4976+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4977+ *
4978+ * Authors: Travis Watkins <travis.watkins@linaro.org>
4979+ */
4980+
4981+#ifndef _COMPIZ_GLPROGRAM_H
4982+#define _COMPIZ_GLPROGRAM_H
4983+
4984+#ifdef USE_GLES
4985+#include <GLES2/gl2.h>
4986+#else
4987+#include <GL/gl.h>
4988+#endif
4989+
4990+#include <core/core.h>
4991+#include <opengl/matrix.h>
4992+
4993+class PrivateProgram;
4994+
4995+class GLProgram
4996+{
4997+ public:
4998+ GLProgram (CompString &vertexShader, CompString &fragmentShader);
4999+ ~GLProgram ();
5000+
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches