1
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/cmake/base.cmake linaro-gles2-debianpatches/cmake/base.cmake
2
--- compiz-0.9.7.8/cmake/base.cmake 2012-04-26 08:47:01.000000000 +0200
3
+++ linaro-gles2-debianpatches/cmake/base.cmake 2012-04-20 11:41:59.241600000 +0200
5
compiz_print_configure_header ("Compiz")
6
compiz_color_message ("\n${_escape}[4mOptional features:${_escape}[0m\n")
8
+ compiz_print_result_message ("GLESv2" USE_GLES)
9
compiz_print_result_message ("gtk window decorator" USE_GTK)
10
compiz_print_result_message ("metacity theme support" USE_METACITY)
11
compiz_print_result_message ("gconf schemas" USE_GCONF)
14
add_custom_target (findcompiz_install
15
${CMAKE_COMMAND} -E make_directory ${COMPIZ_DESTDIR}${CMAKE_ROOT}/Modules &&
16
- ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindCompiz.cmake ${COMPIZ_DESTDIR}${CMAKE_ROOT}/Modules
17
+ ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindCompiz.cmake ${COMPIZ_DESTDIR}${CMAKE_ROOT}/Modules &&
18
+ ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindOpenGLES2.cmake ${COMPIZ_DESTDIR}${CMAKE_ROOT}/Modules
22
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/cmake/CMakeLists.txt linaro-gles2-debianpatches/cmake/CMakeLists.txt
23
--- compiz-0.9.7.8/cmake/CMakeLists.txt 2012-04-26 08:47:01.000000000 +0200
24
+++ linaro-gles2-debianpatches/cmake/CMakeLists.txt 2012-04-20 11:41:59.241600000 +0200
26
plugin_extensions/CompizGenInstallData.cmake)
27
list (APPEND _PluginExtensionFiles
28
plugin_extensions/CompizGenInstallImages.cmake)
29
+list (APPEND _PluginExtensionFiles
30
+ plugin_extensions/CompizOpenGLFixups.cmake)
33
list (APPEND _files CompizGconf.cmake)
34
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/cmake/CompizCommon.cmake linaro-gles2-debianpatches/cmake/CompizCommon.cmake
35
--- compiz-0.9.7.8/cmake/CompizCommon.cmake 2012-04-26 08:47:01.000000000 +0200
36
+++ linaro-gles2-debianpatches/cmake/CompizCommon.cmake 2012-04-20 11:41:59.241600000 +0200
39
set (CMAKE_SKIP_RPATH FALSE)
41
+option (BUILD_GLES "Build against GLESv2 instead of GL" OFF)
42
option (COMPIZ_BUILD_WITH_RPATH "Leave as ON unless building packages" ON)
43
option (COMPIZ_RUN_LDCONFIG "Leave OFF unless you need to run ldconfig after install")
44
option (COMPIZ_PACKAGING_ENABLED "Enable to manually set prefix, exec_prefix, libdir, includedir, datadir" OFF)
47
endif (IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.bzr)
49
+set (USE_GLES ${BUILD_GLES})
52
+ find_package(OpenGLES2)
54
+ if (NOT OPENGLES2_FOUND)
56
+ message (SEND_ERROR "OpenGLESv2 not found")
57
+ endif (NOT OPENGLES2_FOUND)
60
function (compiz_ensure_linkage)
61
find_program (LDCONFIG_EXECUTABLE ldconfig)
62
mark_as_advanced (FORCE LDCONFIG_EXECUTABLE)
63
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/cmake/CompizPlugin.cmake linaro-gles2-debianpatches/cmake/CompizPlugin.cmake
64
--- compiz-0.9.7.8/cmake/CompizPlugin.cmake 2012-04-26 08:47:01.000000000 +0200
65
+++ linaro-gles2-debianpatches/cmake/CompizPlugin.cmake 2012-04-20 11:41:59.241600000 +0200
70
+ set (COMPIZ_CURRENT_PLUGIN ${plugin})
71
+ set (COMPIZ_CURRENT_XML_FILE ${_translated_xml})
73
+ # find extension files
74
+ file (GLOB _extension_files "${COMPIZ_CMAKE_MODULE_PATH}/plugin_extensions/*.cmake")
76
+ foreach (_file ${_extension_files})
80
# generate pkgconfig file and install it and the plugin header file
81
if (_${plugin}_pkg AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin})
82
if ("${PLUGIN_BUILDTYPE}" STREQUAL "local")
84
set (VERSION 0.0.1-git)
87
+ #add CFLAGSADD so pkg-config file has correct flags
88
+ set (COMPIZ_CFLAGS ${COMPIZ_CFLAGS} ${${_PLUGIN}_CFLAGSADD})
90
compiz_configure_file (
92
${CMAKE_BINARY_DIR}/generated/compiz-${plugin}.pc
103
- set (COMPIZ_CURRENT_PLUGIN ${plugin})
104
- set (COMPIZ_CURRENT_XML_FILE ${_translated_xml})
106
- # find extension files
107
- file (GLOB _extension_files "${COMPIZ_CMAKE_MODULE_PATH}/plugin_extensions/*.cmake")
109
- foreach (_file ${_extension_files})
113
# find files for build
114
file (GLOB _h_files "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h")
115
file (GLOB _h_ins_files "${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}/*.h")
116
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/cmake/FindOpenGLES2.cmake linaro-gles2-debianpatches/cmake/FindOpenGLES2.cmake
117
--- compiz-0.9.7.8/cmake/FindOpenGLES2.cmake 1970-01-01 01:00:00.000000000 +0100
118
+++ linaro-gles2-debianpatches/cmake/FindOpenGLES2.cmake 2012-04-20 11:41:59.241600000 +0200
120
+# - Try to find OpenGLES
121
+# Once done this will define
123
+# OPENGLES2_FOUND - system has OpenGLES
124
+# OPENGLES2_INCLUDE_DIR - the GLES include directory
125
+# OPENGLES2_LIBRARY - the GLES library
126
+# OPENGLES2_LIBRARIES - Link this to use OpenGLES
129
+FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
130
+ /usr/openwin/share/include
131
+ /opt/graphics/OpenGL/include /usr/X11R6/include
135
+FIND_LIBRARY(OPENGLES2_LIBRARY
137
+ PATHS /opt/graphics/OpenGL/lib
139
+ /usr/shlib /usr/X11R6/lib
143
+FIND_LIBRARY(OPENGLES2_EGL_LIBRARY
145
+ PATHS /usr/shlib /usr/X11R6/lib
149
+# On Unix OpenGL most certainly always requires X11.
150
+# Feel free to tighten up these conditions if you don't
151
+# think this is always true.
152
+# It's not true on OSX.
154
+IF (OPENGLES2_LIBRARY)
157
+ ENDIF(NOT X11_FOUND)
160
+ SET (OPENGLES2_LIBRARIES ${X11_LIBRARIES})
163
+ENDIF(OPENGLES2_LIBRARY)
165
+SET( OPENGLES2_FOUND "NO" )
166
+IF(OPENGLES2_LIBRARY AND OPENGLES2_EGL_LIBRARY)
167
+ SET( OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY} ${OPENGLES2_EGL_LIBRARY} ${OPENGLES2_LIBRARIES})
168
+ SET( OPENGLES2_FOUND "YES" )
169
+ENDIF(OPENGLES2_LIBRARY AND OPENGLES2_EGL_LIBRARY)
171
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/cmake/plugin_extensions/CompizOpenGLFixups.cmake linaro-gles2-debianpatches/cmake/plugin_extensions/CompizOpenGLFixups.cmake
172
--- compiz-0.9.7.8/cmake/plugin_extensions/CompizOpenGLFixups.cmake 1970-01-01 01:00:00.000000000 +0100
173
+++ linaro-gles2-debianpatches/cmake/plugin_extensions/CompizOpenGLFixups.cmake 2012-04-20 11:41:59.241600000 +0200
176
+# modify pkg-config libs for opengl based on if we found GLES or not
177
+if (${COMPIZ_CURRENT_PLUGIN} STREQUAL "opengl")
179
+ set (PKGCONFIG_LIBS "-lGLESv2 -lEGL")
181
+ set (PKGCONFIG_LIBS "-lGL")
183
+endif (${COMPIZ_CURRENT_PLUGIN} STREQUAL "opengl")
185
+# if plugin is using opengl plugin check for GLES library and set correct define
186
+if (NOT "${${_PLUGIN}_PLUGINDEPS}" STREQUAL "")
187
+ string (REGEX MATCH "opengl" opengl_found ${${_PLUGIN}_PLUGINDEPS})
189
+ if (opengl_found STREQUAL "opengl")
191
+ set (${_PLUGIN}_CFLAGSADD ${${_PLUGIN}_CFLAGSADD} " -DUSE_GLES")
192
+ string (REPLACE ";" " " ${_PLUGIN}_CFLAGSADD ${${_PLUGIN}_CFLAGSADD})
194
+ endif (opengl_found STREQUAL "opengl")
195
+endif (NOT "${${_PLUGIN}_PLUGINDEPS}" STREQUAL "")
197
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/CMakeLists.txt linaro-gles2-debianpatches/CMakeLists.txt
198
--- compiz-0.9.7.8/CMakeLists.txt 2012-04-26 08:47:01.000000000 +0200
199
+++ linaro-gles2-debianpatches/CMakeLists.txt 2012-04-20 11:41:59.241600000 +0200
201
DESTINATION ${COMPIZ_DESTDIR}${libdir}/pkgconfig
204
+# temporarily disable plugins that aren't ported yed
205
+set (COMPIZ_DISABLE_PLUGIN_BLUR ON)
206
+set (COMPIZ_DISABLE_PLUGIN_CUBE ON)
207
+set (COMPIZ_DISABLE_PLUGIN_ROTATE ON)
208
+set (COMPIZ_DISABLE_PLUGIN_WOBBLY ON)
210
# Build Google Test and make its headers known
215
_check_compiz_cmake_macro (${CMAKE_MODULE_PATH_ORIG})
217
+# temporarily disable plugins that aren't ported yed
218
+SET(COMPIZ_DISABLE_PLUGIN_BLUR "ON")
219
+SET(COMPIZ_DISABLE_PLUGIN_CUBE "ON")
220
+SET(COMPIZ_DISABLE_PLUGIN_ROTATE "ON")
221
+SET(COMPIZ_DISABLE_PLUGIN_WATER "ON")
222
+SET(COMPIZ_DISABLE_PLUGIN_WOBBLY "ON")
223
# Enable coverage reporting for compiz
224
enable_coverage_report()
226
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/NEWS linaro-gles2-debianpatches/NEWS
227
--- compiz-0.9.7.8/NEWS 2012-04-26 08:47:01.000000000 +0200
228
+++ linaro-gles2-debianpatches/NEWS 2012-04-26 12:34:44.027302000 +0200
230
976467 - [regression] Compiz 0.9.7.6: Menus often have no shadows at all
231
978900 - Menu shadow clipping flickers while switching menubar
233
- 979252 - Shadow Clipping / Regressions compiz 0.9.7.7 (built an hour ago)
234
980026 - Compiz should not move windows to workspace 0,0 when restarted
235
981703 - regression / unable to interact with window-titlebar (window
236
decoration) after minimizing/unminimizing gnome-terminal
239
Bugs fixed (https://launchpad.net/compiz-core/+milestone/0.9.7.6)
241
+ 659816 - Drop-down menus look disembodied from their titles
242
968985 - Memory leak in dlloaderListPlugins
243
969102 - priv->invisible is not updated when the window is mapped
244
919139 - window management, multi-monitor - In multi-monitor
245
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/annotate/src/annotate.cpp linaro-gles2-debianpatches/plugins/annotate/src/annotate.cpp
246
--- compiz-0.9.7.8/plugins/annotate/src/annotate.cpp 2012-04-26 08:47:01.000000000 +0200
247
+++ linaro-gles2-debianpatches/plugins/annotate/src/annotate.cpp 2012-04-20 11:41:59.241600000 +0200
248
@@ -629,11 +629,14 @@
252
+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
253
+ GLfloat vertexData[18];
254
+ GLfloat textureData[12];
256
GLMatrix sTransform = transform;
259
- float vectorX, vectorY, offset;
263
offset = optionGetStrokeWidth () / 2;
265
/* This replaced prepareXCoords (s, output, -DEFAULT_Z_CAMERA) */
266
sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
269
- glLoadMatrixf (sTransform.getMatrix ());
271
- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
272
- glEnable (GL_BLEND);
274
if (content && !region.isEmpty ())
276
foreach (GLTexture *tex, texture)
277
@@ -656,34 +653,66 @@
279
tex->enable (GLTexture::Fast);
281
- glBegin (GL_QUADS);
282
+ streamingBuffer->begin (GL_TRIANGLES);
287
- COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x1 ()),
288
- COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y2 ()));
289
- glVertex2i (rect.at (pos).x1 (), rect.at (pos).y2 ());
292
- COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x2 ()),
293
- COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y2 ()));
294
- glVertex2i (rect.at (pos).x2 (), rect.at (pos).y2 ());
297
- COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x2 ()),
298
- COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y1 ()));
299
- glVertex2i (rect.at (pos).x2 (), rect.at (pos).y1 ());
302
- COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x1 ()),
303
- COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y1 ()));
304
- glVertex2i (rect.at (pos).x1 (), rect.at (pos).y1 ());
305
+ GLfloat tx1 = COMP_TEX_COORD_X (tex->matrix (),
306
+ rect.at (pos).x1 ());
307
+ GLfloat tx2 = COMP_TEX_COORD_X (tex->matrix (),
308
+ rect.at (pos).x2 ());
309
+ GLfloat ty1 = COMP_TEX_COORD_Y (tex->matrix (),
310
+ rect.at (pos).y1 ());
311
+ GLfloat ty2 = COMP_TEX_COORD_Y (tex->matrix (),
312
+ rect.at (pos).y2 ());
314
+ vertexData[0] = rect.at (pos).x1 ();
315
+ vertexData[1] = rect.at (pos).y1 ();
316
+ vertexData[2] = 0.0f;
317
+ vertexData[3] = rect.at (pos).x1 ();
318
+ vertexData[4] = rect.at (pos).y2 ();
319
+ vertexData[5] = 0.0f;
320
+ vertexData[6] = rect.at (pos).x2 ();
321
+ vertexData[7] = rect.at (pos).y1 ();
322
+ vertexData[8] = 0.0f;
323
+ vertexData[9] = rect.at (pos).x1 ();
324
+ vertexData[10] = rect.at (pos).y2 ();
325
+ vertexData[11] = 0.0f;
327
+ vertexData[12] = rect.at (pos).x2 ();
328
+ vertexData[13] = rect.at (pos).y2 ();
329
+ vertexData[14] = 0.0f;
331
+ vertexData[15] = rect.at (pos).x2 ();
332
+ vertexData[16] = rect.at (pos).y1 ();
333
+ vertexData[17] = 0.0f;
335
+ textureData[0] = tx1;
336
+ textureData[1] = ty1;
338
+ textureData[2] = tx1;
339
+ textureData[3] = ty2;
341
+ textureData[4] = tx2;
342
+ textureData[5] = ty1;
344
+ textureData[6] = tx1;
345
+ textureData[7] = ty2;
347
+ textureData[8] = tx2;
348
+ textureData[9] = ty2;
350
+ textureData[10] = tx2;
351
+ textureData[11] = ty1;
353
+ streamingBuffer->addVertices (6, vertexData);
354
+ streamingBuffer->addTexCoords (0, 6, textureData);
359
+ streamingBuffer->end ();
360
+ streamingBuffer->render (sTransform);
365
@@ -691,85 +720,130 @@
369
- glColor4usv (optionGetStrokeColor ());
370
glLineWidth (optionGetStrokeWidth ());
371
- glBegin (GL_LINES);
372
- glVertex2i (initialPointerX, initialPointerY);
373
- glVertex2i (lineVector.x (), lineVector.y ());
376
+ streamingBuffer->begin (GL_LINES);
378
+ streamingBuffer->addColors (1, optionGetStrokeColor ());
380
+ vertexData[0] = initialPointerX;
381
+ vertexData[1] = initialPointerY;
382
+ vertexData[2] = 0.0f;
383
+ vertexData[3] = lineVector.x ();
384
+ vertexData[4] = lineVector.y ();
385
+ vertexData[5] = 0.0f;
386
+ streamingBuffer->addVertices (2, vertexData);
388
+ streamingBuffer->end ();
389
+ streamingBuffer->render (sTransform);
393
+ vertexData[0] = rectangle.x1 ();
394
+ vertexData[1] = rectangle.y1 ();
395
+ vertexData[2] = 0.0f;
396
+ vertexData[3] = rectangle.x1 ();
397
+ vertexData[4] = rectangle.y2 ();
398
+ vertexData[5] = 0.0f;
399
+ vertexData[6] = rectangle.x2 ();
400
+ vertexData[7] = rectangle.y1 ();
401
+ vertexData[8] = 0.0f;
402
+ vertexData[9] = rectangle.x2 ();
403
+ vertexData[10] = rectangle.y2 ();
404
+ vertexData[11] = 0.0f;
407
- glColor4usv (optionGetFillColor ());
408
- glRecti (rectangle.x1 (), rectangle.y2 (),
409
- rectangle.x2 (), rectangle.y1 ());
410
+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
412
+ streamingBuffer->addColors (1, optionGetFillColor ());
413
+ streamingBuffer->addVertices (4, vertexData);
415
+ streamingBuffer->end ();
416
+ streamingBuffer->render (sTransform);
418
/* draw rectangle outline */
419
- glColor4usv (optionGetStrokeColor ());
420
- glRecti (rectangle.x1 () - offset, rectangle.y2 (),
421
- rectangle.x1 () + offset, rectangle.y1 ());
422
+/* streamingBuffer->begin ();
424
+ streamingBuffer->addColors (1, optionGetStrokeColor ());
426
+ vertexData[0] = rectangle.x1 () - offset;
427
+ vertexData[3] = rectangle.x1 () - offset;
428
+ streamingBuffer->addVertices (4, vertexData);
430
glRecti (rectangle.x2 () - offset, rectangle.y2 (),
431
rectangle.x2 () + offset, rectangle.y1 ());
432
glRecti (rectangle.x1 () - offset, rectangle.y1 () + offset,
433
rectangle.x2 () + offset, rectangle.y1 () - offset);
434
glRecti (rectangle.x1 () - offset, rectangle.y2 () + offset,
435
- rectangle.x2 () + offset, rectangle.y2 () - offset);
436
+ rectangle.x2 () + offset, rectangle.y2 () - offset);*/
441
- glColor4usv (optionGetFillColor ());
442
+ streamingBuffer->begin (GL_TRIANGLE_FAN);
444
+ streamingBuffer->addColors (1, optionGetFillColor ());
446
+ vertexData[0] = ellipse.center.x ();
447
+ vertexData[1] = ellipse.center.y ();
448
+ vertexData[2] = 0.0f;
449
+ streamingBuffer->addVertices (1, vertexData);
451
- glBegin (GL_TRIANGLE_FAN);
452
- glVertex2d (ellipse.center.x (), ellipse.center.y ());
453
for (angle = 0; angle <= 360; angle += 1)
455
- vectorX = ellipse.center.x () +
456
- (ellipse.radiusX * sinf (angle * DEG2RAD));
457
- vectorY = ellipse.center.y () +
458
- (ellipse.radiusY * cosf (angle * DEG2RAD));
459
- glVertex2d (vectorX, vectorY);
460
+ vertexData[0] = ellipse.center.x () +
461
+ (ellipse.radiusX * sinf (angle * DEG2RAD));
462
+ vertexData[1] = ellipse.center.y () +
463
+ (ellipse.radiusY * cosf (angle * DEG2RAD));
464
+ streamingBuffer->addVertices (1, vertexData);
466
- glVertex2d (ellipse.center.x (), ellipse.center.y () +
470
+ vertexData[0] = ellipse.center.x ();
471
+ vertexData[1] = ellipse.center.y () + ellipse.radiusY;
472
+ streamingBuffer->addVertices (1, vertexData);
474
+ streamingBuffer->end ();
475
+ streamingBuffer->render (sTransform);
477
/* draw ellipse outline */
478
- glColor4usv (optionGetStrokeColor ());
479
glLineWidth (optionGetStrokeWidth ());
481
- glBegin (GL_TRIANGLE_STRIP);
482
- glVertex2d (ellipse.center.x (), ellipse.center.y () +
483
- ellipse.radiusY - offset);
484
+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
486
+ streamingBuffer->addColors (1, optionGetStrokeColor ());
489
+ vertexData[0] = ellipse.center.x ();
490
+ vertexData[1] = ellipse.center.y () + ellipse.radiusY - offset;
491
+ vertexData[2] = 0.0f;
492
+ streamingBuffer->addVertices (1, vertexData);
494
for (angle = 360; angle >= 0; angle -= 1)
496
- vectorX = ellipse.center.x () + ((ellipse.radiusX -
497
- offset) * sinf (angle * DEG2RAD));
498
- vectorY = ellipse.center.y () + ((ellipse.radiusY -
499
- offset) * cosf (angle * DEG2RAD));
500
- glVertex2d (vectorX, vectorY);
501
- vectorX = ellipse.center.x () + ((ellipse.radiusX +
502
- offset) * sinf (angle * DEG2RAD));
503
- vectorY = ellipse.center.y () + ((ellipse.radiusY +
504
- offset) * cosf (angle * DEG2RAD));
505
- glVertex2d (vectorX, vectorY);
506
+ vertexData[0] = ellipse.center.x () + ((ellipse.radiusX -
507
+ offset) * sinf (angle * DEG2RAD));
508
+ vertexData[1] = ellipse.center.y () + ((ellipse.radiusY -
509
+ offset) * cosf (angle * DEG2RAD));
510
+ vertexData[2] = 0.0f;
511
+ vertexData[3] = ellipse.center.x () + ((ellipse.radiusX +
512
+ offset) * sinf (angle * DEG2RAD));
513
+ vertexData[4] = ellipse.center.y () + ((ellipse.radiusY +
514
+ offset) * cosf (angle * DEG2RAD));
515
+ vertexData[5] = 0.0f;
516
+ streamingBuffer->addVertices (2, vertexData);
518
- glVertex2d (ellipse.center.x (), ellipse.center.y () +
519
- ellipse.radiusY + offset);
522
+ vertexData[0] = ellipse.center.x ();
523
+ vertexData[1] = ellipse.center.y () + ellipse.radiusY + offset;
524
+ streamingBuffer->addVertices (1, vertexData);
526
+ streamingBuffer->end ();
527
+ streamingBuffer->render (sTransform);
535
- glColor4usv (defaultColor);
536
- glDisable (GL_BLEND);
537
- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
543
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/blur/CMakeLists.txt linaro-gles2-debianpatches/plugins/blur/CMakeLists.txt
544
--- compiz-0.9.7.8/plugins/blur/CMakeLists.txt 2012-04-26 08:47:01.000000000 +0200
545
+++ linaro-gles2-debianpatches/plugins/blur/CMakeLists.txt 2012-04-20 11:41:59.241600000 +0200
548
include (CompizPlugin)
550
-find_package (OpenGL)
551
+#find_package (OpenGL)
553
-if (OPENGL_GLU_FOUND)
554
- compiz_plugin(blur PLUGINDEPS composite opengl LIBRARIES decoration ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
555
+#if (OPENGL_GLU_FOUND)
556
+# compiz_plugin(blur PLUGINDEPS composite opengl LIBRARIES decoration ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
558
- if (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR)
559
- set_target_properties (
561
- INSTALL_RPATH "${COMPIZ_LIBDIR}"
563
- endif (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR)
565
+# if (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR)
566
+# set_target_properties (
568
+# INSTALL_RPATH "${COMPIZ_LIBDIR}"
570
+# endif (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR)
572
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/clone/src/clone.cpp linaro-gles2-debianpatches/plugins/clone/src/clone.cpp
573
--- compiz-0.9.7.8/plugins/clone/src/clone.cpp 2012-04-26 08:47:01.000000000 +0200
574
+++ linaro-gles2-debianpatches/plugins/clone/src/clone.cpp 2012-04-20 11:41:59.241600000 +0200
577
sTransform.scale (zoomX, zoomY, 1.0f);
580
- glLoadMatrixf (sTransform.getMatrix ());
582
filter = gScreen->textureFilter ();
588
gScreen->setTextureFilter (filter);
594
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/compiztoolbox/src/compiztoolbox.cpp linaro-gles2-debianpatches/plugins/compiztoolbox/src/compiztoolbox.cpp
595
--- compiz-0.9.7.8/plugins/compiztoolbox/src/compiztoolbox.cpp 2012-04-26 08:47:01.000000000 +0200
596
+++ linaro-gles2-debianpatches/plugins/compiztoolbox/src/compiztoolbox.cpp 2012-04-20 11:41:59.241600000 +0200
598
sAttrib.yTranslate = wy - g.y () +
599
window->border ().top * sAttrib.yScale;
601
- GLFragment::Attrib fragment (sAttrib);
603
- if (window->alpha () || fragment.getOpacity () != OPAQUE)
604
+ if (window->alpha () || sAttrib.opacity != OPAQUE)
605
mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
607
wTransform.translate (g.x (), g.y (), 0.0f);
609
sAttrib.yTranslate / sAttrib.yScale - g.y (),
613
- glLoadMatrixf (wTransform.getMatrix ());
615
filter = gScreen->textureFilter ();
617
if (baseScreen->getMipmap ())
618
@@ -488,13 +483,11 @@
619
very ugly but necessary until the vertex stage has been made
621
gWindow->glAddGeometrySetCurrentIndex (MAXSHORT);
622
- gWindow->glDraw (wTransform, fragment, infiniteRegion, mask);
623
+ gWindow->glDraw (wTransform, sAttrib, infiniteRegion, mask);
624
gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex);
626
gScreen->setTextureFilter (filter);
630
if (iconMode != HideIcon)
632
icon = gWindow->getIcon (MAX_ICON_SIZE, MAX_ICON_SIZE);
633
@@ -535,30 +528,23 @@
634
sAttrib.xTranslate = wx - g.x ();
635
sAttrib.yTranslate = wy - g.y ();
637
- gWindow->geometry ().reset ();
638
+ gWindow->vertexBuffer ()->begin ();
640
gWindow->glAddGeometrySetCurrentIndex (MAXSHORT);
641
gWindow->glAddGeometry (matrix, iconReg, infiniteRegion);
642
gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex);
644
- if (gWindow->geometry ().vCount)
646
- GLFragment::Attrib fragment (sAttrib);
647
- GLMatrix wTransform (transform);
649
- wTransform.translate (g.x (), g.y (), 0.0f);
650
- wTransform.scale (sAttrib.xScale, sAttrib.yScale, 1.0f);
651
- wTransform.translate (sAttrib.xTranslate / sAttrib.xScale - g.x (),
652
- sAttrib.yTranslate / sAttrib.yScale - g.y (),
654
+ gWindow->vertexBuffer ()->end ();
657
- glLoadMatrixf (wTransform.getMatrix ());
658
+ GLMatrix wTransform (transform);
660
- gWindow->glDrawTexture (icon, fragment, mask);
661
+ wTransform.translate (g.x (), g.y (), 0.0f);
662
+ wTransform.scale (sAttrib.xScale, sAttrib.yScale, 1.0f);
663
+ wTransform.translate (sAttrib.xTranslate / sAttrib.xScale - g.x (),
664
+ sAttrib.yTranslate / sAttrib.yScale - g.y (),
669
+ gWindow->glDrawTexture (icon, wTransform, sAttrib, mask);
673
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/copytex/src/copytex.cpp linaro-gles2-debianpatches/plugins/copytex/src/copytex.cpp
674
--- compiz-0.9.7.8/plugins/copytex/src/copytex.cpp 2012-04-26 08:47:01.000000000 +0200
675
+++ linaro-gles2-debianpatches/plugins/copytex/src/copytex.cpp 2012-04-20 11:41:59.241600000 +0200
678
GLTexture::Matrix matrix = _identity_matrix;
681
+ target = GL_TEXTURE_2D;
682
+ matrix.xx = 1.0f / dim.width ();
683
+ matrix.yy = 1.0f / dim.height ();
684
+ matrix.x0 = -dim.x () * matrix.xx;
685
+ matrix.y0 = -dim.y () * matrix.yy;
688
if (GL::textureNonPowerOfTwo ||
689
(POWER_OF_TWO (dim.width ()) && POWER_OF_TWO (dim.height ())))
692
matrix.x0 = -dim.x ();
693
matrix.y0 = -dim.y ();
697
setData (target, matrix, false);
698
setGeometry (dim.x1 (), dim.y1 (), dim.x2 () - dim.x1 (), dim.y2 () - dim.y1 ());
699
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/cube/CMakeLists.txt linaro-gles2-debianpatches/plugins/cube/CMakeLists.txt
700
--- compiz-0.9.7.8/plugins/cube/CMakeLists.txt 2012-04-26 08:47:01.000000000 +0200
701
+++ linaro-gles2-debianpatches/plugins/cube/CMakeLists.txt 2012-04-20 11:41:59.241600000 +0200
704
include (CompizPlugin)
706
-compiz_plugin(cube PLUGINDEPS composite opengl)
707
\ Kein Zeilenumbruch am Dateiende.
708
+#compiz_plugin(cube PLUGINDEPS composite opengl)
709
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/cube/src/cube.cpp linaro-gles2-debianpatches/plugins/cube/src/cube.cpp
710
--- compiz-0.9.7.8/plugins/cube/src/cube.cpp 2012-04-26 08:47:01.000000000 +0200
711
+++ linaro-gles2-debianpatches/plugins/cube/src/cube.cpp 2012-04-20 11:41:59.241600000 +0200
712
@@ -1123,7 +1123,6 @@
713
if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE))
715
priv->gScreen->setTexEnvMode (GL_MODULATE);
716
- glEnable (GL_BLEND);
717
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
720
@@ -1149,7 +1148,6 @@
721
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
723
priv->gScreen->setTexEnvMode (GL_REPLACE);
724
- glDisable (GL_BLEND);
725
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
728
@@ -1190,7 +1188,6 @@
729
if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE))
731
priv->gScreen->setTexEnvMode (GL_MODULATE);
732
- glEnable (GL_BLEND);
733
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
736
@@ -1206,7 +1203,6 @@
737
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
739
priv->gScreen->setTexEnvMode (GL_REPLACE);
740
- glDisable (GL_BLEND);
741
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
744
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/decor/src/decor.cpp linaro-gles2-debianpatches/plugins/decor/src/decor.cpp
745
--- compiz-0.9.7.8/plugins/decor/src/decor.cpp 2012-04-26 08:47:01.000000000 +0200
746
+++ linaro-gles2-debianpatches/plugins/decor/src/decor.cpp 2012-04-26 12:34:44.027302000 +0200
747
@@ -177,15 +177,13 @@
751
-DecorWindow::glDraw (const GLMatrix &transform,
752
- GLFragment::Attrib &attrib,
753
- const CompRegion ®ion,
755
+DecorWindow::glDraw (const GLMatrix &transform,
756
+ const GLWindowPaintAttrib &attrib,
757
+ const CompRegion ®ion,
762
- status = gWindow->glDraw (transform, attrib, region, mask);
764
/* Don't render dock decorations (shadows) on just any old window */
765
if (!(window->type () & CompWindowTypeDockMask))
767
@@ -205,15 +203,19 @@
771
+ status = gWindow->glDraw (transform, attrib, region, mask);
777
-DecorWindow::glDecorate (const GLMatrix &transform,
778
- GLFragment::Attrib &attrib,
779
- const CompRegion ®ion,
781
+DecorWindow::glDecorate (const GLMatrix &transform,
782
+ const GLWindowPaintAttrib &attrib,
783
+ const CompRegion ®ion,
786
+ GLboolean isBlendingEnabled;
789
wd->decor->type == WINDOW_DECORATION_TYPE_PIXMAP)
793
const CompRegion ® (*preg);
795
- gWindow->geometry ().reset ();
796
+ gWindow->vertexBuffer ()->begin ();
798
for (int i = 0; i < wd->nQuad; i++)
804
- if (gWindow->geometry ().vCount)
805
- gWindow->glDrawTexture (wd->decor->texture->textures[0],
807
+ gWindow->vertexBuffer ()->end ();
809
+ glGetBooleanv (GL_BLEND, &isBlendingEnabled);
810
+ glEnable (GL_BLEND);
811
+ gWindow->glDrawTexture (wd->decor->texture->textures[0], transform,
813
+ if (!isBlendingEnabled)
814
+ glDisable (GL_BLEND);
816
else if (wd && wd->decor->type == WINDOW_DECORATION_TYPE_WINDOW)
818
@@ -275,14 +282,18 @@
819
if (gWindow->textures ().empty ())
822
+ glGetBooleanv (GL_BLEND, &isBlendingEnabled);
823
+ glEnable (GL_BLEND);
825
if (gWindow->textures ().size () == 1)
827
ml[0] = gWindow->matrices ()[0];
828
- gWindow->geometry ().reset ();
829
+ gWindow->vertexBuffer ()->begin ();
830
gWindow->glAddGeometry (ml, window->frameRegion (), region);
831
+ gWindow->vertexBuffer ()->end ();
833
- if (gWindow->geometry ().vCount)
834
- gWindow->glDrawTexture (gWindow->textures ()[0], attrib, mask);
835
+ gWindow->glDrawTexture (gWindow->textures ()[0], transform,
840
@@ -291,14 +302,17 @@
841
for (unsigned int i = 0; i < gWindow->textures ().size (); i++)
843
ml[0] = gWindow->matrices ()[i];
844
- gWindow->geometry ().reset ();
845
+ gWindow->vertexBuffer ()->begin ();
846
gWindow->glAddGeometry (ml, regions[i], region);
847
+ gWindow->vertexBuffer ()->end ();
849
- if (gWindow->geometry ().vCount)
850
- gWindow->glDrawTexture (gWindow->textures ()[i], attrib,
852
+ gWindow->glDrawTexture (gWindow->textures ()[i], transform,
857
+ if (!isBlendingEnabled)
858
+ glDisable (GL_BLEND);
862
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/decor/src/decor.h linaro-gles2-debianpatches/plugins/decor/src/decor.h
863
--- compiz-0.9.7.8/plugins/decor/src/decor.h 2012-04-26 08:47:01.000000000 +0200
864
+++ linaro-gles2-debianpatches/plugins/decor/src/decor.h 2012-04-26 12:34:44.027302000 +0200
865
@@ -252,10 +252,10 @@
867
void computeShadowRegion ();
869
- bool glDraw (const GLMatrix &, GLFragment::Attrib &,
870
+ bool glDraw (const GLMatrix &, const GLWindowPaintAttrib &,
871
const CompRegion &, unsigned int);
872
- void glDecorate (const GLMatrix &, GLFragment::Attrib &,
873
- const CompRegion &, unsigned int);
874
+ void glDecorate (const GLMatrix &, const GLWindowPaintAttrib &,
875
+ const CompRegion &, unsigned int);
877
void windowNotify (CompWindowNotify n);
879
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/imgsvg/src/imgsvg.cpp linaro-gles2-debianpatches/plugins/imgsvg/src/imgsvg.cpp
880
--- compiz-0.9.7.8/plugins/imgsvg/src/imgsvg.cpp 2012-04-26 08:47:01.000000000 +0200
881
+++ linaro-gles2-debianpatches/plugins/imgsvg/src/imgsvg.cpp 2012-04-20 11:41:59.241600000 +0200
882
@@ -220,12 +220,12 @@
886
-SvgWindow::glDraw (const GLMatrix &transform,
887
- GLFragment::Attrib &fragment,
888
- const CompRegion ®ion,
890
+SvgWindow::glDraw (const GLMatrix &transform,
891
+ const GLWindowPaintAttrib &attrib,
892
+ const CompRegion ®ion,
895
- bool status = gWindow->glDraw (transform, fragment, region, mask);
896
+ bool status = gWindow->glDraw (transform, attrib, region, mask);
900
@@ -251,13 +251,15 @@
902
matrix[0] = context->texture[0].matrices[i];
904
- gWindow->geometry ().reset ();
905
+ gWindow->vertexBuffer ()->begin ();
906
gWindow->glAddGeometry (matrix, context->box, reg);
907
+ gWindow->vertexBuffer ()->end ();
909
if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
910
mask |= PAINT_WINDOW_BLEND_MASK;
912
- gWindow->glDrawTexture (context->texture[0].textures[i], fragment, mask);
913
+ gWindow->glDrawTexture (context->texture[0].textures[i], transform,
916
if (rect.width () > 0 && rect.height () > 0)
918
@@ -321,11 +323,12 @@
919
saveFilter = gScreen->filter (SCREEN_TRANS_FILTER);
920
gScreen->setFilter (SCREEN_TRANS_FILTER, GLTexture::Good);
922
- gWindow->geometry ().reset ();
923
+ gWindow->vertexBuffer ()->begin ();
924
gWindow->glAddGeometry (matrix, r, reg);
925
+ gWindow->vertexBuffer ()->end ();
927
gWindow->glDrawTexture (context->texture[1].textures[j],
929
+ transform, attrib, mask);
931
gScreen->setFilter (SCREEN_TRANS_FILTER, saveFilter);
933
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/imgsvg/src/imgsvg.h linaro-gles2-debianpatches/plugins/imgsvg/src/imgsvg.h
934
--- compiz-0.9.7.8/plugins/imgsvg/src/imgsvg.h 2012-04-26 08:47:01.000000000 +0200
935
+++ linaro-gles2-debianpatches/plugins/imgsvg/src/imgsvg.h 2012-04-20 11:41:59.241600000 +0200
937
SvgWindow (CompWindow *window);
940
- bool glDraw (const GLMatrix &transform, GLFragment::Attrib &fragment,
941
+ bool glDraw (const GLMatrix &transform,
942
+ const GLWindowPaintAttrib &attrib,
943
const CompRegion ®ion, unsigned int mask);
944
void moveNotify (int dx, int dy, bool immediate);
945
void resizeNotify (int dx, int dy, int dwidth, int dheight);
946
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/obs/src/obs.cpp linaro-gles2-debianpatches/plugins/obs/src/obs.cpp
947
--- compiz-0.9.7.8/plugins/obs/src/obs.cpp 2012-04-26 08:47:01.000000000 +0200
948
+++ linaro-gles2-debianpatches/plugins/obs/src/obs.cpp 2012-04-20 11:41:59.241600000 +0200
949
@@ -151,29 +151,30 @@
950
we wrap into glDrawWindow here */
953
-ObsWindow::glDraw (const GLMatrix& transform,
954
- GLFragment::Attrib& attrib,
955
- const CompRegion& region,
957
+ObsWindow::glDraw (const GLMatrix &transform,
958
+ const GLWindowPaintAttrib &attrib,
959
+ const CompRegion ®ion,
962
+ GLWindowPaintAttrib wAttrib (attrib);
965
factor = customFactor[MODIFIER_OPACITY];
968
- attrib.setOpacity (factor * attrib.getOpacity () / 100);
969
+ wAttrib.opacity = factor * wAttrib.opacity / 100;
970
mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
973
factor = customFactor[MODIFIER_BRIGHTNESS];
975
- attrib.setBrightness (factor * attrib.getBrightness () / 100);
976
+ wAttrib.brightness = factor * wAttrib.brightness / 100;
978
factor = customFactor[MODIFIER_SATURATION];
980
- attrib.setSaturation (factor * attrib.getSaturation () / 100);
981
+ wAttrib.saturation = factor * wAttrib.saturation / 100;
983
- return gWindow->glDraw (transform, attrib, region, mask);
984
+ return gWindow->glDraw (transform, wAttrib, region, mask);
988
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/obs/src/obs.h linaro-gles2-debianpatches/plugins/obs/src/obs.h
989
--- compiz-0.9.7.8/plugins/obs/src/obs.h 2012-04-26 08:47:01.000000000 +0200
990
+++ linaro-gles2-debianpatches/plugins/obs/src/obs.h 2012-04-20 11:41:59.241600000 +0200
993
bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
994
const CompRegion &, unsigned int);
995
- bool glDraw (const GLMatrix &, GLFragment::Attrib &,
996
+ bool glDraw (const GLMatrix &, const GLWindowPaintAttrib &,
997
const CompRegion &, unsigned int);
999
void changePaintModifier (unsigned int, int);
1000
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/CMakeLists.txt linaro-gles2-debianpatches/plugins/opengl/CMakeLists.txt
1001
--- compiz-0.9.7.8/plugins/opengl/CMakeLists.txt 2012-04-26 08:47:01.000000000 +0200
1002
+++ linaro-gles2-debianpatches/plugins/opengl/CMakeLists.txt 2012-04-20 11:41:59.241600000 +0200
1005
include (CompizPlugin)
1007
-find_package (OpenGL)
1009
- compiz_plugin(opengl PLUGINDEPS composite LIBRARIES ${OPENGL_gl_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
1011
\ Kein Zeilenumbruch am Dateiende.
1013
+ compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD "-DUSE_GLES -std=c++0x" LIBRARIES ${OPENGLES2_LIBRARIES} INCDIRS ${OPENGLES2_INCLUDE_DIR})
1015
+ find_package (OpenGL)
1017
+ compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD -std=c++0x LIBRARIES ${OPENGL_gl_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
1018
+ endif (OPENGL_FOUND)
1021
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/compiz-opengl.pc.in linaro-gles2-debianpatches/plugins/opengl/compiz-opengl.pc.in
1022
--- compiz-0.9.7.8/plugins/opengl/compiz-opengl.pc.in 2012-04-26 08:47:01.000000000 +0200
1023
+++ linaro-gles2-debianpatches/plugins/opengl/compiz-opengl.pc.in 2012-04-20 11:41:59.241600000 +0200
1027
Requires: compiz compiz-composite
1028
-Libs: -lGL -L${libdir} -lopengl
1029
-Cflags: @COMPIZ_CFLAGS@ -I${includedir}/compiz
1030
\ Kein Zeilenumbruch am Dateiende.
1031
+Libs: @PKGCONFIG_LIBS@ -L${libdir} -lopengl
1032
+Cflags: @COMPIZ_CFLAGS@ -I${includedir}/compiz
1033
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/include/opengl/fragment.h linaro-gles2-debianpatches/plugins/opengl/include/opengl/fragment.h
1034
--- compiz-0.9.7.8/plugins/opengl/include/opengl/fragment.h 2012-04-26 08:47:01.000000000 +0200
1035
+++ linaro-gles2-debianpatches/plugins/opengl/include/opengl/fragment.h 1970-01-01 01:00:00.000000000 +0100
1038
- * Copyright © 2008 Dennis Kasprzyk
1039
- * Copyright © 2007 Novell, Inc.
1041
- * Permission to use, copy, modify, distribute, and sell this software
1042
- * and its documentation for any purpose is hereby granted without
1043
- * fee, provided that the above copyright notice appear in all copies
1044
- * and that both that copyright notice and this permission notice
1045
- * appear in supporting documentation, and that the name of
1046
- * Dennis Kasprzyk not be used in advertising or publicity pertaining to
1047
- * distribution of the software without specific, written prior permission.
1048
- * Dennis Kasprzyk makes no representations about the suitability of this
1049
- * software for any purpose. It is provided "as is" without express or
1050
- * implied warranty.
1052
- * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1053
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
1054
- * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1055
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
1056
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
1057
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
1058
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1060
- * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
1061
- * David Reveman <davidr@novell.com>
1064
-#ifndef _GLFRAGMENT_H
1065
-#define _GLFRAGMENT_H
1067
-#define MAX_FRAGMENT_FUNCTIONS 16
1069
-#define COMP_FETCH_TARGET_2D 0
1070
-#define COMP_FETCH_TARGET_RECT 1
1071
-#define COMP_FETCH_TARGET_NUM 2
1073
-struct GLWindowPaintAttrib;
1078
- * Describes a texture modification fragment program
1081
-namespace GLFragment {
1085
- typedef unsigned int FunctionId;
1087
- class PrivateFunctionData;
1088
- class PrivateAttrib;
1090
- class FunctionData {
1096
- * Returns the status of this fragment program
1097
- * (valid or invalid)
1101
- void addTempHeaderOp (const char *name);
1103
- void addParamHeaderOp (const char *name);
1105
- void addAttribHeaderOp (const char *name);
1108
- void addFetchOp (const char *dst, const char *offset, int target);
1110
- void addColorOp (const char *dst, const char *src);
1112
- void addDataOp (const char *str, ...);
1114
- void addBlendOp (const char *str, ...);
1116
- FunctionId createFragmentFunction (const char *name);
1119
- PrivateFunctionData *priv;
1124
- Attrib (const GLWindowPaintAttrib &paint);
1125
- Attrib (const Attrib&);
1128
- Attrib &operator= (const Attrib &rhs);
1130
- unsigned int allocTextureUnits (unsigned int nTexture);
1132
- unsigned int allocParameters (unsigned int nParam);
1134
- void addFunction (FunctionId function);
1136
- bool enable (bool *blending);
1139
- unsigned short getSaturation ();
1140
- unsigned short getBrightness ();
1141
- unsigned short getOpacity ();
1143
- void setSaturation (unsigned short);
1144
- void setBrightness (unsigned short);
1145
- void setOpacity (unsigned short);
1147
- bool hasFunctions ();
1150
- PrivateAttrib *priv;
1153
- void destroyFragmentFunction (FunctionId id);
1155
- FunctionId getSaturateFragmentFunction (GLTexture *texture,
1162
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/include/opengl/framebufferobject.h linaro-gles2-debianpatches/plugins/opengl/include/opengl/framebufferobject.h
1163
--- compiz-0.9.7.8/plugins/opengl/include/opengl/framebufferobject.h 1970-01-01 01:00:00.000000000 +0100
1164
+++ linaro-gles2-debianpatches/plugins/opengl/include/opengl/framebufferobject.h 2012-04-20 11:41:59.241600000 +0200
1167
+ * Copyright (c) 2011 Collabora, Ltd.
1169
+ * Permission to use, copy, modify, distribute, and sell this software
1170
+ * and its documentation for any purpose is hereby granted without
1171
+ * fee, provided that the above copyright notice appear in all copies
1172
+ * and that both that copyright notice and this permission notice
1173
+ * appear in supporting documentation, and that the name of
1174
+ * Collabora Ltd. not be used in advertising or publicity pertaining to
1175
+ * distribution of the software without specific, written prior permission.
1176
+ * Collabora Ltd. makes no representations about the suitability of this
1177
+ * software for any purpose. It is provided "as is" without express or
1178
+ * implied warranty.
1180
+ * COLLABORA LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1181
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
1182
+ * NO EVENT SHALL COLLABORA LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1183
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
1184
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
1185
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
1186
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1188
+ * Authors: Pekka Paalanen <ppaalanen@gmail.com>
1191
+#ifndef _COMPIZ_GLFRAMEBUFFEROBJECT_H
1192
+#define _COMPIZ_GLFRAMEBUFFEROBJECT_H
1194
+#include <opengl/opengl.h>
1196
+struct PrivateGLFramebufferObject;
1199
+ * Class representing a framebuffer object in GL, supporting only one
1200
+ * color attachment as per GLES 2 spec. The color attachment is referred
1201
+ * to as the texture (of the FBO).
1204
+ * 1. create a GLFramebufferObject (requires a GL context)
1205
+ * 2. call allocate (size), and check status ()
1206
+ * 3. old = bind ()
1207
+ * 4. do your rendering
1209
+ * 6. use the rendered texture via tex ()
1210
+ * 7. go to 2 or 3, or delete to quit (requires a GL context)
1212
+ * TODO: add depth/stencil attachments
1213
+ * FIXME: written for OpenGL ES 2 only, desktop OpenGL might not work.
1215
+class GLFramebufferObject
1218
+ GLFramebufferObject ();
1219
+ ~GLFramebufferObject ();
1222
+ * Ensure the texture is of the given size, recreating it if needed,
1223
+ * and replace the FBO color attachment with it. The texture contents
1224
+ * become undefined, unless specified in the 'image' argument.
1225
+ * When specifying 'image', it's also possible to pass-in the
1226
+ * desired image's 'format' and 'type'.
1228
+ * Returns true on success, and false on texture allocation failure.
1230
+ bool allocate (const CompSize &size,
1231
+ const char *image = NULL,
1232
+ GLenum format = GL_RGBA,
1233
+ GLenum type = GL_UNSIGNED_BYTE);
1236
+ * Bind this as the current FBO, previous binding in GL context is
1237
+ * undone. GL rendering is now targeted to this FBO.
1238
+ * Returns a pointer to the previously bound FBO, or NULL if
1239
+ * the previous binding was zero (the window system provided
1242
+ * The previous FBO is no longer bound, so you can use its
1243
+ * texture. To restore the previous FBO, call rebind (FBO) with
1244
+ * the returned pointer as the argument.
1246
+ GLFramebufferObject *bind ();
1249
+ * Bind the given FBO as the current FBO, without looking up the
1250
+ * previous binding. The argument can be NULL, in which case the
1251
+ * window system provided framebuffer gets bound (FBO is unbound).
1253
+ static void rebind (GLFramebufferObject *fbo);
1256
+ * Check the FBO completeness. Returns true on complete.
1257
+ * Otherwise returns false and reports the error to log.
1259
+ bool checkStatus ();
1262
+ * Return a pointer to the texture that is the color attachment.
1263
+ * This will return NULL, if allocate () has not been called, or
1264
+ * the last allocate () call failed.
1266
+ GLTexture *tex ();
1269
+ PrivateGLFramebufferObject *priv;
1272
+#endif // _COMPIZ_GLFRAMEBUFFEROBJECT_H
1273
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/include/opengl/matrix.h linaro-gles2-debianpatches/plugins/opengl/include/opengl/matrix.h
1274
--- compiz-0.9.7.8/plugins/opengl/include/opengl/matrix.h 2012-04-26 08:47:01.000000000 +0200
1275
+++ linaro-gles2-debianpatches/plugins/opengl/include/opengl/matrix.h 2012-04-20 11:41:59.241600000 +0200
1278
void toScreenSpace (const CompOutput *output, float z);
1282
void rotate (const float angle, const float x,
1283
const float y, const float z);
1284
void rotate (const float angle, const GLVector& vector);
1285
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/include/opengl/opengl.h linaro-gles2-debianpatches/plugins/opengl/include/opengl/opengl.h
1286
--- compiz-0.9.7.8/plugins/opengl/include/opengl/opengl.h 2012-04-26 08:47:01.000000000 +0200
1287
+++ linaro-gles2-debianpatches/plugins/opengl/include/opengl/opengl.h 2012-04-20 11:41:59.241600000 +0200
1289
#ifndef _COMPIZ_OPENGL_H
1290
#define _COMPIZ_OPENGL_H
1293
+#define SUPPORT_X11
1294
+#include <GLES2/gl2.h>
1295
+#include <GLES2/gl2ext.h>
1296
+#include <EGL/egl.h>
1297
+#include <EGL/eglext.h>
1303
+#include <core/size.h>
1304
+#include <core/pluginclasshandler.h>
1306
#include <opengl/matrix.h>
1307
#include <opengl/texture.h>
1308
-#include <opengl/fragment.h>
1309
+#include <opengl/framebufferobject.h>
1310
+#include <opengl/vertexbuffer.h>
1311
+#include <opengl/program.h>
1312
+#include <opengl/programcache.h>
1313
+#include <opengl/shadercache.h>
1315
#define COMPIZ_OPENGL_ABI 4
1317
-#include <core/pluginclasshandler.h>
1318
+#if !defined(GL_BGRA)
1319
+ #if !defined(GL_BGRA_EXT)
1320
+ #error GL_BGRA support is required
1322
+ #define GL_BGRA GL_BGRA_EXT
1326
+#if !defined(GL_BGRA)
1327
+ #if !defined(GL_BGRA_EXT)
1328
+ #error GL_BGRA support is required
1330
+ #define GL_BGRA GL_BGRA_EXT
1335
* camera distance from screen, 0.5 * tan (FOV)
1341
+ typedef EGLImageKHR (*EGLCreateImageKHRProc) (EGLDisplay dpy,
1344
+ EGLClientBuffer buffer,
1345
+ const EGLint *attrib_list);
1346
+ typedef EGLBoolean (*EGLDestroyImageKHRProc) (EGLDisplay dpy,
1347
+ EGLImageKHR image);
1349
+ typedef void (*GLEGLImageTargetTexture2DOESProc) (GLenum target,
1350
+ GLeglImageOES image);
1352
+ typedef EGLBoolean (*EGLPostSubBufferNVProc) (EGLDisplay dpy,
1353
+ EGLSurface surface,
1354
+ EGLint x, EGLint y,
1355
+ EGLint width, EGLint height);
1358
typedef void (*FuncPtr) (void);
1360
typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName);
1362
typedef void (*GLXBindTexImageProc) (Display *display,
1363
@@ -122,11 +169,6 @@
1364
const int *attribList);
1365
typedef void (*GLXDestroyPixmapProc) (Display *display,
1368
- typedef void (*GLActiveTextureProc) (GLenum texture);
1369
- typedef void (*GLClientActiveTextureProc) (GLenum texture);
1370
- typedef void (*GLMultiTexCoord2fProc) (GLenum, GLfloat, GLfloat);
1372
typedef void (*GLGenProgramsProc) (GLsizei n,
1374
typedef void (*GLDeleteProgramsProc) (GLsizei n,
1375
@@ -146,11 +188,16 @@
1376
typedef void (*GLGetProgramivProc) (GLenum target,
1381
+ typedef void (*GLActiveTextureProc) (GLenum texture);
1382
+ typedef void (*GLClientActiveTextureProc) (GLenum texture);
1383
+ typedef void (*GLMultiTexCoord2fProc) (GLenum, GLfloat, GLfloat);
1385
typedef void (*GLGenFramebuffersProc) (GLsizei n,
1386
GLuint *framebuffers);
1387
typedef void (*GLDeleteFramebuffersProc) (GLsizei n,
1388
- GLuint *framebuffers);
1389
+ const GLuint *framebuffers);
1390
typedef void (*GLBindFramebufferProc) (GLenum target,
1391
GLuint framebuffer);
1392
typedef GLenum (*GLCheckFramebufferStatusProc) (GLenum target);
1393
@@ -161,6 +208,96 @@
1395
typedef void (*GLGenerateMipmapProc) (GLenum target);
1397
+ typedef void (*GLBindBufferProc) (GLenum target,
1399
+ typedef void (*GLDeleteBuffersProc) (GLsizei n,
1400
+ const GLuint *buffers);
1401
+ typedef void (*GLGenBuffersProc) (GLsizei n,
1403
+ typedef void (*GLBufferDataProc) (GLenum target,
1405
+ const GLvoid *data,
1407
+ typedef void (*GLBufferSubDataProc) (GLenum target,
1410
+ const GLvoid *data);
1412
+ typedef void (*GLGetShaderivProc) (GLuint shader,
1415
+ typedef void (*GLGetShaderInfoLogProc) (GLuint shader,
1419
+ typedef void (*GLGetProgramivProc) (GLuint program,
1422
+ typedef void (*GLGetProgramInfoLogProc) (GLuint program,
1426
+ typedef GLuint (*GLCreateShaderProc) (GLenum type);
1427
+ typedef void (*GLShaderSourceProc) (GLuint shader,
1429
+ const GLchar **string,
1430
+ const GLint* length);
1431
+ typedef void (*GLCompileShaderProc) (GLuint shader);
1432
+ typedef GLuint (*GLCreateProgramProc) ();
1433
+ typedef void (*GLAttachShaderProc) (GLuint program,
1435
+ typedef void (*GLLinkProgramProc) (GLuint program);
1436
+ typedef void (*GLValidateProgramProc) (GLuint program);
1437
+ typedef void (*GLDeleteShaderProc) (GLuint shader);
1438
+ typedef void (*GLDeleteProgramProc) (GLuint program);
1439
+ typedef void (*GLUseProgramProc) (GLuint program);
1440
+ typedef int (*GLGetUniformLocationProc) (GLuint program,
1441
+ const GLchar* name);
1442
+ typedef void (*GLUniform1fProc) (GLint location, GLfloat x);
1443
+ typedef void (*GLUniform1iProc) (GLint location, GLint x);
1444
+ typedef void (*GLUniform2fProc) (GLint location, GLfloat x, GLfloat y);
1445
+ typedef void (*GLUniform3fProc) (GLint location,
1449
+ typedef void (*GLUniform4fProc) (GLint location,
1454
+ typedef void (*GLUniform2iProc) (GLint location, GLint x, GLint y);
1455
+ typedef void (*GLUniform3iProc) (GLint location,
1459
+ typedef void (*GLUniform4iProc) (GLint location,
1464
+ typedef void (*GLUniformMatrix4fvProc) (GLint location,
1466
+ GLboolean transpose,
1467
+ const GLfloat *value);
1468
+ typedef int (*GLGetAttribLocationProc) (GLuint program,
1469
+ const GLchar *name);
1471
+ typedef void (*GLEnableVertexAttribArrayProc) (GLuint index);
1472
+ typedef void (*GLDisableVertexAttribArrayProc) (GLuint index);
1473
+ typedef void (*GLVertexAttribPointerProc) (GLuint index,
1476
+ GLboolean normalized,
1478
+ const GLvoid *ptr);
1481
+ extern EGLCreateImageKHRProc createImage;
1482
+ extern EGLDestroyImageKHRProc destroyImage;
1484
+ extern GLEGLImageTargetTexture2DOESProc eglImageTargetTexture;
1487
extern GLXBindTexImageProc bindTexImage;
1488
extern GLXReleaseTexImageProc releaseTexImage;
1489
extern GLXQueryDrawableProc queryDrawable;
1490
@@ -172,11 +309,6 @@
1491
extern GLXGetFBConfigAttribProc getFBConfigAttrib;
1492
extern GLXCreatePixmapProc createPixmap;
1493
extern GLXDestroyPixmapProc destroyPixmap;
1495
- extern GLActiveTextureProc activeTexture;
1496
- extern GLClientActiveTextureProc clientActiveTexture;
1497
- extern GLMultiTexCoord2fProc multiTexCoord2f;
1499
extern GLGenProgramsProc genPrograms;
1500
extern GLDeleteProgramsProc deletePrograms;
1501
extern GLBindProgramProc bindProgram;
1502
@@ -184,6 +316,11 @@
1503
extern GLProgramParameter4fProc programEnvParameter4f;
1504
extern GLProgramParameter4fProc programLocalParameter4f;
1505
extern GLGetProgramivProc getProgramiv;
1508
+ extern GLActiveTextureProc activeTexture;
1509
+ extern GLClientActiveTextureProc clientActiveTexture;
1510
+ extern GLMultiTexCoord2fProc multiTexCoord2f;
1512
extern GLGenFramebuffersProc genFramebuffers;
1513
extern GLDeleteFramebuffersProc deleteFramebuffers;
1514
@@ -192,16 +329,56 @@
1515
extern GLFramebufferTexture2DProc framebufferTexture2D;
1516
extern GLGenerateMipmapProc generateMipmap;
1518
+ extern GLBindBufferProc bindBuffer;
1519
+ extern GLDeleteBuffersProc deleteBuffers;
1520
+ extern GLGenBuffersProc genBuffers;
1521
+ extern GLBufferDataProc bufferData;
1522
+ extern GLBufferSubDataProc bufferSubData;
1525
+ extern GLGetShaderivProc getShaderiv;
1526
+ extern GLGetShaderInfoLogProc getShaderInfoLog;
1527
+ extern GLGetProgramivProc getProgramiv;
1528
+ extern GLGetProgramInfoLogProc getProgramInfoLog;
1529
+ extern GLCreateShaderProc createShader;
1530
+ extern GLShaderSourceProc shaderSource;
1531
+ extern GLCompileShaderProc compileShader;
1532
+ extern GLCreateProgramProc createProgram;
1533
+ extern GLAttachShaderProc attachShader;
1534
+ extern GLLinkProgramProc linkProgram;
1535
+ extern GLValidateProgramProc validateProgram;
1536
+ extern GLDeleteShaderProc deleteShader;
1537
+ extern GLDeleteProgramProc deleteProgram;
1538
+ extern GLUseProgramProc useProgram;
1539
+ extern GLGetUniformLocationProc getUniformLocation;
1540
+ extern GLUniform1fProc uniform1f;
1541
+ extern GLUniform1iProc uniform1i;
1542
+ extern GLUniform2fProc uniform2f;
1543
+ extern GLUniform2iProc uniform2i;
1544
+ extern GLUniform3fProc uniform3f;
1545
+ extern GLUniform3iProc uniform3i;
1546
+ extern GLUniform4fProc uniform4f;
1547
+ extern GLUniform4iProc uniform4i;
1548
+ extern GLUniformMatrix4fvProc uniformMatrix4fv;
1549
+ extern GLGetAttribLocationProc getAttribLocation;
1551
+ extern GLEnableVertexAttribArrayProc enableVertexAttribArray;
1552
+ extern GLDisableVertexAttribArrayProc disableVertexAttribArray;
1553
+ extern GLVertexAttribPointerProc vertexAttribPointer;
1556
extern bool textureFromPixmap;
1557
extern bool textureRectangle;
1558
extern bool textureNonPowerOfTwo;
1559
+ extern bool textureNonPowerOfTwoMipmap;
1560
extern bool textureEnvCombine;
1561
extern bool textureEnvCrossbar;
1562
extern bool textureBorderClamp;
1563
extern bool textureCompression;
1564
extern GLint maxTextureSize;
1566
- extern bool fragmentProgram;
1568
+ extern bool shaders;
1569
extern GLint maxTextureUnits;
1571
extern bool canDoSaturated;
1574
#define MAX_DEPTH 32
1578
GLXFBConfig fbConfig;
1586
#define NOTHING_TRANS_FILTER 0
1587
#define SCREEN_TRANS_FILTER 1
1589
extern GLScreenPaintAttrib defaultScreenPaintAttrib;
1592
+class GLFramebufferObject;
1594
class GLScreenInterface :
1595
public WrapableInterface<GLScreen, GLScreenInterface>
1596
@@ -302,11 +482,24 @@
1598
virtual void glDisableOutputClipping ();
1600
+ virtual GLMatrix *projectionMatrix ();
1603
+ * Hookable function used by plugins to shade the final composited
1606
+ * @param tmpRegion Describes the final composited output region
1607
+ * @param scratchFbo Describes the final composited FBO that is
1610
+ virtual void glPaintCompositedOutput (const CompRegion ®ion,
1611
+ GLFramebufferObject *fbo,
1612
+ unsigned int mask);
1617
- public WrapableHandler<GLScreenInterface, 6>,
1618
+ public WrapableHandler<GLScreenInterface, 7>,
1619
public PluginClassHandler<GLScreen, CompScreen, COMPIZ_OPENGL_ABI>,
1620
public CompOption::Class
1624
* Gets the libGL address of a particular openGL functor
1627
GL::FuncPtr getProcAddress (const char *name);
1630
void updateBackground ();
1634
void setFilter (int, GLTexture::Filter);
1636
- GLFragment::Storage * fragmentStorage ();
1639
* Sets a new compiz-wid openGL texture environment mode
1643
* Turns lighting on and off
1646
void setLighting (bool lighting);
1649
@@ -371,20 +563,35 @@
1650
GLTexture::BindPixmapHandle registerBindPixmap (GLTexture::BindPixmapProc);
1651
void unregisterBindPixmap (GLTexture::BindPixmapHandle);
1654
GLFBConfig * glxPixmapFBConfig (unsigned int depth);
1658
+ EGLContext getEGLContext ();
1662
- * Returns a default icon texture
1663
+ * Returns a GLProgram from the cache or creates one and caches it
1665
- GLTexture *defaultIcon ();
1666
+ GLProgram *getProgram (std::list<const GLShaderData*>);
1668
- void resetRasterPos ();
1670
+ * Returns a GLShaderData from the cache or creates one and caches it
1672
+ const GLShaderData *getShaderData (GLShaderParameters ¶ms);
1675
- * Returns a 4x4 const float array which
1676
- * represents the current projection matrix
1677
+ * Returns the FBO compiz is using for the screen
1679
- const float * projectionMatrix ();
1680
+ GLFramebufferObject *fbo ();
1683
+ * Returns a default icon texture
1685
+ GLTexture *defaultIcon ();
1687
+ void resetRasterPos ();
1689
bool glInitContext (XVisualInfo *);
1691
@@ -402,7 +609,12 @@
1692
const GLMatrix &, const CompRegion &, CompOutput *);
1693
WRAPABLE_HND (4, GLScreenInterface, void, glDisableOutputClipping);
1695
+ WRAPABLE_HND (5, GLScreenInterface, GLMatrix *, projectionMatrix);
1696
+ WRAPABLE_HND (6, GLScreenInterface, void, glPaintCompositedOutput,
1697
+ const CompRegion &, GLFramebufferObject *, unsigned int);
1699
friend class GLTexture;
1700
+ friend class GLWindow;
1703
PrivateGLScreen *priv;
1704
@@ -453,10 +665,10 @@
1705
* @param region Describes which region will be drawn
1706
* @param mask Bitmask which describes how this window is drawn
1708
- virtual bool glDraw (const GLMatrix &matrix,
1709
- GLFragment::Attrib &attrib,
1710
- const CompRegion ®ion,
1711
- unsigned int mask);
1712
+ virtual bool glDraw (const GLMatrix &matrix,
1713
+ const GLWindowPaintAttrib &attrib,
1714
+ const CompRegion ®ion,
1715
+ unsigned int mask);
1718
* Hookable function to add points to a window
1719
@@ -479,51 +691,18 @@
1720
const CompRegion &clipRegion,
1721
unsigned int min = MAXSHORT,
1722
unsigned int max = MAXSHORT);
1723
- virtual void glDrawTexture (GLTexture *texture, GLFragment::Attrib &,
1725
- virtual void glDrawGeometry ();
1726
+ virtual void glDrawTexture (GLTexture *texture, const GLMatrix &,
1727
+ const GLWindowPaintAttrib &, unsigned int);
1731
- public WrapableHandler<GLWindowInterface, 5>,
1732
+ public WrapableHandler<GLWindowInterface, 4>,
1733
public PluginClassHandler<GLWindow, CompWindow, COMPIZ_OPENGL_ABI>
1738
- * Class which describes the texture geometry and transformation points
1749
- * Set the number of vertices in the texture geometry
1751
- bool moreVertices (int newSize);
1754
- * Set the number of indices in the texture geometry
1756
- bool moreIndices (int newSize);
1759
- GLfloat *vertices;
1762
- GLushort *indices;
1770
static GLWindowPaintAttrib defaultPaintAttrib;
1774
GLWindow (CompWindow *w);
1775
@@ -566,9 +745,20 @@
1776
void updatePaintAttribs ();
1779
- * Returns the window texture geometry
1780
+ * Returns the window vertex buffer object
1782
- Geometry & geometry ();
1783
+ GLVertexBuffer * vertexBuffer ();
1786
+ * Add a vertex and/or fragment shader function to the pipeline.
1788
+ * @param name Name of the plugin adding the functions
1789
+ * @param vertex_shader Function to add to the vertex shader
1790
+ * @param fragment_shader Function to add to the fragment shader
1792
+ void addShaders (std::string name,
1793
+ std::string vertex_shader,
1794
+ std::string fragment_shader);
1796
GLTexture *getIcon (int width, int height);
1798
@@ -576,20 +766,24 @@
1799
const GLWindowPaintAttrib &, const GLMatrix &,
1800
const CompRegion &, unsigned int);
1801
WRAPABLE_HND (1, GLWindowInterface, bool, glDraw, const GLMatrix &,
1802
- GLFragment::Attrib &, const CompRegion &, unsigned int);
1803
+ const GLWindowPaintAttrib &, const CompRegion &,
1805
WRAPABLE_HND (2, GLWindowInterface, void, glAddGeometry,
1806
const GLTexture::MatrixList &, const CompRegion &,
1808
unsigned int = MAXSHORT, unsigned int = MAXSHORT);
1809
WRAPABLE_HND (3, GLWindowInterface, void, glDrawTexture,
1810
- GLTexture *texture, GLFragment::Attrib &, unsigned int);
1811
- WRAPABLE_HND (4, GLWindowInterface, void, glDrawGeometry);
1812
+ GLTexture *texture, const GLMatrix &,
1813
+ const GLWindowPaintAttrib &, unsigned int);
1815
friend class GLScreen;
1816
friend class PrivateGLScreen;
1817
+ friend class SpewScreen;
1818
+ friend class SpewWindow;
1821
PrivateGLWindow *priv;
1826
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/include/opengl/programcache.h linaro-gles2-debianpatches/plugins/opengl/include/opengl/programcache.h
1827
--- compiz-0.9.7.8/plugins/opengl/include/opengl/programcache.h 1970-01-01 01:00:00.000000000 +0100
1828
+++ linaro-gles2-debianpatches/plugins/opengl/include/opengl/programcache.h 2012-04-20 11:41:59.241600000 +0200
1831
+ * Copyright © 2011 Linaro Ltd.
1833
+ * Permission to use, copy, modify, distribute, and sell this software
1834
+ * and its documentation for any purpose is hereby granted without
1835
+ * fee, provided that the above copyright notice appear in all copies
1836
+ * and that both that copyright notice and this permission notice
1837
+ * appear in supporting documentation, and that the name of
1838
+ * Linaro Ltd. not be used in advertising or publicity pertaining to
1839
+ * distribution of the software without specific, written prior permission.
1840
+ * Linaro Ltd. makes no representations about the suitability of this
1841
+ * software for any purpose. It is provided "as is" without express or
1842
+ * implied warranty.
1844
+ * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1845
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
1846
+ * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1847
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
1848
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
1849
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
1850
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1852
+ * Authors: Travis Watkins <travis.watkins@linaro.org>
1855
+#ifndef _COMPIZ_GLPROGRAMCACHE_H
1856
+#define _COMPIZ_GLPROGRAMCACHE_H
1861
+#include <boost/bind.hpp>
1862
+#include <opengl/program.h>
1864
+class PrivateProgramCache;
1865
+struct GLShaderData;
1867
+class GLProgramCache
1870
+ PrivateProgramCache *priv;
1873
+ GLProgramCache (size_t);
1874
+ ~GLProgramCache ();
1876
+ GLProgram* operator () (std::list<const GLShaderData*>);
1879
+#endif // _COMPIZ_GLPROGRAMCACHE_H
1881
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/include/opengl/program.h linaro-gles2-debianpatches/plugins/opengl/include/opengl/program.h
1882
--- compiz-0.9.7.8/plugins/opengl/include/opengl/program.h 1970-01-01 01:00:00.000000000 +0100
1883
+++ linaro-gles2-debianpatches/plugins/opengl/include/opengl/program.h 2012-04-20 11:41:59.241600000 +0200
1886
+ * Copyright © 2011 Linaro Ltd.
1888
+ * Permission to use, copy, modify, distribute, and sell this software
1889
+ * and its documentation for any purpose is hereby granted without
1890
+ * fee, provided that the above copyright notice appear in all copies
1891
+ * and that both that copyright notice and this permission notice
1892
+ * appear in supporting documentation, and that the name of
1893
+ * Linaro Ltd. not be used in advertising or publicity pertaining to
1894
+ * distribution of the software without specific, written prior permission.
1895
+ * Linaro Ltd. makes no representations about the suitability of this
1896
+ * software for any purpose. It is provided "as is" without express or
1897
+ * implied warranty.
1899
+ * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1900
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
1901
+ * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1902
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
1903
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
1904
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
1905
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1907
+ * Authors: Travis Watkins <travis.watkins@linaro.org>
1910
+#ifndef _COMPIZ_GLPROGRAM_H
1911
+#define _COMPIZ_GLPROGRAM_H
1914
+#include <GLES2/gl2.h>
1919
+#include <core/core.h>
1920
+#include <opengl/matrix.h>
1922
+class PrivateProgram;
1927
+ GLProgram (CompString &vertexShader, CompString &fragmentShader);
1934
+ bool setUniform (const char *name, GLfloat value);
1935
+ bool setUniform (const char *name, GLint value);
1936
+ bool setUniform (const char *name, const GLMatrix &value);
1937
+ bool setUniform2f (const char *name, GLfloat x, GLfloat y);
1938
+ bool setUniform3f (const char *name, GLfloat x, GLfloat y, GLfloat z);
1939
+ bool setUniform4f (const char *name,
1944
+ bool setUniform2i (const char *name, GLint x, GLint y);
1945
+ bool setUniform3i (const char *name, GLint x, GLint y, GLint z);
1946
+ bool setUniform4i (const char *name,
1952
+ GLuint attributeLocation (const char *name);
1955
+ PrivateProgram *priv;
1958
+#endif // _COMPIZ_GLPROGRAM_H
1960
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/include/opengl/shadercache.h linaro-gles2-debianpatches/plugins/opengl/include/opengl/shadercache.h
1961
--- compiz-0.9.7.8/plugins/opengl/include/opengl/shadercache.h 1970-01-01 01:00:00.000000000 +0100
1962
+++ linaro-gles2-debianpatches/plugins/opengl/include/opengl/shadercache.h 2012-04-20 11:41:59.241600000 +0200
1965
+ * Copyright © 2012 Linaro Ltd.
1967
+ * Permission to use, copy, modify, distribute, and sell this software
1968
+ * and its documentation for any purpose is hereby granted without
1969
+ * fee, provided that the above copyright notice appear in all copies
1970
+ * and that both that copyright notice and this permission notice
1971
+ * appear in supporting documentation, and that the name of
1972
+ * Linaro Ltd. not be used in advertising or publicity pertaining to
1973
+ * distribution of the software without specific, written prior permission.
1974
+ * Linaro Ltd. makes no representations about the suitability of this
1975
+ * software for any purpose. It is provided "as is" without express or
1976
+ * implied warranty.
1978
+ * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1979
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
1980
+ * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1981
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
1982
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
1983
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
1984
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1986
+ * Authors: Alexandros Frantzis <alexandros.frantzis@linaro.org>
1988
+#ifndef GL_SHADER_CACHE_H_
1989
+#define GL_SHADER_CACHE_H_
1994
+ * How to use a variable in a shader.
1996
+enum GLShaderVariableType
1998
+ /** The variable is not used */
1999
+ GLShaderVariableNone,
2000
+ /** The variable value is held in a uniform */
2001
+ GLShaderVariableUniform,
2002
+ /** The variable value is held in a varying (from a vertex attribute) */
2003
+ GLShaderVariableVarying,
2007
+ * Parameters that define a vertex-fragment shader pair.
2009
+struct GLShaderParameters
2011
+ /** Whether this shader supports opacity */
2013
+ /** Whether this shader supports brightness */
2015
+ /** Whether this shader supports saturation */
2017
+ /** Whether this shader supports color and how */
2018
+ GLShaderVariableType color;
2019
+ /** Whether this shader supports normals and how */
2020
+ GLShaderVariableType normal;
2021
+ /** The number of textures this shader uses */
2024
+ /** Gets a minimalistic string representation of the parameters */
2025
+ std::string id() const;
2026
+ /** Gets a unique hash value for this set of parameters */
2031
+ * An object representing a named vertex-fragment shader pair.
2033
+struct GLShaderData
2036
+ std::string vertexShader;
2037
+ std::string fragmentShader;
2040
+class PrivateShaderCache;
2043
+ * A cache of vertex-fragment shader pairs (GLShaderData).
2045
+class GLShaderCache
2051
+ * Gets the GLShaderData associated with the specified parameters.
2053
+ * @param params the parameters to get the GLShaderData for.
2055
+ * @return the GLShaderData
2057
+ const GLShaderData &getShaderData (const GLShaderParameters ¶ms);
2060
+ PrivateShaderCache *priv;
2064
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/include/opengl/texture.h linaro-gles2-debianpatches/plugins/opengl/include/opengl/texture.h
2065
--- compiz-0.9.7.8/plugins/opengl/include/opengl/texture.h 2012-04-26 08:47:01.000000000 +0200
2066
+++ linaro-gles2-debianpatches/plugins/opengl/include/opengl/texture.h 2012-04-20 11:41:59.241600000 +0200
2068
#include "core/string.h"
2070
#include <X11/Xlib-xcb.h>
2073
+#include <GLES2/gl2.h>
2078
#include <boost/function.hpp>
2080
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/include/opengl/vector.h linaro-gles2-debianpatches/plugins/opengl/include/opengl/vector.h
2081
--- compiz-0.9.7.8/plugins/opengl/include/opengl/vector.h 2012-04-26 08:47:01.000000000 +0200
2082
+++ linaro-gles2-debianpatches/plugins/opengl/include/opengl/vector.h 2012-04-20 11:41:59.241600000 +0200
2087
- GLVector (float x, float y, float z, float w);
2088
+ GLVector (float x, float y, float z, float w = 0.0f);
2091
* Returns a reference to the x, y, z or w value by using
2092
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/include/opengl/vertexbuffer.h linaro-gles2-debianpatches/plugins/opengl/include/opengl/vertexbuffer.h
2093
--- compiz-0.9.7.8/plugins/opengl/include/opengl/vertexbuffer.h 1970-01-01 01:00:00.000000000 +0100
2094
+++ linaro-gles2-debianpatches/plugins/opengl/include/opengl/vertexbuffer.h 2012-04-20 11:41:59.241600000 +0200
2097
+ * Copyright © 2011 Linaro Ltd.
2099
+ * Permission to use, copy, modify, distribute, and sell this software
2100
+ * and its documentation for any purpose is hereby granted without
2101
+ * fee, provided that the above copyright notice appear in all copies
2102
+ * and that both that copyright notice and this permission notice
2103
+ * appear in supporting documentation, and that the name of
2104
+ * Linaro Ltd. not be used in advertising or publicity pertaining to
2105
+ * distribution of the software without specific, written prior permission.
2106
+ * Linaro Ltd. makes no representations about the suitability of this
2107
+ * software for any purpose. It is provided "as is" without express or
2108
+ * implied warranty.
2110
+ * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
2111
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
2112
+ * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
2113
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
2114
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
2115
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
2116
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2118
+ * Authors: Travis Watkins <travis.watkins@linaro.org>
2119
+ * Frederic Plourde <frederic.plourde@collabora.co.uk>
2122
+#ifndef _COMPIZ_GLVERTEXBUFFER_H
2123
+#define _COMPIZ_GLVERTEXBUFFER_H
2126
+#include <GLES2/gl2.h>
2131
+#include <core/core.h>
2132
+#include <opengl/program.h>
2133
+#include <opengl/shadercache.h>
2135
+class PrivateVertexBuffer;
2136
+struct GLWindowPaintAttrib;
2138
+class GLVertexBuffer
2144
+ virtual GLProgram *getProgram(GLShaderParameters ¶ms) = 0;
2147
+ GLVertexBuffer ();
2148
+ GLVertexBuffer (GLenum usage);
2149
+ ~GLVertexBuffer ();
2151
+ static GLVertexBuffer *streamingBuffer ();
2153
+ void begin (GLenum primitiveType);
2154
+ // default primitiveType is GL_TRIANGLES
2158
+ // vertices and normals are 3 parts, count is number of xyz groups
2159
+ void addVertices (GLuint nVertices, GLfloat *vertices);
2160
+ void addNormals (GLuint nNormals, GLfloat *normals);
2162
+ // color is always RGBA (4 parts), count is number of rgba groups
2163
+ void addColors (GLuint nColors, GLushort *colors);
2165
+ // texture is index, texcoords are 2 parts, count is number of pairs
2166
+ void addTexCoords (GLuint texture,
2167
+ GLuint nTexcoords,
2168
+ GLfloat *texcoords);
2170
+ void addUniform (const char *name, GLfloat value);
2171
+ void addUniform (const char *name, GLint value);
2172
+ bool addUniform (const char *name, const GLMatrix &value);
2173
+ void addUniform2f (const char *name, GLfloat x, GLfloat y);
2174
+ void addUniform3f (const char *name, GLfloat x, GLfloat y, GLfloat z);
2175
+ void addUniform4f (const char *name, GLfloat x, GLfloat y,
2176
+ GLfloat z, GLfloat w);
2177
+ void addUniform2i (const char *name, GLint x, GLint y);
2178
+ void addUniform3i (const char *name, GLint x, GLint y, GLint z);
2179
+ void addUniform4i (const char *name, GLint x, GLint y,
2180
+ GLint z, GLint w);
2182
+ void setProgram (GLProgram *program);
2184
+ void setAutoProgram (AutoProgram *autoProgram);
2186
+ // This no-argument render () function is intended for use by plugins
2187
+ // that have custom programs.
2190
+ int render (const GLMatrix &modelview);
2192
+ int render (const GLMatrix &modelview,
2193
+ const GLWindowPaintAttrib &attrib);
2195
+ int render (const GLMatrix &projection,
2196
+ const GLMatrix &modelview,
2197
+ const GLWindowPaintAttrib &attrib);
2200
+ PrivateVertexBuffer *priv;
2203
+#endif // _COMPIZ_GLVERTEXBUFFER_H
2205
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/opengl.xml.in linaro-gles2-debianpatches/plugins/opengl/opengl.xml.in
2206
--- compiz-0.9.7.8/plugins/opengl/opengl.xml.in 2012-04-26 08:47:01.000000000 +0200
2207
+++ linaro-gles2-debianpatches/plugins/opengl/opengl.xml.in 2012-04-20 11:41:59.241600000 +0200
2209
<option name="sync_to_vblank" type="bool">
2210
<_short>Sync To VBlank</_short>
2211
<_long>Only perform screen updates during vertical blanking period</_long>
2212
- <default>true</default>
2213
+ <default>false</default>
2215
<option name="texture_compression" type="bool">
2216
<_short>Texture Compression</_short>
2217
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/fragment.cpp linaro-gles2-debianpatches/plugins/opengl/src/fragment.cpp
2218
--- compiz-0.9.7.8/plugins/opengl/src/fragment.cpp 2012-04-26 08:47:01.000000000 +0200
2219
+++ linaro-gles2-debianpatches/plugins/opengl/src/fragment.cpp 1970-01-01 01:00:00.000000000 +0100
2222
- * Copyright © 2007 Novell, Inc.
2224
- * Permission to use, copy, modify, distribute, and sell this software
2225
- * and its documentation for any purpose is hereby granted without
2226
- * fee, provided that the above copyright notice appear in all copies
2227
- * and that both that copyright notice and this permission notice
2228
- * appear in supporting documentation, and that the name of
2229
- * Novell, Inc. not be used in advertising or publicity pertaining to
2230
- * distribution of the software without specific, written prior permission.
2231
- * Novell, Inc. makes no representations about the suitability of this
2232
- * software for any purpose. It is provided "as is" without express or
2233
- * implied warranty.
2235
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
2236
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
2237
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
2238
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
2239
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
2240
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
2241
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2243
- * Author: David Reveman <davidr@novell.com>
2246
-#include "privatefragment.h"
2247
-#include "privates.h"
2249
-#include "core/string.h"
2251
-#include <boost/function.hpp>
2252
-#include <boost/bind.hpp>
2253
-#include <boost/foreach.hpp>
2254
-#define foreach BOOST_FOREACH
2256
-#include <opengl/texture.h>
2258
-#include <string.h>
2259
-#include <stdlib.h>
2260
-#include <stdarg.h>
2262
-#define COMP_FUNCTION_TYPE_ARB 0
2263
-#define COMP_FUNCTION_TYPE_NUM 1
2265
-#define COMP_FUNCTION_ARB_MASK (1 << 0)
2266
-#define COMP_FUNCTION_MASK (COMP_FUNCTION_ARB_MASK)
2268
-namespace GLFragment {
2276
- type (GL_FRAGMENT_PROGRAM_ARB)
2281
- (*GL::deletePrograms) (1, &name);
2285
- std::vector<FunctionId> signature;
2299
- OpTypeHeaderParam,
2300
- OpTypeHeaderAttrib,
2308
- HeaderOp () : type (OpTypeHeaderTemp), name ("") {}
2317
- type (OpTypeData),
2323
- foreach (CompString &str, noOffset)
2325
- foreach (CompString &str, offset)
2334
- unsigned int target;
2335
- CompString noOffset[COMP_FETCH_TARGET_NUM];
2336
- CompString offset[COMP_FETCH_TARGET_NUM];
2340
- class PrivateFunctionData {
2342
- PrivateFunctionData () : header (0), body (0), status (true) {}
2343
- PrivateFunctionData (const PrivateFunctionData&, CompString);
2346
- std::vector<HeaderOp> header;
2347
- std::vector<BodyOp> body;
2362
- PrivateFunctionData data[COMP_FUNCTION_TYPE_NUM];
2363
- unsigned int mask;
2366
- class PrivateAttrib {
2368
- PrivateAttrib () :
2370
- brightness (0xffff),
2371
- saturation (0xffff),
2377
- PrivateAttrib (const PrivateAttrib &pa) :
2378
- opacity (pa.opacity),
2379
- brightness (pa.brightness),
2380
- saturation (pa.saturation),
2381
- nTexture (pa.nTexture),
2382
- nFunction (pa.nFunction),
2383
- nParam (pa.nParam)
2385
- for (int i = 0; i < MAX_FRAGMENT_FUNCTIONS; i++)
2386
- function[i] = pa.function[i];
2391
- GLushort brightness;
2392
- GLushort saturation;
2394
- FunctionId function[MAX_FRAGMENT_FUNCTIONS];
2399
- typedef boost::function<void (BodyOp *, int)> DataOpCallBack;
2401
- class InitialLoadFunction : public Function {
2403
- InitialLoadFunction ()
2406
- name = "__core_load";
2407
- mask = COMP_FUNCTION_MASK;
2410
- b.type = OpTypeLoad;
2411
- b.noOffset[0] = "TEX output, fragment.texcoord[0], texture[0], 2D;";
2412
- b.noOffset[1] = "TEX output, fragment.texcoord[0], texture[0], RECT;";
2413
- b.offset[0] = "TEX output, __tmp_texcoord0, texture[0], 2D;";
2414
- b.offset[1] = "TEX output, __tmp_texcoord0, texture[0], RECT;";
2415
- data[0].body.push_back (b);
2419
- static InitialLoadFunction initialLoadFunction;
2422
- findFragmentFunction (GLScreen *s,
2425
- foreach (Function *f, s->fragmentStorage ()->functions)
2432
- findFragmentFunctionWithName (GLScreen *s,
2435
- foreach (Function *f, s->fragmentStorage ()->functions)
2436
- if (f->name.compare (name) == 0)
2442
- findFragmentProgram (GLScreen *s,
2443
- FunctionId *signature,
2444
- unsigned int nSignature)
2448
- foreach (Program *p, s->fragmentStorage ()->programs)
2450
- if (p->signature.size () != nSignature)
2453
- for (i = 0; i < nSignature; i++)
2454
- if (signature[i] != p->signature[i])
2457
- if (i == nSignature)
2463
- static unsigned int
2464
- functionMaskToType (int mask)
2467
- unsigned int type;
2468
- unsigned int mask;
2469
- } maskToType[] = {
2470
- { COMP_FUNCTION_TYPE_ARB, COMP_FUNCTION_ARB_MASK }
2475
- for (i = 0; i < sizeof (maskToType) / sizeof (maskToType[0]); i++)
2476
- if (mask & maskToType[i].mask)
2477
- return maskToType[i].type;
2483
- forEachDataOpInFunction (std::vector<Function *> list,
2487
- CompString loadOffset,
2490
- DataOpCallBack callBack)
2492
- Function *f = list[index];
2494
- bool colorDone = false;
2495
- bool blendDone = false;
2500
- foreach (BodyOp &bodyOp, f->data[type].body)
2502
- switch (bodyOp.type) {
2503
- case OpTypeFetch: {
2504
- CompString offset = loadOffset;
2507
- if (bodyOp.data.size ())
2509
- if (loadOffset.size ())
2511
- dataOp.type = OpTypeDataOffset;
2513
- compPrintf ("ADD __tmp_texcoord%d, %s, %s;",
2514
- index, loadOffset.c_str (),
2515
- bodyOp.data.c_str ());
2517
- callBack (&dataOp, index);
2519
- offset = compPrintf ("__tmp_texcoord%d", index);
2523
- offset = bodyOp.data;
2527
- forEachDataOpInFunction (list, index - 1, type,
2529
- offset, &colorDone, &blendDone,
2532
- if (bodyOp.dst.compare ("output"))
2534
- dataOp.type = OpTypeDataStore;
2536
- compPrintf ("MOV %s, output;", bodyOp.dst.c_str ());
2538
- /* move to destination */
2539
- callBack (&dataOp, index);
2543
- if (loadOffset.size ())
2545
- dataOp.type = OpTypeDataOffset;
2547
- compPrintf ("ADD __tmp_texcoord0, fragment.texcoord[0], %s;",
2548
- loadOffset.c_str ());
2550
- callBack (&dataOp, index);
2552
- dataOp.data = bodyOp.offset[loadTarget];
2556
- dataOp.data = bodyOp.noOffset[loadTarget];
2559
- dataOp.type = OpTypeData;
2561
- callBack (&dataOp, index);
2567
- dataOp.type = OpTypeData;
2569
- compPrintf ("MUL %s, fragment.color, %s;",
2570
- bodyOp.dst.c_str (),
2571
- bodyOp.src.c_str ());
2573
- callBack (&dataOp, index);
2575
- else if (bodyOp.dst.compare (bodyOp.src))
2577
- dataOp.type = OpTypeData;
2579
- compPrintf ("MOV %s, %s;",
2580
- bodyOp.dst.c_str (),
2581
- bodyOp.src.c_str ());
2583
- callBack (&dataOp, index);
2587
- case OpTypeDataBlend:
2589
- /* fall-through */
2591
- callBack (&bodyOp, index);
2593
- case OpTypeDataStore:
2594
- case OpTypeDataOffset:
2595
- case OpTypeHeaderTemp:
2596
- case OpTypeHeaderParam:
2597
- case OpTypeHeaderAttrib:
2610
- forEachHeaderOpWithType (std::vector<HeaderOp> list,
2613
- CompString prefix,
2614
- CompString functionPrefix,
2616
- DataOpCallBack callBack)
2620
- dataOp.type = OpTypeData;
2622
- foreach (HeaderOp &header, list)
2624
- if (header.type == type)
2628
- dataOp.data = ", ";
2632
- dataOp.data = prefix;
2635
- dataOp.data += functionPrefix;
2636
- dataOp.data += "_";
2637
- dataOp.data += header.name;
2639
- callBack (&dataOp, index);
2649
- forEachDataOp (std::vector<Function *> list,
2651
- DataOpCallBack callBack)
2656
- int count, nList = list.size ();
2658
- dataOp.type = OpTypeData;
2662
- dataOp.data = "TEMP output";
2664
- callBack (&dataOp, nList);
2666
- foreach (Function *f, list)
2667
- count = forEachHeaderOpWithType (f->data[type].header,
2668
- nList, OpTypeHeaderTemp,
2669
- "", f->name, count, callBack);
2671
- dataOp.data = ";";
2673
- callBack (&dataOp, nList);
2677
- foreach (Function *f, list)
2678
- count = forEachHeaderOpWithType (f->data[type].header,
2679
- nList, OpTypeHeaderParam,
2680
- "PARAM ", f->name, count,
2685
- dataOp.data = ";";
2687
- callBack (&dataOp, nList);
2692
- foreach (Function *f, list)
2693
- count = forEachHeaderOpWithType (f->data[type].header,
2694
- nList, OpTypeHeaderAttrib,
2695
- "ATTRIB ", f->name, count,
2700
- dataOp.data = ";";
2702
- callBack (&dataOp, nList);
2705
- forEachDataOpInFunction (list, nList - 1, type, 0, "",
2706
- &colorDone, &blendDone,
2710
- dataOp.data = "MOV result.color, output;END";
2712
- dataOp.data = "MUL result.color, fragment.color, output;END";
2714
- callBack (&dataOp, nList);
2720
- addFetchOffsetVariables (BodyOp *op,
2725
- if (op->type == OpTypeDataOffset)
2727
- if (!indices[index])
2729
- data->append (compPrintf ("TEMP __tmp_texcoord%d;", index));
2730
- indices[index] = true;
2736
- addData (BodyOp *op,
2739
- data->append (op->data);
2743
- buildFragmentProgram (GLScreen *s,
2744
- PrivateAttrib *attrib)
2747
- std::vector<Function *> functionList (1);
2748
- int mask = COMP_FUNCTION_MASK;
2752
- CompString fetchData;
2753
- bool indices[MAX_FRAGMENT_FUNCTIONS];
2756
- program = new Program ();
2760
- functionList[0] = &initialLoadFunction;
2762
- for (i = 0; i < attrib->nFunction; i++)
2764
- Function *f = findFragmentFunction (s, attrib->function[i]);
2767
- functionList.push_back (f);
2770
- foreach (Function *f, functionList)
2775
- compLogMessage ("opengl", CompLogLevelWarn,
2776
- "fragment functions can't be linked together "
2777
- "because a common type doesn't exist");
2780
- if (!mask || functionList.size () == 1)
2786
- for (i = 0; i < attrib->nFunction; i++)
2787
- program->signature.push_back (attrib->function[i]);
2789
- type = functionMaskToType (mask);
2791
- fetchData = "!!ARBfp1.0";
2793
- foreach (bool &val, indices)
2796
- forEachDataOp (functionList, type,
2797
- boost::bind (addFetchOffsetVariables, _1, _2, indices, &fetchData));
2799
- program->blending = forEachDataOp (functionList, type,
2800
- boost::bind (addData, _1, &fetchData));
2802
- program->type = GL_FRAGMENT_PROGRAM_ARB;
2806
- (*GL::genPrograms) (1, &program->name);
2807
- (*GL::bindProgram) (GL_FRAGMENT_PROGRAM_ARB, program->name);
2808
- (*GL::programString) (GL_FRAGMENT_PROGRAM_ARB,
2809
- GL_PROGRAM_FORMAT_ASCII_ARB,
2810
- fetchData.size (), fetchData.c_str ());
2812
- glGetIntegerv (GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
2813
- errorType = glGetError ();
2814
- if (errorType != GL_NO_ERROR || errorPos != -1)
2816
- compLogMessage ("opengl", CompLogLevelError,
2817
- "failed to load fragment program");
2819
- (*GL::deletePrograms) (1, &program->name);
2821
- program->name = 0;
2822
- program->type = 0;
2829
- getFragmentProgram (GLScreen *s,
2830
- PrivateAttrib *attrib,
2836
- if (!attrib->nFunction)
2839
- program = findFragmentProgram (s, attrib->function, attrib->nFunction);
2842
- program = buildFragmentProgram (s, attrib);
2845
- s->fragmentStorage ()->programs.push_back (program);
2851
- *type = program->type;
2852
- *blending = program->blending;
2854
- return program->name;
2861
- /* performs simple variable substitution */
2863
- copyData (std::vector<HeaderOp> header,
2864
- const CompString prefix,
2867
- CompString inPrefix (prefix);
2870
- foreach (HeaderOp &h, header)
2872
- size_t pos = data.find (h.name);
2873
- while (pos != std::string::npos)
2875
- bool prependPrefix = false;
2876
- /* It is possible to match parts of words here, so
2877
- * make sure that we have found the next chunk in the
2878
- * string and not just a header which matches
2879
- * part of another word */
2880
- if (data.size () > pos + h.name.size ())
2882
- const CompString &token = data.substr (pos + h.name.size (), 1);
2883
- if (token == "," ||
2887
- prependPrefix = true;
2891
- /* We matched part of another word as our
2892
- * token so search for the next whole
2894
- pos = data.find (h.name, pos + 1);
2899
- /* If this is the last word in the string, then it must
2900
- * have matched exactly our header op, so it is ok
2901
- * to prepend a prefix here and go straight to
2902
- * std::string::npos */
2903
- prependPrefix = true;
2906
- if (prependPrefix)
2908
- /* prepend the header op prefix to the header op
2909
- * and seek past this word to the next instance
2910
- * of the unprepended header op */
2911
- data.insert (pos, inPrefix);
2912
- pos += inPrefix.size () + h.name.size ();
2913
- pos = data.find (h.name, pos);
2921
- PrivateFunctionData::PrivateFunctionData (const PrivateFunctionData& src,
2922
- CompString dstPrefix) :
2923
- header (src.header),
2925
- status (src.status)
2928
- foreach (BodyOp b, src.body)
2931
- dst.type = b.type;
2935
- dst.dst = copyData (header, dstPrefix, b.dst);
2936
- if (b.data.size ())
2937
- dst.data = copyData (header, dstPrefix, b.data);
2941
- dst.target = b.target;
2944
- case OpTypeHeaderTemp:
2945
- case OpTypeHeaderParam:
2946
- case OpTypeHeaderAttrib:
2949
- case OpTypeDataBlend:
2950
- case OpTypeDataStore:
2951
- case OpTypeDataOffset:
2952
- dst.data = copyData (header, dstPrefix, b.data);
2955
- dst.dst = copyData (header, dstPrefix, b.dst);
2956
- dst.src = copyData (header, dstPrefix, b.src);
2959
- body.push_back (dst);
2964
- addHeaderOpToFunctionData (PrivateFunctionData *data,
2968
- static const char *reserved[] = {
2978
- CompString n (name);
2980
- foreach (const char *word, reserved)
2982
- if (n.find (word) != std::string::npos)
2984
- compLogMessage ("opengl", CompLogLevelWarn,
2985
- "%s is a reserved word", word);
2991
- header.type = type;
2993
- data->header.push_back (header);
2998
- FunctionData::FunctionData () :
2999
- priv (new PrivateFunctionData ())
3003
- FunctionData::~FunctionData ()
3009
- FunctionData::status ()
3011
- return priv->status;
3015
- FunctionData::addTempHeaderOp (const char *name)
3018
- addHeaderOpToFunctionData (priv, name, OpTypeHeaderTemp);
3022
- FunctionData::addParamHeaderOp (const char *name)
3025
- addHeaderOpToFunctionData (priv, name, OpTypeHeaderParam);
3029
- FunctionData::addAttribHeaderOp (const char *name)
3032
- addHeaderOpToFunctionData (priv, name, OpTypeHeaderAttrib);
3037
- FunctionData::addFetchOp (const char *dst, const char *offset, int target)
3041
- b.type = OpTypeFetch;
3042
- b.dst = CompString (dst);
3043
- b.target = target;
3046
- b.data = CompString (offset);
3048
- b.data = CompString ("");
3050
- priv->body.push_back (b);
3054
- FunctionData::addColorOp (const char *dst, const char *src)
3058
- b.type = OpTypeColor;
3059
- b.dst = CompString (dst);
3060
- b.src = CompString (src);
3062
- priv->body.push_back (b);
3066
- FunctionData::addDataOp (const char *str, ...)
3071
- b.type = OpTypeData;
3072
- va_start (ap, str);
3073
- b.data = compPrintf (str, ap);
3076
- priv->body.push_back (b);
3080
- FunctionData::addBlendOp (const char *str, ...)
3085
- b.type = OpTypeDataBlend;
3086
- va_start (ap, str);
3087
- b.data = compPrintf (str, ap);
3090
- priv->body.push_back (b);
3094
- FunctionData::createFragmentFunction (const char *name)
3096
- GLScreen *s = GLScreen::get (screen);
3097
- Function *function = new Function ();
3098
- CompString validName = name;
3099
- unsigned int i = 0;
3101
- while (findFragmentFunctionWithName (s, validName))
3103
- validName = compPrintf ("%s%d", name, i++);
3106
- function->data[COMP_FUNCTION_TYPE_ARB] =
3107
- PrivateFunctionData (*priv, validName);
3109
- function->name = validName;
3110
- function->mask = COMP_FUNCTION_ARB_MASK;
3111
- function->id = s->fragmentStorage ()->lastFunctionId++;
3113
- s->fragmentStorage ()->functions.push_back (function);
3115
- return function->id;
3118
- Attrib::Attrib (const GLWindowPaintAttrib &paint) :
3119
- priv (new PrivateAttrib ())
3121
- priv->opacity = paint.opacity;
3122
- priv->brightness = paint.brightness;
3123
- priv->saturation = paint.saturation;
3124
- priv->nTexture = 0;
3125
- priv->nFunction = 0;
3128
- foreach (FunctionId &f, priv->function)
3132
- Attrib::Attrib (const Attrib &fa) :
3133
- priv (new PrivateAttrib (*fa.priv))
3137
- Attrib::~Attrib ()
3143
- Attrib::operator= (const Attrib &rhs)
3145
- if (this == &rhs) // Check for self-assignment
3149
- priv = new PrivateAttrib (*rhs.priv);
3155
- Attrib::allocTextureUnits (unsigned int nTexture)
3157
- unsigned int first = priv->nTexture;
3159
- priv->nTexture += nTexture;
3161
- /* 0 is reserved for source texture */
3166
- Attrib::allocParameters (unsigned int nParam)
3168
- unsigned int first = priv->nParam;
3170
- priv->nParam += nParam;
3176
- Attrib::addFunction (FunctionId function)
3178
- if (priv->nFunction < MAX_FRAGMENT_FUNCTIONS)
3179
- priv->function[priv->nFunction++] = function;
3183
- Attrib::enable (bool *blending)
3187
- bool programBlending;
3189
- if (!GL::fragmentProgram)
3192
- name = getFragmentProgram (GLScreen::get (screen), priv, &type,
3193
- &programBlending);
3197
- *blending = !programBlending;
3199
- glEnable (GL_FRAGMENT_PROGRAM_ARB);
3201
- (*GL::bindProgram) (type, name);
3207
- Attrib::disable ()
3209
- glDisable (GL_FRAGMENT_PROGRAM_ARB);
3213
- Attrib::getSaturation ()
3215
- return priv->saturation;
3219
- Attrib::getBrightness ()
3221
- return priv->brightness;
3225
- Attrib::getOpacity ()
3227
- return priv->opacity;
3231
- Attrib::setSaturation (unsigned short value)
3233
- priv->saturation = value;
3237
- Attrib::setBrightness (unsigned short value)
3239
- priv->brightness = value;
3244
- Attrib::setOpacity (unsigned short value)
3246
- priv->opacity = value;
3250
- Attrib::hasFunctions ()
3252
- return priv->nFunction > 0;
3255
- void destroyFragmentFunction (FunctionId id)
3257
- GLScreen *s = GLScreen::get (screen);
3258
- Function *function;
3261
- function = findFragmentFunction (s, id);
3266
- std::vector<Program *>::iterator it;
3271
- it = s->fragmentStorage ()->programs.begin ();
3273
- for (; it != s->fragmentStorage ()->programs.end (); it++)
3275
- foreach (FunctionId i, (*it)->signature)
3289
- s->fragmentStorage ()->programs.erase (it);
3292
- } while (program);
3294
- std::vector<Function *>::iterator fi =
3295
- std::find (s->fragmentStorage ()->functions.begin (),
3296
- s->fragmentStorage ()->functions.end (),
3298
- if (fi != s->fragmentStorage ()->functions.end ())
3299
- s->fragmentStorage ()->functions.erase (fi);
3301
- delete (function);
3305
- getSaturateFragmentFunction (GLTexture *texture,
3309
- GLScreen *s = GLScreen::get (screen);
3314
- if (texture->target () == GL_TEXTURE_2D)
3315
- target = COMP_FETCH_TARGET_2D;
3317
- target = COMP_FETCH_TARGET_RECT;
3319
- if (!s->fragmentStorage ()->saturateFunction [target][param])
3321
- static const char *saturateData =
3322
- "MUL temp, output, { 1.0, 1.0, 1.0, 0.0 };"
3323
- "DP3 temp, temp, program.env[%d];"
3324
- "LRP output.xyz, program.env[%d].w, output, temp;";
3325
- FunctionData data;
3327
- data.addTempHeaderOp ("temp");
3328
- data.addFetchOp ("output", NULL, target);
3329
- data.addColorOp ("output", "output");
3331
- data.addDataOp (saturateData, param, param);
3333
- if (!data.status ())
3336
- s->fragmentStorage ()->saturateFunction [target][param] =
3337
- data.createFragmentFunction ("__core_saturate");
3341
- return s->fragmentStorage ()->saturateFunction [target][param];
3344
- Storage::Storage () :
3345
- lastFunctionId (1),
3349
- for (int i = 0; i < 64; i++)
3351
- saturateFunction[0][i] = 0;
3352
- saturateFunction[1][i] = 0;
3356
- Storage::~Storage ()
3358
- foreach (Program *p, programs)
3360
- programs.clear ();
3361
- foreach (Function *f, functions)
3363
- functions.clear ();
3367
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/framebufferobject.cpp linaro-gles2-debianpatches/plugins/opengl/src/framebufferobject.cpp
3368
--- compiz-0.9.7.8/plugins/opengl/src/framebufferobject.cpp 1970-01-01 01:00:00.000000000 +0100
3369
+++ linaro-gles2-debianpatches/plugins/opengl/src/framebufferobject.cpp 2012-04-20 11:41:59.241600000 +0200
3372
+ * Copyright (c) 2011 Collabora, Ltd.
3374
+ * Permission to use, copy, modify, distribute, and sell this software
3375
+ * and its documentation for any purpose is hereby granted without
3376
+ * fee, provided that the above copyright notice appear in all copies
3377
+ * and that both that copyright notice and this permission notice
3378
+ * appear in supporting documentation, and that the name of
3379
+ * Collabora Ltd. not be used in advertising or publicity pertaining to
3380
+ * distribution of the software without specific, written prior permission.
3381
+ * Collabora Ltd. makes no representations about the suitability of this
3382
+ * software for any purpose. It is provided "as is" without express or
3383
+ * implied warranty.
3385
+ * COLLABORA LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
3386
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
3387
+ * NO EVENT SHALL COLLABORA LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
3388
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
3389
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
3390
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
3391
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3393
+ * Authors: Pekka Paalanen <ppaalanen@gmail.com>
3397
+#include <opengl/framebufferobject.h>
3398
+#include <opengl/texture.h>
3400
+struct PrivateGLFramebufferObject
3402
+ PrivateGLFramebufferObject () :
3415
+ static std::map<GLuint, GLFramebufferObject *> idMap;
3418
+std::map<GLuint, GLFramebufferObject *> PrivateGLFramebufferObject::idMap;
3421
+PrivateGLFramebufferObject::pushFBO ()
3424
+ glGetIntegerv (GL_FRAMEBUFFER_BINDING, &id);
3426
+ if (tmpId == fboId)
3429
+ (*GL::bindFramebuffer) (GL_FRAMEBUFFER, fboId);
3433
+PrivateGLFramebufferObject::popFBO ()
3435
+ if (tmpId != fboId)
3436
+ (*GL::bindFramebuffer) (GL_FRAMEBUFFER, tmpId);
3439
+GLFramebufferObject::GLFramebufferObject () :
3440
+ priv (new PrivateGLFramebufferObject)
3442
+ (*GL::genFramebuffers) (1, &priv->fboId);
3443
+ if (priv->fboId != 0)
3444
+ PrivateGLFramebufferObject::idMap[priv->fboId] = this;
3447
+GLFramebufferObject::~GLFramebufferObject ()
3450
+ GLTexture::decRef (priv->glTex);
3452
+ PrivateGLFramebufferObject::idMap.erase (priv->fboId);
3453
+ (*GL::deleteFramebuffers) (1, &priv->fboId);
3459
+GLFramebufferObject::allocate (const CompSize &size, const char *image,
3460
+ GLenum format, GLenum type)
3462
+ if (!priv->glTex ||
3463
+ size.width () != priv->glTex->width () ||
3464
+ size.height () != priv->glTex->height ())
3467
+ GLTexture::decRef (priv->glTex);
3468
+ priv->glTex = NULL;
3470
+ GLTexture::List list = GLTexture::imageDataToTexture (image, size,
3472
+ if (list.size () != 1 || list[0] == NULL)
3475
+ priv->glTex = list[0];
3476
+ GLTexture::incRef (priv->glTex);
3480
+ (*GL::framebufferTexture2D) (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
3481
+ priv->glTex->target (),
3482
+ priv->glTex->name (), 0);
3487
+GLFramebufferObject *
3488
+GLFramebufferObject::bind ()
3490
+ GLFramebufferObject *old = NULL;
3493
+ glGetIntegerv (GL_FRAMEBUFFER_BINDING, &id);
3496
+ std::map<GLuint, GLFramebufferObject *>::iterator it;
3497
+ it = PrivateGLFramebufferObject::idMap.find (id);
3499
+ if (it != PrivateGLFramebufferObject::idMap.end ())
3502
+ compLogMessage ("opengl", CompLogLevelError,
3503
+ "An FBO without GLFramebufferObject cannot be restored");
3506
+ (*GL::bindFramebuffer) (GL_FRAMEBUFFER, priv->fboId);
3513
+GLFramebufferObject::rebind (GLFramebufferObject *fbo)
3515
+ GLuint id = fbo ? fbo->priv->fboId : 0;
3516
+ (*GL::bindFramebuffer) (GL_FRAMEBUFFER, id);
3519
+static const char *
3520
+getFboErrorString (GLint status)
3524
+ case GL_FRAMEBUFFER_COMPLETE:
3525
+ return "GL_FRAMEBUFFER_COMPLETE";
3526
+ case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
3527
+ return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
3528
+ case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
3529
+ return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
3531
+ case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
3532
+ return "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS";
3534
+ case GL_FRAMEBUFFER_UNSUPPORTED:
3535
+ return "GL_FRAMEBUFFER_UNSUPPORTED";
3537
+ return "unexpected status";
3542
+GLFramebufferObject::checkStatus ()
3545
+ GLint status = (*GL::checkFramebufferStatus) (GL_FRAMEBUFFER);
3548
+ if (status == GL_FRAMEBUFFER_COMPLETE)
3551
+ compLogMessage ("opengl", CompLogLevelError,
3552
+ "FBO is incomplete: %s (0x%04x)",
3553
+ getFboErrorString (status), status);
3558
+GLFramebufferObject::tex ()
3560
+ return priv->glTex;
3562
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/matrix.cpp linaro-gles2-debianpatches/plugins/opengl/src/matrix.cpp
3563
--- compiz-0.9.7.8/plugins/opengl/src/matrix.cpp 2012-04-26 08:47:01.000000000 +0200
3564
+++ linaro-gles2-debianpatches/plugins/opengl/src/matrix.cpp 2012-04-20 11:41:59.241600000 +0200
3565
@@ -163,6 +163,60 @@
3570
+** Invert 4x4 matrix.
3571
+** Contributed by David Moore (See Mesa bug #6748)
3573
+bool GLMatrix::invert ()
3575
+ float inv[16], det;
3578
+ inv[0] = m[5]*m[10]*m[15] - m[5]*m[11]*m[14] - m[9]*m[6]*m[15]
3579
+ + m[9]*m[7]*m[14] + m[13]*m[6]*m[11] - m[13]*m[7]*m[10];
3580
+ inv[4] = -m[4]*m[10]*m[15] + m[4]*m[11]*m[14] + m[8]*m[6]*m[15]
3581
+ - m[8]*m[7]*m[14] - m[12]*m[6]*m[11] + m[12]*m[7]*m[10];
3582
+ inv[8] = m[4]*m[9]*m[15] - m[4]*m[11]*m[13] - m[8]*m[5]*m[15]
3583
+ + m[8]*m[7]*m[13] + m[12]*m[5]*m[11] - m[12]*m[7]*m[9];
3584
+ inv[12] = -m[4]*m[9]*m[14] + m[4]*m[10]*m[13] + m[8]*m[5]*m[14]
3585
+ - m[8]*m[6]*m[13] - m[12]*m[5]*m[10] + m[12]*m[6]*m[9];
3586
+ inv[1] = -m[1]*m[10]*m[15] + m[1]*m[11]*m[14] + m[9]*m[2]*m[15]
3587
+ - m[9]*m[3]*m[14] - m[13]*m[2]*m[11] + m[13]*m[3]*m[10];
3588
+ inv[5] = m[0]*m[10]*m[15] - m[0]*m[11]*m[14] - m[8]*m[2]*m[15]
3589
+ + m[8]*m[3]*m[14] + m[12]*m[2]*m[11] - m[12]*m[3]*m[10];
3590
+ inv[9] = -m[0]*m[9]*m[15] + m[0]*m[11]*m[13] + m[8]*m[1]*m[15]
3591
+ - m[8]*m[3]*m[13] - m[12]*m[1]*m[11] + m[12]*m[3]*m[9];
3592
+ inv[13] = m[0]*m[9]*m[14] - m[0]*m[10]*m[13] - m[8]*m[1]*m[14]
3593
+ + m[8]*m[2]*m[13] + m[12]*m[1]*m[10] - m[12]*m[2]*m[9];
3594
+ inv[2] = m[1]*m[6]*m[15] - m[1]*m[7]*m[14] - m[5]*m[2]*m[15]
3595
+ + m[5]*m[3]*m[14] + m[13]*m[2]*m[7] - m[13]*m[3]*m[6];
3596
+ inv[6] = -m[0]*m[6]*m[15] + m[0]*m[7]*m[14] + m[4]*m[2]*m[15]
3597
+ - m[4]*m[3]*m[14] - m[12]*m[2]*m[7] + m[12]*m[3]*m[6];
3598
+ inv[10] = m[0]*m[5]*m[15] - m[0]*m[7]*m[13] - m[4]*m[1]*m[15]
3599
+ + m[4]*m[3]*m[13] + m[12]*m[1]*m[7] - m[12]*m[3]*m[5];
3600
+ inv[14] = -m[0]*m[5]*m[14] + m[0]*m[6]*m[13] + m[4]*m[1]*m[14]
3601
+ - m[4]*m[2]*m[13] - m[12]*m[1]*m[6] + m[12]*m[2]*m[5];
3602
+ inv[3] = -m[1]*m[6]*m[11] + m[1]*m[7]*m[10] + m[5]*m[2]*m[11]
3603
+ - m[5]*m[3]*m[10] - m[9]*m[2]*m[7] + m[9]*m[3]*m[6];
3604
+ inv[7] = m[0]*m[6]*m[11] - m[0]*m[7]*m[10] - m[4]*m[2]*m[11]
3605
+ + m[4]*m[3]*m[10] + m[8]*m[2]*m[7] - m[8]*m[3]*m[6];
3606
+ inv[11] = -m[0]*m[5]*m[11] + m[0]*m[7]*m[9] + m[4]*m[1]*m[11]
3607
+ - m[4]*m[3]*m[9] - m[8]*m[1]*m[7] + m[8]*m[3]*m[5];
3608
+ inv[15] = m[0]*m[5]*m[10] - m[0]*m[6]*m[9] - m[4]*m[1]*m[10]
3609
+ + m[4]*m[2]*m[9] + m[8]*m[1]*m[6] - m[8]*m[2]*m[5];
3611
+ det = m[0]*inv[0] + m[1]*inv[4] + m[2]*inv[8] + m[3]*inv[12];
3617
+ for (i = 0; i < 16; i++)
3618
+ m[i] = inv[i] * det;
3624
* Generate a 4x4 transformation matrix from glRotate parameters, and
3625
* post-multiply the input matrix by it.
3626
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/paint.cpp linaro-gles2-debianpatches/plugins/opengl/src/paint.cpp
3627
--- compiz-0.9.7.8/plugins/opengl/src/paint.cpp 2012-04-26 08:47:01.000000000 +0200
3628
+++ linaro-gles2-debianpatches/plugins/opengl/src/paint.cpp 2012-04-20 11:41:59.241600000 +0200
3631
* Copyright © 2005 Novell, Inc.
3632
+ * Copyright © 2011 Linaro, Ltd.
3634
* Permission to use, copy, modify, distribute, and sell this software
3635
* and its documentation for any purpose is hereby granted without
3637
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
3638
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3640
- * Author: David Reveman <davidr@novell.com>
3641
+ * Authors: David Reveman <davidr@novell.com>
3642
+ * Travis Watkins <travis.watkins@linaro.org>
3645
#include "privates.h"
3648
#include <opengl/opengl.h>
3650
+#include "privates.h"
3652
#define DEG2RAD (M_PI / 180.0f)
3654
GLScreenPaintAttrib defaultScreenPaintAttrib = {
3659
-PrivateGLScreen::paintBackground (const CompRegion ®ion,
3661
+PrivateGLScreen::paintBackground (const GLMatrix &transform,
3662
+ const CompRegion ®ion,
3665
+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
3666
+ GLfloat vertexData[18];
3667
+ GLushort colorData[4];
3669
BoxPtr pBox = const_cast <Region> (region.handle ())->rects;
3670
int n, nBox = const_cast <Region> (region.handle ())->numRects;
3673
- boost::scoped_array <GLfloat> data;
3677
@@ -97,86 +103,111 @@
3679
if (backgroundTextures.empty ())
3681
- data.reset (new GLfloat [nBox * 8]);
3684
+ streamingBuffer->begin (GL_TRIANGLES);
3694
+ vertexData[0] = pBox->x1;
3695
+ vertexData[1] = pBox->y1;
3696
+ vertexData[2] = 0.0f;
3697
+ vertexData[3] = pBox->x1;
3698
+ vertexData[4] = pBox->y2;
3699
+ vertexData[5] = 0.0f;
3700
+ vertexData[6] = pBox->x2;
3701
+ vertexData[7] = pBox->y1;
3702
+ vertexData[8] = 0.0f;
3703
+ vertexData[9] = pBox->x1;
3704
+ vertexData[10] = pBox->y2;
3705
+ vertexData[11] = 0.0f;
3706
+ vertexData[12] = pBox->x2;
3707
+ vertexData[13] = pBox->y2;
3708
+ vertexData[14] = 0.0f;
3710
+ vertexData[15] = pBox->x2;
3711
+ vertexData[16] = pBox->y1;
3712
+ vertexData[17] = 0.0f;
3719
+ streamingBuffer->addVertices (6, vertexData);
3724
- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
3726
- glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 2, &data[0]);
3727
+ colorData[0] = colorData[1] = colorData[2] = 0;
3728
+ colorData[3] = std::numeric_limits <unsigned short>::max ();
3729
+ streamingBuffer->addColors (1, colorData);
3731
- glColor4us (0, 0, 0, std::numeric_limits<unsigned short>::max ());
3732
- glDrawArrays (GL_QUADS, 0, nBox * 4);
3733
- glColor4usv (defaultColor);
3735
- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
3736
+ streamingBuffer->end ();
3737
+ streamingBuffer->render (transform);
3741
- data.reset (new GLfloat [nBox * 16]);
3746
for (unsigned int i = 0; i < backgroundTextures.size (); i++)
3748
+ GLfloat textureData[12];
3749
GLTexture *bg = backgroundTextures[i];
3750
CompRegion r = region & *bg;
3752
pBox = const_cast <Region> (r.handle ())->rects;
3753
nBox = const_cast <Region> (r.handle ())->numRects;
3757
+ streamingBuffer->begin (GL_TRIANGLES);
3761
- *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x1);
3762
- *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y2);
3767
- *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x2);
3768
- *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y2);
3773
- *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x2);
3774
- *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y1);
3775
+ GLfloat tx1 = COMP_TEX_COORD_X (bg->matrix (), pBox->x1);
3776
+ GLfloat tx2 = COMP_TEX_COORD_X (bg->matrix (), pBox->x2);
3777
+ GLfloat ty1 = COMP_TEX_COORD_Y (bg->matrix (), pBox->y1);
3778
+ GLfloat ty2 = COMP_TEX_COORD_Y (bg->matrix (), pBox->y2);
3780
+ vertexData[0] = pBox->x1;
3781
+ vertexData[1] = pBox->y1;
3782
+ vertexData[2] = 0.0f;
3783
+ vertexData[3] = pBox->x1;
3784
+ vertexData[4] = pBox->y2;
3785
+ vertexData[5] = 0.0f;
3786
+ vertexData[6] = pBox->x2;
3787
+ vertexData[7] = pBox->y1;
3788
+ vertexData[8] = 0.0f;
3789
+ vertexData[9] = pBox->x1;
3790
+ vertexData[10] = pBox->y2;
3791
+ vertexData[11] = 0.0f;
3792
+ vertexData[12] = pBox->x2;
3793
+ vertexData[13] = pBox->y2;
3794
+ vertexData[14] = 0.0f;
3796
+ vertexData[15] = pBox->x2;
3797
+ vertexData[16] = pBox->y1;
3798
+ vertexData[17] = 0.0f;
3800
+ textureData[0] = tx1;
3801
+ textureData[1] = ty1;
3803
+ textureData[2] = tx1;
3804
+ textureData[3] = ty2;
3806
+ textureData[4] = tx2;
3807
+ textureData[5] = ty1;
3809
+ textureData[6] = tx1;
3810
+ textureData[7] = ty2;
3814
+ textureData[8] = tx2;
3815
+ textureData[9] = ty2;
3817
- *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x1);
3818
- *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y1);
3819
+ textureData[10] = tx2;
3820
+ textureData[11] = ty1;
3824
+ streamingBuffer->addVertices (6, vertexData);
3825
+ streamingBuffer->addTexCoords (0, 6, textureData);
3830
- glTexCoordPointer (2, GL_FLOAT, sizeof (GLfloat) * 4, &data[0]);
3831
- glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 4, &data[2]);
3832
+ streamingBuffer->end ();
3838
bg->enable (GLTexture::Fast);
3840
- glDrawArrays (GL_QUADS, 0, nBox * 4);
3841
+ streamingBuffer->render (transform);
3846
CompositeWindow::get (fullscreenWindow)->unredirect ();
3848
if (!(mask & PAINT_SCREEN_NO_BACKGROUND_MASK))
3849
- paintBackground (tmpRegion, (mask & PAINT_SCREEN_TRANSFORMED_MASK));
3850
+ paintBackground (transform,
3852
+ (mask & PAINT_SCREEN_TRANSFORMED_MASK));
3854
/* paint all windows from bottom to top */
3858
WRAPABLE_HND_FUNCTN (glEnableOutputClipping, transform, region, output)
3861
GLdouble h = screen->height ();
3863
GLdouble p1[2] = { static_cast<GLdouble> (region.handle ()->extents.x1),
3865
glEnable (GL_CLIP_PLANE3);
3872
@@ -416,10 +451,12 @@
3874
WRAPABLE_HND_FUNCTN (glDisableOutputClipping)
3877
glDisable (GL_CLIP_PLANE0);
3878
glDisable (GL_CLIP_PLANE1);
3879
glDisable (GL_CLIP_PLANE2);
3880
glDisable (GL_CLIP_PLANE3);
3884
#define CLIP_PLANE_MASK (PAINT_SCREEN_TRANSFORMED_MASK | \
3885
@@ -449,26 +486,14 @@
3886
glEnableOutputClipping (sTransform, region, output);
3888
sTransform.toScreenSpace (output, -sAttrib.zTranslate);
3891
- glLoadMatrixf (sTransform.getMatrix ());
3893
priv->paintOutputRegion (sTransform, region, output, mask);
3897
glDisableOutputClipping ();
3901
sTransform.toScreenSpace (output, -sAttrib.zTranslate);
3904
- glLoadMatrixf (sTransform.getMatrix ());
3906
priv->paintOutputRegion (sTransform, region, output, mask);
3912
@@ -503,13 +528,8 @@
3914
sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
3917
- glLoadMatrixf (sTransform.getMatrix ());
3919
priv->paintOutputRegion (sTransform, region, output, mask);
3925
else if (mask & PAINT_SCREEN_FULL_MASK)
3926
@@ -525,182 +545,260 @@
3930
-#define ADD_RECT(data, m, n, x1, y1, x2, y2) \
3931
- for (it = 0; it < n; it++) \
3933
- const GLTexture::Matrix &mat = m[it]; \
3934
- *(data)++ = COMP_TEX_COORD_X (mat, x1); \
3935
- *(data)++ = COMP_TEX_COORD_Y (mat, y1); \
3937
- *(data)++ = (x1); \
3938
- *(data)++ = (y1); \
3939
- *(data)++ = 0.0; \
3940
- for (it = 0; it < n; it++) \
3942
- const GLTexture::Matrix &mat = m[it]; \
3943
- *(data)++ = COMP_TEX_COORD_X (mat, x1); \
3944
- *(data)++ = COMP_TEX_COORD_Y (mat, y2); \
3946
- *(data)++ = (x1); \
3947
- *(data)++ = (y2); \
3948
- *(data)++ = 0.0; \
3949
- for (it = 0; it < n; it++) \
3951
- const GLTexture::Matrix &mat = m[it]; \
3952
- *(data)++ = COMP_TEX_COORD_X (mat, x2); \
3953
- *(data)++ = COMP_TEX_COORD_Y (mat, y2); \
3955
- *(data)++ = (x2); \
3956
- *(data)++ = (y2); \
3957
- *(data)++ = 0.0; \
3958
- for (it = 0; it < n; it++) \
3960
- const GLTexture::Matrix &mat = m[it]; \
3961
- *(data)++ = COMP_TEX_COORD_X (mat, x2); \
3962
- *(data)++ = COMP_TEX_COORD_Y (mat, y1); \
3964
- *(data)++ = (x2); \
3965
- *(data)++ = (y1); \
3968
-#define ADD_QUAD(data, m, n, x1, y1, x2, y2) \
3969
- for (it = 0; it < n; it++) \
3971
- const GLTexture::Matrix &mat = m[it]; \
3972
- *(data)++ = COMP_TEX_COORD_XY (mat, x1, y1); \
3973
- *(data)++ = COMP_TEX_COORD_YX (mat, x1, y1); \
3975
- *(data)++ = (x1); \
3976
- *(data)++ = (y1); \
3977
- *(data)++ = 0.0; \
3978
- for (it = 0; it < n; it++) \
3980
- const GLTexture::Matrix &mat = m[it]; \
3981
- *(data)++ = COMP_TEX_COORD_XY (mat, x1, y2); \
3982
- *(data)++ = COMP_TEX_COORD_YX (mat, x1, y2); \
3984
- *(data)++ = (x1); \
3985
- *(data)++ = (y2); \
3986
- *(data)++ = 0.0; \
3987
- for (it = 0; it < n; it++) \
3989
- const GLTexture::Matrix &mat = m[it]; \
3990
- *(data)++ = COMP_TEX_COORD_XY (mat, x2, y2); \
3991
- *(data)++ = COMP_TEX_COORD_YX (mat, x2, y2); \
3993
- *(data)++ = (x2); \
3994
- *(data)++ = (y2); \
3995
- *(data)++ = 0.0; \
3996
- for (it = 0; it < n; it++) \
3998
- const GLTexture::Matrix &mat = m[it]; \
3999
- *(data)++ = COMP_TEX_COORD_XY (mat, x2, y1); \
4000
- *(data)++ = COMP_TEX_COORD_YX (mat, x2, y1); \
4002
- *(data)++ = (x2); \
4003
- *(data)++ = (y1); \
4007
-GLWindow::glDrawGeometry ()
4008
+GLScreen::glPaintCompositedOutput (const CompRegion ®ion,
4009
+ GLFramebufferObject *fbo,
4010
+ unsigned int mask)
4012
- WRAPABLE_HND_FUNCTN (glDrawGeometry)
4014
- int texUnit = priv->geometry.texUnits;
4015
- int currentTexUnit = 0;
4016
- int stride = priv->geometry.vertexStride;
4017
- GLfloat *vertices = priv->geometry.vertices + (stride - 3);
4018
+ WRAPABLE_HND_FUNCTN (glPaintCompositedOutput, region, fbo, mask)
4020
- stride *= sizeof (GLfloat);
4021
+ GLMatrix sTransform;
4022
+ std::vector<GLfloat> vertexData;
4023
+ std::vector<GLfloat> textureData;
4024
+ const GLTexture::Matrix & texmatrix = fbo->tex ()->matrix ();
4025
+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
4027
+ streamingBuffer->begin (GL_TRIANGLES);
4029
+ if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
4031
+ GLfloat tx1 = COMP_TEX_COORD_X (texmatrix, 0.0f);
4032
+ GLfloat tx2 = COMP_TEX_COORD_X (texmatrix, screen->width ());
4033
+ GLfloat ty1 = 1.0 - COMP_TEX_COORD_Y (texmatrix, 0.0f);
4034
+ GLfloat ty2 = 1.0 - COMP_TEX_COORD_Y (texmatrix, screen->height ());
4038
+ 0.0f, (float)screen->height (), 0.0f,
4039
+ (float)screen->width (), 0.0f, 0.0f,
4041
+ 0.0f, (float)screen->height (), 0.0f,
4042
+ (float)screen->width (), (float)screen->height (), 0.0f,
4043
+ (float)screen->width (), 0.0f, 0.0f,
4055
- glVertexPointer (3, GL_FLOAT, stride, vertices);
4058
+ streamingBuffer->addVertices (6, &vertexData[0]);
4059
+ streamingBuffer->addTexCoords (0, 6, &textureData[0]);
4063
- if (texUnit != currentTexUnit)
4064
+ BoxPtr pBox = const_cast <Region> (region.handle ())->rects;
4065
+ int nBox = const_cast <Region> (region.handle ())->numRects;
4069
- (*GL::clientActiveTexture) (GL_TEXTURE0_ARB + texUnit);
4070
- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
4071
- currentTexUnit = texUnit;
4072
+ GLfloat tx1 = COMP_TEX_COORD_X (texmatrix, pBox->x1);
4073
+ GLfloat tx2 = COMP_TEX_COORD_X (texmatrix, pBox->x2);
4074
+ GLfloat ty1 = 1.0 - COMP_TEX_COORD_Y (texmatrix, pBox->y1);
4075
+ GLfloat ty2 = 1.0 - COMP_TEX_COORD_Y (texmatrix, pBox->y2);
4078
+ (float)pBox->x1, (float)pBox->y1, 0.0f,
4079
+ (float)pBox->x1, (float)pBox->y2, 0.0f,
4080
+ (float)pBox->x2, (float)pBox->y1, 0.0f,
4082
+ (float)pBox->x1, (float)pBox->y2, 0.0f,
4083
+ (float)pBox->x2, (float)pBox->y2, 0.0f,
4084
+ (float)pBox->x2, (float)pBox->y1, 0.0f,
4096
+ streamingBuffer->addVertices (6, &vertexData[0]);
4097
+ streamingBuffer->addTexCoords (0, 6, &textureData[0]);
4100
- vertices -= priv->geometry.texCoordSize;
4101
- glTexCoordPointer (priv->geometry.texCoordSize,
4102
- GL_FLOAT, stride, vertices);
4105
- glDrawArrays (GL_QUADS, 0, priv->geometry.vCount);
4107
- /* disable all texture coordinate arrays except 0 */
4108
- texUnit = priv->geometry.texUnits;
4113
- (*GL::clientActiveTexture) (GL_TEXTURE0_ARB + texUnit);
4114
- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
4116
+ streamingBuffer->end ();
4117
+ fbo->tex ()-> enable (GLTexture::Fast);
4118
+ sTransform.toScreenSpace (&screen->fullscreenOutput (), -DEFAULT_Z_CAMERA);
4119
+ streamingBuffer->render (sTransform);
4120
+ fbo->tex ()-> disable ();
4123
- (*GL::clientActiveTexture) (GL_TEXTURE0_ARB);
4124
+#define ADD_RECT(vertexBuffer, m, n, x1, y1, x2, y2) \
4125
+ GLfloat vertexData[18] = { \
4126
+ (float)x1, (float)y1, 0.0, \
4127
+ (float)x1, (float)y2, 0.0, \
4128
+ (float)x2, (float)y1, 0.0, \
4129
+ (float)x2, (float)y1, 0.0, \
4130
+ (float)x1, (float)y2, 0.0, \
4131
+ (float)x2, (float)y2, 0.0 \
4133
+ vertexBuffer->addVertices (6, vertexData); \
4135
+ for (it = 0; it < n; it++) \
4137
+ GLfloat data[2]; \
4138
+ const GLTexture::Matrix &mat = m[it]; \
4139
+ data[0] = COMP_TEX_COORD_X (mat, x1); \
4140
+ data[1] = COMP_TEX_COORD_Y (mat, y1); \
4141
+ vertexBuffer->addTexCoords (it, 1, data); \
4143
+ for (it = 0; it < n; it++) \
4145
+ GLfloat data[2]; \
4146
+ const GLTexture::Matrix &mat = m[it]; \
4147
+ data[0] = COMP_TEX_COORD_X (mat, x1); \
4148
+ data[1] = COMP_TEX_COORD_Y (mat, y2); \
4149
+ vertexBuffer->addTexCoords (it, 1, data); \
4151
+ for (it = 0; it < n; it++) \
4153
+ GLfloat data[2]; \
4154
+ const GLTexture::Matrix &mat = m[it]; \
4155
+ data[0] = COMP_TEX_COORD_X (mat, x2); \
4156
+ data[1] = COMP_TEX_COORD_Y (mat, y1); \
4157
+ vertexBuffer->addTexCoords (it, 1, data); \
4159
+ for (it = 0; it < n; it++) \
4161
+ GLfloat data[2]; \
4162
+ const GLTexture::Matrix &mat = m[it]; \
4163
+ data[0] = COMP_TEX_COORD_X (mat, x2); \
4164
+ data[1] = COMP_TEX_COORD_Y (mat, y1); \
4165
+ vertexBuffer->addTexCoords (it, 1, data); \
4167
+ for (it = 0; it < n; it++) \
4169
+ GLfloat data[2]; \
4170
+ const GLTexture::Matrix &mat = m[it]; \
4171
+ data[0] = COMP_TEX_COORD_X (mat, x1); \
4172
+ data[1] = COMP_TEX_COORD_Y (mat, y2); \
4173
+ vertexBuffer->addTexCoords (it, 1, data); \
4175
+ for (it = 0; it < n; it++) \
4177
+ GLfloat data[2]; \
4178
+ const GLTexture::Matrix &mat = m[it]; \
4179
+ data[0] = COMP_TEX_COORD_X (mat, x2); \
4180
+ data[1] = COMP_TEX_COORD_Y (mat, y2); \
4181
+ vertexBuffer->addTexCoords (it, 1, data); \
4184
+#define ADD_QUAD(vertexBuffer, m, n, x1, y1, x2, y2) \
4185
+ GLfloat vertexData[18] = { \
4186
+ (float)x1, (float)y1, 0.0, \
4187
+ (float)x1, (float)y2, 0.0, \
4188
+ (float)x2, (float)y1, 0.0, \
4189
+ (float)x2, (float)y1, 0.0, \
4190
+ (float)x1, (float)y2, 0.0, \
4191
+ (float)x2, (float)y2, 0.0 \
4193
+ vertexBuffer->addVertices (6, vertexData); \
4195
+ for (it = 0; it < n; it++) \
4197
+ GLfloat data[2]; \
4198
+ const GLTexture::Matrix &mat = m[it]; \
4199
+ data[0] = COMP_TEX_COORD_XY (mat, x1, y1); \
4200
+ data[1] = COMP_TEX_COORD_YX (mat, x1, y1); \
4201
+ vertexBuffer->addTexCoords (it, 1, data); \
4203
+ for (it = 0; it < n; it++) \
4205
+ GLfloat data[2]; \
4206
+ const GLTexture::Matrix &mat = m[it]; \
4207
+ data[0] = COMP_TEX_COORD_XY (mat, x1, y2); \
4208
+ data[1] = COMP_TEX_COORD_YX (mat, x1, y2); \
4209
+ vertexBuffer->addTexCoords (it, 1, data); \
4211
+ for (it = 0; it < n; it++) \
4213
+ GLfloat data[2]; \
4214
+ const GLTexture::Matrix &mat = m[it]; \
4215
+ data[0] = COMP_TEX_COORD_XY (mat, x2, y1); \
4216
+ data[1] = COMP_TEX_COORD_YX (mat, x2, y1); \
4217
+ vertexBuffer->addTexCoords (it, 1, data); \
4219
+ for (it = 0; it < n; it++) \
4221
+ GLfloat data[2]; \
4222
+ const GLTexture::Matrix &mat = m[it]; \
4223
+ data[0] = COMP_TEX_COORD_XY (mat, x2, y1); \
4224
+ data[1] = COMP_TEX_COORD_YX (mat, x2, y1); \
4225
+ vertexBuffer->addTexCoords (it, 1, data); \
4227
+ for (it = 0; it < n; it++) \
4229
+ GLfloat data[2]; \
4230
+ const GLTexture::Matrix &mat = m[it]; \
4231
+ data[0] = COMP_TEX_COORD_XY (mat, x1, y2); \
4232
+ data[1] = COMP_TEX_COORD_YX (mat, x1, y2); \
4233
+ vertexBuffer->addTexCoords (it, 1, data); \
4235
+ for (it = 0; it < n; it++) \
4237
+ GLfloat data[2]; \
4238
+ const GLTexture::Matrix &mat = m[it]; \
4239
+ data[0] = COMP_TEX_COORD_XY (mat, x2, y2); \
4240
+ data[1] = COMP_TEX_COORD_YX (mat, x2, y2); \
4241
+ vertexBuffer->addTexCoords (it, 1, data); \
4247
-addSingleQuad (GLfloat *&d,
4248
- const GLTexture::MatrixList &matrix,
4249
- unsigned int nMatrix,
4256
+addSingleQuad (GLVertexBuffer *vertexBuffer,
4257
+ const GLTexture::MatrixList &matrix,
4258
+ unsigned int nMatrix,
4270
- ADD_RECT (d, matrix, nMatrix, x1, y1, x2, y2);
4271
+ ADD_RECT (vertexBuffer, matrix, nMatrix, x1, y1, x2, y2);
4275
- ADD_QUAD (d, matrix, nMatrix, x1, y1, x2, y2);
4276
+ ADD_QUAD (vertexBuffer, matrix, nMatrix, x1, y1, x2, y2);
4282
-addQuads (GLfloat *&d,
4283
- const GLTexture::MatrixList &matrix,
4284
- unsigned int nMatrix,
4292
- GLWindow::Geometry &geometry,
4293
- unsigned int maxGridWidth,
4294
- unsigned int maxGridHeight)
4295
+addQuads (GLVertexBuffer *vertexBuffer,
4296
+ const GLTexture::MatrixList &matrix,
4297
+ unsigned int nMatrix,
4304
+ unsigned int maxGridWidth,
4305
+ unsigned int maxGridHeight)
4307
int nQuadsX = (maxGridWidth == MAXSHORT) ? 1 :
4308
1 + (x2 - x1 - 1) / (int) maxGridWidth; // ceil. division
4309
int nQuadsY = (maxGridHeight == MAXSHORT) ? 1 :
4310
1 + (y2 - y1 - 1) / (int) maxGridHeight;
4311
- int newVertexSize = (n + nQuadsX * nQuadsY) * vSize * 4;
4313
- // Make sure enough vertices are allocated for nQuadsX * nQuadsY more quads
4314
- if (newVertexSize > geometry.vertexSize)
4316
- if (!geometry.moreVertices (newVertexSize))
4319
- d = geometry.vertices + (n * vSize * 4);
4322
if (nQuadsX == 1 && nQuadsY == 1)
4324
- addSingleQuad (d, matrix, nMatrix, x1, y1, x2, y2, n, rect);
4325
+ addSingleQuad (vertexBuffer, matrix, nMatrix, x1, y1, x2, y2, n, rect);
4331
nx2 = MIN (nx1 + (int) quadWidth, x2);
4333
- addSingleQuad (d, matrix, nMatrix, nx1, ny1, nx2, ny2, n, rect);
4334
+ addSingleQuad (vertexBuffer, matrix, nMatrix,
4335
+ nx1, ny1, nx2, ny2, n, rect);
4339
@@ -729,13 +828,11 @@
4340
unsigned int maxGridWidth,
4341
unsigned int maxGridHeight)
4343
- WRAPABLE_HND_FUNCTN (glAddGeometry, matrix, region, clip)
4344
+ WRAPABLE_HND_FUNCTN (glAddGeometry, matrix, region, clip, maxGridWidth, maxGridHeight)
4347
int nMatrix = matrix.size ();
4349
- priv->geometry.texUnits = nMatrix;
4351
full = clip.handle ()->extents;
4352
if (region.handle ()->extents.x1 > full.x1)
4353
full.x1 = region.handle ()->extents.x1;
4359
int n, it, x1, y1, x2, y2;
4363
for (it = 0; it < nMatrix; it++)
4364
@@ -770,18 +865,6 @@
4365
pBox = const_cast <Region> (region.handle ())->rects;
4366
nBox = const_cast <Region> (region.handle ())->numRects;
4368
- vSize = 3 + nMatrix * 2;
4370
- n = priv->geometry.vCount / 4;
4372
- if ((n + nBox) * vSize * 4 > priv->geometry.vertexSize)
4374
- if (!priv->geometry.moreVertices ((n + nBox) * vSize * 4))
4378
- d = priv->geometry.vertices + (priv->geometry.vCount * vSize);
4383
@@ -806,24 +889,15 @@
4387
- addQuads (d, matrix, nMatrix,
4388
+ addQuads (priv->vertexBuffer, matrix, nMatrix,
4390
- n, vSize, rect, priv->geometry,
4392
maxGridWidth, maxGridHeight);
4396
pClip = const_cast <Region> (clip.handle ())->rects;
4398
- if (((n + nClip) * vSize * 4) > priv->geometry.vertexSize)
4400
- if (!priv->geometry.moreVertices ((n + nClip) *
4404
- d = priv->geometry.vertices + (n * vSize * 4);
4410
@@ -841,120 +915,32 @@
4412
if (cbox.x1 < cbox.x2 && cbox.y1 < cbox.y2)
4414
- addQuads (d, matrix, nMatrix,
4415
+ addQuads (priv->vertexBuffer, matrix, nMatrix,
4416
cbox.x1, cbox.y1, cbox.x2, cbox.y2,
4417
- n, vSize, rect, priv->geometry,
4419
maxGridWidth, maxGridHeight);
4426
- priv->geometry.vCount = n * 4;
4427
- priv->geometry.vertexStride = vSize;
4428
- priv->geometry.texCoordSize = 2;
4433
-enableFragmentProgramAndDrawGeometry (GLScreen *gs,
4435
- GLTexture *texture,
4436
- GLFragment::Attrib &attrib,
4437
- GLTexture::Filter filter,
4438
- unsigned int mask)
4440
- GLFragment::Attrib fa (attrib);
4443
- if (GL::canDoSaturated && attrib.getSaturation () != COLOR)
4445
- int param, function;
4447
- param = fa.allocParameters (1);
4449
- GLFragment::getSaturateFragmentFunction (texture, param);
4451
- fa.addFunction (function);
4453
- (*GL::programEnvParameter4f) (GL_FRAGMENT_PROGRAM_ARB, param,
4454
- RED_SATURATION_WEIGHT,
4455
- GREEN_SATURATION_WEIGHT,
4456
- BLUE_SATURATION_WEIGHT,
4457
- attrib.getSaturation () / 65535.0f);
4460
- if (!fa.enable (&blending))
4463
- texture->enable (filter);
4465
- if (mask & PAINT_WINDOW_BLEND_MASK)
4468
- glEnable (GL_BLEND);
4470
- if (attrib.getOpacity () != OPAQUE || attrib.getBrightness () != BRIGHT)
4474
- color = (attrib.getOpacity () * attrib.getBrightness ()) >> 16;
4476
- gs->setTexEnvMode (GL_MODULATE);
4477
- glColor4us (color, color, color, attrib.getOpacity ());
4479
- w->glDrawGeometry ();
4481
- glColor4usv (defaultColor);
4482
- gs->setTexEnvMode (GL_REPLACE);
4486
- w->glDrawGeometry ();
4490
- glDisable (GL_BLEND);
4492
- else if (attrib.getBrightness () != BRIGHT)
4494
- gs->setTexEnvMode (GL_MODULATE);
4495
- glColor4us (attrib.getBrightness (), attrib.getBrightness (),
4496
- attrib.getBrightness (), BRIGHT);
4498
- w->glDrawGeometry ();
4500
- glColor4usv (defaultColor);
4501
- gs->setTexEnvMode (GL_REPLACE);
4505
- w->glDrawGeometry ();
4508
- texture->disable ();
4517
-enableFragmentOperationsAndDrawGeometry (GLScreen *gs,
4519
- GLTexture *texture,
4520
- GLFragment::Attrib &attrib,
4521
- GLTexture::Filter filter,
4522
- unsigned int mask)
4523
+enableLegacyOBSAndRender (GLScreen *gs,
4525
+ GLTexture *texture,
4526
+ const GLMatrix &transform,
4527
+ const GLWindowPaintAttrib &attrib,
4528
+ GLTexture::Filter filter,
4529
+ unsigned int mask)
4531
- if (GL::canDoSaturated && attrib.getSaturation () != COLOR)
4532
+ if (GL::canDoSaturated && attrib.saturation != COLOR)
4534
GLfloat constant[4];
4536
- if (mask & PAINT_WINDOW_BLEND_MASK)
4537
- glEnable (GL_BLEND);
4539
texture->enable (filter);
4541
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
4543
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
4544
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
4546
- if (GL::canDoSlightlySaturated && attrib.getSaturation () > 0)
4547
+ if (GL::canDoSlightlySaturated && attrib.saturation > 0)
4549
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
4550
glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
4551
@@ -1016,20 +1002,20 @@
4552
glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
4553
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
4555
- constant[3] = attrib.getSaturation () / 65535.0f;
4556
+ constant[3] = attrib.saturation / 65535.0f;
4558
glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
4560
- if (attrib.getOpacity () < OPAQUE ||
4561
- attrib.getBrightness () != BRIGHT)
4562
+ if (attrib.opacity < OPAQUE ||
4563
+ attrib.brightness != BRIGHT)
4565
GL::activeTexture (GL_TEXTURE3_ARB);
4567
texture->enable (filter);
4569
- constant[3] = attrib.getOpacity () / 65535.0f;
4570
+ constant[3] = attrib.opacity / 65535.0f;
4571
constant[0] = constant[1] = constant[2] = constant[3] *
4572
- attrib.getBrightness () / 65535.0f;
4573
+ attrib.brightness / 65535.0f;
4575
glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
4577
@@ -1047,7 +1033,7 @@
4578
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
4579
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
4581
- w->glDrawGeometry ();
4582
+ w->vertexBuffer ()->render (transform, attrib);
4584
texture->disable ();
4586
@@ -1057,7 +1043,7 @@
4590
- w->glDrawGeometry ();
4591
+ w->vertexBuffer ()->render (transform, attrib);
4594
texture->disable ();
4595
@@ -1074,9 +1060,9 @@
4596
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
4597
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
4599
- constant[3] = attrib.getOpacity () / 65535.0f;
4600
+ constant[3] = attrib.opacity / 65535.0f;
4601
constant[0] = constant[1] = constant[2] = constant[3] *
4602
- attrib.getBrightness ()/ 65535.0f;
4603
+ attrib.brightness / 65535.0f;
4605
constant[0] = 0.5f + 0.5f * RED_SATURATION_WEIGHT * constant[0];
4606
constant[1] = 0.5f + 0.5f * GREEN_SATURATION_WEIGHT * constant[1];
4607
@@ -1084,7 +1070,7 @@
4609
glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
4611
- w->glDrawGeometry ();
4612
+ w->vertexBuffer ()->render (transform, attrib);
4615
texture->disable ();
4616
@@ -1097,9 +1083,6 @@
4618
glColor4usv (defaultColor);
4619
gs->setTexEnvMode (GL_REPLACE);
4621
- if (mask & PAINT_WINDOW_BLEND_MASK)
4622
- glDisable (GL_BLEND);
4626
@@ -1107,57 +1090,64 @@
4628
if (mask & PAINT_WINDOW_BLEND_MASK)
4630
- glEnable (GL_BLEND);
4631
- if (attrib.getOpacity ()!= OPAQUE ||
4632
- attrib.getBrightness () != BRIGHT)
4633
+ if (attrib.opacity != OPAQUE ||
4634
+ attrib.brightness != BRIGHT)
4638
- color = (attrib.getOpacity () * attrib.getBrightness ()) >> 16;
4639
+ color = (attrib.opacity * attrib.brightness) >> 16;
4641
gs->setTexEnvMode (GL_MODULATE);
4642
- glColor4us (color, color, color, attrib.getOpacity ());
4643
+ glColor4us (color, color, color, attrib.opacity);
4645
- w->glDrawGeometry ();
4646
+ w->vertexBuffer ()->render (transform, attrib);
4648
glColor4usv (defaultColor);
4649
gs->setTexEnvMode (GL_REPLACE);
4653
- w->glDrawGeometry ();
4654
+ w->vertexBuffer ()->render (transform, attrib);
4657
- glDisable (GL_BLEND);
4659
- else if (attrib.getBrightness () != BRIGHT)
4660
+ else if (attrib.brightness != BRIGHT)
4662
gs->setTexEnvMode (GL_MODULATE);
4663
- glColor4us (attrib.getBrightness (), attrib.getBrightness (),
4664
- attrib.getBrightness (), BRIGHT);
4665
+ glColor4us (attrib.brightness, attrib.brightness,
4666
+ attrib.brightness, BRIGHT);
4668
- w->glDrawGeometry ();
4669
+ w->vertexBuffer ()->render (transform, attrib);
4671
glColor4usv (defaultColor);
4672
gs->setTexEnvMode (GL_REPLACE);
4676
- w->glDrawGeometry ();
4677
+ w->vertexBuffer ()->render (transform, attrib);
4680
texture->disable ();
4686
-GLWindow::glDrawTexture (GLTexture *texture,
4687
- GLFragment::Attrib &attrib,
4688
- unsigned int mask)
4689
+GLWindow::glDrawTexture (GLTexture *texture,
4690
+ const GLMatrix &transform,
4691
+ const GLWindowPaintAttrib &attrib,
4692
+ unsigned int mask)
4694
- WRAPABLE_HND_FUNCTN (glDrawTexture, texture, attrib, mask)
4695
+ WRAPABLE_HND_FUNCTN (glDrawTexture, texture, transform, attrib, mask)
4697
GLTexture::Filter filter;
4698
+ GLboolean isBlendingEnabled = GL_FALSE;
4700
+ // Enable blending if needed
4701
+ if (mask & PAINT_WINDOW_BLEND_MASK) {
4702
+ glGetBooleanv (GL_BLEND, &isBlendingEnabled);
4703
+ if (!isBlendingEnabled)
4704
+ glEnable(GL_BLEND);
4707
if (mask & (PAINT_WINDOW_TRANSFORMED_MASK |
4708
PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK))
4709
@@ -1165,24 +1155,36 @@
4711
filter = priv->gScreen->filter (NOTHING_TRANS_FILTER);
4713
- if ((!attrib.hasFunctions () && (!priv->gScreen->lighting () ||
4714
- attrib.getSaturation () == COLOR || attrib.getSaturation () == 0)) ||
4715
- !enableFragmentProgramAndDrawGeometry (priv->gScreen, this, texture,
4716
- attrib, filter, mask))
4718
- enableFragmentOperationsAndDrawGeometry (priv->gScreen, this, texture,
4719
- attrib, filter, mask);
4721
+ glActiveTexture(GL_TEXTURE0);
4722
+ texture->enable (filter);
4725
+ priv->vertexBuffer->render (transform, attrib);
4728
+ if (!GL::vbo && !GL::shaders)
4729
+ enableLegacyOBSAndRender (priv->gScreen, this, texture, transform,
4730
+ attrib, filter, mask);
4732
+ priv->vertexBuffer->render (transform, attrib);
4735
+ priv->shaders.clear ();
4736
+ texture->disable ();
4738
+ // Reset blending to old value
4739
+ if ((mask & PAINT_WINDOW_BLEND_MASK) && !isBlendingEnabled)
4740
+ glDisable(GL_BLEND);
4744
-GLWindow::glDraw (const GLMatrix &transform,
4745
- GLFragment::Attrib &fragment,
4746
- const CompRegion ®ion,
4747
- unsigned int mask)
4748
+GLWindow::glDraw (const GLMatrix &transform,
4749
+ const GLWindowPaintAttrib &attrib,
4750
+ const CompRegion ®ion,
4751
+ unsigned int mask)
4753
WRAPABLE_HND_FUNCTN_RETURN (bool, glDraw, transform,
4754
- fragment, region, mask)
4755
+ attrib, region, mask)
4757
const CompRegion ® = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ?
4758
infiniteRegion : region;
4759
@@ -1213,10 +1215,11 @@
4760
if (priv->textures.size () == 1)
4762
ml[0] = priv->matrices[0];
4763
- priv->geometry.reset ();
4764
+ priv->vertexBuffer->begin ();
4765
glAddGeometry (ml, priv->window->region (), reg);
4766
- if (priv->geometry.vCount)
4767
- glDrawTexture (priv->textures[0], fragment, mask);
4768
+ priv->vertexBuffer->end ();
4770
+ glDrawTexture (priv->textures[0], transform, attrib, mask);
4774
@@ -1225,10 +1228,11 @@
4775
for (unsigned int i = 0; i < priv->textures.size (); i++)
4777
ml[0] = priv->matrices[i];
4778
- priv->geometry.reset ();
4779
+ priv->vertexBuffer->begin ();
4780
glAddGeometry (ml, priv->regions[i], reg);
4781
- if (priv->geometry.vCount)
4782
- glDrawTexture (priv->textures[i], fragment, mask);
4783
+ priv->vertexBuffer->end ();
4785
+ glDrawTexture (priv->textures[i], transform, attrib, mask);
4789
@@ -1243,7 +1247,6 @@
4791
WRAPABLE_HND_FUNCTN_RETURN (bool, glPaint, attrib, transform, region, mask)
4793
- GLFragment::Attrib fragment (attrib);
4796
priv->lastPaint = attrib;
4797
@@ -1273,18 +1276,7 @@
4798
if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK)
4801
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK ||
4802
- mask & PAINT_WINDOW_WITH_OFFSET_MASK)
4805
- glLoadMatrixf (transform.getMatrix ());
4808
- status = glDraw (transform, fragment, region, mask);
4810
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK ||
4811
- mask & PAINT_WINDOW_WITH_OFFSET_MASK)
4813
+ status = glDraw (transform, attrib, region, mask);
4817
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/privatefragment.h linaro-gles2-debianpatches/plugins/opengl/src/privatefragment.h
4818
--- compiz-0.9.7.8/plugins/opengl/src/privatefragment.h 2012-04-26 08:47:01.000000000 +0200
4819
+++ linaro-gles2-debianpatches/plugins/opengl/src/privatefragment.h 1970-01-01 01:00:00.000000000 +0100
4822
- * Copyright © 2008 Dennis Kasprzyk
4823
- * Copyright © 2007 Novell, Inc.
4825
- * Permission to use, copy, modify, distribute, and sell this software
4826
- * and its documentation for any purpose is hereby granted without
4827
- * fee, provided that the above copyright notice appear in all copies
4828
- * and that both that copyright notice and this permission notice
4829
- * appear in supporting documentation, and that the name of
4830
- * Dennis Kasprzyk not be used in advertising or publicity pertaining to
4831
- * distribution of the software without specific, written prior permission.
4832
- * Dennis Kasprzyk makes no representations about the suitability of this
4833
- * software for any purpose. It is provided "as is" without express or
4834
- * implied warranty.
4836
- * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
4837
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
4838
- * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
4839
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
4840
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
4841
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
4842
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4844
- * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
4845
- * David Reveman <davidr@novell.com>
4848
-#ifndef _PRIVATEFRAGMENT_H
4849
-#define _PRIVATEFRAGMENT_H
4853
-#include <opengl/fragment.h>
4855
-namespace GLFragment {
4866
- int lastFunctionId;
4867
- std::vector<Function *> functions;
4868
- std::vector<Program *> programs;
4870
- FunctionId saturateFunction[2][64];
4875
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/privates.h linaro-gles2-debianpatches/plugins/opengl/src/privates.h
4876
--- compiz-0.9.7.8/plugins/opengl/src/privates.h 2012-04-26 08:47:01.000000000 +0200
4877
+++ linaro-gles2-debianpatches/plugins/opengl/src/privates.h 2012-04-20 11:41:59.241600000 +0200
4879
#include <opengl/opengl.h>
4880
#include <core/atoms.h>
4882
-#include "privatefragment.h"
4884
+#include <opengl/framebufferobject.h>
4887
#include "privatetexture.h"
4888
+#include "privatevertexbuffer.h"
4889
#include "opengl_options.h"
4891
extern CompOutput *targetOutput;
4893
void controlSwapVideoSync ();
4894
void waitForVideoSync ();
4896
- void paintBackground (const CompRegion ®ion,
4897
- bool transformed);
4898
+ void paintBackground (const GLMatrix &transform,
4899
+ const CompRegion ®ion,
4900
+ bool transformed);
4902
void paintOutputRegion (const GLMatrix &transform,
4903
const CompRegion ®ion,
4906
GLenum textureFilter;
4909
GLFBConfig glxPixmapFBConfigs[MAX_DEPTH + 1];
4912
GLTexture::List backgroundTextures;
4913
bool backgroundLoaded;
4914
@@ -103,28 +110,41 @@
4916
CompPoint rasterPos;
4918
- GLFragment::Storage fragmentStorage;
4920
- GLfloat projection[16];
4921
+ GLMatrix *projection;
4926
- GL::GLXGetProcAddressProc getProcAddress;
4930
+ EGLSurface surface;
4934
+ GL::GLXGetProcAddressProc getProcAddress;
4937
+ GLFramebufferObject *scratchFbo;
4938
CompRegion outputRegion;
4940
bool pendingCommands;
4942
XRectangle lastViewport;
4943
+ bool refreshSubBuffer;
4944
+ unsigned int lastMask;
4946
std::vector<GLTexture::BindPixmapProc> bindPixmap;
4947
bool hasCompositing;
4951
+ Window saveWindow; // hack for broken applications, see:
4952
+ // https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/807487
4954
+ GLProgramCache *programCache;
4955
+ GLShaderCache shaderCache;
4956
+ GLVertexBuffer::AutoProgram *autoProgram;
4958
Pixmap rootPixmapCopy;
4959
CompSize rootPixmapSize;
4961
@@ -169,10 +189,15 @@
4963
unsigned int lastMask;
4965
- GLWindow::Geometry geometry;
4966
+ GLVertexBuffer *vertexBuffer;
4968
+ // map of shaders, plugin name is key, pair of vertex and fragment
4969
+ // shader source code is value
4970
+ std::list<const GLShaderData*> shaders;
4971
+ GLVertexBuffer::AutoProgram *autoProgram;
4973
std::list<GLIcon> icons;
4979
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/privatetexture.h linaro-gles2-debianpatches/plugins/opengl/src/privatetexture.h
4980
--- compiz-0.9.7.8/plugins/opengl/src/privatetexture.h 2012-04-26 08:47:01.000000000 +0200
4981
+++ linaro-gles2-debianpatches/plugins/opengl/src/privatetexture.h 2012-04-20 11:41:59.241600000 +0200
4984
* Copyright © 2008 Dennis Kasprzyk
4985
* Copyright © 2007 Novell, Inc.
4986
+ * Copyright © 2011 Linaro Ltd.
4988
* Permission to use, copy, modify, distribute, and sell this software
4989
* and its documentation for any purpose is hereby granted without
4992
* Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
4993
* David Reveman <davidr@novell.com>
4994
+ * Travis Watkins <travis.watkins@linaro.org>
4997
#ifndef _PRIVATETEXTURE_H
4998
#define _PRIVATETEXTURE_H
5001
+#define SUPPORT_X11
5002
+#include <GLES2/gl2.h>
5003
+#include <EGL/egl.h>
5004
+#include <EGL/eglext.h>
5009
#include <opengl/texture.h>
5010
#include <X11/extensions/Xdamage.h>
5017
+class EglTexture : public GLTexture {
5022
+ void enable (Filter filter);
5024
+ static List bindPixmapToTexture (Pixmap pixmap,
5032
+ bool updateMipMap;
5035
+extern std::map<Damage, EglTexture*> boundPixmapTex;
5038
class TfpTexture : public GLTexture {
5044
extern std::map<Damage, TfpTexture*> boundPixmapTex;
5048
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/privatevertexbuffer.h linaro-gles2-debianpatches/plugins/opengl/src/privatevertexbuffer.h
5049
--- compiz-0.9.7.8/plugins/opengl/src/privatevertexbuffer.h 1970-01-01 01:00:00.000000000 +0100
5050
+++ linaro-gles2-debianpatches/plugins/opengl/src/privatevertexbuffer.h 2012-04-20 11:41:59.241600000 +0200
5053
+ * Copyright © 2011 Linaro Ltd.
5055
+ * Permission to use, copy, modify, distribute, and sell this software
5056
+ * and its documentation for any purpose is hereby granted without
5057
+ * fee, provided that the above copyright notice appear in all copies
5058
+ * and that both that copyright notice and this permission notice
5059
+ * appear in supporting documentation, and that the name of
5060
+ * Linaro Ltd. not be used in advertising or publicity pertaining to
5061
+ * distribution of the software without specific, written prior permission.
5062
+ * Linaro Ltd. makes no representations about the suitability of this
5063
+ * software for any purpose. It is provided "as is" without express or
5064
+ * implied warranty.
5066
+ * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
5067
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
5068
+ * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
5069
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
5070
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
5071
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
5072
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
5074
+ * Authors: Travis Watkins <travis.watkins@linaro.org>
5075
+ * Frederic Plourde <frederic.plourde@collabora.co.uk>
5078
+#ifndef _VERTEXBUFFER_PRIVATE_H
5079
+#define _VERTEXBUFFER_PRIVATE_H
5082
+#include <GLES2/gl2.h>
5087
+#include <opengl/program.h>
5088
+#include <typeinfo>
5090
+class GLVertexBuffer;
5092
+class AbstractUniform
5095
+ void virtual set(GLProgram* program) = 0;
5098
+template < typename T, int C >
5099
+class Uniform: public AbstractUniform
5102
+ Uniform(const char *_name, ... );
5103
+ void set(GLProgram* program);
5110
+template < typename T, int C >
5111
+Uniform< T, C >::Uniform(const char *_name, ... )
5114
+ va_start( arg_list, _name );
5116
+ for( int i = 0; i < C; i++ )
5117
+ a[i] = va_arg( arg_list, T );
5118
+ va_end( arg_list );
5121
+template < typename T, int C >
5122
+void Uniform< T, C >::set(GLProgram* prog)
5124
+ const char* n = name.c_str();
5126
+ // This will only get called from privateVertexBuffer::render
5127
+ // so we know we've got a valid, bound program here
5128
+ if (typeid(a[0]) == typeid(double))
5132
+ case 1: prog->setUniform (n, (GLfloat) a[0]); break;
5133
+ case 2: prog->setUniform2f (n, a[0], a[1]); break;
5134
+ case 3: prog->setUniform3f (n, a[0], a[1], a[2]); break;
5135
+ case 4: prog->setUniform4f (n, a[0], a[1], a[2], a[3]); break;
5137
+ } else if (typeid(a[0]) == typeid(int))
5141
+ case 1: prog->setUniform (n, (GLint) a[0]); break;
5142
+ case 2: prog->setUniform2i (n, a[0], a[1]); break;
5143
+ case 3: prog->setUniform3i (n, a[0], a[1], a[2]); break;
5144
+ case 4: prog->setUniform4i (n, a[0], a[1], a[2], a[3]); break;
5148
+ compLogMessage ("opengl", CompLogLevelError, "Unknown uniform type!");
5152
+class GLVertexBuffer;
5154
+class PrivateVertexBuffer
5157
+ PrivateVertexBuffer ();
5158
+ ~PrivateVertexBuffer ();
5160
+ int render (const GLMatrix *projection,
5161
+ const GLMatrix *modelview,
5162
+ const GLWindowPaintAttrib *attrib);
5163
+ int legacyRender (const GLMatrix &projection,
5164
+ const GLMatrix &modelview,
5165
+ const GLWindowPaintAttrib &attrib);
5168
+ static GLVertexBuffer *streamingBuffer;
5170
+ std::vector<GLfloat> vertexData;
5171
+ std::vector<GLfloat> normalData;
5172
+ std::vector<GLfloat> colorData;
5173
+ std::vector<std::vector<GLfloat> > textureData;
5175
+ GLProgram *program;
5176
+ GLenum primitiveType;
5179
+ GLuint vertexBuffer;
5180
+ GLuint normalBuffer;
5181
+ GLuint colorBuffer;
5182
+ GLuint textureBuffers[4];
5183
+ std::vector<AbstractUniform*> uniforms;
5185
+ GLVertexBuffer::AutoProgram *autoProgram;
5188
+#endif //_VERTEXBUFFER_PRIVATE_H
5190
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/programcache.cpp linaro-gles2-debianpatches/plugins/opengl/src/programcache.cpp
5191
--- compiz-0.9.7.8/plugins/opengl/src/programcache.cpp 1970-01-01 01:00:00.000000000 +0100
5192
+++ linaro-gles2-debianpatches/plugins/opengl/src/programcache.cpp 2012-04-20 11:41:59.241600000 +0200
5195
+ * Copyright © 2011 Linaro Ltd.
5197
+ * Permission to use, copy, modify, distribute, and sell this software
5198
+ * and its documentation for any purpose is hereby granted without
5199
+ * fee, provided that the above copyright notice appear in all copies
5200
+ * and that both that copyright notice and this permission notice
5201
+ * appear in supporting documentation, and that the name of
5202
+ * Linaro Ltd. not be used in advertising or publicity pertaining to
5203
+ * distribution of the software without specific, written prior permission.
5204
+ * Linaro Ltd. makes no representations about the suitability of this
5205
+ * software for any purpose. It is provided "as is" without express or
5206
+ * implied warranty.
5208
+ * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
5209
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
5210
+ * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
5211
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
5212
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
5213
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
5214
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
5216
+ * Authors: Travis Watkins <travis.watkins@linaro.org>
5219
+#include <opengl/programcache.h>
5220
+#include "privates.h"
5222
+typedef std::list<std::string> access_history_t;
5223
+typedef std::pair<GLProgram*, access_history_t::iterator> value;
5226
+compileProgram (std::string name, std::list<const GLShaderData*> shaders)
5228
+ std::list<const GLShaderData*>::const_iterator it;
5229
+ std::string vertex_shader;
5230
+ std::string fragment_shader;
5231
+ std::string vertex_functions = "";
5232
+ std::string vertex_function_calls = "";
5233
+ std::string fragment_functions = "";
5234
+ std::string fragment_function_calls = "";
5235
+ int vpos, vcallpos, fpos, fcallpos;
5237
+ for (it = shaders.begin (); it != shaders.end (); it++)
5239
+ //find the special shaders to put the rest in
5240
+ if ((*it)->vertexShader.find ("@VERTEX_FUNCTIONS@") != std::string::npos)
5242
+ vertex_shader = (*it)->vertexShader;
5246
+ if ((*it)->vertexShader.length ())
5248
+ vertex_functions += (*it)->vertexShader;
5249
+ vertex_function_calls += (*it)->name + "_vertex();\n";
5253
+ if ((*it)->fragmentShader.find ("@FRAGMENT_FUNCTIONS@") != std::string::npos)
5255
+ fragment_shader = (*it)->fragmentShader;
5259
+ if ((*it)->fragmentShader.length ())
5261
+ fragment_functions += (*it)->fragmentShader;
5262
+ fragment_function_calls += (*it)->name + "_fragment();\n";
5267
+ // put shader functions and function calls into the main shader
5268
+ vpos = vertex_shader.find ("@VERTEX_FUNCTIONS@");
5269
+ vertex_shader.replace (vpos, 18, vertex_functions);
5271
+ vcallpos = vertex_shader.find ("@VERTEX_FUNCTION_CALLS@");
5272
+ vertex_shader.replace (vcallpos, 23, vertex_function_calls);
5274
+ fpos = fragment_shader.find ("@FRAGMENT_FUNCTIONS@");
5275
+ fragment_shader.replace (fpos, 20, fragment_functions);
5277
+ fcallpos = fragment_shader.find ("@FRAGMENT_FUNCTION_CALLS@");
5278
+ fragment_shader.replace (fcallpos, 25, fragment_function_calls);
5280
+ return new GLProgram (vertex_shader, fragment_shader);
5283
+class PrivateProgramCache
5286
+ PrivateProgramCache (size_t);
5288
+ const size_t capacity;
5289
+ access_history_t access_history;
5290
+ std::map<std::string, value> cache;
5292
+ void insert (std::string, GLProgram *);
5296
+GLProgramCache::GLProgramCache (size_t capacity) :
5297
+ priv (new PrivateProgramCache (capacity))
5299
+ assert (priv->capacity != 0);
5302
+GLProgramCache::~GLProgramCache ()
5307
+GLProgram* GLProgramCache::operator () (std::list<const GLShaderData*> shaders)
5309
+ std::list<const GLShaderData*>::const_iterator name_it;
5312
+ for (name_it = shaders.begin(); name_it != shaders.end(); name_it++)
5314
+ if (name.length () == 0)
5315
+ name += (*name_it)->name;
5317
+ name += ":" + (*name_it)->name;
5320
+ std::map<std::string, value>::iterator it = priv->cache.find (name);
5322
+ if (it == priv->cache.end ())
5324
+ GLProgram *program = compileProgram (name, shaders);
5325
+ priv->insert (name, program);
5330
+ priv->access_history.splice (priv->access_history.end (),
5331
+ priv->access_history,
5332
+ (*it).second.second);
5333
+ (*it).second.second = priv->access_history.rbegin ().base ();
5335
+ return (*it).second.first;
5339
+PrivateProgramCache::PrivateProgramCache (size_t c) :
5344
+void PrivateProgramCache::insert (std::string name, GLProgram *program)
5346
+ assert (cache.find (name) == cache.end ());
5348
+ if (cache.size () == capacity)
5351
+ // update most recently used GLProgram
5352
+ access_history_t::iterator it = access_history.insert (access_history.end (), name);
5354
+ cache.insert (std::make_pair (name, std::make_pair (program, it)));
5357
+void PrivateProgramCache::evict ()
5359
+ assert (!access_history.empty ());
5361
+ // find least recently used GLProgram
5362
+ std::map<std::string, value>::iterator it = cache.find (access_history.front ());
5363
+ assert (it != cache.end ());
5366
+ access_history.pop_front ();
5369
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/program.cpp linaro-gles2-debianpatches/plugins/opengl/src/program.cpp
5370
--- compiz-0.9.7.8/plugins/opengl/src/program.cpp 1970-01-01 01:00:00.000000000 +0100
5371
+++ linaro-gles2-debianpatches/plugins/opengl/src/program.cpp 2012-04-20 11:41:59.241600000 +0200
5374
+ * Copyright © 2011 Linaro Ltd.
5376
+ * Permission to use, copy, modify, distribute, and sell this software
5377
+ * and its documentation for any purpose is hereby granted without
5378
+ * fee, provided that the above copyright notice appear in all copies
5379
+ * and that both that copyright notice and this permission notice
5380
+ * appear in supporting documentation, and that the name of
5381
+ * Linaro Ltd. not be used in advertising or publicity pertaining to
5382
+ * distribution of the software without specific, written prior permission.
5383
+ * Linaro Ltd. makes no representations about the suitability of this
5384
+ * software for any purpose. It is provided "as is" without express or
5385
+ * implied warranty.
5387
+ * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
5388
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
5389
+ * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
5390
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
5391
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
5392
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
5393
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
5395
+ * Authors: Travis Watkins <travis.watkins@linaro.org>
5398
+#include <iostream>
5400
+#include <opengl/opengl.h>
5402
+class PrivateProgram
5410
+void printShaderInfoLog (GLuint shader)
5416
+ (*GL::getShaderiv) (shader, GL_INFO_LOG_LENGTH, &length);
5420
+ infoLog = new GLchar[length];
5421
+ (*GL::getShaderInfoLog) (shader, length, &chars, infoLog);
5422
+ std::cout << infoLog << std::endl;
5427
+void printProgramInfoLog(GLuint program)
5433
+ (*GL::getProgramiv) (program, GL_INFO_LOG_LENGTH, &length);
5437
+ infoLog = new GLchar[length];
5438
+ (*GL::getProgramInfoLog) (program, length, &chars, infoLog);
5439
+ std::cout << infoLog << std::endl;
5444
+static bool compileShader (GLuint *shader, GLenum type, CompString &source)
5446
+ const GLchar *data;
5449
+ data = (GLchar *)source.c_str ();
5451
+ *shader = (*GL::createShader) (type);
5452
+ (*GL::shaderSource) (*shader, 1, &data, NULL);
5453
+ (*GL::compileShader) (*shader);
5455
+ (*GL::getShaderiv) (*shader, GL_COMPILE_STATUS, &status);
5456
+ return (status == GL_TRUE);
5459
+GLProgram::GLProgram (CompString &vertexShader, CompString &fragmentShader) :
5460
+ priv (new PrivateProgram ())
5462
+ GLuint vertex, fragment;
5465
+ priv->valid = false;
5466
+ priv->program = (*GL::createProgram) ();
5468
+ if (!compileShader (&vertex, GL_VERTEX_SHADER, vertexShader))
5470
+ printShaderInfoLog (vertex);
5471
+ std::cout << vertexShader << std::endl << std::endl;
5475
+ if (!compileShader (&fragment, GL_FRAGMENT_SHADER, fragmentShader))
5477
+ printShaderInfoLog (fragment);
5478
+ std::cout << fragmentShader << std::endl << std::endl;
5482
+ (*GL::attachShader) (priv->program, vertex);
5483
+ (*GL::attachShader) (priv->program, fragment);
5485
+ (*GL::linkProgram) (priv->program);
5486
+ (*GL::validateProgram) (priv->program);
5488
+ (*GL::getProgramiv) (priv->program, GL_LINK_STATUS, &status);
5489
+ if (status == GL_FALSE)
5491
+ printProgramInfoLog (priv->program);
5495
+ (*GL::deleteShader) (vertex);
5496
+ (*GL::deleteShader) (fragment);
5498
+ priv->valid = true;
5501
+GLProgram::~GLProgram ()
5503
+ (*GL::deleteProgram) (priv->program);
5507
+bool GLProgram::valid ()
5509
+ return priv->valid;
5512
+void GLProgram::bind ()
5514
+ (*GL::useProgram) (priv->program);
5517
+void GLProgram::unbind ()
5519
+ (*GL::useProgram) (0);
5522
+bool GLProgram::setUniform (const char *name, GLfloat value)
5524
+ GLint location = (*GL::getUniformLocation) (priv->program, name);
5525
+ if (location == -1)
5528
+ (*GL::uniform1f) (location, value);
5532
+bool GLProgram::setUniform (const char *name, GLint value)
5534
+ GLint location = (*GL::getUniformLocation) (priv->program, name);
5535
+ if (location == -1)
5538
+ (*GL::uniform1i) (location, value);
5542
+bool GLProgram::setUniform (const char *name, const GLMatrix &value)
5544
+ GLint location = (*GL::getUniformLocation) (priv->program, name);
5545
+ if (location == -1)
5548
+ (*GL::uniformMatrix4fv) (location, 1, GL_FALSE, value.getMatrix ());
5552
+bool GLProgram::setUniform2f (const char *name,
5556
+ GLint location = (*GL::getUniformLocation) (priv->program, name);
5557
+ if (location == -1)
5560
+ (*GL::uniform2f) (location, x, y);
5564
+bool GLProgram::setUniform3f (const char *name,
5569
+ GLint location = (*GL::getUniformLocation) (priv->program, name);
5570
+ if (location == -1)
5573
+ (*GL::uniform3f) (location, x, y, z);
5577
+bool GLProgram::setUniform4f (const char *name,
5583
+ GLint location = (*GL::getUniformLocation) (priv->program, name);
5584
+ if (location == -1)
5587
+ (*GL::uniform4f) (location, x, y, z, w);
5591
+bool GLProgram::setUniform2i (const char *name,
5595
+ GLint location = (*GL::getUniformLocation) (priv->program, name);
5596
+ if (location == -1)
5599
+ (*GL::uniform2i) (location, x, y);
5603
+bool GLProgram::setUniform3i (const char *name,
5608
+ GLint location = (*GL::getUniformLocation) (priv->program, name);
5609
+ if (location == -1)
5612
+ (*GL::uniform3i) (location, x, y, z);
5616
+bool GLProgram::setUniform4i (const char *name,
5622
+ GLint location = (*GL::getUniformLocation) (priv->program, name);
5623
+ if (location == -1)
5626
+ (*GL::uniform4i) (location, x, y, z, w);
5630
+GLuint GLProgram::attributeLocation (const char *name)
5632
+ return (*GL::getAttribLocation) (priv->program, name);
5635
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/screen.cpp linaro-gles2-debianpatches/plugins/opengl/src/screen.cpp
5636
--- compiz-0.9.7.8/plugins/opengl/src/screen.cpp 2012-04-26 12:39:13.700308461 +0200
5637
+++ linaro-gles2-debianpatches/plugins/opengl/src/screen.cpp 2012-04-20 11:41:59.241600000 +0200
5640
+ * Copyright © 2011 Linaro Ltd.
5641
* Copyright © 2008 Dennis Kasprzyk
5642
* Copyright © 2007 Novell, Inc.
5646
* Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
5647
* David Reveman <davidr@novell.com>
5648
+ * Travis Watkins <travis.watkins@linaro.org>
5656
+#ifndef _GNU_SOURCE
5657
+#define _GNU_SOURCE
5661
#include "privates.h"
5668
+ EGLCreateImageKHRProc createImage;
5669
+ EGLDestroyImageKHRProc destroyImage;
5671
+ GLEGLImageTargetTexture2DOESProc eglImageTargetTexture;
5673
+ EGLPostSubBufferNVProc postSubBuffer = NULL;
5676
+ typedef int (*GLXSwapIntervalProc) (int interval);
5678
GLXBindTexImageProc bindTexImage = NULL;
5679
GLXReleaseTexImageProc releaseTexImage = NULL;
5680
GLXQueryDrawableProc queryDrawable = NULL;
5682
GLXGetFBConfigAttribProc getFBConfigAttrib = NULL;
5683
GLXCreatePixmapProc createPixmap = NULL;
5684
GLXDestroyPixmapProc destroyPixmap = NULL;
5686
- GLActiveTextureProc activeTexture = NULL;
5687
- GLClientActiveTextureProc clientActiveTexture = NULL;
5688
- GLMultiTexCoord2fProc multiTexCoord2f = NULL;
5690
GLGenProgramsProc genPrograms = NULL;
5691
GLDeleteProgramsProc deletePrograms = NULL;
5692
GLBindProgramProc bindProgram = NULL;
5693
GLProgramStringProc programString = NULL;
5694
GLProgramParameter4fProc programEnvParameter4f = NULL;
5695
GLProgramParameter4fProc programLocalParameter4f = NULL;
5696
- GLGetProgramivProc getProgramiv = NULL;
5699
+ GLActiveTextureProc activeTexture = NULL;
5700
+ GLClientActiveTextureProc clientActiveTexture = NULL;
5701
+ GLMultiTexCoord2fProc multiTexCoord2f = NULL;
5703
GLGenFramebuffersProc genFramebuffers = NULL;
5704
GLDeleteFramebuffersProc deleteFramebuffers = NULL;
5706
GLFramebufferTexture2DProc framebufferTexture2D = NULL;
5707
GLGenerateMipmapProc generateMipmap = NULL;
5709
+ GLBindBufferProc bindBuffer = NULL;
5710
+ GLDeleteBuffersProc deleteBuffers = NULL;
5711
+ GLGenBuffersProc genBuffers = NULL;
5712
+ GLBufferDataProc bufferData = NULL;
5713
+ GLBufferSubDataProc bufferSubData = NULL;
5715
+ GLGetShaderivProc getShaderiv = NULL;
5716
+ GLGetShaderInfoLogProc getShaderInfoLog = NULL;
5717
+ GLGetProgramivProc getProgramiv = NULL;
5718
+ GLGetProgramInfoLogProc getProgramInfoLog = NULL;
5719
+ GLCreateShaderProc createShader = NULL;
5720
+ GLShaderSourceProc shaderSource = NULL;
5721
+ GLCompileShaderProc compileShader = NULL;
5722
+ GLCreateProgramProc createProgram = NULL;
5723
+ GLAttachShaderProc attachShader = NULL;
5724
+ GLLinkProgramProc linkProgram = NULL;
5725
+ GLValidateProgramProc validateProgram = NULL;
5726
+ GLDeleteShaderProc deleteShader = NULL;
5727
+ GLDeleteProgramProc deleteProgram = NULL;
5728
+ GLUseProgramProc useProgram = NULL;
5729
+ GLGetUniformLocationProc getUniformLocation = NULL;
5730
+ GLUniform1fProc uniform1f = NULL;
5731
+ GLUniform1iProc uniform1i = NULL;
5732
+ GLUniform2fProc uniform2f = NULL;
5733
+ GLUniform2iProc uniform2i = NULL;
5734
+ GLUniform3fProc uniform3f = NULL;
5735
+ GLUniform3iProc uniform3i = NULL;
5736
+ GLUniform4fProc uniform4f = NULL;
5737
+ GLUniform4iProc uniform4i = NULL;
5738
+ GLUniformMatrix4fvProc uniformMatrix4fv = NULL;
5739
+ GLGetAttribLocationProc getAttribLocation = NULL;
5741
+ GLEnableVertexAttribArrayProc enableVertexAttribArray = NULL;
5742
+ GLDisableVertexAttribArrayProc disableVertexAttribArray = NULL;
5743
+ GLVertexAttribPointerProc vertexAttribPointer = NULL;
5745
bool textureFromPixmap = true;
5746
bool textureRectangle = false;
5747
bool textureNonPowerOfTwo = false;
5748
+ bool textureNonPowerOfTwoMipmap = false;
5749
bool textureEnvCombine = false;
5750
bool textureEnvCrossbar = false;
5751
bool textureBorderClamp = false;
5752
bool textureCompression = false;
5753
GLint maxTextureSize = 0;
5755
- bool fragmentProgram = false;
5757
+ bool shaders = false;
5758
GLint maxTextureUnits = 1;
5760
bool canDoSaturated = false;
5763
CompOutput *targetOutput = NULL;
5766
+ * Callback object to create GLPrograms automatically when using GLVertexBuffer.
5768
+class GLScreenAutoProgram : public GLVertexBuffer::AutoProgram
5771
+ GLScreenAutoProgram (GLScreen *gScreen) : gScreen(gScreen) {}
5773
+ GLProgram *getProgram (GLShaderParameters ¶ms)
5775
+ const GLShaderData *shaderData = gScreen->getShaderData (params);
5776
+ std::list<const GLShaderData *> tempShaders;
5777
+ tempShaders.push_back (shaderData);
5778
+ return gScreen->getProgram (tempShaders);
5781
+ GLScreen *gScreen;
5784
class DetectionWorkaround
5787
@@ -106,6 +180,212 @@
5788
GLScreen::glInitContext (XVisualInfo *visinfo)
5790
DetectionWorkaround workaround;
5796
+ EGLint major, minor;
5797
+ const char *eglExtensions, *glExtensions;
5798
+ XWindowAttributes attr;
5799
+ EGLint count, visualid;
5800
+ EGLConfig configs[1024];
5801
+ CompOption::Vector o (0);
5803
+ const EGLint config_attribs[] = {
5804
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
5806
+ EGL_GREEN_SIZE, 1,
5808
+ EGL_ALPHA_SIZE, 0,
5809
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
5810
+ EGL_CONFIG_CAVEAT, EGL_NONE,
5814
+ const EGLint context_attribs[] = {
5815
+ EGL_CONTEXT_CLIENT_VERSION, 2,
5819
+ xdpy = screen->dpy ();
5820
+ dpy = eglGetDisplay ((EGLNativeDisplayType)xdpy);
5821
+ if (!eglInitialize (dpy, &major, &minor))
5823
+ screen->handleCompizEvent ("opengl", "fatal_fallback", o);
5827
+ eglBindAPI (EGL_OPENGL_ES_API);
5829
+ if (!eglChooseConfig (dpy, config_attribs, configs, 1024, &count))
5831
+ screen->handleCompizEvent ("opengl", "fatal_fallback", o);
5835
+ if (!XGetWindowAttributes (xdpy, screen->root (), &attr))
5837
+ screen->handleCompizEvent ("opengl", "fatal_fallback", o);
5841
+ visualid = XVisualIDFromVisual (attr.visual);
5842
+ config = configs[0];
5843
+ for (int i = 0; i < count; i++) {
5845
+ eglGetConfigAttrib (dpy, configs[i], EGL_NATIVE_VISUAL_ID, &val);
5846
+ if (visualid == val) {
5847
+ config = configs[i];
5852
+ overlay = CompositeScreen::get (screen)->overlay ();
5853
+ priv->surface = eglCreateWindowSurface (dpy, config, overlay, 0);
5854
+ if (priv->surface == EGL_NO_SURFACE)
5856
+ compLogMessage ("opengl", CompLogLevelFatal,
5857
+ "eglCreateWindowSurface failed");
5858
+ screen->handleCompizEvent ("opengl", "fatal_fallback", o);
5862
+ // Currently we rely unconditionally on preserving the buffer contents.
5863
+ eglSurfaceAttrib (dpy, priv->surface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
5865
+ priv->ctx = eglCreateContext (dpy, config, EGL_NO_CONTEXT, context_attribs);
5866
+ if (priv->ctx == EGL_NO_CONTEXT)
5868
+ compLogMessage ("opengl", CompLogLevelFatal, "eglCreateContext failed");
5869
+ screen->handleCompizEvent ("opengl", "fatal_fallback", o);
5873
+ if (!eglMakeCurrent (dpy, priv->surface, priv->surface, priv->ctx))
5875
+ compLogMessage ("opengl", CompLogLevelFatal,
5876
+ "eglMakeCurrent failed");
5877
+ screen->handleCompizEvent ("opengl", "fatal_fallback", o);
5881
+ eglExtensions = (const char *) eglQueryString (dpy, EGL_EXTENSIONS);
5882
+ glExtensions = (const char *) glGetString (GL_EXTENSIONS);
5884
+ if (!glExtensions || !eglExtensions)
5886
+ compLogMessage ("opengl", CompLogLevelFatal,
5887
+ "No valid GL extensions string found.");
5888
+ screen->handleCompizEvent ("opengl", "fatal_fallback", o);
5892
+ GL::textureFromPixmap = true;
5893
+ GL::textureNonPowerOfTwo = true;
5896
+ GL::shaders = true;
5897
+ GL::maxTextureUnits = 4;
5898
+ glGetIntegerv (GL_MAX_TEXTURE_SIZE, &GL::maxTextureSize);
5900
+ GL::createImage = (GL::EGLCreateImageKHRProc)
5901
+ eglGetProcAddress ("eglCreateImageKHR");
5902
+ GL::destroyImage = (GL::EGLDestroyImageKHRProc)
5903
+ eglGetProcAddress ("eglDestroyImageKHR");
5904
+ GL::eglImageTargetTexture = (GL::GLEGLImageTargetTexture2DOESProc)
5905
+ eglGetProcAddress ("glEGLImageTargetTexture2DOES");
5907
+ if (!strstr (eglExtensions, "EGL_KHR_image_pixmap") ||
5908
+ !strstr (glExtensions, "GL_OES_EGL_image") ||
5909
+ !GL::createImage || !GL::destroyImage || !GL::eglImageTargetTexture)
5911
+ compLogMessage ("opengl", CompLogLevelFatal,
5912
+ "GL_OES_EGL_image is missing");
5913
+ screen->handleCompizEvent ("opengl", "fatal_fallback", o);
5917
+// work around efika supporting GL_BGRA directly instead of via this extension
5919
+ if (!strstr (glExtensions, "GL_EXT_texture_format_BGRA8888"))
5921
+ compLogMessage ("opengl", CompLogLevelFatal,
5922
+ "GL_EXT_texture_format_BGRA8888 is missing");
5923
+ screen->handleCompizEvent ("opengl", "fatal_fallback", o);
5928
+ if (strstr (glExtensions, "GL_OES_texture_npot"))
5929
+ GL::textureNonPowerOfTwoMipmap = true;
5931
+ if (strstr (eglExtensions, "EGL_NV_post_sub_buffer"))
5932
+ GL::postSubBuffer = (GL::EGLPostSubBufferNVProc)
5933
+ eglGetProcAddress ("eglPostSubBufferNV");
5935
+ GL::activeTexture = glActiveTexture;
5936
+ GL::genFramebuffers = glGenFramebuffers;
5937
+ GL::deleteFramebuffers = glDeleteFramebuffers;
5938
+ GL::bindFramebuffer = glBindFramebuffer;
5939
+ GL::checkFramebufferStatus = glCheckFramebufferStatus;
5940
+ GL::framebufferTexture2D = glFramebufferTexture2D;
5941
+ GL::generateMipmap = glGenerateMipmap;
5943
+ GL::bindBuffer = glBindBuffer;
5944
+ GL::deleteBuffers = glDeleteBuffers;
5945
+ GL::genBuffers = glGenBuffers;
5946
+ GL::bufferData = glBufferData;
5947
+ GL::bufferSubData = glBufferSubData;
5949
+ GL::getShaderiv = glGetShaderiv;
5950
+ GL::getShaderInfoLog = glGetShaderInfoLog;
5951
+ GL::getProgramiv = glGetProgramiv;
5952
+ GL::getProgramInfoLog = glGetProgramInfoLog;
5953
+ GL::createShader = glCreateShader;
5954
+ GL::shaderSource = glShaderSource;
5955
+ GL::compileShader = glCompileShader;
5956
+ GL::createProgram = glCreateProgram;
5957
+ GL::attachShader = glAttachShader;
5958
+ GL::linkProgram = glLinkProgram;
5959
+ GL::validateProgram = glValidateProgram;
5960
+ GL::deleteShader = glDeleteShader;
5961
+ GL::deleteProgram = glDeleteProgram;
5962
+ GL::useProgram = glUseProgram;
5963
+ GL::getUniformLocation = glGetUniformLocation;
5964
+ GL::uniform1f = glUniform1f;
5965
+ GL::uniform1i = glUniform1i;
5966
+ GL::uniform2f = glUniform2f;
5967
+ GL::uniform2i = glUniform2i;
5968
+ GL::uniform3f = glUniform3f;
5969
+ GL::uniform3i = glUniform3i;
5970
+ GL::uniform4f = glUniform4f;
5971
+ GL::uniform4i = glUniform4i;
5972
+ GL::uniformMatrix4fv = glUniformMatrix4fv;
5973
+ GL::getAttribLocation = glGetAttribLocation;
5975
+ GL::enableVertexAttribArray = glEnableVertexAttribArray;
5976
+ GL::disableVertexAttribArray = glDisableVertexAttribArray;
5977
+ GL::vertexAttribPointer = glVertexAttribPointer;
5979
+ glClearColor (0.0, 0.0, 0.0, 1.0);
5980
+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
5981
+ glEnable (GL_BLEND);
5982
+ glEnable (GL_CULL_FACE);
5984
+ priv->updateView ();
5986
+ priv->lighting = false;
5988
+ priv->filter[NOTHING_TRANS_FILTER] = GLTexture::Fast;
5989
+ priv->filter[SCREEN_TRANS_FILTER] = GLTexture::Good;
5990
+ priv->filter[WINDOW_TRANS_FILTER] = GLTexture::Good;
5992
+ if (GL::textureFromPixmap)
5993
+ registerBindPixmap (EglTexture::bindPixmapToTexture);
5997
Display *dpy = screen->dpy ();
5998
const char *glExtensions;
5999
GLfloat globalAmbient[] = { 0.1f, 0.1f, 0.1f, 0.1f };
6002
if (strstr (glExtensions, "GL_ARB_texture_non_power_of_two"))
6003
GL::textureNonPowerOfTwo = true;
6004
+ GL::textureNonPowerOfTwoMipmap = GL::textureNonPowerOfTwo;
6006
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &GL::maxTextureSize);
6008
@@ -221,33 +502,6 @@
6009
glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &GL::maxTextureUnits);
6012
- if (strstr (glExtensions, "GL_ARB_fragment_program"))
6014
- GL::genPrograms = (GL::GLGenProgramsProc)
6015
- getProcAddress ("glGenProgramsARB");
6016
- GL::deletePrograms = (GL::GLDeleteProgramsProc)
6017
- getProcAddress ("glDeleteProgramsARB");
6018
- GL::bindProgram = (GL::GLBindProgramProc)
6019
- getProcAddress ("glBindProgramARB");
6020
- GL::programString = (GL::GLProgramStringProc)
6021
- getProcAddress ("glProgramStringARB");
6022
- GL::programEnvParameter4f = (GL::GLProgramParameter4fProc)
6023
- getProcAddress ("glProgramEnvParameter4fARB");
6024
- GL::programLocalParameter4f = (GL::GLProgramParameter4fProc)
6025
- getProcAddress ("glProgramLocalParameter4fARB");
6026
- GL::getProgramiv = (GL::GLGetProgramivProc)
6027
- getProcAddress ("glGetProgramivARB");
6029
- if (GL::genPrograms &&
6030
- GL::deletePrograms &&
6031
- GL::bindProgram &&
6032
- GL::programString &&
6033
- GL::programEnvParameter4f &&
6034
- GL::programLocalParameter4f &&
6036
- GL::fragmentProgram = true;
6039
if (strstr (glExtensions, "GL_EXT_framebuffer_object"))
6041
GL::genFramebuffers = (GL::GLGenFramebuffersProc)
6042
@@ -272,6 +526,63 @@
6046
+ if (strstr (glExtensions, "GL_ARB_vertex_buffer_object"))
6048
+ GL::bindBuffer = (GL::GLBindBufferProc)
6049
+ getProcAddress ("glBindBufferARB");
6050
+ GL::deleteBuffers = (GL::GLDeleteBuffersProc)
6051
+ getProcAddress ("glDeleteBuffersARB");
6052
+ GL::genBuffers = (GL::GLGenBuffersProc)
6053
+ getProcAddress ("glGenBuffersARB");
6054
+ GL::bufferData = (GL::GLBufferDataProc)
6055
+ getProcAddress ("glBufferDataARB");
6056
+ GL::bufferSubData = (GL::GLBufferSubDataProc)
6057
+ getProcAddress ("glBufferSubDataARB");
6059
+ if (GL::bindBuffer &&
6060
+ GL::deleteBuffers &&
6063
+ GL::bufferSubData)
6067
+ if (strstr (glExtensions, "GL_ARB_fragment_shader") &&
6068
+ strstr (glExtensions, "GL_ARB_vertex_shader"))
6070
+ GL::getShaderiv = (GL::GLGetShaderivProc) getProcAddress ("glGetShaderiv");
6071
+ GL::getShaderInfoLog = (GL::GLGetShaderInfoLogProc) getProcAddress ("glGetShaderInfoLog");
6072
+ GL::getProgramiv = (GL::GLGetProgramivProc) getProcAddress ("glGetProgramiv");
6073
+ GL::getProgramInfoLog = (GL::GLGetProgramInfoLogProc) getProcAddress ("glGetProgramInfoLog");
6074
+ GL::createShader = (GL::GLCreateShaderProc) getProcAddress ("glCreateShader");
6075
+ GL::shaderSource = (GL::GLShaderSourceProc) getProcAddress ("glShaderSource");
6076
+ GL::compileShader = (GL::GLCompileShaderProc) getProcAddress ("glCompileShader");
6077
+ GL::createProgram = (GL::GLCreateProgramProc) getProcAddress ("glCreateProgram");
6078
+ GL::attachShader = (GL::GLAttachShaderProc) getProcAddress ("glAttachShader");
6079
+ GL::linkProgram = (GL::GLLinkProgramProc) getProcAddress ("glLinkProgram");
6080
+ GL::validateProgram = (GL::GLValidateProgramProc) getProcAddress ("glValidateProgram");
6081
+ GL::deleteShader = (GL::GLDeleteShaderProc) getProcAddress ("glDeleteShader");
6082
+ GL::deleteProgram = (GL::GLDeleteProgramProc) getProcAddress ("glDeleteProgram");
6083
+ GL::useProgram = (GL::GLUseProgramProc) getProcAddress ("glUseProgram");
6084
+ GL::getUniformLocation = (GL::GLGetUniformLocationProc) getProcAddress ("glGetUniformLocation");
6085
+ GL::uniform1f = (GL::GLUniform1fProc) getProcAddress ("glUniform1f");
6086
+ GL::uniform1i = (GL::GLUniform1iProc) getProcAddress ("glUniform1i");
6087
+ GL::uniform2f = (GL::GLUniform2fProc) getProcAddress ("glUniform2f");
6088
+ GL::uniform2i = (GL::GLUniform2iProc) getProcAddress ("glUniform2i");
6089
+ GL::uniform3f = (GL::GLUniform3fProc) getProcAddress ("glUniform3f");
6090
+ GL::uniform3i = (GL::GLUniform3iProc) getProcAddress ("glUniform3i");
6091
+ GL::uniform4f = (GL::GLUniform4fProc) getProcAddress ("glUniform4f");
6092
+ GL::uniform4i = (GL::GLUniform4iProc) getProcAddress ("glUniform4i");
6093
+ GL::uniformMatrix4fv = (GL::GLUniformMatrix4fvProc) getProcAddress ("glUniformMatrix4fv");
6094
+ GL::getAttribLocation = (GL::GLGetAttribLocationProc) getProcAddress ("glGetAttribLocation");
6096
+ GL::enableVertexAttribArray = (GL::GLEnableVertexAttribArrayProc) getProcAddress ("glEnableVertexAttribArray");
6097
+ GL::disableVertexAttribArray = (GL::GLDisableVertexAttribArrayProc) getProcAddress ("glDisableVertexAttribArray");
6098
+ GL::vertexAttribPointer = (GL::GLVertexAttribPointerProc) getProcAddress ("glVertexAttribPointer");
6100
+ GL::shaders = true;
6103
if (strstr (glExtensions, "GL_ARB_texture_compression"))
6104
GL::textureCompression = true;
6106
@@ -313,6 +624,12 @@
6108
if (GL::textureFromPixmap)
6109
registerBindPixmap (TfpTexture::bindPixmapToTexture);
6112
+ priv->scratchFbo = new GLFramebufferObject;
6113
+ priv->scratchFbo->allocate (*screen, NULL, GL_BGRA);
6115
+ GLVertexBuffer::streamingBuffer ()->setAutoProgram (priv->autoProgram);
6119
@@ -322,9 +639,10 @@
6120
PluginClassHandler<GLScreen, CompScreen, COMPIZ_OPENGL_ABI> (s),
6121
priv (new PrivateGLScreen (this))
6123
+ XVisualInfo *visinfo = NULL;
6125
Display *dpy = s->dpy ();
6127
- XVisualInfo *visinfo;
6128
GLXFBConfig *fbConfigs;
6129
int defaultDepth, nvisinfo, nElements, value, i;
6130
const char *glxExtensions;
6136
if (!glInitContext (visinfo))
6139
@@ -582,7 +901,22 @@
6141
if (priv->hasCompositing)
6142
CompositeScreen::get (screen)->unregisterPaintHandler ();
6145
+ Display *xdpy = screen->dpy ();
6146
+ EGLDisplay dpy = eglGetDisplay (xdpy);
6148
+ eglMakeCurrent (dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
6149
+ eglDestroyContext (dpy, priv->ctx);
6150
+ eglDestroySurface (dpy, priv->surface);
6151
+ eglTerminate (dpy);
6152
+ eglReleaseThread ();
6155
glXDestroyContext (screen->dpy (), priv->ctx);
6158
+ delete priv->scratchFbo;
6162
@@ -593,14 +927,21 @@
6163
backgroundTextures (),
6164
backgroundLoaded (false),
6166
- fragmentStorage (),
6167
+ projection (NULL),
6168
clearBuffers (true),
6173
+ scratchFbo (NULL),
6175
pendingCommands (false),
6178
hasCompositing (false),
6179
+ programCache (new GLProgramCache (30)),
6181
+ autoProgram (new GLScreenAutoProgram(gs)),
6182
rootPixmapCopy (None),
6187
PrivateGLScreen::~PrivateGLScreen ()
6189
+ delete programCache;
6190
+ delete autoProgram;
6192
XFreePixmap (screen->dpy (), rootPixmapCopy);
6194
@@ -670,8 +1013,13 @@
6196
XDamageNotifyEvent *de = (XDamageNotifyEvent *) event;
6199
+ std::map<Damage, EglTexture*>::iterator it =
6200
+ boundPixmapTex.find (de->damage);
6202
std::map<Damage, TfpTexture*>::iterator it =
6203
boundPixmapTex.find (de->damage);
6205
if (it != boundPixmapTex.end ())
6207
it->second->damaged = true;
6208
@@ -743,22 +1091,32 @@
6210
PrivateGLScreen::updateView ()
6212
+ GLfloat projection_array[16];
6215
glMatrixMode (GL_PROJECTION);
6217
glMatrixMode (GL_MODELVIEW);
6219
glDepthRange (0, 1);
6220
- glViewport (-1, -1, 2, 2);
6221
glRasterPos2f (0, 0);
6223
+ glViewport (-1, -1, 2, 2);
6225
rasterPos = CompPoint (0, 0);
6227
- perspective (projection, 60.0f, 1.0f, 0.1f, 100.0f);
6228
+ perspective (projection_array, 60.0f, 1.0f, 0.1f, 100.0f);
6230
+ if (projection != NULL)
6231
+ delete projection;
6232
+ projection = new GLMatrix (projection_array);
6235
glMatrixMode (GL_PROJECTION);
6237
- glMultMatrixf (projection);
6238
+ glMultMatrixf (projection_array);
6239
glMatrixMode (GL_MODELVIEW);
6242
CompRegion region (screen->region ());
6243
/* remove all output regions from visible screen region */
6244
@@ -777,9 +1135,11 @@
6246
screen->outputChangeNotify ();
6248
+ scratchFbo->allocate (*screen, NULL, GL_BGRA);
6254
GLScreen::getProcAddress (const char *name)
6256
@@ -805,6 +1165,7 @@
6263
PrivateGLScreen::updateScreenBackground ()
6264
@@ -922,32 +1283,23 @@
6269
- if (!backgroundTextures.empty ())
6271
- foreach (GLTexture *t, backgroundTextures)
6272
- if (t->target () == GL_TEXTURE_2D)
6274
- glBindTexture (t->target (), t->name ());
6275
- glTexParameteri (t->target (), GL_TEXTURE_WRAP_S, GL_REPEAT);
6276
- glTexParameteri (t->target (), GL_TEXTURE_WRAP_T, GL_REPEAT);
6277
- glBindTexture (t->target (), 0);
6283
GLScreen::setTexEnvMode (GLenum mode)
6287
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
6289
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode);
6294
GLScreen::setLighting (bool lighting)
6297
if (priv->lighting != lighting)
6299
if (!priv->optionGetLighting ())
6300
@@ -968,6 +1320,7 @@
6302
setTexEnvMode (GL_REPLACE);
6308
@@ -1003,6 +1356,25 @@
6309
GLScreenInterface::glDisableOutputClipping ()
6310
WRAPABLE_DEF (glDisableOutputClipping)
6313
+GLScreenInterface::projectionMatrix ()
6314
+ WRAPABLE_DEF (projectionMatrix)
6317
+GLScreenInterface::glPaintCompositedOutput (const CompRegion ®ion,
6318
+ GLFramebufferObject *fbo,
6319
+ unsigned int mask)
6320
+ WRAPABLE_DEF (glPaintCompositedOutput, region, fbo, mask)
6324
+GLScreen::projectionMatrix ()
6326
+ WRAPABLE_HND_FUNCTN_RETURN (GLMatrix *, projectionMatrix)
6328
+ return priv->projection;
6332
GLScreen::updateBackground ()
6334
@@ -1033,17 +1405,13 @@
6335
priv->filter[num] = filter;
6338
-GLFragment::Storage *
6339
-GLScreen::fragmentStorage ()
6341
- return &priv->fragmentStorage;
6346
GLScreen::glxPixmapFBConfig (unsigned int depth)
6348
return &priv->glxPixmapFBConfigs[depth];
6353
GLScreen::clearOutput (CompOutput *output,
6354
@@ -1056,16 +1424,13 @@
6355
pBox->x2 != (int) screen->width () ||
6356
pBox->y2 != (int) screen->height ())
6358
- glPushAttrib (GL_SCISSOR_BIT);
6360
glEnable (GL_SCISSOR_TEST);
6361
glScissor (pBox->x1,
6362
screen->height () - pBox->y2,
6363
pBox->x2 - pBox->x1,
6364
pBox->y2 - pBox->y1);
6368
+ glDisable (GL_SCISSOR_TEST);
6372
@@ -1088,12 +1453,33 @@
6373
priv->lastViewport.height);
6378
+GLScreen::getEGLContext ()
6385
+GLScreen::getProgram (std::list<const GLShaderData*> shaders)
6387
+ return (*priv->programCache)(shaders);
6390
+const GLShaderData *
6391
+GLScreen::getShaderData (GLShaderParameters ¶ms)
6393
+ return &priv->shaderCache.getShaderData(params);
6403
GL::unthrottledFrames++;
6404
if (GL::waitVideoSync)
6406
@@ -1118,11 +1504,13 @@
6407
if (GL::vsyncCount != oldCount)
6408
GL::unthrottledFrames = 0;
6414
controlSwapVideoSync (bool sync)
6417
// Docs: http://www.opengl.org/registry/specs/SGI/swap_control.txt
6418
if (GL::swapInterval)
6420
@@ -1131,6 +1519,7 @@
6423
waitForVideoSync ();
6428
@@ -1149,6 +1538,35 @@
6432
+ // Blending is disabled by default. Each operation/plugin
6433
+ // should enable it (and reset it) as needed.
6434
+ glDisable(GL_BLEND);
6436
+ GLFramebufferObject *oldFbo = NULL;
6437
+ bool useFbo = false;
6439
+ oldFbo = scratchFbo->bind ();
6440
+ useFbo = scratchFbo->checkStatus () && scratchFbo->tex ();
6442
+printf ("bailing!");
6443
+ GLFramebufferObject::rebind (oldFbo);
6446
+ refreshSubBuffer = ((lastMask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) &&
6447
+ !(mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) &&
6448
+ (mask & COMPOSITE_SCREEN_DAMAGE_REGION_MASK));
6450
+ if (refreshSubBuffer)
6452
+ // FIXME: We shouldn't have to substract a 1X1 pixel region here !!
6453
+ // This is an ugly workaround for what appears to be a bug in the SGX
6454
+ // X11 driver (e.g. on Pandaboard OMAP4 platform).
6455
+ // Posting a fullscreen damage region to the SGX seems to reset the
6456
+ // framebuffer, causing the screen to blackout.
6457
+ cScreen->damageRegion (CompRegion (screen->fullscreenOutput ()) -
6458
+ CompRegion (CompRect(0, 0, 1, 1)));
6463
if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
6464
@@ -1175,7 +1593,11 @@
6469
+ if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK || !GL::postSubBuffer)
6471
if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
6476
@@ -1189,6 +1611,9 @@
6480
+ if (refreshSubBuffer)
6481
+ tmpRegion = CompRegion (*output);
6483
outputRegion = tmpRegion & CompRegion (*output);
6485
if (!gScreen->glPaintOutput (defaultScreenPaintAttrib,
6486
@@ -1204,15 +1629,38 @@
6487
PAINT_SCREEN_FULL_MASK);
6489
tmpRegion += *output;
6495
targetOutput = &screen->outputDevs ()[0];
6498
- if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
6501
+ GLFramebufferObject::rebind (oldFbo);
6503
+ // FIXME: does not work if screen dimensions exceed max texture size
6504
+ gScreen->glPaintCompositedOutput (tmpRegion, scratchFbo, mask);
6507
+ // FIXME: Actually fix the composite plugin to be more efficient;
6508
+ // If GL::swapInterval == NULL && GL::waitVideoSync != NULL then the
6509
+ // composite plugin should not be imposing any framerate restriction
6510
+ // (ie. blocking the CPU) at all. Because the framerate will be controlled
6511
+ // and optimized here:
6513
+ if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK || !GL::postSubBuffer)
6515
+ if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
6519
+ Display *xdpy = screen->dpy ();
6520
+ eglSwapBuffers (eglGetDisplay (xdpy), surface);
6525
* controlSwapVideoSync is much faster than waitForVideoSync because
6526
* it won't block the CPU. The waiting is offloaded to the GPU.
6527
@@ -1220,6 +1668,7 @@
6529
GL::controlSwapVideoSync (optionGetSyncToVblank ());
6530
glXSwapBuffers (screen->dpy (), cScreen->output ());
6535
@@ -1229,6 +1678,31 @@
6537
waitForVideoSync ();
6540
+ Display *xdpy = screen->dpy ();
6542
+ if (GL::postSubBuffer)
6546
+ y = screen->height () - pBox->y2;
6548
+ (*GL::postSubBuffer) (eglGetDisplay (xdpy), surface,
6550
+ pBox->x2 - pBox->x1,
6551
+ pBox->y2 - pBox->y1);
6557
+ eglSwapBuffers (eglGetDisplay (xdpy), surface);
6564
if (GL::copySubBuffer)
6567
@@ -1275,14 +1749,21 @@
6568
glDisable (GL_SCISSOR_TEST);
6578
PrivateGLScreen::hasVSync ()
6583
return GL::waitVideoSync && optionGetSyncToVblank () &&
6584
GL::unthrottledFrames < 5;
6589
@@ -1327,6 +1808,12 @@
6593
+GLFramebufferObject *
6596
+ return priv->scratchFbo;
6600
GLScreen::defaultIcon ()
6602
@@ -1359,13 +1846,10 @@
6604
GLScreen::resetRasterPos ()
6607
glRasterPos2f (0, 0);
6609
priv->rasterPos.setX (0);
6610
priv->rasterPos.setY (0);
6614
-GLScreen::projectionMatrix ()
6616
- return priv->projection;
6618
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/shadercache.cpp linaro-gles2-debianpatches/plugins/opengl/src/shadercache.cpp
6619
--- compiz-0.9.7.8/plugins/opengl/src/shadercache.cpp 1970-01-01 01:00:00.000000000 +0100
6620
+++ linaro-gles2-debianpatches/plugins/opengl/src/shadercache.cpp 2012-04-20 11:41:59.241600000 +0200
6623
+ * Copyright © 2012 Linaro Ltd.
6625
+ * Permission to use, copy, modify, distribute, and sell this software
6626
+ * and its documentation for any purpose is hereby granted without
6627
+ * fee, provided that the above copyright notice appear in all copies
6628
+ * and that both that copyright notice and this permission notice
6629
+ * appear in supporting documentation, and that the name of
6630
+ * Linaro Ltd. not be used in advertising or publicity pertaining to
6631
+ * distribution of the software without specific, written prior permission.
6632
+ * Linaro Ltd. makes no representations about the suitability of this
6633
+ * software for any purpose. It is provided "as is" without express or
6634
+ * implied warranty.
6636
+ * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
6637
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
6638
+ * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
6639
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
6640
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
6641
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
6642
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
6644
+ * Authors: Alexandros Frantzis <alexandros.frantzis@linaro.org>
6649
+#include <opengl/shadercache.h>
6652
+ * Compares two GLShaderParameters objects.
6654
+class GLShaderParametersComparer
6657
+ bool operator()(const GLShaderParameters &left, const GLShaderParameters &right) const
6659
+ return left.hash() < right.hash();
6664
+typedef std::map<GLShaderParameters, GLShaderData, GLShaderParametersComparer> ShaderMapType;
6667
+ * Private data for GLPrivate
6669
+class PrivateShaderCache
6672
+ PrivateShaderCache() {}
6674
+ ShaderMapType::const_iterator addShaderData(const GLShaderParameters ¶ms);
6676
+ std::string createVertexShader (const GLShaderParameters ¶ms);
6677
+ std::string createFragmentShader (const GLShaderParameters ¶ms);
6679
+ ShaderMapType shaderMap;
6682
+/**********************
6683
+ * GLShaderParameters *
6684
+ **********************/
6687
+GLShaderParameters::hash() const
6689
+ return static_cast<int>(opacity) |
6690
+ (static_cast<int>(brightness) << 1) |
6691
+ (static_cast<int>(saturation) << 2) |
6692
+ (static_cast<int>(color) << 3) |
6693
+ (static_cast<int>(normal) << 5) |
6694
+ (static_cast<int>(numTextures) << 8);
6698
+GLShaderParameters::id() const
6700
+ std::stringstream ss;
6702
+ ss << (opacity ? "t" : "f");
6703
+ ss << (brightness ? "t" : "f");
6704
+ ss << (saturation ? "t" : "f");
6705
+ ss << (color == GLShaderVariableNone ? "n" :
6706
+ color == GLShaderVariableUniform ? "u" : "v");
6708
+ ss << (normal == GLShaderVariableNone ? "n" :
6709
+ normal == GLShaderVariableUniform ? "u" : "v");
6710
+ ss << numTextures;
6717
+ *****************/
6719
+GLShaderCache::GLShaderCache () :
6720
+ priv (new PrivateShaderCache ())
6724
+const GLShaderData &
6725
+GLShaderCache::getShaderData (const GLShaderParameters ¶ms)
6727
+ ShaderMapType::const_iterator iter;
6729
+ // Try to find a cached shader pair that matches the parameters.
6730
+ // If we don't have it cached, create it.
6731
+ if ((iter = priv->shaderMap.find (params)) == priv->shaderMap.end ())
6732
+ iter = priv->addShaderData (params);
6734
+ return iter->second;
6737
+/**********************
6738
+ * PrivateShaderCache *
6739
+ **********************/
6741
+ShaderMapType::const_iterator
6742
+PrivateShaderCache::addShaderData (const GLShaderParameters ¶ms)
6744
+ GLShaderData shaderData;
6746
+ shaderData.name = params.id ();
6747
+ shaderData.fragmentShader = createFragmentShader (params);
6748
+ shaderData.vertexShader = createVertexShader (params);
6750
+ std::pair<ShaderMapType::iterator, bool> ret =
6751
+ shaderMap.insert(std::pair<GLShaderParameters, GLShaderData>(params,shaderData));
6757
+ * Creates a minimal vertex shader that can handle the GLShaderParameters.
6759
+ * @param params the GLShaderParameters the created shader should handle.
6761
+ * @return the shader string
6764
+PrivateShaderCache::createVertexShader (const GLShaderParameters ¶ms)
6766
+ std::stringstream ss;
6768
+ ss << "#ifdef GL_ES\n" <<
6769
+ "precision mediump float;\n" <<
6772
+ ss << "uniform mat4 modelview;\n" <<
6773
+ "uniform mat4 projection;\n";
6775
+ ss << "attribute vec3 position;\n" <<
6776
+ "attribute vec3 normal;\n" <<
6777
+ "attribute vec4 color;\n" <<
6778
+ "attribute vec2 texCoord0;\n" <<
6779
+ "attribute vec2 texCoord1;\n" <<
6780
+ "attribute vec2 texCoord2;\n" <<
6781
+ "attribute vec2 texCoord3;\n";
6783
+ ss << "@VERTEX_FUNCTIONS@\n";
6785
+ if (params.color == GLShaderVariableVarying)
6786
+ ss << "varying vec4 vColor;\n";
6788
+ for (int i = 0; i < params.numTextures; i++)
6789
+ ss << "varying vec2 vTexCoord" << i << ";\n";
6791
+ ss << "void main() {\n";
6793
+ for (int i = 0; i < params.numTextures; i++)
6794
+ ss << "vTexCoord" << i << " = texCoord" << i <<";\n";
6796
+ if (params.color == GLShaderVariableVarying)
6797
+ ss << "vColor = color;\n";
6799
+ ss << "gl_Position = projection * modelview * vec4(position, 1.0);\n";
6801
+ ss << "@VERTEX_FUNCTION_CALLS@\n}";
6807
+ * Creates a minimal fragment shader that can handle the GLShaderParameters.
6809
+ * @param params the GLShaderParameters the created shader should handle.
6811
+ * @return the shader string
6814
+PrivateShaderCache::createFragmentShader (const GLShaderParameters ¶ms)
6816
+ std::stringstream ss;
6817
+ ss << "#ifdef GL_ES\n" <<
6818
+ "precision mediump float;\n" <<
6821
+ ss << "uniform vec3 paintAttrib;\n";
6823
+ for (int i = 0; i < params.numTextures; i++) {
6824
+ ss << "uniform sampler2D texture" << i << ";\n";
6825
+ ss << "varying vec2 vTexCoord" << i << ";\n";
6828
+ if (params.color == GLShaderVariableUniform)
6829
+ ss << "uniform vec4 singleColor;\n";
6830
+ else if (params.color == GLShaderVariableVarying)
6831
+ ss << "varying vec4 vColor;\n";
6833
+ ss << "@FRAGMENT_FUNCTIONS@\n";
6835
+ ss << "void main() {\n vec4 color = ";
6837
+ if (params.color == GLShaderVariableUniform)
6838
+ ss << "singleColor *";
6839
+ else if (params.color == GLShaderVariableVarying)
6842
+ for (int i = 0; i < params.numTextures; i++)
6843
+ ss << " texture2D(texture" << i << ", vTexCoord" << i << ") *";
6847
+ if (params.saturation) {
6848
+ ss << "vec3 desaturated = color.rgb * vec3 (0.30, 0.59, 0.11);\n" <<
6849
+ "desaturated = vec3 (dot (desaturated, color.rgb));\n" <<
6850
+ "color.rgb = color.rgb * vec3 (paintAttrib.z) + desaturated *\n" <<
6851
+ " vec3 (1.0 - paintAttrib.z);\n";
6854
+ if (params.brightness) {
6855
+ ss << "color.rgb = color.rgb * paintAttrib.y" <<
6856
+ (params.opacity ? " * paintAttrib.x;\n" : ";\n") <<
6857
+ (params.opacity ? "color.a = color.a * paintAttrib.x;\n" : "");
6859
+ else if (params.opacity) {
6860
+ ss << "color = color * paintAttrib.x;\n";
6863
+ ss << "gl_FragColor = color;\n";
6864
+ ss << "@FRAGMENT_FUNCTION_CALLS@\n}";
6868
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/texture.cpp linaro-gles2-debianpatches/plugins/opengl/src/texture.cpp
6869
--- compiz-0.9.7.8/plugins/opengl/src/texture.cpp 2012-04-26 08:47:01.000000000 +0200
6870
+++ linaro-gles2-debianpatches/plugins/opengl/src/texture.cpp 2012-04-20 11:41:59.241600000 +0200
6872
#include <privatetexture.h>
6873
#include "privates.h"
6876
+std::map<Damage, EglTexture*> boundPixmapTex;
6878
std::map<Damage, TfpTexture*> boundPixmapTex;
6881
static GLTexture::Matrix _identity_matrix = {
6885
GLTexture::mipmap () const
6887
- return priv->mipmap & priv->mipmapSupport;
6888
+ return priv->mipmap && priv->mipmapSupport;
6893
GLTexture::enable (GLTexture::Filter filter)
6895
GLScreen *gs = GLScreen::get (screen);
6897
glEnable (priv->target);
6899
glBindTexture (priv->target, priv->name);
6904
if (gs->textureFilter () == GL_LINEAR_MIPMAP_LINEAR)
6906
- if (GL::textureNonPowerOfTwo && GL::fbo && priv->mipmap)
6909
glTexParameteri (priv->target,
6910
GL_TEXTURE_MIN_FILTER,
6915
- (*GL::generateMipmap) (priv->target);
6916
+ GL::generateMipmap (priv->target);
6917
priv->initial = false;
6921
GLTexture::disable ()
6923
glBindTexture (priv->target, 0);
6925
glDisable (priv->target);
6930
@@ -295,20 +303,26 @@
6933
GLTexture::Matrix matrix = _identity_matrix;
6935
GLint internalFormat;
6938
+ bool pot = POWER_OF_TWO (width) && POWER_OF_TWO (height);
6941
+ target = GL_TEXTURE_2D;
6942
+ matrix.xx = 1.0f / width;
6943
+ matrix.yy = 1.0f / height;
6945
+ mipmap = GL::textureNonPowerOfTwoMipmap || pot;
6948
- if (GL::textureNonPowerOfTwo ||
6949
- (POWER_OF_TWO (width) && POWER_OF_TWO (height)))
6950
+ if (GL::textureNonPowerOfTwo || pot)
6952
target = GL_TEXTURE_2D;
6953
matrix.xx = 1.0f / width;
6954
matrix.yy = 1.0f / height;
6957
+ mipmap = GL::fbo && (GL::textureNonPowerOfTwoMipmap || pot);
6961
@@ -318,17 +332,26 @@
6967
t->setData (target, matrix, mipmap);
6968
t->setGeometry (0, 0, width, height);
6970
glBindTexture (target, t->name ());
6973
+ // For GLES2 no format conversion is allowed, i.e., format must equal internalFormat
6974
+ internalFormat = format;
6976
+ internalFormat = GL_RGBA;
6981
opt = GLScreen::get (screen)->getOption ("texture_compression");
6982
if (opt->value ().b () && GL::textureCompression)
6983
internalFormat = GL_COMPRESSED_RGBA_ARB;
6985
- internalFormat = GL_RGBA;
6988
glTexImage2D (target, 0, internalFormat, width, height, 0,
6989
format, type, image);
6990
@@ -413,6 +436,106 @@
6991
return GLTexture::List ();
6995
+EglTexture::EglTexture () :
6998
+ updateMipMap (true)
7002
+EglTexture::~EglTexture ()
7004
+ GLuint temp = name ();
7005
+ glBindTexture (target (), name ());
7007
+ glDeleteTextures (1, &temp);
7009
+ glBindTexture (target (), 0);
7011
+ boundPixmapTex.erase (damage);
7012
+ XDamageDestroy (screen->dpy (), damage);
7016
+EglTexture::bindPixmapToTexture (Pixmap pixmap,
7021
+ if ((int) width > GL::maxTextureSize || (int) height > GL::maxTextureSize ||
7022
+ !GL::textureFromPixmap)
7023
+ return GLTexture::List ();
7025
+ GLTexture::List rv (1);
7026
+ EglTexture *tex = NULL;
7027
+ EGLImageKHR eglImage = NULL;
7028
+ GLTexture::Matrix matrix = _identity_matrix;
7030
+ const EGLint img_attribs[] = {
7031
+ EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
7035
+ eglImage = GL::createImage (eglGetDisplay (screen->dpy ()),
7036
+ EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR,
7037
+ (EGLClientBuffer)pixmap, img_attribs);
7039
+ if (eglImage == EGL_NO_IMAGE_KHR)
7041
+ compLogMessage ("core", CompLogLevelWarn,
7042
+ "eglCreateImageKHR failed");
7044
+ return GLTexture::List ();
7047
+ matrix.xx = 1.0f / width;
7048
+ matrix.yy = 1.0f / height;
7051
+ tex = new EglTexture ();
7052
+ tex->setData (GL_TEXTURE_2D, matrix,
7053
+ GL::textureNonPowerOfTwoMipmap ||
7054
+ (POWER_OF_TWO (width) && POWER_OF_TWO (height)));
7055
+ tex->setGeometry (0, 0, width, height);
7059
+ glBindTexture (GL_TEXTURE_2D, tex->name ());
7061
+ GL::eglImageTargetTexture (GL_TEXTURE_2D, (GLeglImageOES)eglImage);
7062
+ GL::destroyImage (eglGetDisplay (screen->dpy ()), eglImage);
7064
+ tex->setFilter (GL_NEAREST);
7065
+ tex->setWrap (GL_CLAMP_TO_EDGE);
7067
+ glBindTexture (GL_TEXTURE_2D, 0);
7069
+ tex->damage = XDamageCreate (screen->dpy (), pixmap,
7070
+ XDamageReportRawRectangles);
7071
+ boundPixmapTex[tex->damage] = tex;
7077
+EglTexture::enable (GLTexture::Filter filter)
7079
+ glBindTexture (target (), name ());
7080
+ GLTexture::enable (filter);
7083
+ updateMipMap = true;
7085
+ if (this->filter () == GL_LINEAR_MIPMAP_LINEAR && updateMipMap)
7087
+ GL::generateMipmap (target ());
7088
+ updateMipMap = false;
7094
TfpTexture::TfpTexture () :
7103
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/vertexbuffer.cpp linaro-gles2-debianpatches/plugins/opengl/src/vertexbuffer.cpp
7104
--- compiz-0.9.7.8/plugins/opengl/src/vertexbuffer.cpp 1970-01-01 01:00:00.000000000 +0100
7105
+++ linaro-gles2-debianpatches/plugins/opengl/src/vertexbuffer.cpp 2012-04-20 11:41:59.241600000 +0200
7108
+ * Copyright © 2011 Linaro Ltd.
7110
+ * Permission to use, copy, modify, distribute, and sell this software
7111
+ * and its documentation for any purpose is hereby granted without
7112
+ * fee, provided that the above copyright notice appear in all copies
7113
+ * and that both that copyright notice and this permission notice
7114
+ * appear in supporting documentation, and that the name of
7115
+ * Linaro Ltd. not be used in advertising or publicity pertaining to
7116
+ * distribution of the software without specific, written prior permission.
7117
+ * Linaro Ltd. makes no representations about the suitability of this
7118
+ * software for any purpose. It is provided "as is" without express or
7119
+ * implied warranty.
7121
+ * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
7122
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
7123
+ * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
7124
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
7125
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
7126
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
7127
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
7129
+ * Authors: Travis Watkins <travis.watkins@linaro.org>
7130
+ * Frederic Plourde <frederic.plourde@collabora.co.uk>
7131
+ * Alexandros Frantzis <alexandros.frantzis@linaro.org>
7135
+#include <iostream>
7138
+#include <GLES2/gl2.h>
7141
+#include <GL/glext.h>
7144
+#include <opengl/vertexbuffer.h>
7146
+#include "privates.h"
7148
+GLVertexBuffer *PrivateVertexBuffer::streamingBuffer = NULL;
7150
+GLVertexBuffer::GLVertexBuffer () :
7151
+ priv (new PrivateVertexBuffer ())
7153
+ priv->usage = GL_STATIC_DRAW;
7156
+GLVertexBuffer::GLVertexBuffer (GLenum usage) :
7157
+ priv (new PrivateVertexBuffer ())
7159
+ priv->usage = usage;
7162
+GLVertexBuffer::~GLVertexBuffer ()
7167
+GLVertexBuffer *GLVertexBuffer::streamingBuffer ()
7169
+ if (PrivateVertexBuffer::streamingBuffer == NULL)
7170
+ PrivateVertexBuffer::streamingBuffer = new GLVertexBuffer
7172
+ return PrivateVertexBuffer::streamingBuffer;
7175
+void GLVertexBuffer::begin (GLenum primitiveType)
7177
+ priv->primitiveType = primitiveType;
7179
+ priv->vertexData.clear ();
7180
+ priv->normalData.clear ();
7181
+ priv->colorData.clear ();
7182
+ priv->textureData.clear ();
7183
+ priv->uniforms.clear ();
7186
+void GLVertexBuffer::begin ()
7188
+ begin (GL_TRIANGLES);
7191
+int GLVertexBuffer::end ()
7196
+ if (!priv->vertexData.size ())
7199
+ GL::bindBuffer (GL_ARRAY_BUFFER, priv->vertexBuffer);
7200
+ GL::bufferData (GL_ARRAY_BUFFER,
7201
+ sizeof(GLfloat) * priv->vertexData.size (),
7202
+ &priv->vertexData[0], priv->usage);
7204
+ if (priv->normalData.size ())
7206
+ GL::bindBuffer (GL_ARRAY_BUFFER, priv->normalBuffer);
7207
+ GL::bufferData (GL_ARRAY_BUFFER,
7208
+ sizeof(GLfloat) * priv->normalData.size (),
7209
+ &priv->normalData[0], priv->usage);
7212
+ if (priv->colorData.size ())
7214
+ GL::bindBuffer (GL_ARRAY_BUFFER, priv->colorBuffer);
7215
+ GL::bufferData (GL_ARRAY_BUFFER,
7216
+ sizeof(GLfloat) * priv->colorData.size (),
7217
+ &priv->colorData[0], priv->usage);
7220
+ if (priv->textureData.size ())
7222
+ for (unsigned int i = 0; i < priv->textureData.size (); i++)
7224
+ GL::bindBuffer (GL_ARRAY_BUFFER, priv->textureBuffers[i]);
7225
+ GL::bufferData (GL_ARRAY_BUFFER,
7226
+ sizeof(GLfloat) * priv->textureData[i].size (),
7227
+ &priv->textureData[i][0], priv->usage);
7231
+ GL::bindBuffer (GL_ARRAY_BUFFER, 0);
7236
+void GLVertexBuffer::addVertices (GLuint nVertices, GLfloat *vertices)
7238
+ priv->vertexData.reserve (priv->vertexData.size () + (nVertices * 3));
7240
+ for (GLuint i = 0; i < nVertices * 3; i++)
7242
+ priv->vertexData.push_back (vertices[i]);
7246
+void GLVertexBuffer::addNormals (GLuint nNormals, GLfloat *normals)
7248
+ priv->normalData.reserve (priv->normalData.size () + (nNormals * 3));
7250
+ for (GLuint i = 0; i < nNormals * 3; i++)
7252
+ priv->normalData.push_back (normals[i]);
7256
+void GLVertexBuffer::addColors (GLuint nColors, GLushort *colors)
7258
+ priv->colorData.reserve (priv->colorData.size () + (nColors * 4));
7260
+ for (GLuint i = 0; i < nColors * 4; i++)
7262
+ priv->colorData.push_back (colors[i] / 65535.0f);
7266
+void GLVertexBuffer::addTexCoords (GLuint texture,
7267
+ GLuint nTexcoords,
7268
+ GLfloat *texcoords)
7270
+ //four textures max (zero indexed)
7274
+ while (texture >= priv->textureData.size ())
7276
+ std::vector<GLfloat> temp;
7277
+ priv->textureData.push_back (temp);
7280
+ priv->textureData[texture].reserve (priv->textureData[texture].size () +
7281
+ (nTexcoords * 2));
7283
+ for (GLuint i = 0; i < nTexcoords * 2; i++)
7285
+ priv->textureData[texture].push_back (texcoords[i]);
7289
+void GLVertexBuffer::addUniform (const char *name, GLfloat value)
7291
+ // we're casting to double here to make our template va_arg happy
7292
+ Uniform<double, 1>* uniform = new Uniform<double, 1>(name, (double)value);
7293
+ priv->uniforms.push_back (uniform);
7296
+void GLVertexBuffer::addUniform (const char *name, GLint value)
7298
+ Uniform<GLint, 1>* uniform = new Uniform<GLint, 1>(name, value);
7299
+ priv->uniforms.push_back (uniform);
7302
+bool GLVertexBuffer::addUniform (const char *name, const GLMatrix &value)
7304
+ //#warning Add 'addUniform' support to GLMatrix type !
7308
+void GLVertexBuffer::addUniform2f (const char *name,
7312
+ // we're casting to double here to make our template va_arg happy
7313
+ Uniform<double, 2>* uniform = new Uniform<double, 2>(name,
7316
+ priv->uniforms.push_back (uniform);
7319
+void GLVertexBuffer::addUniform3f (const char *name,
7324
+ // we're casting to double here to make our template va_arg happy
7325
+ Uniform<double, 3>* uniform = new Uniform<double, 3>(name,
7329
+ priv->uniforms.push_back (uniform);
7332
+void GLVertexBuffer::addUniform4f (const char *name,
7338
+ // we're casting to double here to make our template va_arg happy
7339
+ Uniform<double, 4>* uniform = new Uniform<double, 4>(name,
7344
+ priv->uniforms.push_back (uniform);
7347
+void GLVertexBuffer::addUniform2i (const char *name,
7351
+ Uniform<GLint, 2>* uniform = new Uniform<GLint, 2>(name, x, y);
7352
+ priv->uniforms.push_back (uniform);
7355
+void GLVertexBuffer::addUniform3i (const char *name,
7360
+ Uniform<GLint, 3>* uniform = new Uniform<GLint, 3>(name, x, y, z);
7361
+ priv->uniforms.push_back (uniform);
7364
+void GLVertexBuffer::addUniform4i (const char *name,
7370
+ Uniform<GLint, 4>* uniform = new Uniform<GLint, 4>(name, x, y, z, w);
7371
+ priv->uniforms.push_back (uniform);
7374
+void GLVertexBuffer::setProgram (GLProgram *program)
7376
+ priv->program = program;
7379
+void GLVertexBuffer::setAutoProgram (AutoProgram *autoProgram)
7381
+ priv->autoProgram = autoProgram;
7384
+int GLVertexBuffer::render ()
7386
+ if (GL::vbo && GL::shaders)
7387
+ return priv->render (NULL, NULL, NULL);
7392
+int GLVertexBuffer::render (const GLMatrix &modelview)
7394
+ const GLWindowPaintAttrib attrib = { OPAQUE, BRIGHT, COLOR, 0, 0, 0, 0 };
7396
+ return render (modelview, attrib);
7399
+int GLVertexBuffer::render (const GLMatrix &modelview,
7400
+ const GLWindowPaintAttrib &attrib)
7402
+ GLScreen *gScreen = GLScreen::get (screen);
7403
+ GLMatrix *projection = gScreen->projectionMatrix ();
7405
+ return render (*projection, modelview, attrib);
7408
+int GLVertexBuffer::render (const GLMatrix &projection,
7409
+ const GLMatrix &modelview,
7410
+ const GLWindowPaintAttrib &attrib)
7412
+ if (!priv->vertexData.size ())
7415
+ if (GL::vbo && GL::shaders)
7416
+ return priv->render (&projection, &modelview, &attrib);
7418
+ return priv->legacyRender (projection, modelview, attrib);
7421
+PrivateVertexBuffer::PrivateVertexBuffer () :
7427
+ GL::genBuffers (1, &vertexBuffer);
7428
+ GL::genBuffers (1, &normalBuffer);
7429
+ GL::genBuffers (1, &colorBuffer);
7430
+ GL::genBuffers (4, &textureBuffers[0]);
7433
+PrivateVertexBuffer::~PrivateVertexBuffer ()
7438
+ GL::deleteBuffers (1, &vertexBuffer);
7439
+ GL::deleteBuffers (1, &normalBuffer);
7440
+ GL::deleteBuffers (1, &colorBuffer);
7441
+ GL::deleteBuffers (4, &textureBuffers[0]);
7444
+int PrivateVertexBuffer::render (const GLMatrix *projection,
7445
+ const GLMatrix *modelview,
7446
+ const GLWindowPaintAttrib *attrib)
7448
+ GLfloat attribs[3] = {1, 1, 1};
7449
+ GLint positionIndex = -1;
7450
+ GLint normalIndex = -1;
7451
+ GLint colorIndex = -1;
7452
+ GLint texCoordIndex[4] = {-1, -1, -1, -1};
7453
+ GLProgram *tmpProgram = program;
7455
+ // If we don't have an explicitly set program, try to get one
7456
+ // using the AutoProgram callback object.
7457
+ if (tmpProgram == NULL && autoProgram) {
7458
+ // Convert attrib to shader parameters
7459
+ GLShaderParameters params;
7461
+ params.opacity = attrib->opacity != OPAQUE;
7462
+ params.brightness = attrib->brightness != BRIGHT;
7463
+ params.saturation = attrib->saturation != COLOR;
7464
+ params.color = colorData.size () == 4 ? GLShaderVariableUniform :
7465
+ colorData.size () > 4 ? GLShaderVariableVarying :
7466
+ GLShaderVariableNone;
7467
+ params.normal = normalData.size () <= 4 ? GLShaderVariableUniform :
7468
+ GLShaderVariableVarying;
7469
+ params.numTextures = textureData.size ();
7471
+ // Get a program matching the parameters
7472
+ tmpProgram = autoProgram->getProgram(params);
7475
+ if (tmpProgram == NULL)
7477
+ std::cerr << "no program defined!" << std::endl;
7481
+ tmpProgram->bind ();
7482
+ if (!tmpProgram->valid ())
7488
+ tmpProgram->setUniform ("projection", *projection);
7491
+ tmpProgram->setUniform ("modelview", *modelview);
7493
+ positionIndex = tmpProgram->attributeLocation ("position");
7494
+ (*GL::enableVertexAttribArray) (positionIndex);
7495
+ (*GL::bindBuffer) (GL_ARRAY_BUFFER, vertexBuffer);
7496
+ (*GL::vertexAttribPointer) (positionIndex, 3, GL_FLOAT, GL_FALSE, 0, 0);
7498
+ //use default normal
7499
+ if (normalData.size () == 0)
7501
+ tmpProgram->setUniform3f ("singleNormal", 0.0f, 0.0f, -1.0f);
7503
+ // special case a single normal and apply it to the entire operation
7504
+ else if (normalData.size () == 3)
7506
+ tmpProgram->setUniform3f ("singleNormal",
7507
+ normalData[0], normalData[1], normalData[2]);
7509
+ else if (normalData.size () > 3)
7511
+ normalIndex = tmpProgram->attributeLocation ("normal");
7512
+ (*GL::enableVertexAttribArray) (normalIndex);
7513
+ (*GL::bindBuffer) (GL_ARRAY_BUFFER, normalBuffer);
7514
+ (*GL::vertexAttribPointer) (normalIndex, 3, GL_FLOAT, GL_FALSE, 0, 0);
7517
+ // special case a single color and apply it to the entire operation
7518
+ if (colorData.size () == 4)
7520
+ tmpProgram->setUniform4f ("singleColor", colorData[0],
7521
+ colorData[1], colorData[2], colorData[3]);
7523
+ else if (colorData.size () > 4)
7525
+ colorIndex = tmpProgram->attributeLocation ("color");
7526
+ (*GL::enableVertexAttribArray) (colorIndex);
7527
+ (*GL::bindBuffer) (GL_ARRAY_BUFFER, colorBuffer);
7528
+ (*GL::vertexAttribPointer) (colorIndex, 4, GL_FLOAT, GL_FALSE, 0, 0);
7531
+ for (int i = textureData.size () - 1; i >= 0; i--)
7535
+ snprintf (name, 10, "texCoord%d", i);
7536
+ texCoordIndex[i] = tmpProgram->attributeLocation (name);
7538
+ (*GL::enableVertexAttribArray) (texCoordIndex[i]);
7539
+ (*GL::bindBuffer) (GL_ARRAY_BUFFER, textureBuffers[i]);
7540
+ (*GL::vertexAttribPointer) (texCoordIndex[i], 2, GL_FLOAT, GL_FALSE, 0, 0);
7542
+ snprintf (name, 9, "texture%d", i);
7543
+ tmpProgram->setUniform (name, i);
7546
+ // set per-plugin uniforms
7547
+ for (unsigned int i = 0; i < uniforms.size (); i++)
7549
+ uniforms[i]->set (program);
7552
+ //convert paint attribs to 0-1 range
7555
+ attribs[0] = attrib->opacity / 65535.0f;
7556
+ attribs[1] = attrib->brightness / 65535.0f;
7557
+ attribs[2] = attrib->saturation / 65535.0f;
7558
+ tmpProgram->setUniform3f ("paintAttrib", attribs[0], attribs[1], attribs[2]);
7561
+ glDrawArrays (primitiveType, 0, vertexData.size () / 3);
7563
+ for (int i = 0; i < 4; ++i)
7565
+ if (texCoordIndex[i] != -1)
7566
+ (*GL::disableVertexAttribArray) (texCoordIndex[i]);
7569
+ if (colorIndex != -1)
7570
+ (*GL::disableVertexAttribArray) (colorIndex);
7572
+ if (normalIndex != -1)
7573
+ (*GL::disableVertexAttribArray) (normalIndex);
7575
+ (*GL::disableVertexAttribArray) (positionIndex);
7577
+ GL::bindBuffer (GL_ARRAY_BUFFER, 0);
7578
+ tmpProgram->unbind ();
7583
+int PrivateVertexBuffer::legacyRender (const GLMatrix &projection,
7584
+ const GLMatrix &modelview,
7585
+ const GLWindowPaintAttrib &attrib)
7588
+ glMatrixMode (GL_PROJECTION);
7590
+ glLoadMatrixf (projection.getMatrix ());
7592
+ glMatrixMode (GL_MODELVIEW);
7594
+ glLoadMatrixf (modelview.getMatrix ());
7596
+ glEnableClientState (GL_VERTEX_ARRAY);
7597
+ glVertexPointer (3, GL_FLOAT, 0, &vertexData[0]);
7599
+ //use default normal
7600
+ if (normalData.size () == 0)
7602
+ glNormal3f (0.0f, 0.0f, -1.0f);
7604
+ // special case a single normal and apply it to the entire operation
7605
+ else if (normalData.size () == 3)
7607
+ glNormal3fv (&normalData[0]);
7609
+ else if (normalData.size () > 3)
7611
+ glEnableClientState (GL_NORMAL_ARRAY);
7612
+ glNormalPointer (GL_FLOAT, 0, &normalData[0]);
7615
+ // special case a single color and apply it to the entire operation
7616
+ if (colorData.size () == 4)
7618
+ glColor4fv (&colorData[0]);
7620
+ else if (colorData.size () > 4)
7622
+ glEnableClientState (GL_COLOR_ARRAY);
7623
+ glColorPointer (4, GL_FLOAT, 0, &colorData[0]);
7626
+ for (int i = textureData.size () - 1; i >= 0; i--)
7628
+ GL::clientActiveTexture (GL_TEXTURE0_ARB + i);
7629
+ glEnableClientState (GL_TEXTURE_COORD_ARRAY);
7630
+ glTexCoordPointer (2, GL_FLOAT, 0, &textureData[i][0]);
7633
+ glDrawArrays (primitiveType, 0, vertexData.size () / 3);
7635
+ glDisableClientState (GL_VERTEX_ARRAY);
7636
+ glDisableClientState (GL_NORMAL_ARRAY);
7637
+ glDisableClientState (GL_COLOR_ARRAY);
7639
+ for (int i = textureData.size (); i > 0; i--)
7641
+ GL::clientActiveTexture (GL_TEXTURE0_ARB + i);
7642
+ glDisableClientState (GL_TEXTURE_COORD_ARRAY);
7645
+ GL::clientActiveTexture (GL_TEXTURE0_ARB);
7647
+ glMatrixMode (GL_PROJECTION);
7650
+ glMatrixMode (GL_MODELVIEW);
7657
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/opengl/src/window.cpp linaro-gles2-debianpatches/plugins/opengl/src/window.cpp
7658
--- compiz-0.9.7.8/plugins/opengl/src/window.cpp 2012-04-26 08:47:01.000000000 +0200
7659
+++ linaro-gles2-debianpatches/plugins/opengl/src/window.cpp 2012-04-20 11:41:59.241600000 +0200
7666
+ * Callback object to create GLPrograms automatically when using GLVertexBuffer.
7668
+class GLWindowAutoProgram : public GLVertexBuffer::AutoProgram
7671
+ GLWindowAutoProgram (PrivateGLWindow *pWindow) : pWindow(pWindow) {}
7673
+ GLProgram *getProgram (GLShaderParameters ¶ms)
7675
+ GLScreen *gScreen = pWindow->gScreen;
7677
+ const GLShaderData *shaderData = gScreen->getShaderData (params);
7678
+ pWindow->shaders.push_back (shaderData);
7679
+ return gScreen->getProgram (pWindow->shaders);
7682
+ PrivateGLWindow *pWindow;
7686
PrivateGLWindow::PrivateGLWindow (CompWindow *w,
7694
+ vertexBuffer (new GLVertexBuffer ()),
7695
+ autoProgram(new GLWindowAutoProgram(this)),
7698
paint.xScale = 1.0f;
7701
WindowInterface::setHandler (w);
7702
CompositeWindowInterface::setHandler (cWindow);
7703
+ vertexBuffer->setAutoProgram(autoProgram);
7706
PrivateGLWindow::~PrivateGLWindow ()
7708
+ delete vertexBuffer;
7709
+ delete autoProgram;
7713
@@ -105,6 +131,21 @@
7714
compLogMessage ("opengl", CompLogLevelInfo,
7715
"Couldn't bind redirected window 0x%x to "
7716
"texture\n", (int) priv->window->id ());
7718
+ if (priv->cWindow->size ().width () > GL::maxTextureSize ||
7719
+ priv->cWindow->size ().height () > GL::maxTextureSize)
7721
+ compLogMessage ("opengl", CompLogLevelWarn,
7722
+ "Bug in window 0x%x (identifying as %s)", (int) priv->window->id (), priv->window->resName ().size () ? priv->window->resName ().c_str () : "(none available)");
7723
+ compLogMessage ("opengl", CompLogLevelWarn,
7724
+ "This window tried to create an absurdly large window %i x %i\n", priv->cWindow->size ().width (), priv->cWindow->size ().height ());
7725
+ compLogMessage ("opengl", CompLogLevelWarn,
7726
+ "Unforunately, that's not supported on your hardware, because you have a maximum texture size of %i", GL::maxTextureSize);
7727
+ compLogMessage ("opengl", CompLogLevelWarn, "you should probably file a bug against that application");
7728
+ compLogMessage ("opengl", CompLogLevelWarn, "for now, we're going to hide tht window so that it doesn't break your desktop\n");
7730
+ XReparentWindow (screen->dpy (), priv->window->id (), GLScreen::get (screen)->priv->saveWindow, 0, 0);
7734
priv->setWindowMatrix ();
7735
@@ -132,11 +173,11 @@
7736
WRAPABLE_DEF (glPaint, attrib, transform, region, mask)
7739
-GLWindowInterface::glDraw (const GLMatrix &transform,
7740
- GLFragment::Attrib &fragment,
7741
- const CompRegion ®ion,
7742
- unsigned int mask)
7743
- WRAPABLE_DEF (glDraw, transform, fragment, region, mask)
7744
+GLWindowInterface::glDraw (const GLMatrix &transform,
7745
+ const GLWindowPaintAttrib &attrib,
7746
+ const CompRegion ®ion,
7747
+ unsigned int mask)
7748
+ WRAPABLE_DEF (glDraw, transform, attrib, region, mask)
7751
GLWindowInterface::glAddGeometry (const GLTexture::MatrixList &matrix,
7752
@@ -148,14 +189,11 @@
7753
maxGridWidth, maxGridHeight)
7756
-GLWindowInterface::glDrawTexture (GLTexture *texture,
7757
- GLFragment::Attrib &fragment,
7758
- unsigned int mask)
7759
- WRAPABLE_DEF (glDrawTexture, texture, fragment, mask)
7762
-GLWindowInterface::glDrawGeometry ()
7763
- WRAPABLE_DEF (glDrawGeometry)
7764
+GLWindowInterface::glDrawTexture (GLTexture *texture,
7765
+ const GLMatrix &transform,
7766
+ const GLWindowPaintAttrib &attrib,
7767
+ unsigned int mask)
7768
+ WRAPABLE_DEF (glDrawTexture, texture, transform, attrib, mask)
7771
GLWindow::clip () const
7772
@@ -223,76 +261,10 @@
7773
priv->paint.saturation = cw->saturation ();
7776
-GLWindow::Geometry &
7777
-GLWindow::geometry ()
7779
- return priv->geometry;
7782
-GLWindow::Geometry::Geometry () :
7795
-GLWindow::Geometry::~Geometry ()
7805
-GLWindow::Geometry::reset ()
7807
- vCount = indexCount = 0;
7811
-GLWindow::Geometry::moreVertices (int newSize)
7813
- if (newSize > vertexSize)
7815
- GLfloat *nVertices;
7817
- nVertices = (GLfloat *)
7818
- realloc (vertices, sizeof (GLfloat) * newSize);
7822
- vertices = nVertices;
7823
- vertexSize = newSize;
7830
-GLWindow::Geometry::moreIndices (int newSize)
7832
+GLWindow::vertexBuffer ()
7834
- if (newSize > indexSize)
7836
- GLushort *nIndices;
7838
- nIndices = (GLushort *)
7839
- realloc (indices, sizeof (GLushort) * newSize);
7843
- indices = nIndices;
7844
- indexSize = newSize;
7848
+ return priv->vertexBuffer;
7851
const GLTexture::List &
7852
@@ -335,6 +307,19 @@
7856
+GLWindow::addShaders (std::string name,
7857
+ std::string vertex_shader,
7858
+ std::string fragment_shader)
7860
+ GLShaderData *data = new GLShaderData;
7861
+ data->name = name;
7862
+ data->vertexShader = vertex_shader;
7863
+ data->fragmentShader = fragment_shader;
7865
+ priv->shaders.push_back(data);
7869
PrivateGLWindow::updateFrameRegion (CompRegion ®ion)
7871
window->updateFrameRegion (region);
7872
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/resize/src/resize.cpp linaro-gles2-debianpatches/plugins/resize/src/resize.cpp
7873
--- compiz-0.9.7.8/plugins/resize/src/resize.cpp 2012-04-26 08:47:01.000000000 +0200
7874
+++ linaro-gles2-debianpatches/plugins/resize/src/resize.cpp 2012-04-20 11:41:59.241600000 +0200
7875
@@ -1525,60 +1525,114 @@
7876
unsigned short *borderColor,
7877
unsigned short *fillColor)
7880
- GLMatrix sTransform (transform);
7881
- GLint origSrc, origDst;
7882
- float_t fc[4], bc[4];
7883
+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
7886
+ GLMatrix sTransform (transform);
7887
+ GLfloat vertexData [12];
7888
+ GLfloat vertexData2[24];
7889
+ GLint origSrc, origDst;
7890
+ GLushort fc[4], bc[4];
7893
+ GLint origSrcAlpha, origDstAlpha;
7894
+ glGetIntegerv (GL_BLEND_SRC_RGB, &origSrc);
7895
+ glGetIntegerv (GL_BLEND_DST_RGB, &origDst);
7896
+ glGetIntegerv (GL_BLEND_SRC_ALPHA, &origSrcAlpha);
7897
+ glGetIntegerv (GL_BLEND_DST_ALPHA, &origDstAlpha);
7899
glGetIntegerv (GL_BLEND_SRC, &origSrc);
7900
glGetIntegerv (GL_BLEND_DST, &origDst);
7903
/* Premultiply the alpha values */
7905
- bc[3] = (float) borderColor[3] / (float) 65535.0f;
7906
+ bc[3] = (float) borderColor[3] / (float) 65535.0f;
7907
bc[0] = ((float) borderColor[0] / 65535.0f) * bc[3];
7908
bc[1] = ((float) borderColor[1] / 65535.0f) * bc[3];
7909
bc[2] = ((float) borderColor[2] / 65535.0f) * bc[3];
7911
getPaintRectangle (&box);
7914
+ vertexData[0] = box.x1;
7915
+ vertexData[1] = box.y1;
7916
+ vertexData[2] = 0.0f;
7917
+ vertexData[3] = box.x1;
7918
+ vertexData[4] = box.y2;
7919
+ vertexData[5] = 0.0f;
7920
+ vertexData[6] = box.x2;
7921
+ vertexData[7] = box.y1;
7922
+ vertexData[8] = 0.0f;
7923
+ vertexData[9] = box.x2;
7924
+ vertexData[10] = box.y2;
7925
+ vertexData[11] = 0.0f;
7927
+ // FIXME: this is a quick work-around.
7928
+ // GL_LINE_LOOP and GL_LINE_STRIP primitive types in the SGX Pvr X11 driver
7929
+ // take special number of vertices (and reorder them). Thus, usage of
7930
+ // those line primitive is currently not supported by our GLVertexBuffer
7931
+ // implementation. This is a quick workaround to make it all work until
7932
+ // we come up with a better GLVertexBuffer::render(...) function.
7934
+ vertexData2[0] = box.x1;
7935
+ vertexData2[1] = box.y1;
7936
+ vertexData2[2] = 0.0f;
7937
+ vertexData2[3] = box.x1;
7938
+ vertexData2[4] = box.y2;
7939
+ vertexData2[5] = 0.0f;
7940
+ vertexData2[6] = box.x1;
7941
+ vertexData2[7] = box.y2;
7942
+ vertexData2[8] = 0.0f;
7943
+ vertexData2[9] = box.x2;
7944
+ vertexData2[10] = box.y2;
7945
+ vertexData2[11] = 0.0f;
7946
+ vertexData2[12] = box.x2;
7947
+ vertexData2[13] = box.y2;
7948
+ vertexData2[14] = 0.0f;
7949
+ vertexData2[15] = box.x2;
7950
+ vertexData2[16] = box.y1;
7951
+ vertexData2[17] = 0.0f;
7952
+ vertexData2[18] = box.x2;
7953
+ vertexData2[19] = box.y1;
7954
+ vertexData2[20] = 0.0f;
7955
+ vertexData2[21] = box.x1;
7956
+ vertexData2[22] = box.y1;
7957
+ vertexData2[23] = 0.0f;
7959
sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
7961
- glLoadMatrixf (sTransform.getMatrix ());
7963
- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
7964
- glEnable (GL_BLEND);
7965
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
7967
/* fill rectangle */
7970
- fc[3] = (float) fillColor[3] / (float) 65535.0f;
7971
- fc[0] = ((float) fillColor[0] / 65535.0f) * fc[3];
7972
- fc[1] = ((float) fillColor[1] / 65535.0f) * fc[3];
7973
- fc[2] = ((float) fillColor[2] / 65535.0f) * fc[3];
7975
- glColor4f (fc[0], fc[1], fc[2], fc[3]);
7976
- glRecti (box.x1, box.y2, box.x2, box.y1);
7977
+ fc[3] = fillColor[3];
7978
+ fc[0] = fillColor[0] * fc[3];
7979
+ fc[1] = fillColor[1] * fc[3];
7980
+ fc[2] = fillColor[2] * fc[3];
7982
+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
7983
+ streamingBuffer->addColors (1, fc);
7984
+ streamingBuffer->addVertices (4, &vertexData[0]);
7985
+ streamingBuffer->end ();
7986
+ streamingBuffer->render (sTransform);
7990
- glColor4f (bc[0], bc[1], bc[2], bc[3]);
7992
- glBegin (GL_LINE_LOOP);
7993
- glVertex2i (box.x1, box.y1);
7994
- glVertex2i (box.x2, box.y1);
7995
- glVertex2i (box.x2, box.y2);
7996
- glVertex2i (box.x1, box.y2);
8000
- glColor4usv (defaultColor);
8001
- glDisable (GL_BLEND);
8002
- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
8004
+ streamingBuffer->begin (GL_LINES);
8005
+ streamingBuffer->addColors (1, borderColor);
8006
+ streamingBuffer->addVertices (8, &vertexData2[0]);
8007
+ streamingBuffer->end ();
8008
+ streamingBuffer->render (sTransform);
8010
+ cScreen->damageScreen ();
8013
+ glBlendFuncSeparate (origSrc, origDst,
8014
+ origSrcAlpha, origDstAlpha);
8016
+ glBlendFunc (origSrc, origDst);
8021
@@ -1589,6 +1643,7 @@
8025
+ GLboolean isBlendingEnabled;
8029
@@ -1605,6 +1660,9 @@
8030
border = optionGetBorderColor ();
8031
fill = optionGetFillColor ();
8033
+ glGetBooleanv (GL_BLEND, &isBlendingEnabled);
8034
+ glEnable (GL_BLEND);
8037
case ResizeOptions::ModeOutline:
8038
glPaintRectangle (sAttrib, transform, output, border, NULL);
8039
@@ -1614,6 +1672,9 @@
8044
+ if (!isBlendingEnabled)
8045
+ glDisable (GL_BLEND);
8049
@@ -1641,9 +1702,9 @@
8050
status = gWindow->glPaint (attrib, transform, region,
8051
mask | PAINT_WINDOW_NO_CORE_INSTANCE_MASK);
8053
- GLFragment::Attrib fragment (gWindow->lastPaintAttrib ());
8054
+ GLWindowPaintAttrib lastAttrib (gWindow->lastPaintAttrib ());
8056
- if (window->alpha () || fragment.getOpacity () != OPAQUE)
8057
+ if (window->alpha () || lastAttrib.opacity != OPAQUE)
8058
mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
8060
rScreen->getPaintRectangle (&box);
8061
@@ -1661,13 +1722,8 @@
8062
(rScreen->geometry.y - y) / yScale - yOrigin,
8066
- glLoadMatrixf (wTransform.getMatrix ());
8068
- gWindow->glDraw (wTransform, fragment, region,
8069
+ gWindow->glDraw (wTransform, lastAttrib, region,
8070
mask | PAINT_WINDOW_TRANSFORMED_MASK);
8076
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/rotate/CMakeLists.txt linaro-gles2-debianpatches/plugins/rotate/CMakeLists.txt
8077
--- compiz-0.9.7.8/plugins/rotate/CMakeLists.txt 2012-04-26 08:47:01.000000000 +0200
8078
+++ linaro-gles2-debianpatches/plugins/rotate/CMakeLists.txt 2012-04-20 11:41:59.241600000 +0200
8081
include (CompizPlugin)
8083
-compiz_plugin(rotate PLUGINDEPS composite opengl cube)
8084
\ Kein Zeilenumbruch am Dateiende.
8085
+#compiz_plugin(rotate PLUGINDEPS composite opengl cube)
8086
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/scale/src/scale.cpp linaro-gles2-debianpatches/plugins/scale/src/scale.cpp
8087
--- compiz-0.9.7.8/plugins/scale/src/scale.cpp 2012-04-26 08:47:01.000000000 +0200
8088
+++ linaro-gles2-debianpatches/plugins/scale/src/scale.cpp 2012-04-20 11:41:59.241600000 +0200
8089
@@ -226,26 +226,19 @@
8090
GLTexture::MatrixList ml (1);
8092
ml[0] = icon->matrix ();
8093
- priv->gWindow->geometry ().reset ();
8094
+ priv->gWindow->vertexBuffer ()->begin ();
8096
if (width && height)
8097
priv->gWindow->glAddGeometry (ml, iconReg, iconReg);
8099
- if (priv->gWindow->geometry ().vCount)
8101
- GLFragment::Attrib fragment (sAttrib);
8102
- GLMatrix wTransform (transform);
8103
+ priv->gWindow->vertexBuffer ()->end ();
8105
- wTransform.scale (scale, scale, 1.0f);
8106
- wTransform.translate (x / scale, y / scale, 0.0f);
8109
- glLoadMatrixf (wTransform.getMatrix ());
8110
+ GLMatrix wTransform (transform);
8112
- priv->gWindow->glDrawTexture (icon, fragment, mask);
8113
+ wTransform.scale (scale, scale, 1.0f);
8114
+ wTransform.translate (x / scale, y / scale, 0.0f);
8118
+ priv->gWindow->glDrawTexture (icon, wTransform, sAttrib, mask);
8122
@@ -392,13 +385,13 @@
8126
- GLFragment::Attrib fragment (gWindow->lastPaintAttrib ());
8127
+ GLWindowPaintAttrib lastAttrib (gWindow->lastPaintAttrib ());
8128
GLMatrix wTransform (transform);
8130
if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
8133
- if (window->alpha () || fragment.getOpacity () != OPAQUE)
8134
+ if (window->alpha () || lastAttrib.opacity != OPAQUE)
8135
mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
8137
wTransform.translate (window->x (), window->y (), 0.0f);
8138
@@ -406,14 +399,9 @@
8139
wTransform.translate (tx / scale - window->x (),
8140
ty / scale - window->y (), 0.0f);
8143
- glLoadMatrixf (wTransform.getMatrix ());
8145
- gWindow->glDraw (wTransform, fragment, region,
8146
+ gWindow->glDraw (wTransform, lastAttrib, region,
8147
mask | PAINT_WINDOW_TRANSFORMED_MASK);
8151
sWindow->scalePaintDecoration (sAttrib, transform, region, mask);
8154
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/screenshot/src/screenshot.cpp linaro-gles2-debianpatches/plugins/screenshot/src/screenshot.cpp
8155
--- compiz-0.9.7.8/plugins/screenshot/src/screenshot.cpp 2012-04-26 08:47:01.000000000 +0200
8156
+++ linaro-gles2-debianpatches/plugins/screenshot/src/screenshot.cpp 2012-04-20 11:41:59.241600000 +0200
8157
@@ -249,6 +249,10 @@
8161
+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
8162
+ GLMatrix transform (matrix);
8163
+ GLfloat vertexData[12];
8164
+ GLushort colorData[4];
8167
status = gScreen->glPaintOutput (attrib, matrix, region, output, mask);
8168
@@ -264,31 +268,54 @@
8173
+ vertexData[0] = x1;
8174
+ vertexData[1] = y1;
8175
+ vertexData[2] = 0.0f;
8176
+ vertexData[3] = x1;
8177
+ vertexData[4] = y2;
8178
+ vertexData[5] = 0.0f;
8179
+ vertexData[6] = x2;
8180
+ vertexData[7] = y1;
8181
+ vertexData[8] = 0.0f;
8182
+ vertexData[9] = x2;
8183
+ vertexData[10] = y2;
8184
+ vertexData[11] = 0.0f;
8186
+ colorData[0] = 0x2fff;
8187
+ colorData[1] = 0x2fff;
8188
+ colorData[2] = 0x4fff;
8189
+ colorData[3] = 0x4fff;
8192
+ transform.translate (-0.5f, -0.5f, -DEFAULT_Z_CAMERA);
8193
+ transform.scale (1.0f / output->width (),
8194
+ -1.0f / output->height (),
8196
+ transform.translate (-output->region ()->extents.x1,
8197
+ -output->region ()->extents.y2,
8200
+ streamingBuffer->begin (GL_TRIANGLE_STRIP);
8202
+ streamingBuffer->addColors (1, colorData);
8203
+ streamingBuffer->addVertices (4, vertexData);
8205
+ streamingBuffer->end ();
8206
+ streamingBuffer->render (transform);
8208
+ streamingBuffer->begin (GL_LINE_LOOP);
8210
+ vertexData[6] = x2;
8211
+ vertexData[7] = y2;
8212
+ vertexData[9] = x2;
8213
+ vertexData[10] = y1;
8214
+ colorData [3] = 0x9fff;
8216
- glTranslatef (-0.5f, -0.5f, -DEFAULT_Z_CAMERA);
8217
- glScalef (1.0f / output->width (),
8218
- -1.0f / output->height (),
8220
- glTranslatef (-output->region ()->extents.x1,
8221
- -output->region ()->extents.y2,
8224
- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
8225
- glEnable (GL_BLEND);
8226
- glColor4us (0x2fff, 0x2fff, 0x4fff, 0x4fff);
8227
- glRecti (x1, y2, x2, y1);
8228
- glColor4us (0x2fff, 0x2fff, 0x4fff, 0x9fff);
8229
- glBegin (GL_LINE_LOOP);
8230
- glVertex2i (x1, y1);
8231
- glVertex2i (x2, y1);
8232
- glVertex2i (x2, y2);
8233
- glVertex2i (x1, y2);
8235
- glColor4usv (defaultColor);
8236
- glDisable (GL_BLEND);
8237
- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
8239
+ streamingBuffer->addColors (1, colorData);
8240
+ streamingBuffer->addVertices (4, vertexData);
8242
+ streamingBuffer->end ();
8243
+ streamingBuffer->render (transform);
8247
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/switcher/src/switcher.cpp linaro-gles2-debianpatches/plugins/switcher/src/switcher.cpp
8248
--- compiz-0.9.7.8/plugins/switcher/src/switcher.cpp 2012-04-26 08:47:01.000000000 +0200
8249
+++ linaro-gles2-debianpatches/plugins/switcher/src/switcher.cpp 2012-04-20 11:41:59.241600000 +0200
8252
static float _boxVertices[] =
8255
- -(WIDTH >> 1), BOX_WIDTH,
8256
- (WIDTH >> 1), BOX_WIDTH,
8259
- -(WIDTH >> 1), BOX_WIDTH,
8260
- -(WIDTH >> 1), HEIGHT - BOX_WIDTH,
8261
- -(WIDTH >> 1) + BOX_WIDTH, HEIGHT - BOX_WIDTH,
8262
- -(WIDTH >> 1) + BOX_WIDTH, 0,
8264
- (WIDTH >> 1) - BOX_WIDTH, BOX_WIDTH,
8265
- (WIDTH >> 1) - BOX_WIDTH, HEIGHT - BOX_WIDTH,
8266
- (WIDTH >> 1), HEIGHT - BOX_WIDTH,
8269
- -(WIDTH >> 1), HEIGHT - BOX_WIDTH,
8270
- -(WIDTH >> 1), HEIGHT,
8271
- (WIDTH >> 1), HEIGHT,
8272
- (WIDTH >> 1), HEIGHT - BOX_WIDTH
8273
+ -(WIDTH >> 1), BOX_WIDTH, 0.0f,
8274
+ (WIDTH >> 1), BOX_WIDTH, 0.0f,
8275
+ -(WIDTH >> 1), 0.0f, 0.0f,
8276
+ -(WIDTH >> 1), 0.0f, 0.0f,
8277
+ (WIDTH >> 1), BOX_WIDTH, 0.0f,
8278
+ (WIDTH >> 1), 0.0f, 0.0f,
8280
+ -(WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
8281
+ -(WIDTH >> 1) + BOX_WIDTH, HEIGHT - BOX_WIDTH, 0.0f,
8282
+ -(WIDTH >> 1), BOX_WIDTH, 0.0f,
8283
+ -(WIDTH >> 1), BOX_WIDTH, 0.0f,
8284
+ -(WIDTH >> 1) + BOX_WIDTH, HEIGHT - BOX_WIDTH, 0.0f,
8285
+ -(WIDTH >> 1) + BOX_WIDTH, BOX_WIDTH, 0.0f,
8287
+ (WIDTH >> 1) - BOX_WIDTH, HEIGHT - BOX_WIDTH, 0.0f,
8288
+ (WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
8289
+ (WIDTH >> 1) - BOX_WIDTH, BOX_WIDTH, 0.0f,
8290
+ (WIDTH >> 1) - BOX_WIDTH, BOX_WIDTH, 0.0f,
8291
+ (WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
8292
+ (WIDTH >> 1), BOX_WIDTH, 0.0f,
8294
+ -(WIDTH >> 1), HEIGHT, 0.0f,
8295
+ (WIDTH >> 1), HEIGHT, 0.0f,
8296
+ -(WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
8297
+ -(WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
8298
+ (WIDTH >> 1), HEIGHT, 0.0f,
8299
+ (WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
8305
sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
8308
- glLoadMatrixf (sTransform.getMatrix ());
8310
if (!switcher->destroyed () &&
8311
switcher->isViewable () &&
8312
sw->cWindow->damaged ())
8314
sw->gWindow->glPaint (sw->gWindow->paintAttrib (),
8315
sTransform, infiniteRegion, 0);
8322
@@ -950,8 +953,10 @@
8323
const CompRegion ®ion,
8326
- int zoomType = NORMAL_WINDOW_MASK;
8328
+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
8329
+ GLMatrix wTransform (transform);
8330
+ int zoomType = NORMAL_WINDOW_MASK;
8333
if (window->id () == sScreen->popupWindow)
8335
@@ -975,17 +980,14 @@
8336
x = x1 + sScreen->pos;
8339
- glPushAttrib (GL_SCISSOR_BIT);
8341
glEnable (GL_SCISSOR_TEST);
8342
glScissor (x1, 0, x2 - x1, screen->height ());
8344
foreach (CompWindow *w, sScreen->windows)
8347
- SwitchWindow::get (w)->paintThumb (
8348
- gWindow->lastPaintAttrib (), transform,
8350
+ SwitchWindow::get (w)->paintThumb (gWindow->lastPaintAttrib (),
8351
+ transform, mask, x, y);
8355
@@ -994,31 +996,30 @@
8359
- SwitchWindow::get (w)->paintThumb (
8360
- gWindow->lastPaintAttrib (), transform,
8362
+ SwitchWindow::get (w)->paintThumb (gWindow->lastPaintAttrib (),
8363
+ transform, mask, x, y);
8368
+ glDisable (GL_SCISSOR_TEST);
8370
cx = g.x () + (g.width () >> 1);
8371
+ wTransform.translate (cx, y, 0.0f);
8373
- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
8374
- glEnable (GL_BLEND);
8375
for (i = 0; i < 4; i++)
8377
color[i] = (unsigned int)sScreen->fgColor[i] *
8378
- gWindow->lastPaintAttrib ().opacity /
8380
- glColor4usv (color);
8382
- glTranslatef (cx, y, 0.0f);
8383
- glVertexPointer (2, GL_FLOAT, 0, _boxVertices);
8384
- glDrawArrays (GL_QUADS, 0, 16);
8386
- glColor4usv (defaultColor);
8387
- glDisable (GL_BLEND);
8388
- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
8389
+ gWindow->lastPaintAttrib ().opacity /
8393
+ streamingBuffer->begin (GL_TRIANGLES);
8395
+ streamingBuffer->addColors (1, color);
8396
+ streamingBuffer->addVertices (24, _boxVertices);
8398
+ streamingBuffer->end ();
8399
+ streamingBuffer->render (wTransform, attrib);
8401
else if (window == sScreen->selectedWindow)
8403
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/water/CMakeLists.txt linaro-gles2-debianpatches/plugins/water/CMakeLists.txt
8404
--- compiz-0.9.7.8/plugins/water/CMakeLists.txt 2012-04-26 08:47:01.000000000 +0200
8405
+++ linaro-gles2-debianpatches/plugins/water/CMakeLists.txt 2012-04-20 11:41:59.241600000 +0200
8408
include (CompizPlugin)
8410
-compiz_plugin(water PLUGINDEPS composite opengl)
8411
\ Kein Zeilenumbruch am Dateiende.
8412
+compiz_plugin(water PLUGINDEPS composite opengl)
8413
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/water/src/shaders.h linaro-gles2-debianpatches/plugins/water/src/shaders.h
8414
--- compiz-0.9.7.8/plugins/water/src/shaders.h 1970-01-01 01:00:00.000000000 +0100
8415
+++ linaro-gles2-debianpatches/plugins/water/src/shaders.h 2012-04-20 11:41:59.241600000 +0200
8418
+ * Copyright © 2011 Collabora Ltd.
8420
+ * Permission to use, copy, modify, distribute, and sell this software
8421
+ * and its documentation for any purpose is hereby granted without
8422
+ * fee, provided that the above copyright notice appear in all copies
8423
+ * and that both that copyright notice and this permission notice
8424
+ * appear in supporting documentation, and that the name of
8425
+ * Collabora Ltd. not be used in advertising or publicity pertaining to
8426
+ * distribution of the software without specific, written prior permission.
8427
+ * Collabora Ltd. makes no representations about the suitability of this
8428
+ * software for any purpose. It is provided "as is" without express or
8429
+ * implied warranty.
8431
+ * COLLABORA LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
8432
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
8433
+ * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
8434
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
8435
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
8436
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
8437
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
8439
+ * Authors: Frederic Plourde <frederic.plourde@collabora.co.uk>
8442
+#ifndef _COMPIZ_WATERSHADERS_H
8443
+#define _COMPIZ_WATERSHADERS_H
8446
+// This vertex shader is used to set water vertices ...
8447
+static std::string set_water_vertices_vertex_shader = " \n\
8449
+precision mediump float; \n\
8452
+attribute vec3 position; \n\
8456
+ gl_PointSize = 3.0; \n\
8457
+ gl_Position = vec4(position, 1.0); \n\
8461
+// This fragment shader is used to draw water primitives ...
8462
+// we're only setting the height here, so we only care about the .w coord.
8463
+static std::string set_water_vertices_fragment_shader = " \n\
8465
+precision mediump float; \n\
8468
+uniform float color; \n\
8472
+ gl_FragColor = vec4(0.0, 0.0, 0.0, color); \n\
8478
+// This vertex shader is used to update water vertices...
8479
+static std::string update_water_vertices_vertex_shader = " \n\
8481
+precision mediump float; \n\
8484
+attribute vec3 position; \n\
8485
+attribute vec2 texCoord0; \n\
8487
+varying vec2 vTexCoord0; \n\
8491
+ vTexCoord0 = texCoord0; \n\
8492
+ gl_Position = vec4(position, 1.0); \n\
8496
+// This fragment shader is used to compute new normal + height of water vertices.
8497
+// here we're using two input textures, previous and current.
8498
+static std::string update_water_vertices_fragment_shader = " \n\
8500
+precision mediump float; \n\
8503
+uniform sampler2D prevTex; \n\
8504
+uniform sampler2D currTex; \n\
8506
+varying vec2 vTexCoord0; \n\
8508
+uniform float timeLapse; \n\
8509
+uniform float fade; \n\
8513
+ vec2 t01, t21, t10, t12; \n\
8514
+ vec4 c01, c21, c10, c12; \n\
8515
+ vec4 curr, prev, v; \n\
8518
+ // fetch current and previous normals \n\
8519
+ prev = texture%s (prevTex, vTexCoord0); \n\
8520
+ curr = texture%s (currTex, vTexCoord0); \n\
8522
+ // sample offsets \n\
8523
+ t01 = vTexCoord0 + vec2 (- %f, 0.0); \n\
8524
+ t21 = vTexCoord0 + vec2 ( %f, 0.0); \n\
8525
+ t10 = vTexCoord0 + vec2 ( 0.0,- %f); \n\
8526
+ t12 = vTexCoord0 + vec2 ( 0.0, %f); \n\
8528
+ // fetch necessary samples \n\
8529
+ c01 = texture%s (currTex, t01); \n\
8530
+ c21 = texture%s (currTex, t21); \n\
8531
+ c10 = texture%s (currTex, t10); \n\
8532
+ c12 = texture%s (currTex, t12); \n\
8534
+ // x/y normals from height \n\
8535
+ v = vec4 (0.0, 0.0, 0.75, 0.0); \n\
8536
+ v.x = c01.w - c21.w; \n\
8537
+ v.y = c12.w - c10.w; \n\
8540
+ v = normalize (v); \n\
8542
+ // add scale and bias \n\
8543
+ v = (v * 0.5) + 0.5; \n\
8545
+ // done with computing the normal, continue with computing \n\
8546
+ // the next height value \n\
8547
+ accel = (curr.w * -4.0) + (c10.w + c12.w + c01.w + c21.w); \n\
8549
+ // store new height in alpha component \n\
8550
+ v.w = (accel * timeLapse) + ((curr.w * 2.0) - prev.w); \n\
8552
+ // fade out height \n\
8555
+ gl_FragColor = v; \n\
8561
+// This vertex shader is used when painting our bump map FX over
8562
+// final composited screen FBO
8563
+static std::string paint_water_vertices_vertex_shader = " \n\
8565
+precision mediump float; \n\
8568
+attribute vec3 position; \n\
8569
+attribute vec2 texCoord0; \n\
8571
+varying vec2 vTexCoord0; \n\
8575
+ vTexCoord0 = texCoord0; \n\
8576
+ gl_Position = vec4(position, 1.0); \n\
8580
+// This fragment shader is used to produce our dot3 bump mapping output,
8581
+// blended over final composited glScreen FBO.
8582
+// here we're using two input textures :
8583
+// 1) The final composited FBO color attachment over which we're
8584
+// applying our bump map FX (baseTex)
8585
+// 2) The updated bump map (waveTex)
8586
+static std::string paint_water_vertices_fragment_shader = " \n\
8588
+precision mediump float; \n\
8591
+uniform sampler2D baseTex; \n\
8592
+uniform sampler2D waveTex; \n\
8594
+varying vec2 vTexCoord0; \n\
8596
+uniform vec3 lightVec; \n\
8597
+uniform float offsetScale; \n\
8601
+ vec4 normal = texture2D (waveTex, vTexCoord0); \n\
8602
+ float height = normal.w; \n\
8603
+ float diffuse = 0.75; \n\
8606
+ normal = normalize ((normal * 2.0) - 1.0); \n\
8608
+ offset.x = normal.x * height * offsetScale/%d.0; \n\
8609
+ offset.y = normal.y * height * offsetScale/%d.0; \n\
8610
+ vec4 baseColor = texture2D (baseTex, vTexCoord0 + offset.xy); \n\
8612
+ float diffFact = dot (normal.xyz, vec3(lightVec.xy, 0.0)) * diffuse; \n\
8613
+ gl_FragColor = vec4 (vec3 (baseColor) + diffFact, 1.0); \n\
8616
+#endif // _COMPIZ_WATERSHADERS_H
8618
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/water/src/water.cpp linaro-gles2-debianpatches/plugins/water/src/water.cpp
8619
--- compiz-0.9.7.8/plugins/water/src/water.cpp 2012-04-26 08:47:01.000000000 +0200
8620
+++ linaro-gles2-debianpatches/plugins/water/src/water.cpp 2012-04-20 11:41:59.241600000 +0200
8622
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
8624
* Author: David Reveman <davidr@novell.com>
8625
+ * Frederic Plourde <frederic.plourde@collabora.co.uk>
8629
@@ -33,270 +34,33 @@
8630
static int waterLastPointerX = 0;
8631
static int waterLastPointerY = 0;
8633
-static const char *waterFpString =
8636
- "PARAM param = program.local[0];"
8637
- "ATTRIB t11 = fragment.texcoord[0];"
8639
- "TEMP t01, t21, t10, t12;"
8640
- "TEMP c11, c01, c21, c10, c12;"
8641
- "TEMP prev, v, temp, accel;"
8643
- "TEX prev, t11, texture[0], %s;"
8644
- "TEX c11, t11, texture[1], %s;"
8646
- /* sample offsets */
8647
- "ADD t01, t11, { - %f, 0.0, 0.0, 0.0 };"
8648
- "ADD t21, t11, { %f, 0.0, 0.0, 0.0 };"
8649
- "ADD t10, t11, { 0.0, - %f, 0.0, 0.0 };"
8650
- "ADD t12, t11, { 0.0, %f, 0.0, 0.0 };"
8652
- /* fetch nesseccary samples */
8653
- "TEX c01, t01, texture[1], %s;"
8654
- "TEX c21, t21, texture[1], %s;"
8655
- "TEX c10, t10, texture[1], %s;"
8656
- "TEX c12, t12, texture[1], %s;"
8658
- /* x/y normals from height */
8659
- "MOV v, { 0.0, 0.0, 0.75, 0.0 };"
8660
- "SUB v.x, c12.w, c10.w;"
8661
- "SUB v.y, c01.w, c21.w;"
8667
- "MAD temp, v.x, v.x, 1.0;"
8668
- "MAD temp, v.y, v.y, temp;"
8669
- "RSQ temp, temp.x;"
8672
- /* add scale and bias to normal */
8673
- "MAD v, v, 0.5, 0.5;"
8675
- /* done with computing the normal, continue with computing the next
8677
- "ADD accel, c10, c12;"
8678
- "ADD accel, c01, accel;"
8679
- "ADD accel, c21, accel;"
8680
- "MAD accel, -4.0, c11, accel;"
8682
- /* store new height in alpha component */
8683
- "MAD v.w, 2.0, c11, -prev.w;"
8684
- "MAD v.w, accel, param.x, v.w;"
8686
- /* fade out height */
8687
- "MUL v.w, v.w, param.y;"
8689
- "MOV result.color, v;"
8694
-loadFragmentProgram (GLuint *program,
8695
- const char *string)
8699
- /* clear errors */
8703
- GL::genPrograms (1, program);
8705
- GL::bindProgram (GL_FRAGMENT_PROGRAM_ARB, *program);
8706
- GL::programString (GL_FRAGMENT_PROGRAM_ARB,
8707
- GL_PROGRAM_FORMAT_ASCII_ARB,
8708
- strlen (string), string);
8710
- glGetIntegerv (GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
8711
- if (glGetError () != GL_NO_ERROR || errorPos != -1)
8713
- compLogMessage ("water", CompLogLevelError,
8714
- "failed to load bump map program");
8716
- GL::deletePrograms (1, program);
8726
-loadWaterProgram ()
8728
- char buffer[1024];
8730
- WATER_SCREEN (screen);
8732
- if (ws->target == GL_TEXTURE_2D)
8733
- sprintf (buffer, waterFpString,
8735
- 1.0f / ws->width, 1.0f / ws->width,
8736
- 1.0f / ws->height, 1.0f / ws->height,
8737
- "2D", "2D", "2D", "2D");
8739
- sprintf (buffer, waterFpString,
8741
- 1.0f, 1.0f, 1.0f, 1.0f,
8742
- "RECT", "RECT", "RECT", "RECT");
8744
- return loadFragmentProgram (&ws->program, buffer);
8747
-GLFragment::FunctionId
8748
-WaterScreen::getBumpMapFragmentFunction (GLTexture *texture,
8752
- GLFragment::FunctionData data;
8754
- WaterFunction function;
8756
- if (texture->target () == GL_TEXTURE_2D)
8757
- target = COMP_FETCH_TARGET_2D;
8759
- target = COMP_FETCH_TARGET_RECT;
8761
- foreach (WaterFunction &f, bumpMapFunctions)
8763
- if (f.param == param &&
8765
- f.target == target)
8769
- static const char *temp[] = { "normal", "temp", "total", "bump", "offset" };
8771
- for (unsigned int i = 0; i < sizeof (temp) / sizeof (temp[0]); i++)
8772
- data.addTempHeaderOp (temp[i]);
8775
- /* get normal from normal map */
8776
- "TEX normal, fragment.texcoord[%d], texture[%d], %s;"
8779
- "MOV offset, normal;"
8781
- /* remove scale and bias from normal */
8782
- "MAD normal, normal, 2.0, -1.0;"
8784
- /* normalize the normal map */
8785
- "DP3 temp, normal, normal;"
8786
- "RSQ temp, temp.x;"
8787
- "MUL normal, normal, temp;"
8789
- /* scale down normal by height and constant and use as
8790
- offset in texture */
8791
- "MUL offset, normal, offset.w;"
8792
- "MUL offset, offset, program.env[%d];",
8795
- (this->target == GL_TEXTURE_2D) ? "2D" : "RECT",
8798
- data.addFetchOp ("output", "offset.yxzz", target);
8801
- /* normal dot lightdir, this should eventually be
8802
- changed to a real light vector */
8803
- "DP3 bump, normal, { 0.707, 0.707, 0.0, 0.0 };"
8804
- "MUL bump, bump, state.light[0].diffuse;");
8807
- data.addColorOp ("output", "output");
8810
- /* diffuse per-vertex lighting, opacity and brightness
8811
- and add lightsource bump color */
8812
- "ADD output, output, bump;");
8814
- if (!data.status ())
8818
- function.id = data.createFragmentFunction ("water");
8820
- function.target = target;
8821
- function.param = param;
8822
- function.unit = unit;
8824
- bumpMapFunctions.push_back (function);
8826
- return function.id;
8830
-WaterScreen::allocTexture (int index)
8832
- glGenTextures (1, &texture[index]);
8833
- glBindTexture (target, texture[index]);
8835
- glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
8836
- glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
8837
- glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
8838
- glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
8840
- glTexImage2D (target, 0, GL_RGBA, width, height, 0, GL_BGRA,
8841
-#if IMAGE_BYTE_ORDER == MSBFirst
8842
- GL_UNSIGNED_INT_8_8_8_8_REV,
8848
- glBindTexture (target, 0);
8850
+GLfloat WaterScreen::vertexData [18] = {
8851
+ -1.0f, -1.0f, 0.0f,
8852
+ 1.0f, -1.0f, 0.0f,
8853
+ -1.0f, 1.0f, 0.0f,
8854
+ -1.0f, 1.0f, 0.0f,
8855
+ 1.0f, -1.0f, 0.0f,
8859
+GLfloat WaterScreen::textureData [12] = {
8869
-WaterScreen::fboPrologue (int tIndex)
8870
+WaterScreen::fboPrologue (int fIndex)
8876
- if (!texture[tIndex])
8877
- allocTexture (tIndex);
8879
- GL::bindFramebuffer (GL_FRAMEBUFFER_EXT, fbo);
8881
- GL::framebufferTexture2D (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
8882
- target, texture[tIndex], 0);
8884
- glDrawBuffer (GL_COLOR_ATTACHMENT0_EXT);
8885
- glReadBuffer (GL_COLOR_ATTACHMENT0_EXT);
8887
- /* check status the first time */
8890
- fboStatus = GL::checkFramebufferStatus (GL_FRAMEBUFFER_EXT);
8891
- if (fboStatus != GL_FRAMEBUFFER_COMPLETE_EXT)
8893
- compLogMessage ("water", CompLogLevelError,
8894
- "framebuffer incomplete");
8896
- GL::bindFramebuffer (GL_FRAMEBUFFER_EXT, 0);
8897
- GL::deleteFramebuffers (1, &fbo);
8899
- glDrawBuffer (GL_BACK);
8900
- glReadBuffer (GL_BACK);
8908
- glViewport (0, 0, width, height);
8909
- glMatrixMode (GL_PROJECTION);
8911
- glLoadIdentity ();
8912
- glOrtho (0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
8913
- glMatrixMode (GL_MODELVIEW);
8915
- glLoadIdentity ();
8916
+ oldFbo = waterFbo[fIndex]->bind ();
8917
+ glGetIntegerv(GL_VIEWPORT, &oldViewport[0]);
8918
+ glViewport (0, 0, texWidth, texHeight);
8922
@@ -304,424 +68,115 @@
8924
WaterScreen::fboEpilogue ()
8926
- GL::bindFramebuffer (GL_FRAMEBUFFER_EXT, 0);
8928
- glMatrixMode (GL_PROJECTION);
8929
- glLoadIdentity ();
8930
- glMatrixMode (GL_MODELVIEW);
8931
- glLoadIdentity ();
8932
- glDepthRange (0, 1);
8933
- glViewport (-1, -1, 2, 2);
8935
- gScreen->resetRasterPos ();
8937
- gScreen->setDefaultViewport ();
8939
- glMatrixMode (GL_PROJECTION);
8941
- glMatrixMode (GL_MODELVIEW);
8944
- glDrawBuffer (GL_BACK);
8945
- glReadBuffer (GL_BACK);
8949
-WaterScreen::fboUpdate (float dt, float fade)
8951
- if (!fboPrologue (TINDEX (this, 1)))
8954
- if (!texture[TINDEX (this, 2)])
8955
- allocTexture (TINDEX (this, 2));
8957
- if (!texture[TINDEX (this, 0)])
8958
- allocTexture (TINDEX (this, 0));
8960
- glEnable (target);
8962
- GL::activeTexture (GL_TEXTURE0_ARB);
8963
- glBindTexture (target, texture[TINDEX (this, 2)]);
8965
- glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
8966
- glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
8967
- GL::activeTexture (GL_TEXTURE1_ARB);
8968
- glBindTexture (target, texture[TINDEX (this, 0)]);
8969
- glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
8970
- glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
8972
- glEnable (GL_FRAGMENT_PROGRAM_ARB);
8973
- GL::bindProgram (GL_FRAGMENT_PROGRAM_ARB, program);
8975
- GL::programLocalParameter4f (GL_FRAGMENT_PROGRAM_ARB, 0,
8976
- dt * K, fade, 1.0f, 1.0f);
8978
- glBegin (GL_QUADS);
8980
- glTexCoord2f (0.0f, 0.0f);
8981
- glVertex2f (0.0f, 0.0f);
8982
- glTexCoord2f (tx, 0.0f);
8983
- glVertex2f (1.0f, 0.0f);
8984
- glTexCoord2f (tx, ty);
8985
- glVertex2f (1.0f, 1.0f);
8986
- glTexCoord2f (0.0f, ty);
8987
- glVertex2f (0.0f, 1.0f);
8991
- glDisable (GL_FRAGMENT_PROGRAM_ARB);
8993
- glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
8994
- glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
8995
- glBindTexture (target, 0);
8996
- GL::activeTexture (GL_TEXTURE0_ARB);
8997
- glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
8998
- glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
8999
- glBindTexture (target, 0);
9001
- glDisable (target);
9005
- /* increment texture index */
9006
- tIndex = TINDEX (this, 1);
9012
-WaterScreen::fboVertices (GLenum type,
9017
- if (!fboPrologue (TINDEX (this, 0)))
9020
- glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
9021
- glColor4f (0.0f, 0.0f, 0.0f, v);
9023
- glPointSize (3.0f);
9024
- glLineWidth (1.0f);
9026
- glScalef (1.0f / width, 1.0f / height, 1.0);
9027
- glTranslatef (0.5f, 0.5f, 0.0f);
9033
- glVertex2i (p->x, p->y);
9039
- glColor4usv (defaultColor);
9040
- glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
9045
+ GLFramebufferObject::rebind (oldFbo);
9046
+ glViewport (oldViewport[0], oldViewport[1], oldViewport[2], oldViewport[3]);
9050
-WaterScreen::softwareUpdate (float dt, float fade)
9051
+WaterScreen::waterUpdate (float dt)
9055
- float v0, v1, inv;
9056
- float accel, value;
9057
- unsigned char *t0, *t;
9058
- int dWidth, dHeight;
9059
- float *d01, *d10, *d11, *d12;
9061
- if (!texture[TINDEX (this, 0)])
9062
- allocTexture (TINDEX (this, 0));
9067
- dWidth = width + 2;
9068
- dHeight = height + 2;
9070
-#define D(d, j) (*((d) + (j)))
9072
- d01 = d0 + dWidth;
9074
- d11 = d10 + dWidth;
9075
- d12 = d11 + dWidth;
9077
- for (i = 1; i < dHeight - 1; i++)
9079
- for (j = 1; j < dWidth - 1; j++)
9081
- accel = dt * (D (d10, j) +
9084
- D (d11, j + 1) - 4.0f * D (d11, j));
9086
- value = (2.0f * D (d11, j) - D (d01, j) + accel) * fade;
9088
- value = CLAMP (value, 0.0f, 1.0f);
9090
- D (d01, j) = value;
9099
- /* update border */
9100
- memcpy (d0, d0 + dWidth, dWidth * sizeof (GLfloat));
9101
- memcpy (d0 + dWidth * (dHeight - 1),
9102
- d0 + dWidth * (dHeight - 2),
9103
- dWidth * sizeof (GLfloat));
9105
- d01 = d0 + dWidth;
9107
- for (i = 1; i < dHeight - 1; i++)
9109
- D (d01, 0) = D (d01, 1);
9110
- D (d01, dWidth - 1) = D (d01, dWidth - 2);
9116
- d11 = d10 + dWidth;
9117
- d12 = d11 + dWidth;
9120
+ GLfloat fade = 1.0f;
9122
- /* update texture */
9123
- for (i = 0; i < height; i++)
9126
- for (j = 0; j < width; j++)
9128
- v0 = (D (d12, j) - D (d10, j)) * 1.5f;
9129
- v1 = (D (d11, j - 1) - D (d11, j + 1)) * 1.5f;
9131
- /* 0.5 for scale */
9132
- inv = 0.5f / sqrtf (v0 * v0 + v1 * v1 + 1.0f);
9134
- /* add scale and bias to normal */
9135
- v0 = v0 * inv + 0.5f;
9136
- v1 = v1 * inv + 0.5f;
9138
- /* store normal map in RGB components */
9140
- t[0] = (unsigned char) ((inv + 0.5f) * 255.0f);
9141
- t[1] = (unsigned char) (v1 * 255.0f);
9142
- t[2] = (unsigned char) (v0 * 255.0f);
9144
- /* store height in A component */
9145
- t[3] = (unsigned char) (D (d11, j) * 255.0f);
9154
+ fade = 0.90f + (float) count / 10000.0f;
9161
- /* swap height maps */
9165
+ if (!fboPrologue (INDEX (this, 1)))
9168
- if (texture[TINDEX (this, 0)])
9170
- glBindTexture (target, texture[TINDEX (this, 0)]);
9171
- glTexImage2D (target, 0, GL_RGBA, width, height, 0, GL_BGRA,
9172
-#if IMAGE_BYTE_ORDER == MSBFirst
9173
- GL_UNSIGNED_INT_8_8_8_8_REV,
9180
+ glEnable (GL_TEXTURE_2D);
9182
+ vertexBuffer[UPDATE]->begin ();
9183
+ vertexBuffer[UPDATE]->addVertices (6, &vertexData[0]);
9184
+ vertexBuffer[UPDATE]->addTexCoords (0, 6, &textureData[0]);
9185
+ vertexBuffer[UPDATE]->end ();
9187
+ // TODO: use GLTexture facilities here, instead of manually setting active
9188
+ // texture, especially when there will be texture unit support
9189
+ glActiveTexture (GL_TEXTURE0);
9190
+ waterFbo[INDEX (this, 2)]->tex ()->setFilter (GL_NEAREST);
9191
+ glBindTexture (GL_TEXTURE_2D, waterFbo[INDEX (this, 2)]->tex ()->name ());
9193
+ glActiveTexture (GL_TEXTURE1);
9194
+ waterFbo[INDEX (this, 0)]->tex ()->setFilter (GL_NEAREST);
9195
+ glBindTexture (GL_TEXTURE_2D, waterFbo[INDEX (this, 0)]->tex ()->name ());
9197
+ vertexBuffer[UPDATE]->addUniform ("prevTex", 0);
9198
+ vertexBuffer[UPDATE]->addUniform ("currTex", 1);
9199
+ vertexBuffer[UPDATE]->addUniform ("timeLapse", dt * K);
9200
+ vertexBuffer[UPDATE]->addUniform ("fade", fade);
9202
+ GLboolean isBlendingEnabled;
9203
+ glGetBooleanv (GL_BLEND, &isBlendingEnabled);
9204
+ glDisable (GL_BLEND);
9205
+ vertexBuffer[UPDATE]->render ();
9206
+ if (isBlendingEnabled)
9207
+ glEnable (GL_BLEND);
9209
-#define SET(x, y, v) *((d1) + (width + 2) * (y + 1) + (x + 1)) = (v)
9210
+ glActiveTexture (GL_TEXTURE0);
9211
+ glBindTexture (GL_TEXTURE_2D, 0);
9214
-WaterScreen::softwarePoints (XPoint *p,
9220
- SET (p->x - 1, p->y - 1, add);
9221
- SET (p->x, p->y - 1, add);
9222
- SET (p->x + 1, p->y - 1, add);
9223
+ glActiveTexture (GL_TEXTURE1);
9224
+ glBindTexture (GL_TEXTURE_2D, 0);
9226
- SET (p->x - 1, p->y, add);
9227
- SET (p->x, p->y, add);
9228
- SET (p->x + 1, p->y, add);
9229
+ glDisable (GL_TEXTURE_2D);
9231
- SET (p->x - 1, p->y + 1, add);
9232
- SET (p->x, p->y + 1, add);
9233
- SET (p->x + 1, p->y + 1, add);
9238
+ /* increment texture index */
9239
+ fboIndex = INDEX (this, 1);
9244
-WaterScreen::softwareLines (XPoint *p,
9245
+WaterScreen::waterVertices (GLenum type,
9250
- int x1, y1, x2, y2;
9253
- int deltaX, deltaY;
9258
-#define SWAP(v0, v1) \
9277
- steep = abs (y2 - y1) > abs (x2 - x1);
9293
- deltaY = abs (y2 - y1);
9301
- for (x = x1; x <= x2; x++)
9313
- if (2 * error >= deltaX)
9325
-WaterScreen::softwareVertices (GLenum type,
9332
- softwarePoints (p, n, v);
9335
- softwareLines (p, n, v);
9341
-WaterScreen::waterUpdate (float dt)
9343
- GLfloat fade = 1.0f;
9348
- fade = 0.90f + count / 10000.0f;
9352
+ if (!fboPrologue (INDEX (this, 0)))
9355
- if (!fboUpdate (dt, fade))
9356
- softwareUpdate (dt, fade);
9358
+ glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
9359
+ glLineWidth (1.0f);
9362
-WaterScreen::scaleVertices (XPoint *p, int n)
9365
+ if (GL::vbo && GL::shaders)
9367
- p[n].x = (width * p[n].x) / screen->width ();
9368
- p[n].y = (height * p[n].y) / screen->height ();
9369
+ vertexBuffer[SET]->begin (type);
9371
+ for (int i = 0; i < n; i++)
9373
+ data[0] = (((float) p->x / (float) screen->width ()) * 2.0f) - 1.0f;
9374
+ data[1] = ((((float) screen->height () - (float) p->y)/
9375
+ (float) screen->height ()) * 2.0f) - 1.0f;
9378
+ vertexBuffer[SET]->addVertices (1, &data[0]);
9380
+ vertexBuffer[SET]->end();
9382
+ vertexBuffer[SET]->addUniform ("color", v);
9383
+ GLboolean isBlendingEnabled;
9384
+ glGetBooleanv (GL_BLEND, &isBlendingEnabled);
9385
+ glDisable (GL_BLEND);
9386
+ vertexBuffer[SET]->render ();
9387
+ if (isBlendingEnabled)
9388
+ glEnable (GL_BLEND);
9393
-WaterScreen::waterVertices (GLenum type,
9398
- if (!GL::fragmentProgram)
9401
- scaleVertices (p, n);
9402
+ glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
9404
- if (!fboVertices (type, p, n, v))
9405
- softwareVertices (type, p, n, v);
9412
cScreen->preparePaintSetEnabled (this, true);
9413
+ gScreen->glPaintOutputSetEnabled (this, true);
9414
+ gScreen->glPaintCompositedOutputSetEnabled (this, true);
9415
cScreen->donePaintSetEnabled (this, true);
9416
- foreach (CompWindow *w, screen->windows ())
9418
- ww = WaterWindow::get (w);
9419
- ww->gWindow->glDrawTextureSetEnabled (ww, true);
9424
@@ -758,15 +213,21 @@
9428
-WaterScreen::waterReset ()
9429
+WaterScreen::waterSetup ()
9433
- height = TEXTURE_SIZE;
9434
- width = (height * screen->width ()) / screen->height ();
9438
+ std::string buffer;
9440
+ texHeight = TEXTURE_SIZE;
9441
+ texWidth = (texHeight * screen->width ()) / screen->height ();
9444
+ target = GL_TEXTURE_2D;
9447
if (GL::textureNonPowerOfTwo ||
9448
- (POWER_OF_TWO (width) && POWER_OF_TWO (height)))
9449
+ (POWER_OF_TWO (texWidth) && POWER_OF_TWO (texHeight)))
9451
target = GL_TEXTURE_2D;
9453
@@ -774,38 +235,15 @@
9456
target = GL_TEXTURE_RECTANGLE_NV;
9461
- if (!GL::fragmentProgram)
9466
- loadWaterProgram ();
9468
- GL::genFramebuffers (1, &fbo);
9473
- for (i = 0; i < TEXTURE_NUM; i++)
9477
- glDeleteTextures (1, &texture[i]);
9488
- size = (width + 2) * (height + 2);
9489
+ size = (texWidth + 2) * (texHeight + 2);
9491
data = calloc (1, (sizeof (float) * size * 2) +
9492
- (sizeof (GLubyte) * width * height * 4));
9493
+ (sizeof (GLubyte) * texWidth * texHeight * 4));
9497
@@ -813,89 +251,112 @@
9499
t0 = (unsigned char *) (d1 + (size));
9501
- for (i = 0; i < height; i++)
9504
- for (j = 0; j < width; j++)
9505
+ program[SET] = new GLProgram (set_water_vertices_vertex_shader,
9506
+ set_water_vertices_fragment_shader);
9508
+ if (target == GL_TEXTURE_2D)
9509
+ sprintf (buf, update_water_vertices_fragment_shader.c_str (),
9511
+ 1.0f / (float) texWidth, 1.0f / (float) texWidth,
9512
+ 1.0f / (float) texHeight, 1.0f / (float) texHeight,
9513
+ "2D", "2D", "2D", "2D");
9515
+ sprintf (buf, update_water_vertices_fragment_shader.c_str (),
9517
+ 1.0f, 1.0f, 1.0f, 1.0f,
9518
+ "RECT", "RECT", "RECT", "RECT");
9520
+ buffer.assign (buf);
9521
+ program[UPDATE] = new GLProgram (update_water_vertices_vertex_shader,
9524
+ sprintf (buf, paint_water_vertices_fragment_shader.c_str (),
9525
+ screen->width (), screen->height ());
9527
+ buffer.assign (buf);
9528
+ program[PAINT] = new GLProgram (paint_water_vertices_vertex_shader,
9531
+ vertexBuffer[SET] = new GLVertexBuffer (GL_DYNAMIC_DRAW);
9532
+ vertexBuffer[SET]->setProgram (program[SET]);
9534
+ vertexBuffer[UPDATE] = new GLVertexBuffer (GL_STATIC_DRAW);
9535
+ vertexBuffer[UPDATE]->setProgram (program[UPDATE]);
9537
+ vertexBuffer[PAINT] = new GLVertexBuffer (GL_STATIC_DRAW);
9538
+ vertexBuffer[PAINT]->setProgram (program[PAINT]);
9543
+ CompSize size(texWidth, texHeight);
9544
+ for (int i = 0; i < TEXTURE_NUM; i++)
9546
- (t0 + (width * 4 * i + j * 4))[0] = 0xff;
9547
+ waterFbo[i] = new GLFramebufferObject ();
9548
+ waterFbo[i]->allocate (size, (char *) t0,
9549
+ GL_BGRA, GL_UNSIGNED_BYTE);
9550
+ // check if FBOs are working. If not, fallback to software textures
9551
+ oldFbo = waterFbo[i]->bind ();
9552
+ waterFbo[i]->rebind (oldFbo);
9553
+ if (!waterFbo[i]->checkStatus ())
9556
+ delete waterFbo[i];
9564
-WaterWindow::glDrawTexture (GLTexture *texture,
9565
- GLFragment::Attrib &attrib,
9566
- unsigned int mask)
9567
+WaterScreen::glPaintCompositedOutput (const CompRegion ®ion,
9568
+ GLFramebufferObject *fbo,
9569
+ unsigned int mask)
9571
- if (wScreen->count)
9574
- GLFragment::Attrib fa (attrib);
9575
- bool lighting = wScreen->gScreen->lighting ();
9577
- GLFragment::FunctionId function;
9580
- param = fa.allocParameters (1);
9581
- unit = fa.allocTextureUnits (1);
9583
- function = wScreen->getBumpMapFragmentFunction (texture, unit, param);
9585
+ if (GL::vbo && GL::shaders)
9587
- fa.addFunction (function);
9589
- gScreen->setLighting (true);
9591
- GL::activeTexture (GL_TEXTURE0_ARB + unit);
9593
- glBindTexture (wScreen->target,
9594
- wScreen->texture[TINDEX (wScreen, 0)]);
9596
- plane[1] = plane[2] = 0.0f;
9597
- plane[0] = wScreen->tx / (GLfloat) screen->width ();
9600
- glTexGeni (GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
9601
- glTexGenfv (GL_S, GL_EYE_PLANE, plane);
9602
- glEnable (GL_TEXTURE_GEN_S);
9604
- plane[0] = plane[2] = 0.0f;
9605
- plane[1] = wScreen->ty / (GLfloat) screen->height ();
9608
- glTexGeni (GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
9609
- glTexGenfv (GL_T, GL_EYE_PLANE, plane);
9610
- glEnable (GL_TEXTURE_GEN_T);
9611
+ GLFramebufferObject::rebind (oldFbo);
9612
+ glViewport (oldViewport[0], oldViewport[1],
9613
+ oldViewport[2], oldViewport[3]);
9615
+ vertexBuffer[PAINT]->begin ();
9616
+ vertexBuffer[PAINT]->addVertices (6, &vertexData[0]);
9617
+ vertexBuffer[PAINT]->addTexCoords (0, 6, &textureData[0]);
9618
+ vertexBuffer[PAINT]->end ();
9620
+ glEnable (GL_TEXTURE_2D);
9622
+ glActiveTexture (GL_TEXTURE0);
9623
+ fbo->tex ()->setFilter (GL_LINEAR);
9624
+ glBindTexture (GL_TEXTURE_2D, fbo->tex ()->name ());
9625
+ vertexBuffer[PAINT]->addUniform ("baseTex", 0);
9627
+ glActiveTexture (GL_TEXTURE1);
9628
+ waterFbo[INDEX (this, 0)]->tex ()->setFilter (GL_LINEAR);
9629
+ glBindTexture (GL_TEXTURE_2D,
9630
+ waterFbo[INDEX (this, 0)]->tex ()->name ());
9631
+ vertexBuffer[PAINT]->addUniform ("waveTex", 1);
9633
+ vertexBuffer[PAINT]->addUniform3f ("lightVec",
9637
+ vertexBuffer[PAINT]->addUniform ("offsetScale", offsetScale);
9638
+ GLboolean isBlendingEnabled;
9639
+ glGetBooleanv (GL_BLEND, &isBlendingEnabled);
9640
+ glDisable (GL_BLEND);
9641
+ vertexBuffer[PAINT]->render ();
9642
+ if (isBlendingEnabled)
9643
+ glEnable (GL_BLEND);
9645
- GL::activeTexture (GL_TEXTURE0_ARB);
9647
- GL::programEnvParameter4f (GL_FRAGMENT_PROGRAM_ARB, param,
9648
- texture->matrix ().yy *
9649
- wScreen->offsetScale,
9650
- -texture->matrix ().xx *
9651
- wScreen->offsetScale,
9655
- /* to get appropriate filtering of texture */
9656
- mask |= PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK;
9658
- gWindow->glDrawTexture (texture, fa, mask);
9662
- GL::activeTexture (GL_TEXTURE0_ARB + unit);
9663
- glDisable (GL_TEXTURE_GEN_T);
9664
- glDisable (GL_TEXTURE_GEN_S);
9665
- glBindTexture (wScreen->target, 0);
9666
- GL::activeTexture (GL_TEXTURE0_ARB);
9668
- gScreen->setLighting (lighting);
9669
+ glBindTexture (GL_TEXTURE_2D, 0);
9670
+ glDisable (GL_TEXTURE_2D);
9675
- gWindow->glDrawTexture (texture, attrib, mask);
9679
/* TODO: a way to control the speed */
9681
p[0].y = screen->height ();
9684
- /* software rasterizer doesn't support triangles yet so wiper
9685
- effect will only work with FBOs right now */
9686
waterVertices (GL_TRIANGLES, p, 3, 0.0f);
9693
- waterUpdate (0.8f);
9694
+ waterUpdate (0.8);
9697
cScreen->preparePaint (msSinceLastPaint);
9698
@@ -998,15 +457,10 @@
9699
cScreen->damageScreen ();
9704
cScreen->preparePaintSetEnabled (this, false);
9705
+ gScreen->glPaintOutputSetEnabled (this, false);
9706
+ gScreen->glPaintCompositedOutputSetEnabled (this, false);
9707
cScreen->donePaintSetEnabled (this, false);
9708
- foreach (CompWindow *w, screen->windows ())
9710
- ww = WaterWindow::get (w);
9711
- ww->gWindow->glDrawTextureSetEnabled (ww, false);
9715
cScreen->donePaint ();
9716
@@ -1029,7 +483,6 @@
9718
cScreen->damageScreen ();
9724
@@ -1059,7 +512,7 @@
9725
p.x = waterLastPointerX = xRoot;
9726
p.y = waterLastPointerY = yRoot;
9728
- ws->waterVertices (GL_POINTS, &p, 1, 0.8f);
9729
+ ws->waterVertices (GL_POINTS, &p, 1, 1.0f);
9731
ws->cScreen->damageScreen ();
9733
@@ -1263,7 +716,7 @@
9736
case WaterOptions::OffsetScale:
9737
- offsetScale = optionGetOffsetScale () * 50.0f;
9738
+ offsetScale = optionGetOffsetScale () * 10.0f;
9740
case WaterOptions::RainDelay:
9741
if (rainTimer.active ())
9742
@@ -1272,6 +725,15 @@
9743
(float)optionGetRainDelay () * 1.2);
9746
+ case WaterOptions::LightVecX:
9747
+ lightVec[0] = optionGetLightVecX();
9749
+ case WaterOptions::LightVecY:
9750
+ lightVec[1] = optionGetLightVecY();
9752
+ case WaterOptions::LightVecZ:
9753
+ lightVec[2] = optionGetLightVecZ();
9758
@@ -1282,21 +744,20 @@
9759
cScreen (CompositeScreen::get (screen)),
9760
gScreen (GLScreen::get (screen)),
9786
@@ -1304,20 +765,22 @@
9791
- bumpMapFunctions ()
9792
+ lightVec(GLVector(optionGetLightVecX(),
9793
+ optionGetLightVecY(),
9794
+ optionGetLightVecZ()))
9796
- offsetScale = optionGetOffsetScale () * 50.0f;
9798
- memset (texture, 0, sizeof (GLuint) * TEXTURE_NUM);
9799
+ offsetScale = optionGetOffsetScale () * 10.0f;
9801
wiperTimer.setCallback (boost::bind (&WaterScreen::wiperTimeout, this));
9802
rainTimer.setCallback (boost::bind (&WaterScreen::rainTimeout, this));
9807
optionSetOffsetScaleNotify (boost::bind (&WaterScreen::optionChange, this, _2));
9808
- optionSetRainDelayNotify (boost::bind (&WaterScreen::optionChange, this, _2));
9809
+ optionSetRainDelayNotify (boost::bind (&WaterScreen::optionChange, this, _2));
9810
+ optionSetLightVecXNotify (boost::bind (&WaterScreen::optionChange, this, _2));
9811
+ optionSetLightVecYNotify (boost::bind (&WaterScreen::optionChange, this, _2));
9812
+ optionSetLightVecZNotify (boost::bind (&WaterScreen::optionChange, this, _2));
9814
optionSetInitiateKeyInitiate (waterInitiate);
9815
optionSetInitiateKeyTerminate (waterTerminate);
9816
@@ -1329,29 +792,28 @@
9818
ScreenInterface::setHandler (screen, false);
9819
CompositeScreenInterface::setHandler (cScreen, false);
9820
+ GLScreenInterface::setHandler (gScreen, false);
9823
WaterScreen::~WaterScreen ()
9826
- GL::deleteFramebuffers (1, &fbo);
9828
+ delete program[SET];
9830
+ if (program[UPDATE])
9831
+ delete program[UPDATE];
9833
+ if (program[PAINT])
9834
+ delete program[PAINT];
9836
- for (unsigned int i = 0; i < TEXTURE_NUM; i++)
9837
+ for (int i = 0; i < TEXTURE_NUM; i++)
9840
- glDeleteTextures (1, &texture[i]);
9842
+ delete waterFbo[i];
9846
- GL::deletePrograms (1, &program);
9851
- foreach (WaterFunction &f, bumpMapFunctions)
9853
- GLFragment::destroyFragmentFunction (f.id);
9858
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/water/src/water.h linaro-gles2-debianpatches/plugins/water/src/water.h
9859
--- compiz-0.9.7.8/plugins/water/src/water.h 2012-04-26 08:47:01.000000000 +0200
9860
+++ linaro-gles2-debianpatches/plugins/water/src/water.h 2012-04-20 11:41:59.241600000 +0200
9862
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
9864
* Author: David Reveman <davidr@novell.com>
9865
+ * Frederic Plourde <frederic.plourde@collabora.co.uk>
9868
#include "water_options.h"
9871
#include <composite/composite.h>
9872
#include <opengl/opengl.h>
9873
+#include <opengl/framebufferobject.h>
9874
+#include "shaders.h"
9877
#define WATER_SCREEN(s) \
9882
-#define TEXTURE_NUM 3
9883
+#define TEXTURE_NUM 3
9886
-#define TINDEX(ws, i) (((ws)->tIndex + (i)) % TEXTURE_NUM)
9887
+#define INDEX(ws, i) (((ws)->fboIndex + (i)) % TEXTURE_NUM)
9889
-#define WATER_INITIATE_MODIFIERS_DEFAULT (ControlMask | CompSuperMask)
9891
-struct WaterFunction {
9892
- GLFragment::FunctionId id;
9898
+enum programTypes { SET, UPDATE, PAINT};
9901
public ScreenInterface,
9902
+ public GLScreenInterface,
9903
public CompositeScreenInterface,
9904
public PluginClassHandler<WaterScreen,CompScreen>,
9909
WaterScreen (CompScreen *screen);
9914
void handleEvent (XEvent *);
9916
+ void glPaintCompositedOutput (const CompRegion ®ion,
9917
+ GLFramebufferObject *fbo,
9918
+ unsigned int mask);
9919
void preparePaint (int);
9922
- GLFragment::FunctionId
9923
- getBumpMapFragmentFunction (GLTexture *texture,
9927
- void allocTexture (int index);
9929
- bool fboPrologue (int tIndex);
9930
+ bool fboPrologue (int fboIndex);
9931
void fboEpilogue ();
9932
- bool fboUpdate (float dt, float fade);
9933
- bool fboVertices (GLenum type, XPoint *p, int n, float v);
9934
+ bool fboUpdate (float dt, float fade);
9936
- void softwareUpdate (float dt, float fade);
9937
- void softwarePoints (XPoint *p, int n, float add);
9938
- void softwareLines (XPoint *p, int n, float v);
9939
- void softwareVertices (GLenum type, XPoint *p, int n, float v);
9941
- void waterUpdate (float dt);
9942
- void scaleVertices (XPoint *p, int n);
9943
+ void waterUpdate (float dt);
9944
void waterVertices (GLenum type, XPoint *p, int n, float v);
9946
bool rainTimeout ();
9947
bool wiperTimeout ();
9949
- void waterReset ();
9950
+ void waterSetup ();
9952
void handleMotionEvent ();
9954
@@ -104,20 +91,26 @@
9956
CompScreen::GrabHandle grabIndex;
9958
- int width, height;
9959
+ GLProgram *program[PROG_NUM];
9960
+ GLVertexBuffer *vertexBuffer[PROG_NUM];
9962
+ static GLfloat vertexData[18];
9965
- GLuint texture[TEXTURE_NUM];
9966
+ static GLfloat textureData[12];
9969
+ GLFramebufferObject *waterFbo[TEXTURE_NUM];
9971
+ GLFramebufferObject *oldFbo;
9972
+ GLint oldViewport[4];
9976
+ int texWidth, texHeight;
9988
@@ -129,37 +122,14 @@
9992
- std::vector<WaterFunction> bumpMapFunctions;
9995
-class WaterWindow :
9996
- public GLWindowInterface,
9997
- public PluginClassHandler<WaterWindow,CompWindow>
10000
- WaterWindow (CompWindow *window) :
10001
- PluginClassHandler<WaterWindow,CompWindow> (window),
10003
- gWindow (GLWindow::get (window)),
10004
- wScreen (WaterScreen::get (screen)),
10005
- gScreen (GLScreen::get (screen))
10007
- GLWindowInterface::setHandler (gWindow, false);
10010
- void glDrawTexture (GLTexture *texture, GLFragment::Attrib &,
10013
- CompWindow *window;
10014
- GLWindow *gWindow;
10015
- WaterScreen *wScreen;
10016
- GLScreen *gScreen;
10017
+ GLVector lightVec;
10020
class WaterPluginVTable :
10021
- public CompPlugin::VTableForScreenAndWindow<WaterScreen,WaterWindow>
10022
+ public CompPlugin::VTableForScreen<WaterScreen>
10029
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/water/water.xml.in linaro-gles2-debianpatches/plugins/water/water.xml.in
10030
--- compiz-0.9.7.8/plugins/water/water.xml.in 2012-04-26 08:47:01.000000000 +0200
10031
+++ linaro-gles2-debianpatches/plugins/water/water.xml.in 2012-04-20 11:41:59.241600000 +0200
10036
+ <option name="light_vec_x" type="float">
10037
+ <_short>lightVec X</_short>
10038
+ <_long>Light vector X coordinate</_long>
10039
+ <default>1.0</default>
10042
+ <precision>0.1</precision>
10044
+ <option name="light_vec_y" type="float">
10045
+ <_short>lightVec Y</_short>
10046
+ <_long>Light vector Y coordinate</_long>
10047
+ <default>1.0</default>
10050
+ <precision>0.1</precision>
10052
+ <option name="light_vec_z" type="float">
10053
+ <_short>lightVec Z</_short>
10054
+ <_long>Light vector Z coordinate</_long>
10055
+ <default>1.0</default>
10058
+ <precision>0.1</precision>
10060
<option name="title_wave" type="bell">
10061
<_short>Title wave</_short>
10062
<_long>Wave effect from window title</_long>
10063
diff -Nur '--exclude=.*' '--exclude=debian' compiz-0.9.7.8/plugins/wobbly/CMakeLists.txt linaro-gles2-debianpatches/plugins/wobbly/CMakeLists.txt
10064
--- compiz-0.9.7.8/plugins/wobbly/CMakeLists.txt 2012-04-26 08:47:01.000000000 +0200
10065
+++ linaro-gles2-debianpatches/plugins/wobbly/CMakeLists.txt 2012-04-20 11:41:59.241600000 +0200
10068
include (CompizPlugin)
10070
-compiz_plugin(wobbly PLUGINDEPS composite opengl)
10071
+#compiz_plugin(wobbly PLUGINDEPS composite opengl)